/* ==========================================================================
   AKNAVJ — minimal portfolio
   ========================================================================== */

:root {
    --bg:          #0a0a0b;
    --bg-elev:     #131316;
    --bg-elev-2:   #1a1a1e;
    --fg:          #f4f4f5;
    --muted:       #9a9aa4;
    --faint:       #5b5b64;
    --line:        rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.30);
    --accent:      #ffffff;

    --max:         1440px;
    --gutter:      clamp(20px, 5vw, 72px);
    --nav-h:       66px;

    --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
    --font-body:    'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:    'Space Mono', ui-monospace, 'SFMono-Regular', monospace;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: var(--faint) var(--bg); }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; transition: color .25s var(--ease), opacity .25s var(--ease); }

::selection { background: var(--fg); color: var(--bg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a2a30; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #3a3a42; }

.mono { font-family: var(--font-mono); }

/* ==========================================================================
   TOP NAV (interior pages)
   ========================================================================== */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--gutter);
    background: linear-gradient(180deg, rgba(10,10,11,0.92), rgba(10,10,11,0.55));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 0.22em;
    color: var(--fg);
}
.brand:hover { color: var(--muted); }

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(18px, 2.4vw, 40px);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.nav-links a {
    color: var(--muted);
    position: relative;
    padding: 4px 0;
    white-space: nowrap;
}
.nav-links a::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: var(--fg);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .3s var(--ease);
}
.nav-links a:hover,
.nav-links a.active { color: var(--fg); }
.nav-links a:hover::after,
.nav-links a.active::after { transform: scaleX(1); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 8px 12px;
    cursor: pointer;
}

/* ==========================================================================
   HOME HUB
   ========================================================================== */
.hub {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* full-bleed background layers */
.hub-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: brightness(0.74) contrast(1.02);
    transform: scale(1.03);
}
.hub-bg-top {
    z-index: 1;
    opacity: 0;
    transition: opacity .6s var(--ease);
}
.hub-bg-top.show { opacity: 1; }

/* youtube video preview layer */
.hub-video {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    opacity: 0;
    transition: opacity .6s var(--ease);
    pointer-events: none;
}
.hub-video.show { opacity: 1; }
.hub-video iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    /* overscan-crop so YouTube's title bar & watermark sit outside the viewport */
    transform: translate(-50%, -50%) scale(1.2);
    width: 100vw;
    height: 56.25vw;      /* 16:9 sized off width */
    min-height: 100vh;
    min-width: 177.78vh;  /* 16:9 sized off height */
    border: 0;
    pointer-events: none;
    filter: brightness(0.74) contrast(1.02);
}

/* legibility overlay — darkest on the left where the nav sits */
.hub::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    background:
        linear-gradient(90deg, rgba(8,8,10,0.88) 0%, rgba(8,8,10,0.5) 42%, rgba(8,8,10,0.12) 100%),
        linear-gradient(0deg, rgba(8,8,10,0.6) 0%, transparent 34%);
    pointer-events: none;
}

/* top bar — brand left, socials right */
.hub-top {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: clamp(24px, 4vw, 44px) var(--gutter);
}
.hub-brand {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(18px, 2.2vw, 24px);
    letter-spacing: 0.4em;
    color: var(--fg);
}
.hub-brand:hover { color: var(--muted); }

.hub-socials { display: flex; gap: 20px; }
.hub-socials a { color: var(--fg); line-height: 0; opacity: 0.85; }
.hub-socials a:hover { opacity: 1; }
.hub-socials svg { width: 20px; height: 20px; }

/* big vertical nav list — center-left */
.hub-nav {
    position: relative;
    z-index: 4;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(2px, 0.7vh, 12px);
    padding: 0 var(--gutter);
}
.hub-nav a {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(32px, 6.4vw, 74px);
    line-height: 1.06;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(244, 244, 245, 0.92);
    transition: color .25s var(--ease), transform .35s var(--ease), opacity .25s var(--ease);
}
.hub-nav a:hover { color: #fff; transform: translateX(10px); }
.hub-nav:hover a { opacity: 0.4; }
.hub-nav:hover a:hover { opacity: 1; }

/* small tagline — bottom-left */
.hub-tagline {
    position: relative;
    z-index: 4;
    padding: 0 var(--gutter) clamp(24px, 4vw, 44px);
    font-family: var(--font-mono);
    font-size: clamp(10px, 1.3vw, 13px);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    max-width: 680px;
}

/* ==========================================================================
   SECTION PAGES
   ========================================================================== */
.section {
    max-width: var(--max);
    margin: 0 auto;
    padding: calc(var(--nav-h) + clamp(40px, 8vw, 96px)) var(--gutter) 80px;
}

.section-head {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: clamp(28px, 5vw, 56px);
    margin-bottom: clamp(28px, 5vw, 56px);
    border-bottom: 1px solid var(--line);
}
.section-index {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.28em;
    color: var(--faint);
}
.section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(40px, 9vw, 120px);
    line-height: 0.92;
    letter-spacing: 0.01em;
}
.section-sub {
    max-width: 60ch;
    color: var(--muted);
    font-size: clamp(15px, 2vw, 18px);
}

/* ==========================================================================
   GALLERY
   ========================================================================== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(clamp(240px, 30vw, 360px), 1fr));
    gap: clamp(10px, 1.4vw, 20px);
    margin-bottom: clamp(40px, 6vw, 72px);
}

.gallery-item {
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    cursor: pointer;
    padding: 0;
    font: inherit;
    color: inherit;
    text-align: left;
}
.gallery-item img,
.gallery-item video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(0.15) brightness(0.92);
    transition: transform .6s var(--ease), filter .5s var(--ease);
}
.gallery-item:hover img,
.gallery-item:focus-visible img,
.gallery-item:hover video,
.gallery-item:focus-visible video {
    transform: scale(1.05);
    filter: grayscale(0) brightness(1);
}
.gallery-item:focus-visible { outline: 1px solid var(--fg); outline-offset: -1px; }

/* video play badge on gallery thumbnails */
.gallery-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding-left: 3px;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: rgba(10, 10, 11, 0.62);
    color: var(--fg);
    font-size: 11px;
    backdrop-filter: blur(4px);
    pointer-events: none;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.gallery-item:hover .gallery-badge { background: var(--fg); color: var(--bg); }

.gallery-cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 16px 14px;
    background: linear-gradient(0deg, rgba(10,10,11,0.92) 10%, transparent);
    transform: translateY(8px);
    opacity: 0;
    transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.gallery-item:hover .gallery-cap,
.gallery-item:focus-visible .gallery-cap { opacity: 1; transform: translateY(0); }
.gallery-cap .gt {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.03em;
}
.gallery-cap .gc {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-transform: uppercase;
}

/* ---------- lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 5vw, 64px);
    background: rgba(6, 6, 8, 0.96);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .35s var(--ease), visibility .35s var(--ease);
}
.lightbox.open { opacity: 1; visibility: visible; }

.lb-figure {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.lb-figure img,
.lb-figure video {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    border: 1px solid var(--line);
}
.lb-figure video { background: #000; }
.lb-figure [hidden] { display: none; }
.lb-youtube {
    position: relative;
    width: min(100%, 138.6vh);
    aspect-ratio: 16 / 9;
    max-height: 78vh;
    border: 1px solid var(--line);
    background: #000;
}
.lb-youtube iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.lb-figure figcaption {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-align: center;
    text-transform: uppercase;
}
.lb-figure figcaption b { color: var(--fg); font-weight: 700; }

.lb-close, .lb-prev, .lb-next {
    position: absolute;
    background: none;
    border: 1px solid var(--line);
    color: var(--fg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .25s var(--ease), border-color .25s var(--ease);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
    background: var(--bg-elev-2);
    border-color: var(--line-strong);
}
.lb-close {
    top: clamp(16px, 3vw, 28px);
    right: clamp(16px, 3vw, 28px);
    width: 44px; height: 44px;
    font-size: 18px;
}
.lb-prev, .lb-next {
    top: 50%;
    transform: translateY(-50%);
    width: 52px; height: 64px;
    font-size: 30px;
    line-height: 1;
}
.lb-prev { left: clamp(12px, 2vw, 28px); }
.lb-next { right: clamp(12px, 2vw, 28px); }

.lb-counter {
    position: absolute;
    bottom: clamp(16px, 3vw, 28px);
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--muted);
}

/* ==========================================================================
   RESEARCH LIST
   ========================================================================== */
.research-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
}
.research-item {
    display: grid;
    grid-template-columns: 130px 1fr auto;
    gap: 24px;
    align-items: baseline;
    padding: 26px 6px;
    border-bottom: 1px solid var(--line);
    transition: background .3s var(--ease), padding-left .3s var(--ease);
}
.research-item:hover { background: var(--bg-elev); padding-left: 18px; }
.ri-date {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--faint);
    letter-spacing: 0.06em;
}
.ri-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(19px, 2.6vw, 26px);
    line-height: 1.2;
    display: block;
    margin-bottom: 6px;
}
.research-item:hover .ri-title { color: var(--fg); }
.ri-desc { color: var(--muted); font-size: 15px; max-width: 66ch; display: block; }
.ri-cat {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--faint);
    white-space: nowrap;
}
.ri-ext {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.6em;
    vertical-align: super;
    color: var(--faint);
    transition: color .3s var(--ease), transform .3s var(--ease);
}
.research-item:hover .ri-ext { color: var(--fg); transform: translate(2px, -2px); }

/* ==========================================================================
   PROSE (about + article body + inline section copy)
   ========================================================================== */
.prose { max-width: 74ch; }
.prose > * + * { margin-top: 1.1em; }
.prose p { color: var(--fg); font-size: clamp(16px, 2vw, 18px); line-height: 1.75; }
.prose a { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--faint); }
.prose a:hover { text-decoration-color: var(--fg); }
.prose h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(24px, 4vw, 34px);
    letter-spacing: 0.01em;
    margin-top: 1.8em;
    padding-top: 0.6em;
    border-top: 1px solid var(--line);
}
.prose h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(19px, 3vw, 24px);
    margin-top: 1.4em;
}
.prose ul, .prose ol { padding-left: 1.3em; color: var(--fg); }
.prose li { margin-top: 0.4em; }
.prose li::marker { color: var(--faint); }
.prose blockquote {
    border-left: 2px solid var(--line-strong);
    padding: 4px 0 4px 22px;
    color: var(--muted);
    font-style: italic;
    font-size: clamp(17px, 2.4vw, 21px);
}
.prose code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--bg-elev-2);
    border: 1px solid var(--line);
    padding: 0.12em 0.4em;
    border-radius: 2px;
}
.prose pre {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    padding: 20px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}
.prose pre code { background: none; border: none; padding: 0; font-size: inherit; }
.prose img { border: 1px solid var(--line); margin: 1.4em 0; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 14px; text-align: left; }
.prose th { background: var(--bg-elev); font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ==========================================================================
   ARTICLE
   ========================================================================== */
.article {
    max-width: 820px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + clamp(40px, 7vw, 84px)) var(--gutter) 64px;
}
.article-back {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.article-back:hover { color: var(--fg); }
.article-head {
    margin: 26px 0 clamp(30px, 5vw, 48px);
    padding-bottom: clamp(24px, 4vw, 40px);
    border-bottom: 1px solid var(--line);
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 20px;
}
.article-meta .cat { color: var(--muted); }
.article-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(30px, 6vw, 56px);
    line-height: 1.04;
    letter-spacing: 0.005em;
}
.article-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.tag-chip {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    border: 1px solid var(--line);
    padding: 5px 10px;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}
.article-nav a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 46%;
    color: var(--muted);
}
.article-nav a:hover { color: var(--fg); }
.article-nav .dir { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.article-nav .t { font-family: var(--font-display); font-weight: 500; font-size: 16px; line-height: 1.3; }
.article-nav .next-link { text-align: right; align-items: flex-end; margin-left: auto; }

.table-wrap { overflow-x: auto; margin: 1.4em 0; }
.table-wrap table { margin: 0; }

/* ---------- rouge syntax (muted) ---------- */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cp, .highlight .cs { color: #6a6a74; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kt { color: #c9a2ff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss { color: #b7e08a; }
.highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: #f0956b; }
.highlight .nf, .highlight .fm { color: #82aaff; }
.highlight .nc, .highlight .nn, .highlight .no, .highlight .nb, .highlight .bp { color: #ffcb6b; }
.highlight .o, .highlight .ow { color: #89ddff; }
.highlight .nt { color: #f07178; }
.highlight .na { color: #ffcb6b; }
.highlight .p, .highlight .nv, .highlight .n { color: var(--fg); }
.highlight .gd { color: #f07178; }
.highlight .gi { color: #b7e08a; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
    border-top: 1px solid var(--line);
    padding: 40px var(--gutter);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--faint);
}
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--fg); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 760px) {
    .nav-toggle { display: inline-flex; }
    .nav-links {
        position: fixed;
        top: var(--nav-h); left: 0; right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        padding: 8px var(--gutter) 20px;
        transform: translateY(-12px);
        opacity: 0;
        pointer-events: none;
        transition: opacity .25s var(--ease), transform .25s var(--ease);
    }
    .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .nav-links a { width: 100%; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
    .nav-links a::after { display: none; }

    .research-item { grid-template-columns: 1fr; gap: 8px; }
    .ri-cat { order: -1; }

    .article-nav { flex-direction: column; }
    .article-nav a { max-width: 100%; }
    .article-nav .next-link { text-align: left; align-items: flex-start; }

    .lb-prev, .lb-next { width: 42px; height: 52px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
    .hub-bg { transition: opacity .3s ease !important; }
}
