  :root {
    --bg: #0a0e14;
    --bg-elevated: #10161f;
    --bg-elevated-2: #141c27;
    --ink: #eef4fb;
    --ink-dim: #c3cee0;
    --muted: #7c8ba3;
    --muted-2: #56637a;
    --teal: #00d9c0;
    --blue: #3aa8e0;
    --line: rgba(238, 244, 251, 0.09);
    --line-strong: rgba(238, 244, 251, 0.16);

    --font-display: "Schibsted Grotesk", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  }

  * { box-sizing: border-box; }

  html { color-scheme: dark; }

  body {
    margin: 0;
    color: var(--ink-dim);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
    /* Ambient glow that stays fixed to the viewport as the page scrolls, so a wide
       desktop window reads as atmosphere at the edges rather than dead space - the
       same technique the hero already used, extended to the whole page. */
    background-color: var(--bg);
    background-image:
      radial-gradient(58% 46% at 8% 8%, rgba(0, 217, 192, 0.065) 0%, transparent 62%),
      radial-gradient(52% 42% at 94% 46%, rgba(58, 168, 224, 0.055) 0%, transparent 62%),
      radial-gradient(50% 42% at 12% 92%, rgba(0, 217, 192, 0.045) 0%, transparent 62%);
    background-attachment: fixed, fixed, fixed;
    background-repeat: no-repeat, no-repeat, no-repeat;
  }

  /* Very faint grain over the whole page - the difference between a flat fill and a
     surface with some depth to it, kept subtle enough to never read as texture. */
  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  }

  /* Scroll-reveal: one consistent entrance per section, not per element - a section
     settles into place once as it enters view, rather than a wall of items animating
     independently. */
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.7s ease, transform 0.7s ease;
  }

  .reveal.is-visible { opacity: 1; transform: translateY(0); }

  @media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
  }

  /* Sits above the fixed grain overlay (z-index: 1) without needing z-index on every element. */
  header.hero, main, footer { position: relative; z-index: 2; }

  ::selection { background: var(--teal); color: #04120f; }

  a { color: var(--teal); text-decoration: none; }
  a:hover { color: var(--blue); }
  a:focus-visible, button:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

  h1, h2, h3 { font-family: var(--font-display); color: var(--ink); text-wrap: balance; margin: 0; }

  .wrap {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 48px;
  }

  .eyebrow {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--teal);
    display: inline-flex;
    align-items: center;
    gap: 9px;
  }

  .eyebrow .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 8px 1px rgba(0, 217, 192, 0.75);
    animation: blink 2.4s ease-in-out infinite;
    flex: 0 0 auto;
  }

  @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

  /* Each numbered section is its own windowed module: a title bar (pulse-blip chip,
     label, hairline fill, "N / 4" readout) attached to a bordered card body below it -
     like an oscilloscope or plugin panel, not just a line of text floating on the page.
     --accent is set per section (a distinct "channel" color per section, set inline). */
  .section-card {
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-elevated);
    border-left: 2px solid var(--accent, var(--teal));
  }

  .section-card__bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 22px;
    border-bottom: 1px solid var(--line-strong);
  }

  .section-card__bar .chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 4px;
    padding: 6px 10px;
    background: color-mix(in srgb, var(--accent, var(--teal)) 14%, transparent);
    flex: 0 0 auto;
  }

  .section-card__bar .chip span {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent, var(--teal));
    letter-spacing: 0.03em;
  }

  .section-card__bar .chip svg path { stroke: var(--accent, var(--teal)); }

  .section-card__bar .label {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
  }

  .section-card__bar .fill-line {
    flex: 1 1 auto;
    height: 1px;
    background: var(--line-strong);
  }

  .section-card__bar .meta {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--muted-2);
    letter-spacing: 0.06em;
    flex: 0 0 auto;
  }

  .section-card__body { padding: 34px 32px 38px; }

  /* language toggle */
  .lang-toggle {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 20;
    display: flex;
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    overflow: hidden;
  }

  .lang-toggle button {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 7px 11px;
    background: var(--bg-elevated);
    color: var(--muted);
    border: none;
    cursor: pointer;
  }

  .lang-toggle button.active { background: var(--bg-elevated-2); color: var(--teal); }
  .lang-toggle button:hover { color: var(--ink-dim); }
  .lang-toggle button.active:hover { color: var(--teal); }

  /* ============ HERO ============ */
  .hero {
    position: relative;
    padding-top: 56px;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background:
      radial-gradient(120% 70% at 15% 0%, rgba(0, 217, 192, 0.10) 0%, transparent 55%),
      radial-gradient(90% 60% at 100% 10%, rgba(58, 168, 224, 0.09) 0%, transparent 60%);
  }

  .hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 40px;
  }

  .hero-top .readout {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--muted);
    letter-spacing: 0.04em;
  }

  .hero-top .readout strong {
    color: var(--ink-dim);
    font-variant-numeric: tabular-nums;
  }

  .hero-inner {
    display: flex;
    align-items: center;
    gap: 48px;
  }

  .hero-copy { flex: 1 1 auto; min-width: 0; }

  .hero-photo { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; }

  .hero-photo-ring {
    width: 348px;
    height: 348px;
    border-radius: 50%;
    padding: 5px;
    background: linear-gradient(135deg, var(--teal), var(--blue));
    box-shadow: 0 32px 90px rgba(0, 217, 192, 0.22), 0 12px 34px rgba(0, 0, 0, 0.45);
  }

  .hero-photo-ring img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elevated);
  }

  h1.headline {
    font-size: clamp(34px, 5.4vw, 58px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.08;
    max-width: 21ch;
    margin-top: 18px;
  }

  h1.headline .accent { color: var(--teal); }

  .hero-sub {
    max-width: 62ch;
    font-size: 17px;
    color: var(--muted);
    margin: 20px 0 0;
  }

  .hero-sub strong { color: var(--ink-dim); font-weight: 500; }

  .hero-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 26px 0 0;
    font-family: var(--font-mono);
    font-size: 13.5px;
  }

  .hero-links a { color: var(--ink-dim); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; }
  .hero-links a:hover { color: var(--teal); border-color: var(--teal); }

  /* Pulse widget: a compact heartbeat-monitor strip, same width as the photo, sitting
     just under it - an accessory reading, not the hero centerpiece it used to be. */
  .pulse-card {
    width: 348px;
    margin-top: 22px;
  }

  canvas#trace {
    display: block;
    width: 100%;
    height: 84px;
  }

  .pulse-card-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 9px;
    font-family: var(--font-mono);
  }

  .pulse-label {
    font-size: 10.5px;
    color: var(--muted-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .pulse-bpm {
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
  }

  /* ============ SECTIONS ============ */
  section { padding: 40px 0; }

  .section-card__body h2 { font-size: 26px; font-weight: 700; margin-bottom: 22px; }

  .about-body {
    max-width: 76ch;
    font-size: 17px;
    color: var(--muted);
  }

  .about-body p + p { margin-top: 16px; }
  .about-body strong { color: var(--ink-dim); font-weight: 500; }

  /* credential strip (Track record section) */
  .credential-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    margin-top: 30px;
    width: fit-content;
  }

  .credential {
    background: var(--bg-elevated-2);
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 148px;
  }

  .credential .n {
    font-family: var(--font-mono);
    font-size: 17px;
    font-weight: 600;
    color: var(--teal);
    white-space: nowrap;
  }

  .credential .label {
    font-size: 11.5px;
    color: var(--muted);
    letter-spacing: 0.02em;
  }

  .background-link { margin: 18px 0 0; font-family: var(--font-mono); font-size: 13.5px; }

  /* project screenshot carousel */
  .shot-carousel { margin-top: 34px; }

  .shot-frame {
    position: relative;
    border: 1px solid var(--line-strong);
    background: var(--bg-elevated-2);
    overflow: hidden;
    aspect-ratio: 1568 / 765;
  }

  .shot-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

  .shot-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: rgba(10, 14, 20, 0.55);
    backdrop-filter: blur(6px);
    color: var(--ink-dim);
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }

  .shot-nav svg { display: block; }

  .shot-nav:hover {
    background: rgba(10, 14, 20, 0.85);
    border-color: var(--accent, var(--teal));
    color: var(--ink);
    transform: translateY(-50%) scale(1.06);
  }

  .shot-prev { left: 14px; }
  .shot-prev svg { margin-right: 1px; }
  .shot-next { right: 14px; }
  .shot-next svg { margin-left: 1px; }

  .shot-foot {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }

  .shot-caption { font-size: 13.5px; color: var(--muted); }

  .shot-dots { display: flex; gap: 8px; flex: 0 0 auto; }

  .shot-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--line-strong);
    cursor: pointer;
  }

  .shot-dot.is-active { background: var(--accent, var(--teal)); }

  /* readout stat tiles */
  .readout-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    margin-top: 34px;
  }

  .readout-tile {
    background: var(--bg-elevated-2);
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .readout-tile .n {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 600;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }

  .readout-tile .label {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.35;
  }

  /* architecture rows */
  .arch-list { margin-top: 40px; display: flex; flex-direction: column; }

  .arch-row {
    display: grid;
    grid-template-columns: 148px 1fr;
    gap: 22px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
  }

  .arch-row:last-child { border-bottom: 1px solid var(--line); }

  .arch-row .repo {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--blue);
    padding-top: 2px;
  }

  .arch-row .desc { font-size: 15px; color: var(--muted); }
  .arch-row .desc strong { color: var(--ink-dim); font-weight: 500; }

  /* pipeline chain */
  .pipeline {
    margin-top: 44px;
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
    gap: 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
  }

  .pipeline .step {
    background: var(--bg-elevated);
    border: 1px solid var(--line-strong);
    padding: 12px 16px;
    color: var(--ink-dim);
    display: flex;
    align-items: center;
    white-space: nowrap;
  }

  .pipeline .arrow {
    display: flex;
    align-items: center;
    padding: 0 10px;
    color: var(--muted-2);
  }

  /* skills panel */
  .panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 34px;
  }

  .panel {
    border: 1px solid var(--line);
    background: var(--bg-elevated-2);
    padding: 22px 20px;
  }

  .panel h3 {
    font-family: var(--font-mono);
    font-size: 12.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--line);
  }

  .panel ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

  .panel li {
    font-size: 14.5px;
    color: var(--ink-dim);
    display: flex;
    align-items: baseline;
    gap: 9px;
  }

  .panel li::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--teal);
    flex: 0 0 auto;
    transform: translateY(-2px);
  }

  /* privacy callout */
  .callout {
    margin-top: 40px;
    border-left: 2px solid var(--teal);
    padding: 4px 0 4px 22px;
  }

  .callout p { font-size: 15px; color: var(--muted); max-width: 70ch; margin: 0; }
  .callout p strong { color: var(--ink-dim); font-weight: 500; }

  /* footer */
  footer { padding: 70px 0 60px; }

  .footer-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 26px;
  }

  footer h2 { font-size: 26px; font-weight: 700; max-width: 14ch; }

  .contact-list { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }

  .contact-list a {
    font-family: var(--font-mono);
    font-size: 14.5px;
    color: var(--ink-dim);
  }

  .contact-list a:hover { color: var(--teal); }

  .footer-note {
    margin-top: 46px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted-2);
  }

  @media (max-width: 780px) {
    .hero-inner { flex-direction: column-reverse; align-items: flex-start; gap: 26px; }
    .hero-photo-ring { width: 192px; height: 192px; }
    .pulse-card { width: 192px; margin-top: 16px; }
  }

  @media (max-width: 720px) {
    .readout-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panel-grid { grid-template-columns: 1fr; }
    .arch-row { grid-template-columns: 1fr; gap: 6px; }
    .footer-grid { align-items: flex-start; }
    .contact-list { align-items: flex-start; }
    .credential-row { width: 100%; }
    .credential { flex: 1 1 45%; }
    .section-card__bar { padding: 12px 16px; gap: 10px; }
    .section-card__bar .meta { display: none; }
    .section-card__body { padding: 24px 20px 28px; }
  }

  /* interactive-feeling surfaces: a small, consistent lift + accent border on hover */
  .arch-row, .panel, .credential, .readout-tile {
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  }

  .panel:hover, .credential:hover, .readout-tile:hover {
    border-color: var(--line-strong);
    background: var(--bg-elevated-2);
  }

  .arch-row:hover { background: rgba(238, 244, 251, 0.02); }

  @media (hover: hover) {
    .panel:hover, .readout-tile:hover { transform: translateY(-2px); }
  }

  @media (prefers-reduced-motion: reduce) {
    .arch-row, .panel, .credential, .readout-tile { transition: none; }
    .panel:hover, .readout-tile:hover { transform: none; }
  }

  @media (prefers-reduced-motion: reduce) {
    .eyebrow .dot { animation: none; }
  }
