* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-grad-start: #0f172a;
    --bg-grad-mid: #1e293b;
    --bg-grad-end: #0f172a;
    --text-main: #E2E8F0;
    --text-sub: rgba(226, 232, 240, 0.7);
    --text-muted: rgba(226, 232, 240, 0.25);
    --accent: #38BDF8;
    --accent-dim: rgba(56, 189, 248, 0.75);
    --accent-glow: rgba(56, 189, 248, 0.5);
    --accent-faint: rgba(56, 189, 248, 0.25);
    --accent-bg: rgba(56, 189, 248, 0.12);
    --card-bg: rgba(15, 23, 42, 0.85);
    --card-border: rgba(56, 189, 248, 0.3);
    --shadow: rgba(0, 0, 0, 0.4);
    --tooltip-bg: rgba(15, 23, 42, 0.95);
    --tooltip-text: #4ade80;
}

body.light-mode {
    --bg-grad-start: #f8fafc;
    --bg-grad-mid: #e2e8f0;
    --bg-grad-end: #f1f5f9;
    --text-main: #0f172a;
    --text-sub: rgba(15, 23, 42, 0.7);
    --text-muted: rgba(15, 23, 42, 0.3);
    --accent: #0284c7;
    --accent-dim: rgba(2, 132, 199, 0.9);
    --accent-glow: rgba(2, 132, 199, 0.6);
    --accent-faint: rgba(2, 132, 199, 0.4);
    --accent-bg: rgba(2, 132, 199, 0.12);
    --card-bg: rgba(255, 255, 255, 0.95);
    --card-border: rgba(56, 189, 248, 0.4);
    --shadow: rgba(0, 0, 0, 0.1);
    --tooltip-bg: rgba(255, 255, 255, 0.95);
    --tooltip-text: #16a34a;
}

html {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    width: 100%;
    font-family: 'JetBrains Mono', 'Courier New', 'Monaco', 'Consolas', monospace;
    background: linear-gradient(135deg, var(--bg-grad-start) 0%, var(--bg-grad-mid) 50%, var(--bg-grad-end) 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    transition: background 0.3s ease, color 0.3s ease;
    padding: 2rem 0;
}

main {
    text-align: center;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    animation: fadeIn 0.4s ease-out;
}

.terminal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 24px var(--shadow);
    border-radius: 8px;
    padding: 2.5rem 3rem;
    width: clamp(280px, 90vw, 720px);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.terminal-lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    letter-spacing: 0.12em;
    margin-bottom: 1.2rem;
    align-self: flex-end;
}

.lang-separator {
    color: var(--text-muted);
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--accent-faint);
    color: var(--accent-dim);
    font-family: inherit;
    font-size: 0.8rem;
    text-transform: lowercase;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    min-width: 80px;
    text-align: center;
}

.lang-btn:hover,
.lang-btn:focus-visible {
    color: var(--text-main);
    border-color: var(--accent-glow);
    background: var(--accent-bg);
    outline: none;
}

.theme-btn {
    background: transparent;
    border: 1px solid var(--accent-faint);
    color: var(--accent-dim);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.theme-btn:hover,
.theme-btn:focus-visible {
    color: var(--text-main);
    border-color: var(--accent-glow);
    background: var(--accent-bg);
    outline: none;
}

.theme-icon {
    display: block;
}

.theme-tooltip {
    position: absolute;
    top: 50%;
    left: calc(100% + 0.75rem);
    transform: translateY(-50%);
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid var(--card-border);
}

.theme-tooltip::before {
    content: '// ';
}

.theme-btn[data-theme="light"]:hover .theme-tooltip {
    opacity: 1;
}

@media (max-width: 600px) {
    .theme-tooltip {
        left: auto;
        right: 0;
        top: calc(100% + 0.5rem);
        transform: none;
        max-width: min(240px, 80vw);
        white-space: normal;
        padding: 0.45rem 0.6rem;
    }
}

.main-title {
    font-size: clamp(1.2rem, 4vw, 2.5rem);
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.prompt-line {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: clamp(1rem, 3vw, 1.5rem);
    min-height: calc(1em * 2.6);
}

.prompt {
    color: var(--accent);
    animation: prompt-flicker 1.8s infinite ease-in-out;
    flex-shrink: 0;
}

.typed-output {
    display: inline;
    line-height: 1.4;
}

.typed-text {
    display: inline;
    color: var(--accent);
    word-break: break-word;
}

.cursor {
    /* pls dont break alignment */
    display: inline-block;
    width: 0.6em;
    height: 1.05em;
    background: var(--accent);
    vertical-align: middle;
    margin-left: -0.45em;
    margin-bottom: 0.05em;
    animation: cursor-blink 0.9s steps(2, start) infinite;
}

.coolbutton {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.coolbutton:hover {
    text-shadow: 0 0 8px currentColor;
    transform: scale(1.05);
}

.terminal-actions {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.terminal-btn {
    text-decoration: none;
    text-transform: lowercase;
    color: var(--accent);
    border: 1px solid var(--accent-glow);
    padding: 0.75rem 1.75rem;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
    letter-spacing: 0.08em;
}

.terminal-btn:hover,
.terminal-btn:focus-visible {
    background: rgba(56, 189, 248, 0.15);
    color: var(--text-main);
}

/* Impact Badge Styling */
.impact-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.8rem;
    font-weight: 500;
    vertical-align: middle;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    white-space: nowrap;
}

body.light-mode .impact-badge {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
    border-color: rgba(2, 132, 199, 0.3);
}

/* responsive stuff */
@media (max-width: 768px) {
    .main-title {
        letter-spacing: 0.1em;
    }

    .terminal-card {
        padding: 2rem;
    }

    .terminal-actions {
        flex-direction: column;
        width: 100%;
    }

    .terminal-btn {
        text-align: center;
    }
    
    .impact-badge {
        margin-left: 0;
        margin-top: 0.5rem;
        display: inline-block;
    }
}

@media (max-width: 480px) {
    main {
        padding: 1rem;
    }

    .main-title {
        letter-spacing: 0.08em;
    }
}

@keyframes cursor-blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

@keyframes prompt-flicker {

    0%,
    100% {
        color: var(--accent);
    }

    50% {
        color: var(--accent-glow);
    }
}

/* gallery stuff */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    width: 100%;
    margin-top: 1.5rem;
}

.gallery-item {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.2);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.3);
    padding-bottom: 0.5rem;
    display: inline-block;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

body.light-mode .gallery-item {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(2, 132, 199, 0.2);
}

.gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-glow);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 16/9;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.gallery-item img.fade-in {
    opacity: 1;
}

.caption {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-sub);
    border-top: 1px solid rgba(56, 189, 248, 0.1);
    background: rgba(15, 23, 42, 0.4);
}

body.light-mode .caption {
    border-top-color: rgba(2, 132, 199, 0.1);
    background: rgba(255, 255, 255, 0.4);
}

.video-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(56, 189, 248, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-placeholder {
    text-align: center;
    color: var(--accent-glow);
}

.placeholder-text {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.placeholder-sub {
    font-size: 0.8rem;
    opacity: 0.7;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.project-card {
    display: block;
    text-decoration: none;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(56, 189, 248, 0.2);
    padding: 1.2rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

body.light-mode .project-card {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(2, 132, 199, 0.2);
}

.project-card:hover {
    background: var(--accent-bg);
    border-color: var(--accent-glow);
    transform: translateY(-2px);
}

.project-title {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-desc {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.project-link {
    font-size: 0.8rem;
    color: var(--accent);
}

/* mod grid stuff */
.mod-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    background: rgba(15, 23, 42, 0.4);
}

body.light-mode .mod-grid-container {
    background: rgba(255, 255, 255, 0.3);
}

.mod-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(56, 189, 248, 0.15);
    border-radius: 6px;
    padding: 1.2rem;
}

body.light-mode .mod-card {
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(2, 132, 199, 0.2);
}

.mod-title {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    padding-bottom: 0.5rem;
    font-weight: 500;
}

body.light-mode .mod-title {
    border-bottom-color: rgba(2, 132, 199, 0.2);
}

.mod-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mod-list li {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.8);
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
    line-height: 1.4;
}

body.light-mode .mod-list li {
    color: rgba(15, 23, 42, 0.8);
}

.mod-list li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--accent-glow);
}

.mod-note {
    color: rgba(226, 232, 240, 0.5);
    font-size: 0.75rem;
    font-style: italic;
}

body.light-mode .mod-note {
    color: rgba(15, 23, 42, 0.5);
}

/* transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* lightbox stuff */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.light-mode .lightbox {
    background: rgba(255, 255, 255, 0.95);
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.lightbox-close:hover {
    color: var(--accent);
}

/* matrix rain effect */
.matrix-particle {
    position: fixed;
    color: #0f0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 9999;
    opacity: 1;
    animation: matrix-fall 1.5s ease-in forwards;
    text-shadow: 0 0 5px #0f0;
    font-weight: bold;
}

@keyframes matrix-fall {
    0% {
        transform: translateY(0) scaleX(1) scaleY(0.01);
        opacity: 0.5;
    }

    5% {
        opacity: 1;
        transform: translateY(-50px) scaleX(1) scaleY(1);
    }

    100% {
        transform: translateY(100vh) scaleX(1) scaleY(0.01);
        opacity: 0;
    }
}