:root{
    --bg: #14141a;
    --text: #eee8dc;
    --text-dim: #8f8e96;
    --accent: #ffb454;
    --accent-deep: #c2660a;
    --accent-soft: rgba(255,180,84,0.14);
    --line: #2c2c34;
  }

  body.light{
    --bg: #faf7f2;
    --text: #1c1c22;
    --text-dim: #6b6a72;
    --accent: #c2660a;
    --accent-deep: #ffb454;
    --accent-soft: rgba(194,102,10,0.12);
    --line: #e4e0d5;
  }

  /* the UvA mark is white line-art made for the dark theme — invert it so it stays visible on a light background */
  body.light .uva-logo-img{
    filter: invert(1);
  }

  * { box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body{
    margin:0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
  }

  /* film grain, sits over everything, very low opacity */
  body::before{
    content: '';
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 5;
    opacity: 0.1;
    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>");
  }

  body.driving { overflow-x: hidden; }

  a { color: inherit; }

  ::selection { background: var(--accent-soft); color: var(--accent); }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  .wrap{
    max-width: 680px;
    margin: 0 auto;
    padding: 0 28px;
  }

  /* ---------- Nav ---------- */

  nav{
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: linear-gradient(var(--bg) 60%, transparent);
  }

  .nav-name{
    font-family: 'Fraunces', serif;
    font-size: 16px;
  }

  .nav-actions{
    display: flex;
    align-items: center;
    gap: 18px;
  }

  .nav-btn{
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: none;
    border: none;
    padding: 0;
    color: var(--text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 4px;
    transition: color 150ms ease, text-decoration-color 150ms ease, transform 140ms ease-out;
  }
  .nav-btn:hover{ color: var(--accent); text-decoration-color: var(--accent); }
  .nav-btn:active{ transform: scale(0.96); }
  .nav-btn.active{ color: var(--accent); text-decoration-color: var(--accent); }

  /* ---------- Hero ---------- */

  header.hero{
    padding: 56px 0 70px;
  }

  .kicker{
    font-size: 14px;
    color: var(--text-dim);
    margin: 0 0 32px;
  }

  h1{
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-style: italic;
    font-size: clamp(40px, 8vw, 58px);
    line-height: 1.05;
    margin: 0 0 14px;
  }

  .links-row{
    font-size: 15px;
    margin: 0;
    color: var(--text-dim);
  }
  .links-row a{
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 4px;
    transition: opacity 150ms ease, transform 140ms ease-out;
    display: inline-block;
  }
  .links-row a:hover{ opacity: 0.75; }
  .links-row a:active{ transform: scale(0.97); }
  .links-row .sep{ margin: 0 8px; }

  /* ---------- Sections ---------- */

  section{ padding: 0 0 56px; }

  /* About: no box, drop cap on the opening letter */
  .about p{
    font-size: 17px;
    line-height: 1.85;
    color: var(--text);
    max-width: 48ch;
    margin: 0 0 16px;
  }
  /* Entries: Education / Experience / Projects, all share this pattern */
  .entry{
    padding: 40px 0;
    border-top: 1px solid var(--line);
  }
  .entry:first-of-type{ border-top: 1px solid var(--line); }

  .entry-top{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }

  .entry h2{
    font-family: 'Fraunces', serif;
    font-weight: 500;
    font-size: 22px;
    margin: 0;
  }

  .entry .year{
    font-size: 13px;
    color: var(--text-dim);
    white-space: nowrap;
  }

  .entry .org{
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--accent);
    margin: 0 0 10px;
  }

  .org-logo{
    height: 22px;
    width: auto;
  }

  /* The UvA mark is a dense symbol, not a wordmark — needs more room to actually read */
  .uva-logo-img{
    height: 28px;
  }

  .entry p{
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-dim);
    max-width: 46ch;
    margin: 0;
  }

  footer{
    padding: 40px 0 80px;
    font-size: 13px;
    color: var(--text-dim);
  }
  footer a{ text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; display: inline-block; transition: color 150ms ease, text-decoration-color 150ms ease, transform 140ms ease-out; }
  footer a:hover{ color: var(--accent); text-decoration-color: var(--accent); }
  footer a:active{ transform: scale(0.97); }

  @media (prefers-reduced-motion: reduce){
    html{ scroll-behavior: auto; }
  }

  /* ---------- Letter shatter ---------- */

  .letter{
    display: inline-block;
    transition: transform 0.6s cubic-bezier(.17,.67,.36,1.3), opacity 0.6s ease;
    will-change: transform;
  }

  .word{
    display: inline-block;
  }

  .letter.scattered{
    transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 0deg));
    opacity: 0.3;
  }

  @media (prefers-reduced-motion: reduce){
    .letter{ transition: none; }
  }

  /* ---------- Car canvas ---------- */

  #car-canvas{
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    touch-action: none;
    pointer-events: none;
  }
  #car-canvas.active{ display: block; }

  #drive-hint{
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 51;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-dim);
    background: rgba(20,20,26,0.85);
    border: 1px solid var(--line);
    padding: 9px 16px;
    border-radius: 999px;
    display: none;
    pointer-events: none;
  }
  #drive-hint.active{ display: block; }

  #achievement-toast{
    position: fixed;
    top: 22px;
    left: 50%;
    z-index: 60;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    background: var(--accent);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  #achievement-toast.show{
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  .confetti-piece{
    position: fixed;
    top: 20px;
    left: 50%;
    width: 7px;
    height: 12px;
    z-index: 61;
    pointer-events: none;
    opacity: 1;
    animation: confetti-fall 1100ms cubic-bezier(.17,.67,.36,1) forwards;
  }

  @keyframes confetti-fall{
    to{
      transform: translate(var(--cx), var(--cy)) rotate(var(--crot));
      opacity: 0;
    }
  }

  #joystick-base{
    position: fixed;
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 180, 84, 0.35);
    z-index: 52;
    display: none;
    pointer-events: none;
  }
  #joystick-base.active{ display: block; }

  #joystick-knob{
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    margin-left: -22px;
    margin-top: -22px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.85;
  }
