/* ================================ */
/* === DESIGN TOKENS / PALETTE  === */
/* ================================ */
:root {
    --bg-primary: #080808;
    --bg-surface: #0a0a0a;
    --bg-card: rgba(0, 25, 0, 0.35);

    /* Green palette — neon for accents, softer for body text */
    --green-neon: #00ff41;        /* titles, borders, accents */
    --green-body: #33ff66;        /* body text — reduced halation */
    --green-muted: #55cc66;       /* secondary info, patterns */
    --green-dim: #2a8a3e;         /* disabled / inactive */
    --green-glow: rgba(0, 255, 65, 0.12);

    --white-soft: #ccc;           /* subtitles */
    --white-muted: #999;          /* tertiary text */
    --text-inactive: #555;        /* filter buttons off */

    --font-mono: 'Courier New', Courier, monospace;
}

/* ================================ */
/* === BASE                     === */
/* ================================ */
html {
    font-size: 16px; /* rem anchor — respects user browser settings */
}

body {
    background-color: var(--bg-primary);
    color: var(--green-body);
    font-family: var(--font-mono);
    margin: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
    line-height: 1.6;
}

/* CRT scanline overlay */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.08) 50%),
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 3px 100%;
    z-index: 100;
    pointer-events: none;
}

/* ================================ */
/* === HEADER                   === */
/* ================================ */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    border-bottom: 1px solid var(--green-neon);
    background: var(--bg-surface);
    z-index: 10;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    font-size: clamp(0.8rem, 0.7rem + 0.4vw, 1rem);
    font-weight: bold;
    letter-spacing: 0.5px;
    color: var(--green-neon);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--green-neon);
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--green-neon);
    animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.social-icons {
    display: flex;
    gap: 18px;
    flex-shrink: 0;
}

.social-icons a {
    color: var(--green-neon);
    font-size: 1.2rem;
    text-decoration: none;
    transition: text-shadow 0.2s;
}
.social-icons a:hover {
    text-shadow: 0 0 10px var(--green-neon);
}

/* CV download — sits in side-nav below Education, distinct visual weight */
.nav-btn--cv {
    text-decoration: none;
    margin-top: 8px;
    background: rgba(0, 255, 65, 0.06);
    padding: 10px 10px;
    font-size: clamp(0.72rem, 0.68rem + 0.2vw, 0.84rem);
}
.nav-btn--cv:hover,
.nav-btn--cv:focus-visible {
    background: var(--green-neon);
    color: #000;
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.5);
    outline: none;
}

/* ================================ */
/* === TERMINAL LAYOUT          === */
/* ================================ */
.terminal-container {
    display: flex;
    flex: 1;
    padding: 18px;
    gap: 18px;
    overflow: hidden;
}

/* ================================ */
/* === SIDEBAR NAV              === */
/* ================================ */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 190px;
    flex-shrink: 0;
}

.nav-btn {
    background: none;
    border: 1px solid var(--green-neon);
    color: var(--green-neon);
    padding: 10px 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    font-family: inherit;
    font-weight: bold;
    font-size: clamp(0.78rem, 0.72rem + 0.25vw, 0.92rem);
}

.nav-btn:hover,
.nav-btn.active {
    background: var(--green-neon);
    color: var(--bg-primary);
}

/* ================================ */
/* === CONSOLE SCREEN           === */
/* ================================ */
.console-screen {
    flex: 1;
    background: rgba(0, 20, 0, 0.15);
    border: 1px solid var(--green-neon);
    padding: 28px;
    overflow-y: auto;
    position: relative;
    box-shadow: inset 0 0 20px var(--green-glow);
}

#console-output {
    margin-bottom: 20px;
    line-height: 1.7;
    /* pre-line: preserve newlines but collapse multi-space sequences,
       so wrapped lines don't look offset from indented first lines. */
    white-space: pre-line;
    font-size: clamp(0.88rem, 0.84rem + 0.2vw, 1.02rem);
    letter-spacing: 0.3px;
    max-width: 75ch;
    color: var(--green-body);
}

/* ================================ */
/* === PROJECT FILTERS          === */
/* ================================ */
.filter-section {
    margin-bottom: 20px;
    border-left: 3px solid var(--green-neon);
    padding-left: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.filter-label {
    margin-right: 10px;
    font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
    color: var(--green-neon);
}

.filter-btn {
    background: none;
    border: none;
    color: var(--text-inactive);
    font-family: inherit;
    font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
    cursor: pointer;
    transition: all 0.3s;
    padding: 5px 10px;
}

.filter-btn:hover, .filter-btn.active {
    color: var(--green-neon);
    text-shadow: 0 0 5px var(--green-neon);
}

/* Contrast fix: inactive filters must pass WCAG AA on dark bg */
.filter-btn { color: #777; }

/* ================================ */
/* === PROJECT GRID             === */
/* ================================ */
.project-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Progressive fallback: fewer cols on narrower viewports */
@media (max-width: 1400px) {
    .project-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1050px) {
    .project-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Hero card (full width) === */
.project-card.hero {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
}

.project-card.hero .card-header {
    grid-column: 1 / -1;
}

.project-card.hero .card-img,
.project-card.hero .card-carousel--hero {
    height: 100%;
    min-height: 200px;
    border-bottom: none;
    border-right: 1px solid var(--green-neon);
}

.project-card.hero .card-content {
    padding: 20px;
}

/* === Standard cards === */
.project-card {
    border: 1px solid var(--green-neon);
    background-color: var(--bg-card);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 10px var(--green-glow);
    transition: box-shadow 0.3s;
}

.project-card:hover {
    box-shadow: 0 0 24px rgba(0, 255, 65, 0.3);
}

.card-header {
    background-color: var(--green-neon);
    color: var(--bg-surface);
    padding: 6px 14px;
    font-weight: bold;
    font-size: clamp(0.72rem, 0.68rem + 0.2vw, 0.85rem);
}

.card-img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
    border-bottom: 1px solid var(--green-neon);
    filter: saturate(0.7) brightness(0.85);
    transition: filter 0.3s;
}

.project-card:hover .card-img {
    filter: saturate(1) brightness(1);
}

/* ================================ */
/* === CAROUSEL                 === */
/* ================================ */
.card-carousel {
    position: relative;
    overflow: hidden;
    height: 170px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--green-neon);
}

.carousel-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.35s ease;
    filter: saturate(0.7) brightness(0.85);
}

.carousel-img.active {
    opacity: 1;
}

/* Video slide — iframe fills slot; black letterbox via background */
iframe.carousel-video {
    border: 0;
    background: #000;
    object-fit: unset;
    pointer-events: none;
}
iframe.carousel-video.active {
    pointer-events: auto;
}

/* Zoomable image in a carousel — only clickable when it's the active slide */
.carousel-img--zoomable {
    pointer-events: none;
}
.carousel-img--zoomable.active {
    pointer-events: auto;
    cursor: zoom-in;
}

/* Hide zoom hint when a video slide is active (hint only applies to images) */
.card-carousel:has(iframe.carousel-video.active) .carousel-zoom-hint {
    display: none;
}

.project-card:hover .carousel-img.active {
    filter: saturate(1) brightness(1);
}

.carousel-click-zone {
    position: absolute;
    inset: 0;
    z-index: 2;
    cursor: zoom-in;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid var(--green-neon);
    color: var(--green-neon);
    font-size: 1.6rem;
    line-height: 1;
    padding: 4px 10px 6px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    z-index: 2;
    font-family: inherit;
}

.carousel-btn.prev { left: 6px; }
.carousel-btn.next { right: 6px; }

.card-carousel:hover .carousel-btn {
    opacity: 1;
}

.carousel-btn:hover {
    background: var(--green-neon);
    color: var(--bg-surface);
}

.carousel-dots {
    position: absolute;
    bottom: 7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 6px;
    z-index: 2;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 255, 65, 0.35);
    border: 1px solid var(--green-neon);
    transition: background 0.2s;
}

.dot.active {
    background: var(--green-neon);
}

/* ================================ */
/* === CARD CONTENT             === */
/* ================================ */
.card-content {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
    line-height: 1.6;
}

.card-content h3 {
    margin: 0 0 4px 0;
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.18rem);
    color: var(--green-neon);
}

.card-tier {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--bg-surface);
    background: var(--green-neon);
    padding: 1px 8px;
    margin-bottom: 8px;
    font-weight: bold;
    letter-spacing: 1px;
    width: fit-content;
}

.card-content .card-subtitle {
    color: var(--white-soft);
    margin: 0 0 10px 0;
    font-size: clamp(0.78rem, 0.74rem + 0.2vw, 0.88rem);
}

.card-content p {
    margin: 0 0 8px 0;
    color: var(--green-body);
}

.lead-quote {
    margin: 10px 0 12px 0;
    padding: 10px 14px;
    border-left: 2px solid var(--green-neon);
    background: rgba(0, 255, 65, 0.04);
    font-size: clamp(0.74rem, 0.70rem + 0.2vw, 0.84rem);
    line-height: 1.6;
    font-style: italic;
}

.lead-quote p {
    color: var(--white-soft) !important;
    margin: 0 0 6px 0 !important;
}

.lead-quote p:last-of-type {
    margin-bottom: 8px !important;
    color: var(--green-body) !important;
    font-weight: bold;
    font-style: normal;
}

.lead-quote footer {
    font-style: normal;
    font-size: 0.72rem;
    color: var(--green-muted);
    letter-spacing: 0.3px;
}

.lead-quote footer a {
    color: var(--green-neon);
    text-decoration: none;
}

.lead-quote footer a:hover {
    text-decoration: underline;
}

.card-content .card-contribution {
    color: var(--white-soft);
    font-size: clamp(0.76rem, 0.72rem + 0.2vw, 0.85rem);
    border-left: 2px solid var(--green-muted);
    padding-left: 10px;
    margin: 6px 0 10px 0;
    line-height: 1.5;
}

.card-patterns {
    font-size: clamp(0.7rem, 0.66rem + 0.2vw, 0.8rem);
    color: var(--green-muted);
    font-style: italic;
    margin-top: 4px;
}

.card-links {
    display: flex;
    gap: 8px;
    margin-top: auto;
    flex-wrap: wrap;
}

.card-links .download-btn {
    flex: 1;
}

/* ================================ */
/* === BUTTONS                  === */
/* ================================ */
.download-btn {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 14px;
    background-color: transparent;
    color: var(--green-neon);
    border: 1px dashed var(--green-neon);
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    font-size: clamp(0.76rem, 0.72rem + 0.2vw, 0.88rem);
    font-family: inherit;
}

.download-btn:hover {
    background-color: var(--green-neon);
    color: var(--bg-surface);
}

/* Subtle note below download buttons — e.g. unsigned APK caveat */
.install-note {
    display: block;
    margin-top: 6px;
    color: var(--green-dim);
    font-family: inherit;
    font-size: 0.72rem;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

/* ================================ */
/* === WEBGL CONTAINER          === */
/* ================================ */
.webgl-container {
    width: 100%;
    aspect-ratio: 16/9;
    border: 1px dotted var(--green-neon);
    margin-top: 10px;
}

.webgl-container iframe {
    width: 100%;
    height: 100%;
}

/* ================================ */
/* === FOOTER                   === */
/* ================================ */
.site-footer {
    border-top: 1px solid var(--green-neon);
    background: var(--bg-surface);
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    font-size: clamp(0.7rem, 0.66rem + 0.2vw, 0.78rem);
    color: var(--green-muted);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    color: var(--green-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--green-neon);
}

/* ================================ */
/* === SKIP LINK (accessibility) === */
/* ================================ */
.skip-link {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    background: var(--green-neon);
    color: var(--bg-surface);
    padding: 8px 16px;
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 9999;
    text-decoration: none;
    transition: transform 0.1s;
}
.skip-link:focus {
    transform: translateY(0);
}

/* ================================ */
/* === FOCUS STYLES (keyboard nav) = */
/* ================================ */
:focus-visible {
    outline: 2px solid var(--green-neon);
    outline-offset: 3px;
}

/* Remove default outline only when focus-visible is supported */
:focus:not(:focus-visible) {
    outline: none;
}

/* ================================ */
/* === TECHNICAL CHALLENGES     === */
/* ================================ */
.card-challenges {
    margin-top: 10px;
    border-left: 2px solid var(--green-dim);
    padding-left: 10px;
}

.card-challenges summary {
    color: var(--green-muted);
    font-size: clamp(0.7rem, 0.66rem + 0.2vw, 0.78rem);
    cursor: pointer;
    letter-spacing: 0.5px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    transition: color 0.2s;
}

.card-challenges summary::-webkit-details-marker { display: none; }

.card-challenges summary::before {
    content: '▶';
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.card-challenges[open] summary::before {
    transform: rotate(90deg);
}

.card-challenges summary:hover {
    color: var(--green-neon);
}

.challenge-item {
    font-size: clamp(0.7rem, 0.66rem + 0.15vw, 0.78rem);
    line-height: 1.55;
    color: var(--green-body);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 255, 65, 0.08);
}

.challenge-item:first-of-type {
    border-top: none;
    margin-top: 6px;
}

.ch-label {
    display: inline-block;
    color: var(--green-neon);
    font-size: 0.65rem;
    font-weight: bold;
    letter-spacing: 1px;
    background: rgba(0, 255, 65, 0.08);
    padding: 1px 6px;
    margin-right: 4px;
    margin-bottom: 2px;
}

.challenge-item code {
    font-family: var(--font-mono);
    color: var(--green-neon);
    font-size: 0.9em;
    background: rgba(0, 255, 65, 0.06);
    padding: 0 3px;
}

/* ================================ */
/* === ZOOMABLE IMAGES          === */
/* ================================ */
.card-img.zoomable {
    cursor: zoom-in;
}

.card-img.zoomable:hover {
    filter: saturate(1) brightness(1.1);
}

/* Zoom hint badge shown on carousel hover */
.carousel-zoom-hint {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.62rem;
    color: var(--green-neon);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--green-dim);
    padding: 3px 7px;
    letter-spacing: 1.5px;
    font-weight: bold;
    font-family: var(--font-mono);
    z-index: 4;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.card-carousel:hover .carousel-zoom-hint,
.card-img-wrap:hover .carousel-zoom-hint {
    opacity: 1;
}

/* Wrapper for single zoomable images (non-carousel) to anchor zoom hint */
.card-img-wrap {
    position: relative;
    flex-shrink: 0;
}

/* ================================ */
/* === ARCHITECTURE DIAGRAM     === */
/* ================================ */
.arch-diagram {
    margin: 12px 0;
    border: 1px solid var(--green-dim);
    border-radius: 3px;
    overflow: hidden;
    background: #050505;
}

.arch-diagram-trigger {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    cursor: zoom-in;
    position: relative;
    font-family: var(--font-mono);
}

.arch-img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.2s;
}

.arch-diagram-trigger:hover .arch-img,
.arch-diagram-trigger:focus-visible .arch-img {
    filter: brightness(1.15);
}

.arch-diagram-trigger:focus-visible {
    outline: 2px solid var(--green-neon);
    outline-offset: 2px;
}

.arch-zoom-hint {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.62rem;
    color: var(--green-neon);
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--green-dim);
    padding: 3px 7px;
    letter-spacing: 1.5px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.arch-diagram-trigger:hover .arch-zoom-hint,
.arch-diagram-trigger:focus-visible .arch-zoom-hint {
    opacity: 1;
}

.arch-diagram figcaption {
    font-size: clamp(0.62rem, 0.58rem + 0.2vw, 0.72rem);
    color: var(--green-dim);
    text-align: center;
    padding: 4px 8px;
    border-top: 1px solid rgba(42, 138, 62, 0.3);
    letter-spacing: 1px;
}

/* ================================ */
/* === DIAGRAM MODAL (LIGHTBOX) === */
/* ================================ */
.diagram-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.diagram-modal[hidden] { display: none; }

.diagram-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: zoom-out;
}

.diagram-modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--green-neon);
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.25), inset 0 0 0 1px rgba(0, 255, 65, 0.1);
    max-width: min(96vw, 1300px);
    max-height: 94vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    animation: modal-in 0.2s ease-out;
}

.diagram-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--green-dim);
    background: rgba(0, 255, 65, 0.06);
    flex-shrink: 0;
}

.diagram-modal-header #diagram-modal-title {
    color: var(--green-neon);
    font-family: var(--font-mono);
    font-size: clamp(0.72rem, 0.68rem + 0.25vw, 0.9rem);
    letter-spacing: 1.5px;
    font-weight: bold;
    text-shadow: 0 0 6px rgba(0, 255, 65, 0.35);
}

.diagram-modal-close {
    background: transparent;
    border: 1px solid var(--green-dim);
    color: var(--green-body);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 5px 12px;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.diagram-modal-close:hover,
.diagram-modal-close:focus-visible {
    background: var(--green-neon);
    color: #000;
    border-color: var(--green-neon);
    outline: none;
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.5);
}

.diagram-modal-body {
    flex: 1 1 auto;
    overflow: auto;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050505;
}

/* Photos: centered, fit within modal */
.diagram-modal-body img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

/* SVG diagram: fill full modal width, scroll vertically if needed */
.modal--diagram .diagram-modal-content {
    max-width: min(98vw, 1600px);
    max-height: 96vh;
}

.modal--diagram .diagram-modal-body {
    display: block;
    overflow: auto;
}

.modal--diagram .diagram-modal-body img {
    width: 100%;
    height: auto;
    max-height: none;
    min-width: 700px;
}

.diagram-modal-hint {
    padding: 6px 16px;
    border-top: 1px solid rgba(42, 138, 62, 0.4);
    background: rgba(0, 255, 65, 0.03);
    color: var(--green-dim);
    font-size: 0.65rem;
    text-align: center;
    letter-spacing: 1.5px;
    flex-shrink: 0;
}

body.modal-open {
    overflow: hidden;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ================================ */
/* === REDUCED MOTION           === */
/* ================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Instant typewriter — show all text immediately */
    #console-output {
        transition: none;
    }

    .status-dot {
        animation: none;
        opacity: 1;
    }

    .carousel-img {
        transition: none;
    }

    .diagram-modal-content {
        animation: none;
    }
}

/* ================================ */
/* === SCROLLBAR                === */
/* ================================ */
.console-screen::-webkit-scrollbar {
    width: 6px;
}
.console-screen::-webkit-scrollbar-track {
    background: var(--bg-surface);
}
.console-screen::-webkit-scrollbar-thumb {
    background: var(--green-neon);
    border-radius: 3px;
}

/* ================================ */
/* === RESPONSIVE — TABLET      === */
/* === (≤768px)                 === */
/* ================================ */
@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .top-nav {
        padding: 10px 16px;
    }

    .terminal-container {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
        overflow: visible;
    }

    .side-nav {
        flex-direction: row;
        width: 100%;
        overflow-x: auto;
        gap: 6px;
        flex-shrink: 0;
        padding-bottom: 4px;
    }

    .nav-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    .console-screen {
        padding: 18px;
        overflow-y: visible;
        min-height: 300px;
    }

    /* 1 col on tablet (hero already spans full width) */
    .project-grid {
        grid-template-columns: 1fr;
    }

    .project-card.hero {
        grid-template-columns: 1fr;
    }

    .project-card.hero .card-img,
    .project-card.hero .card-carousel--hero {
        height: 200px;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--green-neon);
    }

    .card-img {
        height: 180px;
    }

    /* Lead quote more compact on tablet */
    .lead-quote {
        padding: 8px 12px;
    }

    /* Modal: near fullscreen on tablet */
    .diagram-modal {
        padding: 10px;
    }

    .diagram-modal-content {
        max-width: 100%;
        max-height: 100%;
    }

    .site-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 12px 16px;
    }
}

/* ================================ */
/* === RESPONSIVE — MOBILE      === */
/* === (≤520px) header wrap     === */
/* ================================ */
@media (max-width: 520px) {
    /* Stack header: name on top, icons below */
    .top-nav {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
    }

    .user-info {
        font-size: clamp(0.68rem, 0.6rem + 1.5vw, 0.82rem);
        justify-content: center;
        text-align: center;
    }

    .social-icons {
        gap: 20px;
    }

    /* Side nav: slightly smaller buttons */
    .nav-btn {
        font-size: 0.72rem;
        padding: 6px 8px;
    }
}

/* ================================ */
/* === RESPONSIVE — MOBILE      === */
/* === (≤480px)                 === */
/* ================================ */
@media (max-width: 480px) {
    .terminal-container {
        padding: 8px;
        gap: 8px;
    }

    .side-nav {
        gap: 4px;
    }

    .console-screen {
        padding: 12px;
    }

    .card-img {
        height: 150px;
    }

    .card-carousel {
        height: 150px;
    }

    /* Filter buttons: smaller on mobile */
    .filter-btn {
        font-size: 0.72rem;
        padding: 4px 7px;
    }

    /* Arch diagram hint hidden on touch (no hover) */
    .arch-zoom-hint,
    .carousel-zoom-hint {
        display: none;
    }

    /* Modal full bleed on small phones */
    .diagram-modal {
        padding: 6px;
    }

    .diagram-modal-header {
        padding: 8px 12px;
    }

    .diagram-modal-body {
        padding: 10px;
    }

    .site-footer {
        padding: 10px 12px;
    }
}
