  :root {
    /* Off-white paper, dark olive-green ink, and a lime pop.
       (Variable names are historical.) */
    --cream: #F4F4ED;
    --cream-dark: #EBEEE0;
    --cream-deeper: #DDE1D2;
    --ink: #282C20;
    --ink-light: #3B3C38;
    --ink-muted: #535450;
    --accent: #B4B8A5;
    /* Lime is a FILL colour: buttons, dots, hover states — always with dark
       green on top. It is far too pale to read as text on the off-white
       page, so the text accent (-warm) is dark green in light mode and only
       becomes lime in dark mode. -rust is the hover step of -warm. */
    --accent-fill: #D2FF00;
    --on-accent: #282C20;
    --accent-warm: #282C20;
    --accent-green: #282C20;
    --accent-rust: #535450;
    /* Small mono labels and metadata. */
    --accent-2: #535450;
    --border: rgba(40,44,32,0.12);
    --shadow: rgba(40,44,32,0.08);
  }

  [data-theme="dark"] {
    --cream: #282C20;
    --cream-dark: #2E3325;
    --cream-deeper: #343A26;
    --ink: #F4F4ED;
    --ink-light: #DDE1D2;
    --ink-muted: #B4B8A5;
    --accent: #535450;
    --accent-warm: #D2FF00;
    --accent-green: #D2FF00;
    --accent-rust: #B2C73A;
    --accent-2: #B2C73A;
    --border: rgba(244,244,237,0.12);
    --shadow: rgba(0,0,0,0.3);
  }

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

  ::selection { background: var(--accent-fill); color: var(--on-accent); }
  
  html {
    scroll-behavior: smooth;
    font-size: 16px;
    scrollbar-width: none;       /* hide native scrollbar (Firefox) */
    -ms-overflow-style: none;    /* hide native scrollbar (legacy Edge/IE) */
  }
  /* hide native scrollbar (WebKit) — we draw a custom overlay bar in JS instead */
  ::-webkit-scrollbar { width: 0; height: 0; }

  /* ── CUSTOM OVERLAY SCROLLBAR — floats on top, auto-hides, reserves no layout space ── */
  .scrollbar {
    position: fixed;
    top: 0;
    right: 3px;
    width: 6px;
    border-radius: 10px;
    background: var(--accent-warm);
    opacity: 0;                  /* hidden until you scroll */
    pointer-events: none;        /* never blocks clicks while hidden */
    cursor: grab;
    z-index: 9998;
    transition: opacity 0.35s ease, background 0.3s ease;
  }
  .scrollbar.is-visible { opacity: 1; pointer-events: auto; }
  .scrollbar:hover { background: var(--accent-rust); }
  .scrollbar:active { cursor: grabbing; }

  /* transparent click region behind the thumb — click it to jump the thumb there */
  .scrollbar-track {
    position: fixed;
    top: 0;
    right: 0;
    width: 14px;
    height: 100%;
    z-index: 9997;               /* just below the thumb */
    pointer-events: none;        /* inert until the bar is shown, so it never blocks content */
  }
  .scrollbar-track.is-visible { pointer-events: auto; cursor: pointer; }

  @media (prefers-reduced-motion: reduce) {
    .scrollbar { transition: opacity 0.2s ease; }
  }
  
  body {
    font-family: 'DM Sans', sans-serif;
    background: var(--cream);
    color: var(--ink);
    transition: background 0.4s, color 0.4s;
    overflow-x: hidden;
  }

  /* ── NOISE TEXTURE OVERLAY ── */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
    opacity: 0.4;
  }

  /* ── DRIFTING CONTOUR LINES ──
     A fixed canvas behind everything; index.js redraws the lines each frame.
     Its colour is the ink colour, which the script reads for the stroke, and
     the opacity here is the single knob for how loud the pattern is. */
  .contours {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    color: var(--ink);
    opacity: 0.11;
  }
  [data-theme="dark"] .contours { opacity: 0.09; }

  /* ── NAVIGATION ── */
  nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    padding: 1.25rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .nav-logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
  }
  .nav-logo span { color: var(--accent-fill); font-style: italic; }

  .nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    align-items: center;
  }
  .nav-links a {
    font-family: 'DM Mono', monospace;
    font-size: 0.64rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-decoration: none;
    transition: color 0.2s;
  }
  .nav-links a:hover { color: var(--ink); }

  .theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px; height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: border-color 0.2s, transform 0.2s;
    color: var(--ink);
  }
  .theme-toggle:hover { transform: rotate(20deg); border-color: var(--accent-warm); }

  .hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
  }
  .hamburger span {
    width: 24px; height: 1.5px;
    background: var(--ink);
    transition: 0.3s;
    display: block;
  }

  /* ── HERO SECTION ── */
  #hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-top: 80px;
    position: relative;
    overflow: hidden;
  }

  .hero-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 5rem 4rem 5rem 6rem;
  }

  .hero-tag {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 1.5rem;
  }

  .hero-name {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.8rem, 4.8vw, 4.4rem);
    font-weight: 700;
    line-height: 1.0;
    letter-spacing: -0.03em;
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeUp 0.9s 0.2s forwards;
  }

  .hero-name em {
    font-style: italic;
    color: var(--accent-warm);
    display: block;
  }

  .hero-role {
    font-family: 'DM Mono', monospace;
    /* Scales down on narrow screens so the line never wraps/overflows */
    font-size: clamp(0.56rem, 2vw, 0.72rem);
    /* Keep on one line so a web-font swap can't reflow 2 lines -> 1 line
       and shift the elements below it */
    white-space: nowrap;
    color: var(--ink-muted);
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeUp 0.9s 0.4s forwards;
  }

  .hero-summary {
    font-size: 0.84rem;
    line-height: 1.75;
    color: var(--ink-light);
    max-width: 480px;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeUp 0.9s 0.6s forwards;
    position: relative;
  }

  /* ── HERO SUMMARY: TERMINAL-STYLE TYPING ──
     Typography and colour stay exactly as above — only the entrance is
     bash-like. JS builds .hs-ghost / .hs-type; without JS the plain
     paragraph renders as normal. */

  /* The real text at zero opacity. Reserves the paragraph's final height so
     the CTA row below never jumps while the overlay types, and keeps the copy
     available to screen readers, Ctrl+F, and text selection. */
  .hs-ghost { color: transparent; }

  /* The visible, progressively typed copy. Inherits every type property from
     .hero-summary, so it wraps line-for-line onto the ghost beneath it.
     Inert to the pointer so selecting the paragraph targets the ghost and
     copies the text once, not twice. */
  .hs-type {
    position: absolute;
    inset: 0;
    pointer-events: none;
    user-select: none;
  }

  /* Block cursor, drawn rather than typed, so it reads as a terminal caret
     while the text itself stays DM Sans. currentColor = the paragraph's ink. */
  .hs-caret { position: relative; }
  /* Drawn out of flow so the caret never takes up inline space — the typed
     overlay then wraps exactly like the finished paragraph. */
  .hs-caret::after {
    content: '';
    position: absolute;
    left: 0.06em;
    top: 0.12em;
    width: 0.5em;
    height: 1.05em;
    background: currentColor;
  }
  /* The not-yet-typed remainder: present for layout, invisible. Keeps every
     line break (and justified word gap) fixed from the first character. */
  .hs-rest { color: transparent; }
  /* Solid while output is streaming, blinking once the line is done — the way
     a real shell cursor behaves. */
  .hs-caret.is-blinking { animation: hsCaret 1.06s step-end infinite; }

  @keyframes hsCaret {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
  }

  .hero-cta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeUp 0.9s 0.8s forwards;
  }

  .btn-primary {
    background: var(--accent-fill);
    color: var(--on-accent);
    padding: 0.85rem 2rem;
    border: none;
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--shadow); }

  .btn-outline {
    background: transparent;
    color: var(--ink);
    padding: 0.85rem 2rem;
    border: 1px solid var(--border);
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }
  .btn-outline:hover { transform: translateY(-2px); border-color: var(--accent-warm); color: var(--accent-warm); }

  .hero-right {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 3rem;
  }

  .hero-graphic {
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: var(--cream-deeper);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: fadeIn 1s 0.5s forwards;
  }

  .hero-initials {
    font-family: 'Playfair Display', serif;
    font-size: 4.8rem;
    font-weight: 700;
    color: var(--ink);
    opacity: 0.50;
    letter-spacing: -0.05em;
  }

  .hero-stats {
    position: absolute;
    bottom: 3rem;
    right: 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .stat-item {
    text-align: right;
  }
  .stat-num {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-warm);
    line-height: 1;
  }
  .stat-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }

  .scroll-hint {
    position: absolute;
    bottom: 2rem;
    left: 6rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-muted);
    opacity: 0;
    animation: fadeIn 1s 1.5s forwards;
  }
  .scroll-line {
    width: 48px;
    height: 1px;
    background: var(--ink-muted);
    position: relative;
    overflow: hidden;
  }
  .scroll-line::after {
    content: '';
    position: absolute;
    left: -100%;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-warm);
    animation: scrollLine 2s ease-in-out infinite;
  }

  /* ── SECTIONS ── */
  section {
    padding: 7rem 6rem;
    position: relative;
  }

  .section-header {
    margin-bottom: 4rem;
    display: flex;
    align-items: flex-end;
    gap: 2rem;
  }

  .section-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.15em;
    color: var(--accent-2);
    padding-bottom: 0.5rem;
  }

  .section-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.6rem, 3.2vw, 2.56rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
  }

  .section-title em { font-style: italic; color: var(--accent-warm); }

  .section-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-bottom: 0.5rem;
  }

  /* ── ABOUT ── */
  #about {
    background: var(--cream-dark);
  }

  .about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 5rem;
  }

  .about-text h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.12rem;
    margin-bottom: 1rem;
    font-weight: 400;
  }
  .about-text p {
    color: var(--ink-light);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-size: 0.776rem;
  }

  .about-sidebar {}

  .edu-item {
    border-left: 2px solid var(--accent);
    padding-left: 1.25rem;
    margin-bottom: 2rem;
  }
  .edu-year {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.1em;
    color: var(--accent-2);
    margin-bottom: 0.25rem;
  }
  .edu-degree {
    font-weight: 500;
    font-size: 0.776rem;
    margin-bottom: 0.15rem;
  }
  .edu-school {
    color: var(--ink-muted);
    font-size: 0.704rem;
  }

  .spec-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 2rem;
  }
  .spec-tag {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    color: var(--ink-light);
    background: var(--cream);
    transition: border-color 0.2s, color 0.2s;
  }
  .spec-tag:hover { border-color: var(--accent-warm); color: var(--accent-warm); }

  /* ── PROJECTS ── */
  #projects { background: var(--cream); }

  .project-category-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 2rem;
    margin-top: 3.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
  }
  .project-category-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }
  .project-category-label:first-of-type { margin-top: 0; }

  .projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
  }

  .project-card {
    background: var(--cream-dark);
    border: 1px solid var(--border);
    padding: 2rem;
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
    position: relative;
    overflow: hidden;
    cursor: default;
  }
  .project-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px var(--shadow); border-color: var(--accent); }

  .project-type {
    font-family: 'DM Mono', monospace;
    font-size: 0.496rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 0.75rem;
  }

  .project-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.04rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.2;
  }

  .project-desc {
    font-size: 0.704rem;
    color: var(--ink-light);
    line-height: 1.7;
    margin-bottom: 1rem;
  }

  .project-problem {
    font-size: 0.664rem;
    color: var(--ink-muted);
    font-style: italic;
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--accent);
    line-height: 1.6;
  }

  .project-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
  }
  .stack-tag {
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    padding: 0.25rem 0.6rem;
    background: var(--cream-deeper);
    color: var(--ink-muted);
    border: 1px solid var(--border);
    letter-spacing: 0.03em;
  }

  .project-results {
    background: var(--chip-fill);
    border: 1px solid var(--chip-edge);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.664rem;
    color: var(--accent-2);
  }
  .project-results strong {
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.25rem;
    color: var(--accent-2);
  }

  .project-links {
    display: flex;
    gap: 0.75rem;
  }
  .project-link {
    font-family: 'DM Mono', monospace;
    font-size: 0.544rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--border);
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
  }
  .project-link:hover { border-color: var(--accent-fill); background: var(--accent-fill); color: var(--on-accent); }

  /* ── SKILLS ── */
  #skills { background: var(--cream-dark); }

  /* One compact glass panel: a row per category, label on the left, pills on
     the right — sized so the whole section reads without scrolling. */
  #skills .section-header { margin-bottom: 2.5rem; }

  .skills-grid {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1.75rem;
  }

  .skill-category {
    display: grid;
    grid-template-columns: 15rem 1fr;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--chip-edge);
  }
  .skill-category:last-child { border-bottom: 0; }

  .skill-cat-title {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
    display: flex;
    align-items: center;
    gap: 0.6rem;
  }
  .skill-cat-title::before {
    content: '';
    width: 20px;
    height: 1px;
    background: var(--accent-2);
  }

  .skill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .skill-pill {
    font-family: 'DM Mono', monospace;
    font-size: 0.576rem;
    padding: 0.35rem 0.75rem;
    background: var(--cream-dark);
    border: 1px solid var(--border);
    color: var(--ink-light);
    transition: all 0.2s;
    letter-spacing: 0.03em;
  }
  .skill-pill:hover { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }

  /* ── EXPERIENCE ── */
  #experience { background: var(--cream); }

  .timeline {
    position: relative;
    padding-left: 2rem;
  }
  .timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
  }

  .timeline-item {
    position: relative;
    padding-bottom: 3.5rem;
  }
  .timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem;
    top: 0.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-fill);
    border: 2px solid var(--cream);
    box-shadow: 0 0 0 1px var(--accent-warm);
  }

  .timeline-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
  }
  .timeline-period {
    font-family: 'DM Mono', monospace;
    font-size: 0.544rem;
    letter-spacing: 0.1em;
    color: var(--accent-2);
    text-transform: uppercase;
  }
  .timeline-badge {
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    padding: 0.2rem 0.6rem;
    background: var(--chip-fill);
    border: 1px solid var(--accent);
    color: var(--ink-muted);
    letter-spacing: 0.05em;
  }

  .timeline-role {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
  }
  .timeline-company {
    font-size: 0.72rem;
    color: var(--ink-muted);
    margin-bottom: 1rem;
  }
  .timeline-content p {
    font-size: 0.72rem;
    color: var(--ink-light);
    line-height: 1.75;
    margin-bottom: 0.5rem;
  }
  .timeline-achievements {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }
  .achievement-point {
    font-size: 0.704rem;
    color: var(--ink-light);
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
  }
  .achievement-point::before {
    content: '→';
    color: var(--accent-warm);
    font-size: 0.72rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
  }

  /* ── ACHIEVEMENTS ── */
  #achievements { background: var(--cream-dark); }

  .achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
  }

  .achievement-card {
    background: var(--cream);
    border: 1px solid var(--border);
    padding: 1.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .achievement-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px var(--shadow); }

  .achievement-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin-bottom: 1.1rem;
    border: 1px solid var(--border);
    background: var(--cream-dark);
    color: var(--ink);
    position: relative;
    transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  }
  .achievement-icon::after {
    content: '';
    position: absolute;
    top: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-top: 1px solid var(--accent-warm);
    border-right: 1px solid var(--accent-warm);
    opacity: 0.6;
    transition: opacity 0.22s ease;
  }
  .achievement-icon svg {
    width: 24px;
    height: 24px;
    display: block;
  }
  .achievement-card:hover .achievement-icon {
    color: var(--accent-warm);
    border-color: var(--accent-warm);
    background: var(--cream);
  }
  .achievement-card:hover .achievement-icon::after { opacity: 1; }
  .achievement-category {
    font-family: 'DM Mono', monospace;
    font-size: 0.52rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-2);
    margin-bottom: 0.5rem;
  }
  .achievement-title {
    font-family: 'Playfair Display', serif;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.3;
  }
  .achievement-desc {
    font-size: 0.68rem;
    color: var(--ink-muted);
    line-height: 1.65;
  }

  /* ── RESUME ── */
  #resume { background: var(--cream); }

  .resume-box {
    border: 1px solid var(--border);
    padding: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--cream-dark);
    max-width: 800px;
    gap: 2rem;
    flex-wrap: wrap;
  }

  .resume-text h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
  }
  .resume-text p {
    color: var(--ink-muted);
    font-size: 0.72rem;
    line-height: 1.65;
  }

  /* ── CONTACT ── */
  #contact { background: var(--cream-dark); }

  .contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
  }

  .contact-info h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.12rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
  }

  .contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
    transition: color 0.2s;
    font-size: 0.736rem;
  }
  .contact-link:hover { color: var(--accent-warm); }
  .contact-link-icon {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
  }
  .contact-link-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.544rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    display: block;
    margin-bottom: 0.1rem;
  }
  .contact-link-value { font-size: 0.72rem; }

  .contact-form { display: flex; flex-direction: column; gap: 1.25rem; }

  .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }
  .form-group label {
    font-family: 'DM Mono', monospace;
    font-size: 0.544rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
  }
  .form-group input,
  .form-group textarea {
    background: var(--cream);
    border: 1px solid var(--border);
    padding: 0.85rem 1rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    color: var(--ink);
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
  }
  .form-group input:focus,
  .form-group textarea:focus { border-color: var(--accent-warm); }
  .form-group textarea { min-height: 130px; }

  /* ── FOOTER ──
     A glass capsule that mirrors the nav: same material, same width, so the
     page opens and closes with the same shape. */
  footer {
    position: relative;
    max-width: 1180px;
    margin: 0 auto 16px;
    width: calc(100% - 32px);
    padding: 0.8rem 1.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    border-radius: 999px;
    color: var(--ink);
    background: var(--glass-nav-on);
    -webkit-backdrop-filter: blur(28px) saturate(var(--glass-sat));
    backdrop-filter: blur(28px) saturate(var(--glass-sat));
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-inner), var(--glass-drop);
  }

  footer p {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
  }

  .footer-links {
    display: flex;
    gap: 0.25rem;
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  footer a {
    color: var(--ink-muted);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    transition: color 0.3s ease, background 0.3s ease;
  }

  footer a:hover {
    color: var(--ink);
    background: var(--chip-fill);
  }

  @media (max-width: 900px) {
    footer {
      width: calc(100% - 24px);
      margin-bottom: 12px;
      padding: 0.6rem 0.6rem 0.6rem 1.25rem;
    }
    footer a { padding: 0.4rem 0.55rem; }
  }

  /* ── ANIMATIONS ── */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  @keyframes scrollLine {
    0% { left: -100%; }
    50% { left: 0; }
    100% { left: 100%; }
  }
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  .hero-graphic { animation: fadeIn 1s 0.5s forwards, float 6s ease-in-out 1.5s infinite; }

  /* ── REVEAL ON SCROLL ── */
  .reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }
  .reveal.visible {
    opacity: 1;
    transform: none;
  }

  /* ── MOBILE ── */
  @media (max-width: 900px) {
    nav { padding: 1rem 2rem; }
    .hamburger { display: flex; }

    section { padding: 5rem 2rem; }
    #hero { grid-template-columns: 1fr; padding-top: 80px; }
    .hero-left { padding: 3rem 2rem; }
    .hero-right { display: none; }
    .scroll-hint { left: 2rem; }
    .about-grid { grid-template-columns: 1fr; gap: 2rem; }
    .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
    .projects-grid {
    grid-template-columns: 1fr;
  }
    .resume-box { padding: 2rem; }
    .section-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .section-line { display: none; }
  }

  /* ───────────────────────────────────────────
     PAGE LOADER
     ─────────────────────────────────────────── */
  #loader {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--cream);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.6s ease;
  }
  /* subtle film grain to match the site */
  #loader::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    opacity: 0.4;
    pointer-events: none;
  }

  .loader-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 2rem;
  }

  .loader-mark {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3.2rem, 8.8vw, 5.6rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ink);
    line-height: 1;
    opacity: 0;
    transform: translateY(18px);
    animation: loaderMarkIn 1s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
  }
  .loader-mark span {
    color: var(--accent-fill);
    font-style: italic;
    opacity: 0;
    animation: loaderDotIn 0.5s ease 0.95s forwards;
  }

  .loader-tagline {
    font-family: 'DM Mono', monospace;
    font-size: clamp(0.48rem, 1.28vw, 0.576rem);
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-top: 1.4rem;
    opacity: 0;
    animation: loaderFadeIn 0.9s ease 0.55s forwards;
  }

  .loader-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2.6rem;
    opacity: 0;
    animation: loaderFadeIn 0.9s ease 0.8s forwards;
  }
  .loader-bar {
    width: clamp(140px, 26vw, 240px);
    height: 1px;
    background: var(--border);
    position: relative;
    overflow: hidden;
  }
  .loader-bar-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    background: var(--accent-warm);
  }
  .loader-count {
    font-family: 'DM Mono', monospace;
    font-size: 0.56rem;
    letter-spacing: 0.12em;
    color: var(--accent-warm);
    min-width: 2.4ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  /* dark curtain waits just below the viewport, trailing the loader */
  .loader-curtain {
    position: fixed;
    inset: 0;
    background: var(--ink);
    z-index: 9000;            /* above the page content, below the loader */
    transform: translateY(100%);
    pointer-events: none;
  }

  /* EXIT: loader + curtain slide up together as one stack, unveiling the live site from the bottom up */
  #loader.loader-exit { animation: loaderLift 1.1s cubic-bezier(0.76, 0, 0.24, 1) forwards; }
  #loader.loader-exit ~ .loader-curtain { animation: curtainLift 1.1s cubic-bezier(0.76, 0, 0.24, 1) forwards; }

  @keyframes loaderMarkIn {
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes loaderDotIn {
    0% { opacity: 0; transform: translateY(-6px); }
    60% { opacity: 1; transform: translateY(2px); }
    100% { opacity: 1; transform: translateY(0); }
  }
  @keyframes loaderFadeIn {
    to { opacity: 1; }
  }
  @keyframes loaderLift {
    to { transform: translateY(-200%); }
  }
  @keyframes curtainLift {
    to { transform: translateY(-100%); }
  }

  @media (prefers-reduced-motion: reduce) {
    .loader-mark, .loader-mark span, .loader-tagline, .loader-progress { animation: none !important; opacity: 1 !important; transform: none !important; }
    #loader.loader-exit,
    #loader.loader-exit ~ .loader-curtain { animation: none !important; }
  }

  /* ───────────────────────────────────────────
     HERO NAME — KINETIC TYPOGRAPHY (replaces .hero-graphic)
     ─────────────────────────────────────────── */
  .name-motion {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 0.5rem 0 0.5rem 2.2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    user-select: none;
  }
  /* hairline rail down the left edge */
  .name-motion::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 1px;
    background: var(--border);
  }
  .name-motion::after {
    content: '';
    position: absolute;
    left: -3px;
    top: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-warm);
    animation: nmRail 6.4s ease-in-out infinite;
  }

  .nm-index {
    font-family: 'DM Mono', monospace;
    font-size: 0.48rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: 1.1rem;
    opacity: 0;
    animation: nmFadeLoop 6.4s ease-in-out infinite;
  }

  /* the whole line is the reveal mask; padding gives room for
     descenders ('y') and italic overhang so glyphs aren't clipped */
  .nm-line {
    display: flex;
    overflow: hidden;
    line-height: 1.08;
    padding: 0.14em 0.26em 0.62em;
    margin-left: -0.26em;
  }
  .nm-l2 { margin-left: calc(1.6rem - 0.26em); }

  /* letters slide up; the line-level mask hides them until revealed */
  .nm-clip {
    display: inline-block;
    vertical-align: bottom;
  }
  .nm-char {
    display: inline-block;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.72rem, 4.8vw, 4.32rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--ink);
    transform: translateY(200%);
    animation: nmCharLoop 6.4s cubic-bezier(0.22, 1, 0.36, 1) infinite;
    animation-delay: var(--d);
    will-change: transform;
  }
  /* second line italic + accent, echoing the static hero name treatment */
  .nm-l2 .nm-char {
    font-style: italic;
    color: var(--accent-warm);
  }

  .nm-underline {
    height: 2px;
    width: 0;
    background: var(--ink);
    margin: 1.1rem 0 0 1.6rem;
    transform-origin: left center;
    animation: nmUnderline 6.4s ease-in-out infinite;
  }

  .nm-tag {
    font-family: 'DM Mono', monospace;
    font-size: 0.528rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0.9rem 0 0 1.6rem;
    opacity: 0;
    animation: nmTag 6.4s ease-in-out infinite;
  }

  /* letters mask up, hold, then mask away — seamless loop */
  @keyframes nmCharLoop {
    0%   { transform: translateY(200%); }
    9%   { transform: translateY(0); }
    72%  { transform: translateY(0); }
    82%  { transform: translateY(-160%); }
    100% { transform: translateY(-160%); }
  }
  @keyframes nmUnderline {
    0%, 22% { width: 0; opacity: 1; }
    40%     { width: calc(100% - 1.6rem); opacity: 1; }
    74%     { width: calc(100% - 1.6rem); opacity: 1; }
    84%     { width: calc(100% - 1.6rem); opacity: 0; }
    100%    { width: 0; opacity: 0; }
  }
  @keyframes nmFadeLoop {
    0%, 6%  { opacity: 0; transform: translateY(6px); }
    16%     { opacity: 1; transform: translateY(0); }
    74%     { opacity: 1; transform: translateY(0); }
    84%     { opacity: 0; transform: translateY(-4px); }
    100%    { opacity: 0; }
  }
  @keyframes nmTag {
    0%, 32% { opacity: 0; letter-spacing: 0.4em; }
    46%     { opacity: 1; letter-spacing: 0.2em; }
    74%     { opacity: 1; }
    84%     { opacity: 0; }
    100%    { opacity: 0; }
  }
  @keyframes nmRail {
    0%   { transform: translateY(0); }
    40%  { transform: translateY(calc(0.5px)); }
    72%  { transform: translateY(140px); opacity: 1; }
    84%  { transform: translateY(160px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    .nm-char { animation: none; transform: translateY(0); }
    .nm-index, .nm-tag { animation: none; opacity: 1; }
    .nm-underline { animation: none; width: calc(100% - 1.6rem); }
    .name-motion::after { animation: none; }
  }

  /* ───────────────────────────────────────────
     HERO MONOGRAM — minimal mark
     ─────────────────────────────────────────── */
  #hero { grid-template-columns: 1fr 1fr; }
  .hero-right {
    padding: 3rem 6rem;
    align-items: center;
    justify-content: center;
  }

  .hero-monogram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.6rem;
  }
  .mono-mark {
    display: inline-flex;
    align-items: flex-end;
    font-family: 'Playfair Display', serif;
    font-size: clamp(5.6rem, 10.4vw, 8.8rem);
    font-weight: 700;
    line-height: 0.9;
    letter-spacing: -0.05em;
    color: var(--ink);
  }
  /* mask each letter, then slide it up into view */
  .ml-clip {
    display: inline-block;
    overflow: hidden;
    padding: 0.12em 0.04em 0;
    margin: -0.12em 0 0;
  }
  .ml-char {
    display: inline-block;
    transform: translateY(116%);
    animation: monoUp 1s cubic-bezier(0.22, 1, 0.36, 1) var(--d) forwards;
    will-change: transform;
  }
  .mono-dot {
    color: var(--accent-fill);
    font-style: italic;
    display: inline-block;
    transform-origin: 50% 80%;
    opacity: 0;
    transform: scale(0);
    animation: monoDotIn 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) 1.0s both,
               monoDotPulse 3.4s ease-in-out 1.8s infinite;
  }
  .mono-rule {
    width: 72px;
    height: 1px;
    background: var(--border);
    transform: scaleX(0);
    transform-origin: center;
    animation: monoRule 0.8s ease 1.15s forwards;
  }
  .mono-caption {
    font-family: 'DM Mono', monospace;
    font-size: 0.544rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-align: center;
    opacity: 0;
    animation: monoCaption 0.9s ease 1.35s forwards;
  }

  @keyframes monoUp {
    to { transform: translateY(0); }
  }
  @keyframes monoDotIn {
    0%   { opacity: 0; transform: scale(0); }
    70%  { opacity: 1; transform: scale(1.22); }
    100% { opacity: 1; transform: scale(1); }
  }
  @keyframes monoDotPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(0.74); opacity: 0.65; }
  }
  @keyframes monoRule {
    to { transform: scaleX(1); }
  }
  @keyframes monoCaption {
    from { opacity: 0; letter-spacing: 0.36em; }
    to   { opacity: 1; letter-spacing: 0.22em; }
  }

  /* hold the entrance paused until the loader lifts, so it's actually seen */
  .ml-char, .mono-dot, .mono-rule, .mono-caption { animation-play-state: paused; }
  html.site-ready .ml-char,
  html.site-ready .mono-dot,
  html.site-ready .mono-rule,
  html.site-ready .mono-caption { animation-play-state: running; }

  @media (prefers-reduced-motion: reduce) {
    .ml-char { animation: none; transform: translateY(0); }
    .mono-dot { animation: none; opacity: 1; transform: scale(1); }
    .mono-rule { animation: none; transform: scaleX(1); }
    .mono-caption { animation: none; opacity: 1; }
  }

  /* monogram is a desktop-only flourish — keep it hidden on tablet/mobile */
  @media (max-width: 900px) {
    #hero { grid-template-columns: 1fr; }
    .hero-right { display: none; }
  }

  /* ───────────────────────────────────────────
     SURFACES — GLASS
     Cards are frosted glass over the drifting contour
     lines: a translucent flat fill, a backdrop blur light
     enough that the lines still read through it as soft
     ghosts, a thin edge, a top highlight and a drop
     shadow. No gradients anywhere. The nav and footer
     capsules are denser glass, since content scrolls
     under them.
     ─────────────────────────────────────────── */

  :root {
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.45, 0.64, 1);

    --glass-blur: 4px;
    --glass-sat: 180%;
    --glass-radius: 22px;

    --gf-1: rgba(255,255,255,0.38);
    --glass-fill: var(--gf-1);
    --glass-edge: rgba(40,44,32,0.10);
    --glass-inner: inset 0 1px 0 rgba(255,255,255,0.75);
    --glass-drop: 0 1px 2px rgba(40,44,32,0.04), 0 16px 38px -20px rgba(40,44,32,0.26);
    --glass-drop-hover: 0 2px 4px rgba(40,44,32,0.05), 0 28px 54px -22px rgba(40,44,32,0.34);

    /* Nav capsule: lighter over the hero, denser once content passes under it */
    --glass-nav:    rgba(244,244,237,0.60);
    --glass-nav-on: rgba(244,244,237,0.82);
    /* The mobile menu is small type over live content, so it stays denser */
    --glass-menu:   rgba(244,244,237,0.94);

    --chip-fill: rgba(40,44,32,0.04);
    --chip-edge: rgba(40,44,32,0.10);
  }

  [data-theme="dark"] {
    --gf-1: rgba(244,244,237,0.07);
    --glass-edge: rgba(244,244,237,0.13);
    --glass-inner: inset 0 1px 0 rgba(244,244,237,0.10);
    --glass-drop: 0 1px 2px rgba(0,0,0,0.25), 0 16px 40px -20px rgba(0,0,0,0.70);
    --glass-drop-hover: 0 2px 4px rgba(0,0,0,0.30), 0 28px 56px -22px rgba(0,0,0,0.85);

    --glass-nav:    rgba(40,44,32,0.60);
    --glass-nav-on: rgba(40,44,32,0.82);
    --glass-menu:   rgba(40,44,32,0.94);

    --chip-fill: rgba(244,244,237,0.06);
    --chip-edge: rgba(244,244,237,0.12);
  }

  /* All sections are transparent: alternating tints left a hard seam where
     one section met the next. The flat page colour is the only background. */
  #about, #experience, #skills, #projects, #achievements, #resume, #contact { background: transparent; }

  /* ── NAV — floating capsule ──
     The glass lives on ::before, not on the nav itself. A backdrop-filter on
     the nav would make the mobile menu (its child) blur only the nav instead
     of the page behind it. */
  nav {
    top: 12px;
    left: 16px;
    right: 16px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.55rem 0.8rem 0.55rem 1.5rem;
    border: 0;
    border-radius: 999px;
    background: none;
  }
  nav::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: var(--glass-nav);
    -webkit-backdrop-filter: blur(28px) saturate(var(--glass-sat));
    backdrop-filter: blur(28px) saturate(var(--glass-sat));
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-inner), var(--glass-drop);
    transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
  }
  nav.is-scrolled::before {
    background: var(--glass-nav-on);
    box-shadow: var(--glass-inner), var(--glass-drop-hover);
  }

  .nav-links { gap: 0.3rem; position: relative; z-index: 0; }
  .nav-links a {
    display: block;
    padding: 0.5rem 0.85rem;
    border-radius: 999px;
    transition: color 0.3s ease, background 0.3s ease;
  }
  .nav-links a:hover:not(.is-active) { background: var(--chip-fill); }

  /* Sliding glass block behind the active link. JS only writes its position
     and size (--ind-*); the glide between links is this transition. */
  .nav-links::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    width: var(--ind-w, 0px);
    height: var(--ind-h, 0px);
    transform: translate(var(--ind-x, 0px), var(--ind-y, 0px));
    opacity: var(--ind-o, 0);
    border-radius: 999px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-edge);
    box-shadow: var(--glass-inner), 0 6px 16px -8px rgba(40,44,32,0.35);
    pointer-events: none;
    transition: transform 0.6s var(--ease-spring), width 0.45s var(--ease-out), height 0.45s var(--ease-out), opacity 0.3s ease;
  }

  .theme-toggle {
    background: var(--chip-fill);
    border-color: var(--chip-edge);
    transition: border-color 0.3s ease, background 0.3s ease, transform 0.5s var(--ease-spring);
  }
  .theme-toggle:active { transform: scale(0.9); }

  .hamburger { padding: 8px 6px; }
  .hamburger span { transition: transform 0.45s var(--ease-out), opacity 0.25s ease; transform-origin: center; }
  .hamburger.is-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0.2); }
  .hamburger.is-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  /* ── GLASS SURFACES ── */
  .project-card,
  .skills-grid,
  .achievement-card,
  .resume-box,
  .about-sidebar,
  .timeline-item,
  .contact-link {
    position: relative;
    background: var(--glass-fill);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    border: 1px solid var(--glass-edge);
    border-radius: var(--glass-radius);
    box-shadow: var(--glass-inner), var(--glass-drop);
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), border-color 0.4s ease;
  }

  .about-sidebar { padding: 1.75rem; align-self: start; }
  .about-sidebar .edu-item:last-child { margin-bottom: 0; }

  /* Timeline entries become cards; the dot stays on the rail outside them */
  .timeline { --tl-gap: 2rem; padding-left: var(--tl-gap); }
  .timeline-item { padding: 1.6rem 1.75rem; margin-bottom: 1.5rem; }
  .timeline-item:last-child { margin-bottom: 0; }
  .timeline-item::before { left: calc(-1 * var(--tl-gap) - 0.35rem); top: 1.9rem; }

  .contact-link {
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 18px;
    transition: transform 0.5s var(--ease-out), box-shadow 0.5s var(--ease-out), color 0.3s ease;
  }
  .contact-link-icon {
    border-radius: 12px;
    border-color: var(--chip-edge);
    background: var(--chip-fill);
  }
  .contact-link-value { overflow-wrap: anywhere; }

  :is(.project-card, .skills-grid, .achievement-card, .resume-box, .about-sidebar) { overflow: hidden; }

  @media (hover: hover) and (pointer: fine) {
    .project-card:hover,
    .achievement-card:hover,
    .timeline-item:hover {
      transform: translateY(-5px);
      box-shadow: var(--glass-inner), var(--glass-drop-hover);
      border-color: var(--glass-edge);
    }
    .contact-link:hover { transform: translateX(5px); box-shadow: var(--glass-inner), var(--glass-drop-hover); }
  }
  /* Touch: a quick press-in instead of a hover lift that would stick */
  @media (hover: none) {
    .project-card:hover, .achievement-card:hover { transform: none; box-shadow: var(--glass-inner), var(--glass-drop); border-color: var(--glass-edge); }
    .project-card:active, .achievement-card:active, .contact-link:active { transform: scale(0.985); }
  }

  /* ── CHIPS, TAGS, BUTTONS ── */
  .spec-tag,
  .skill-pill,
  .stack-tag,
  .timeline-badge,
  .project-link {
    border-radius: 999px;
    background: var(--chip-fill);
    border-color: var(--chip-edge);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.4s var(--ease-spring);
  }
  .skill-pill:hover, .spec-tag:hover { transform: translateY(-2px); }
  .project-link:active, .skill-pill:active { transform: scale(0.95); }

  .project-results { border-radius: 14px; }

  .achievement-icon {
    border-radius: 14px;
    background: var(--chip-fill);
    border-color: var(--chip-edge);
    transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease, transform 0.5s var(--ease-spring);
  }
  .achievement-icon::after { display: none; }
  .achievement-card:hover .achievement-icon { background: var(--chip-fill); transform: scale(1.08) rotate(-4deg); }

  .btn-primary,
  .btn-outline {
    border-radius: 999px;
    position: relative;
    overflow: hidden;
    transition: transform 0.45s var(--ease-spring), box-shadow 0.45s var(--ease-out), border-color 0.3s ease, color 0.3s ease, background 0.3s ease;
  }
  .btn-outline {
    background: var(--chip-fill);
    border-color: var(--glass-edge);
    box-shadow: var(--glass-drop);
  }
  .btn-primary { box-shadow: var(--glass-drop); }
  .btn-primary:active, .btn-outline:active { transform: scale(0.96); }

  /* ── MOTION ── */

  /* Hero entrance waits for the loader to lift, so it is actually seen.
     Keyed off .loading (set and failsafe-cleared by the inline head script)
     so the text can never be left invisible if index.js fails. */
  .hero-tag { opacity: 0; animation: fadeUp 0.9s 0.05s forwards; }
  .hero-tag, .hero-name, .hero-role, .hero-summary, .hero-cta { animation-timing-function: var(--ease-out); }
  html.loading:not(.site-ready) :is(.hero-tag, .hero-name, .hero-role, .hero-summary, .hero-cta, .scroll-hint) {
    animation-play-state: paused;
  }

  /* Reveal on scroll. Declared after the glass surfaces so this transition
     wins while an element is entering; JS drops .reveal once it has landed,
     handing the element back to its own (hover) transition. */
  .reveal {
    opacity: 0;
    transform: translateY(30px) scale(0.985);
    transition: opacity 0.9s ease-out, transform 1s var(--ease-out);
  }
  .reveal.visible { opacity: 1; transform: none; }

  /* Section rule draws itself in after its heading arrives */
  .section-header.reveal .section-line {
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1.1s var(--ease-out) 0.25s;
  }
  .section-header.visible .section-line { transform: scaleX(1); }

  /* Theme switch: every palette colour is a registered custom property, so
     the palette itself fades on <html> and the whole page — text, glass,
     nav, accent — moves between themes as one, in step. No snapshot of the
     page is involved, so backdrop blur stays live throughout.
     Per-element colour transitions are frozen during the fade (they would
     otherwise trail a beat behind the palette). */
  @property --cream { syntax: '<color>'; inherits: true; initial-value: #F4F4ED; }
  @property --cream-dark { syntax: '<color>'; inherits: true; initial-value: #EBEEE0; }
  @property --cream-deeper { syntax: '<color>'; inherits: true; initial-value: #DDE1D2; }
  @property --ink { syntax: '<color>'; inherits: true; initial-value: #282C20; }
  @property --ink-light { syntax: '<color>'; inherits: true; initial-value: #3B3C38; }
  @property --ink-muted { syntax: '<color>'; inherits: true; initial-value: #535450; }
  @property --accent { syntax: '<color>'; inherits: true; initial-value: #B4B8A5; }
  @property --accent-warm { syntax: '<color>'; inherits: true; initial-value: #282C20; }
  @property --accent-green { syntax: '<color>'; inherits: true; initial-value: #282C20; }
  @property --accent-rust { syntax: '<color>'; inherits: true; initial-value: #535450; }
  @property --accent-2 { syntax: '<color>'; inherits: true; initial-value: #535450; }
  @property --border { syntax: '<color>'; inherits: true; initial-value: rgba(40,44,32,0.12); }
  @property --shadow { syntax: '<color>'; inherits: true; initial-value: rgba(40,44,32,0.08); }
  @property --gf-1 { syntax: '<color>'; inherits: true; initial-value: rgba(255,255,255,0.38); }
  @property --glass-edge { syntax: '<color>'; inherits: true; initial-value: rgba(40,44,32,0.10); }
  @property --glass-nav { syntax: '<color>'; inherits: true; initial-value: rgba(244,244,237,0.60); }
  @property --glass-nav-on { syntax: '<color>'; inherits: true; initial-value: rgba(244,244,237,0.82); }
  @property --glass-menu { syntax: '<color>'; inherits: true; initial-value: rgba(244,244,237,0.94); }
  @property --chip-fill { syntax: '<color>'; inherits: true; initial-value: rgba(40,44,32,0.04); }
  @property --chip-edge { syntax: '<color>'; inherits: true; initial-value: rgba(40,44,32,0.10); }

  html {
    --theme-fade: 0.6s ease;
    transition:
      --cream var(--theme-fade),
      --cream-dark var(--theme-fade),
      --cream-deeper var(--theme-fade),
      --ink var(--theme-fade),
      --ink-light var(--theme-fade),
      --ink-muted var(--theme-fade),
      --border var(--theme-fade),
      --shadow var(--theme-fade),
      --accent var(--theme-fade),
      --accent-warm var(--theme-fade),
      --accent-green var(--theme-fade),
      --accent-rust var(--theme-fade),
      --accent-2 var(--theme-fade),
      --gf-1 var(--theme-fade),
      --glass-edge var(--theme-fade),
      --glass-nav var(--theme-fade),
      --glass-nav-on var(--theme-fade),
      --glass-menu var(--theme-fade),
      --chip-fill var(--theme-fade),
      --chip-edge var(--theme-fade);
  }
  html.theme-switching *,
  html.theme-switching *::before,
  html.theme-switching *::after { transition: none !important; }

  /* Circular wipe (View Transitions API), where the browser supports it.
     The palette fade above is switched off for its duration so the new theme
     arrives fully formed inside the circle; it remains the fallback where
     View Transitions are unavailable. */
  html.theme-wipe { transition: none; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

  /* The nav is lifted out of the page snapshot for the wipe. Inside a
     snapshot its backdrop blur is not reliable, which showed as the bar's
     transparency flickering mid-switch. Captured on its own, the blur is
     supplied by the transition layer instead: the group box sits exactly
     where the nav is and blurs the wiping page beneath it, and the nav's own
     tint, edge and contents are drawn on top — the same stack as normal. */
  html.theme-wipe nav { view-transition-name: site-nav; }
  ::view-transition-group(site-nav) {
    animation: none;
    border-radius: 999px;
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
  }
  ::view-transition-image-pair(site-nav) { isolation: auto; }
  ::view-transition-old(site-nav) { display: none; }
  ::view-transition-new(site-nav) { animation: none; mix-blend-mode: normal; }

  /* ── CURSOR RIFT ──
     A second copy of the page, in the opposite theme, fixed over the
     viewport. index.js clips it to the shape of the tear behind the cursor
     and keeps it scrolled in step with the page; while the pointer rests it
     is hidden outright. It sits over the page and nav, and under the loader
     curtain, the scrollbar and the grain. */
  .rift {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 8000;
    pointer-events: none;
    visibility: hidden;
    clip-path: inset(50%);
    /* Not a fade: a hair under 1 makes the browser flatten the whole copy
       into one image before clipping it. Without that, each glass card
       inside the copy blurs the clip's edge along with its backdrop, and the
       rift comes out crisp over bare page but smeared over cards and the nav. */
    opacity: 0.999;
  }
  /* The tear reads as tinted glass, not a hole. Two more layers, clipped by
     the same script, sit either side of the copy:

     .rift-glass, underneath — the frosting. It blurs and enriches the real
     page showing through the tear, so what lies behind the glass arrives as
     soft light rather than legible text, and lays a faint flat haze over it,
     the scatter of frosted glass. */
  .rift-glass {
    position: fixed;
    inset: 0;
    z-index: 7999;
    pointer-events: none;
    visibility: hidden;
    clip-path: inset(50%);
    background: rgba(255,255,255,0.09);
    -webkit-backdrop-filter: blur(12px) saturate(190%) brightness(1.08);
    backdrop-filter: blur(12px) saturate(190%) brightness(1.08);
  }
  /* .rift-edge, on top — the lit rim: a hollow accent band around the tear.
     Its glow spreads outward over the page and inward across the glass,
     which is where the edge-lit look comes from. The glow is on a wrapper
     because a filter on the clipped element itself would be clipped away
     with it. */
  .rift-glow {
    position: fixed;
    inset: 0;
    z-index: 8001;
    pointer-events: none;
    visibility: hidden;
    filter: drop-shadow(0 0 4px var(--accent-fill)) drop-shadow(0 0 24px var(--accent-fill));
  }
  .rift-edge {
    position: absolute;
    inset: 0;
    background: var(--accent-fill);
    clip-path: inset(50%);
  }

  /* Inside that copy: script positions it, so scrolling must not ease; the
     loader never shows; and the grain is left to the real page, whose own
     grain layer already lies over the rift. */
  html.is-mirror { scroll-behavior: auto; }
  html.is-mirror #loader,
  html.is-mirror .loader-curtain,
  html.is-mirror body::before { display: none; }

  /* The copy's page colour is only a tint, so the frosted page shows through
     behind its text and cards. --rift-tint is how solid the glass is: lower
     is clearer. Where the page behind can't be frosted (or the tint can't be
     mixed) the copy stays opaque, as two sharp copies of the same text laid
     over each other would only muddy it. */
  html.is-mirror { --rift-tint: 48%; }
  @supports ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    html.is-mirror body {
      background: color-mix(in srgb, var(--cream) var(--rift-tint), transparent);
    }
  }

  /* ── MOBILE ── */
  @media (max-width: 900px) {
    :root { --glass-radius: 20px; }

    nav { top: 10px; left: 12px; right: 12px; padding: 0.5rem 0.6rem 0.5rem 1.25rem; }

    /* Menu: a glass sheet that drops out of the capsule */
    .nav-links {
      display: flex;
      flex-direction: column;
      align-items: stretch;   /* full-width rows = full-width tap targets */
      text-align: center;
      gap: 0;
      position: absolute;
      top: calc(100% + 10px);
      left: 0;
      right: 0;
      padding: 0.6rem;
      border-radius: 26px;
      background: var(--glass-menu);
      -webkit-backdrop-filter: blur(30px) saturate(var(--glass-sat));
      backdrop-filter: blur(30px) saturate(var(--glass-sat));
      border: 1px solid var(--glass-edge);
      box-shadow: var(--glass-inner), var(--glass-drop-hover);
      opacity: 0;
      visibility: hidden;
      transform: translateY(-12px) scale(0.96);
      transform-origin: top center;
      transition: opacity 0.3s ease, transform 0.45s var(--ease-out), visibility 0s linear 0.45s;
    }
    .nav-links.open {
      opacity: 1;
      visibility: visible;
      transform: none;
      transition: opacity 0.3s ease, transform 0.5s var(--ease-spring), visibility 0s;
    }
    .nav-links a { color: var(--ink); padding: 0.9rem 1rem; font-size: 0.656rem; }
    .nav-links li {
      opacity: 0;
      transform: translateY(-8px);
      transition: opacity 0.25s ease, transform 0.25s ease;
    }
    .nav-links.open li {
      opacity: 1;
      transform: none;
      transition: opacity 0.45s ease, transform 0.55s var(--ease-out);
    }
    .nav-links.open li:nth-child(1) { transition-delay: 0.05s; }
    .nav-links.open li:nth-child(2) { transition-delay: 0.09s; }
    .nav-links.open li:nth-child(3) { transition-delay: 0.13s; }
    .nav-links.open li:nth-child(4) { transition-delay: 0.17s; }
    .nav-links.open li:nth-child(5) { transition-delay: 0.21s; }
    .nav-links.open li:nth-child(6) { transition-delay: 0.25s; }

    /* Narrower gutters: justified text needs the measure */
    section { padding: 4.5rem 1.25rem; }
    .hero-left { padding: 3rem 1.25rem; }
    .scroll-hint { left: 1.25rem; }
    .project-card, .achievement-card, .about-sidebar { padding: 1.4rem; }

    /* Skills: label stacks above its pills, everything a notch smaller, so
       all five categories fit one phone screen. */
    #skills .section-header { margin-bottom: 1.25rem; }
    .skills-grid { padding: 0.25rem 1.1rem; }
    .skill-category { grid-template-columns: 1fr; gap: 0.5rem; padding: 0.7rem 0; }
    .skill-cat-title { font-size: 0.512rem; }
    .skill-list { gap: 0.35rem; }
    .skill-pill { font-size: 0.528rem; padding: 0.24rem 0.55rem; }
    .resume-box { padding: 1.6rem; }
    .timeline { --tl-gap: 1.35rem; }
    .timeline-item { padding: 1.3rem 1.25rem; }

    /* Justified body copy. Hyphenation keeps the word gaps from opening up
       into rivers on a narrow column. */
    .hero-summary,
    .about-text p,
    .timeline-content p,
    .achievement-point,
    .project-desc,
    .project-problem,
    .project-results,
    .achievement-desc,
    .resume-text p,
    .contact-info > p {
      text-align: justify;
      text-justify: inter-word;
      -webkit-hyphens: auto;
      hyphens: auto;
      hyphenate-limit-chars: 7 3 3;
      overflow-wrap: break-word;
    }
    /* The typed overlay splits words across spans mid-animation; hyphenating
       there would make line breaks shift as characters arrive. */
    .hero-summary { -webkit-hyphens: manual; hyphens: manual; }
  }

  /* No backdrop-filter: make the nav and footer near-opaque rather than
     leave their text floating over the content scrolling beneath, and give
     the cards a solid fill so text never sits on sharp contour lines. */
  @supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
    :root {
      --gf-1: #FBFBF7;
      --glass-nav: rgba(244,244,237,0.96);
      --glass-nav-on: rgba(244,244,237,0.98);
      --glass-menu: rgba(244,244,237,0.99);
    }
    [data-theme="dark"] {
      --gf-1: #313628;
      --glass-nav: rgba(40,44,32,0.96);
      --glass-nav-on: rgba(40,44,32,0.98);
      --glass-menu: rgba(40,44,32,0.99);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html { transition: none; }
    .reveal { transform: none; transition: opacity 0.3s ease; }
    .section-header.reveal .section-line { transform: none; transition: none; }
    .nav-links, .nav-links li, .nav-links::before, .hamburger span { transition-duration: 0.01s !important; transition-delay: 0s !important; }
  }

/* ── KEYBOARD FOCUS ── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-warm);
  outline-offset: 3px;
  border-radius: 2px;
}
