/* Single dark look, on purpose */
  :root {
    color-scheme: dark;
    --bg: #000;
    --ink: #f2f2f2;
    --muted: #8a8a8e;
    --faint: #3d3d41;
    --line: #1c1c1f;
    --accent: #b9a6ff;
    --frame: #2c2c2f;
    --btn: #111113;
    --ph: min(71.3vh, 736px);
    --slide-w: min(1240px, 94vw);
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 400 15px/1.5 "Geist", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  button { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

  /* Top bar */
  .top {
    position: fixed; inset: 0 0 auto 0; z-index: 20;
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    padding: calc(40px + env(safe-area-inset-top, 0px)) 40px 20px;
    background: linear-gradient(var(--bg) 55%, transparent);
  }
  .tagline { font-size: 17.3px; min-width: 0; transition: opacity .35s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tagline em { font-style: normal; color: var(--accent); }
  .tagline strong { font-weight: 600; }
  .tagline.fade { opacity: 0; }
  /* Rotating phrase: the name stays put, the phrase after it swaps word by word, shifting color as it appears */
  .tl-phrase { display: inline; }
  .tl-phrase[hidden] { display: none; }
  .tl-phrase .w, .caption .d .w { --to: var(--ink); color: var(--to); display: inline-block; white-space: pre; animation: tl-in 1.1s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 70ms); }
  .tl-phrase .w.em { --to: var(--accent); }
  .caption .d .w { --to: var(--muted); animation-name: cap-in; }
  @keyframes cap-in {
    0%   { opacity: 0; filter: blur(6px); transform: translateY(3px); }
    35%  { opacity: 1; filter: blur(0); transform: none; }
    100% { opacity: 1; filter: blur(0); transform: none; }
  }
  .caption.has-info:hover .d .w { --to: var(--ink); }
  .tl-phrase.out .w { animation: tl-out .28s ease-in both; animation-delay: calc(var(--i) * 18ms); }
  @keyframes tl-in {
    0%   { opacity: 0; filter: blur(6px); transform: translateY(3px); color: #7a55e6; }
    35%  { opacity: 1; filter: blur(0); transform: none; color: #b48cff; }
    65%  { color: #e6c9f5; }
    100% { opacity: 1; filter: blur(0); transform: none; color: var(--to); }
  }
  @keyframes tl-out {
    from { opacity: 1; filter: blur(0); }
    to   { opacity: 0; filter: blur(6px); transform: translateY(-2px); color: #7a55e6; }
  }
  nav { display: flex; gap: 20px; flex-shrink: 0; font-size: 17.3px; }
  nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
  nav a:hover, nav a[aria-current="page"] { color: var(--ink); }
  .view[hidden] { display: none !important; }

  /* ---------- WORK ---------- */
  #work { position: fixed; inset: 0; overflow: hidden; touch-action: pan-y; }
  .track { position: absolute; top: 0; bottom: 0; left: 50%; display: flex; transition: transform .8s cubic-bezier(.22,.8,.2,1); will-change: transform; }
  .slide {
    width: var(--slide-w); flex: none; height: 100%;
    display: flex; align-items: center; justify-content: center; gap: clamp(24px, 6vw, 120px);
    opacity: .1; transition: opacity .8s ease; perspective: 1600px;
  }
  .slide.active { opacity: 1; }
  .slide.active.has-info .dev { cursor: pointer; }

  /* Devices */
  .dev { position: relative; flex: none; }
  .screen { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--scr, #1c1c20); }
  .screen img, .screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .ph-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 12%; color: rgba(255,255,255,.55); font-size: 13px; line-height: 1.4; }

  .phone {
    height: var(--ph); aspect-ratio: 9 / 19.5;
    border-radius: calc(var(--ph) * .085); padding: calc(var(--ph) * .014);
    background: #0a0a0b;
    box-shadow: 0 0 0 1.5px var(--frame), 0 0 0 3px #0d0d0e;
  }
  .phone .screen { border-radius: calc(var(--ph) * .072); }
  .island { position: absolute; top: 2.2%; left: 50%; translate: -50% 0; width: 32%; height: 4.4%; background: #000; border-radius: 99px; z-index: 2; }
  .status { position: absolute; top: 2.6%; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 11%; font-size: calc(var(--ph) * .02); font-weight: 500; z-index: 2; color: #fff; }
  .status i { display: inline-block; width: 1.9em; height: .9em; border: 1px solid #fff; border-radius: 3px; position: relative; top: .1em; }
  .status i::after { content: ""; position: absolute; inset: 1px 3px 1px 1px; background: #fff; border-radius: 1px; }
  .ph-ui { position: absolute; left: 7%; right: 7%; bottom: 5%; display: grid; gap: 6px; }
  .ph-ui b { display: block; height: calc(var(--ph) * .012); border-radius: 99px; background: rgba(255,255,255,.28); }
  .ph-ui b:nth-child(1) { width: 45%; background: rgba(255,255,255,.5); }
  .ph-ui b:nth-child(2) { width: 85%; }
  .ph-ui b:nth-child(3) { width: 60%; }
  .ph-tray { position: absolute; top: 12%; left: 7%; right: 7%; display: flex; gap: 6%; }
  .ph-tray span { flex: 1; aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); }

  .tablet {
    width: min(73.6vw, 989px, calc(var(--ph) * 1.25)); aspect-ratio: 4 / 3;
    border-radius: 30px; padding: 14px; background: #0c0c0d;
    box-shadow: 0 0 0 1.5px var(--frame), 0 0 0 3px #0d0d0e;
  }
  .tablet .screen { border-radius: 18px; }
  .tv {
    width: min(69vw, 943px, calc(var(--ph) * 1.4)); aspect-ratio: 16 / 9;
    padding: 6px; background: #0b0b0c; border-radius: 6px;
    box-shadow: 0 0 0 1px var(--frame);
  }
  .tv .screen { border-radius: 2px; }
  .desktop {
    width: min(75.9vw, 1035px, calc(var(--ph) * 1.5)); aspect-ratio: 16 / 10;
    border-radius: 8px; overflow: hidden;
  }
  .desktop .screen { border-radius: 8px; }
  .win { position: absolute; background: rgba(255,255,255,.92); border-radius: 8px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.5); padding: 3% 3%; display: grid; gap: 7px; align-content: start; }
  .win b { display: block; height: 7px; border-radius: 4px; background: #d9dbe4; }
  .win b:first-child { width: 40%; background: #aeb3c7; }
  .win .bars { display: flex; align-items: end; gap: 4%; height: 50%; margin-top: 8px; }
  .win .bars i { flex: 1; background: #4d7cf0; border-radius: 2px 2px 0 0; }

  /* Entrance animations when a slide becomes active */
  .slide.enter .phone { animation: rise .9s cubic-bezier(.22,.8,.2,1) both; }
  .slide.enter .phone:nth-child(2) { animation-delay: .08s; }
  .slide.enter .tablet { animation: flip 1.3s cubic-bezier(.3,.7,.1,1) both; }
  .bare { height: calc(var(--ph) * var(--k, 1.23)); aspect-ratio: var(--ar, 9 / 16); max-width: 94vw; }
  .bare video { display: block; width: 100%; height: 100%; object-fit: contain; }
  .bare-img { height: calc(var(--ph) * var(--k, 1.16)); aspect-ratio: var(--ar, 16 / 9); max-width: 94vw; }
  .bare-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
  /* Screen recording in a dark bezel: 24px outer corners, thick warm-grey frame */
  .screenrec {
    width: min(75.9vw, 1035px, calc(var(--ph) * 1.6)); padding: 1.2%;
    border-radius: 24px; background: #2d2b28;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 30px 80px -30px rgba(0,0,0,.6);
  }
  .screenrec video { display: block; width: 100%; height: auto; aspect-ratio: var(--ar, 16 / 10); object-fit: cover; border-radius: 12px; background: #fff; }
  .slide.enter .bare, .slide.enter .bare-img, .slide.enter .screenrec, .slide.enter .tv, .slide.enter .desktop { animation: rise 1s cubic-bezier(.22,.8,.2,1) both; }
  @keyframes rise { from { transform: translateY(24px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes flip { 0% { transform: rotateX(88deg); } 25% { transform: rotateX(88deg); } 100% { transform: rotateX(0); } }

  .arrow {
    position: fixed; top: 50%; translate: 0 -50%; z-index: 15;
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
    background: var(--btn); display: grid; place-items: center; cursor: pointer;
    transition: opacity .25s, background .2s;
  }
  .arrow:hover { background: #1d1d20; }
  .arrow[disabled] { opacity: 0; pointer-events: none; }
  .arrow.prev { left: 40px; }
  .arrow.next { right: 40px; }

  .caption { position: fixed; left: 40px; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 15; font-size: 15.8px; line-height: 1.4; color: var(--muted); transition: opacity .3s; }
  .caption.fade { opacity: 0; }
  .caption .p, .info-co { font-weight: 600; }
  .caption .p { color: var(--ink); }
  @media (min-width: 641px) { .caption { max-width: calc(50vw - 90px); } }
  .caption.has-info { cursor: pointer; transition: opacity .3s, color .2s; }
  .caption.has-info:hover { color: var(--ink); }

  /* Project overview overlay */
  .info {
    position: fixed; inset: 0; z-index: 40; overflow-y: auto;
    background: rgba(0, 0, 0, .8);
    -webkit-backdrop-filter: blur(32px) saturate(.8); backdrop-filter: blur(32px) saturate(.8);
    opacity: 0; transition: opacity .35s ease;
    padding: 96px 40px;
    display: flex; flex-direction: column;
  }
  .info[hidden] { display: none; }
  .info.open { opacity: 1; }
  body.info-open .top, body.info-open .caption, body.info-open .dots, body.info-open .arrow { opacity: 0 !important; pointer-events: none; transition: opacity .3s; }
  .info-body { max-width: 530px; margin: auto; width: 100%; transform: translateY(10px); transition: transform .45s cubic-bezier(.22,.8,.2,1); }
  .info.open .info-body { transform: none; }
  .info-co { color: var(--muted); font-size: 17px; }
  .info-title { margin: 6px 0 0; font-size: 24px; font-weight: 400; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
  .info-text { margin-top: clamp(48px, 10vh, 96px); display: grid; gap: 26px; }
  .info-text p { margin: 0; font-size: 17.5px; line-height: 1.65; color: #cacacd; text-wrap: pretty; }
  .info-close {
    position: fixed; left: 40px; bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    padding: 12px 26px; border-radius: 999px; cursor: pointer;
    background: rgba(28, 28, 30, .75); border: 1px solid rgba(255, 255, 255, .14);
    color: var(--ink); font-size: 18px; line-height: 1.2;
    transition: background .2s, border-color .2s;
  }
  .info-close:hover { background: rgba(44, 44, 47, .85); border-color: rgba(255, 255, 255, .24); }

  .dots { position: fixed; left: 50%; translate: -50% 0; bottom: calc(40px + env(safe-area-inset-bottom, 0px)); z-index: 15; display: flex; gap: 12px; }
  .grp { position: relative; display: flex; gap: 3px; padding: 8px 0; }
  .grp button { width: 14px; height: 10px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; transition: width .4s cubic-bezier(.22,.8,.2,1); }
  .grp button::after { content: ""; position: absolute; left: 0; right: 0; top: 3px; height: 4px; border-radius: 99px; background: #3a3a3d; transition: background .3s; }
  .grp:hover button::after { background: #5c5c61; }
  .grp.cur button { width: 14px; }
  .grp.cur button::after { background: #6e6e73; }
  .grp button.on { width: 32px; }
  .grp button.on::after { background: #f2f2f2; }
  .tip {
    position: absolute; bottom: calc(100% + 8px); left: 50%; translate: -50% 4px;
    white-space: nowrap; font-size: 12.5px; padding: 6px 11px; border-radius: 99px;
    background: #161618; border: 1px solid #242427; color: var(--ink);
    opacity: 0; pointer-events: none; transition: opacity .2s, translate .2s;
  }
  .grp:hover .tip { opacity: 1; translate: -50% 0; }

  /* ---------- ABOUT ---------- */
  #about { padding: 150px 40px 140px; }
  .col { max-width: 486px; margin-inline: auto; }
  .hello { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 32px; align-items: start; }
  .hello p, .more p { margin: 0 0 18px; color: #cfcfd2; font-size: 16.5px; line-height: 1.5; }
  .hello p { font-size: 18.2px; }
  .hello p:first-child { margin-top: 4px; }
  .u { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
  .portrait {
    aspect-ratio: 4 / 5; border-radius: 10px; border: 1px solid var(--line);
    background: radial-gradient(120% 90% at 30% 20%, #3b2a6b 0%, #17121f 55%, #0b0a0d 100%);
    display: grid; place-items: center; color: rgba(255,255,255,.5); font-size: 13px; overflow: hidden;
  }
  .portrait img { width: 100%; height: 100%; object-fit: cover; }
  .social { display: flex; gap: 16px; margin-top: 30px; }
  .social a { display: grid; place-items: center; width: 26.4px; height: 26.4px; color: #d9d9dc; transition: color .2s; }
  .social a svg { scale: 1.1; }
  .social a:hover { color: #fff; }
  .more { margin-top: 110px; }
  .more p { font-size: 16.5px; line-height: 1.6; color: #b9b9bd; }

  h2.sec { font-size: 16.5px; font-weight: 500; margin: 0 0 20px; }
  .history { max-width: 780px; margin: 110px auto 0; }
  .history h2 { padding-left: 148px; }
  .row { position: relative; display: grid; grid-template-columns: 148px minmax(0, 1fr); padding: 20px 0 22px; border-top: 1px solid var(--line); min-height: 84px; font-size: 15.4px; line-height: 1.45; }
  .row.empty { border-top: 1px dashed #19191b; }
  .row .yr { color: var(--muted); }
  .row.empty .yr { color: #36363a; }
  .row .co { color: var(--ink); }
  .row .role { color: #c9c9cc; }
  .row .area { color: var(--muted); }
  .stack { position: absolute; right: 20px; top: 50%; translate: 0 -30%; width: 150px; height: 100px; pointer-events: none; z-index: 1; scale: 1.21; transform-origin: right center; }
  .stack span { position: absolute; border-radius: 6px; border: 1px solid #2a2a2e; box-shadow: 0 10px 30px -10px rgba(0,0,0,.8); display: grid; place-items: center; font-size: 10px; color: rgba(255,255,255,.45); }
  .stack span:nth-child(1) { width: 58px; height: 100px; right: 0; top: -20px; rotate: 4deg; background: linear-gradient(160deg, #3d5a8a, #1b2438); }
  .stack span:nth-child(2) { width: 100px; height: 60px; right: 48px; top: 18px; rotate: -3deg; background: linear-gradient(160deg, #6b5a44, #221c16); }
  .stack span.img { background-size: cover; background-position: center; background-repeat: no-repeat; border: 0; outline: 0; overflow: hidden; }
  .stack span.img video { display: block; width: 100%; height: 100%; object-fit: cover; }
  /* Two tall photos, the right one overlapping the left */
  .stack.pair span:nth-child(1) { width: 62px; height: 104px; right: 52px; top: -30px; rotate: -3deg; background-image: linear-gradient(160deg, #5f7a4a, #1d2616); }
  .stack.pair span:nth-child(2) { width: 62px; height: 104px; right: calc(-2px / 1.21); top: -8px; rotate: 4deg; background-image: linear-gradient(160deg, #6b5a44, #221c16); z-index: 1; }
  .stack.on-line { top: 100%; translate: 0 -33%; }
  /* Single portrait photo that sits on the line between two years */
  .stack.solo { top: 100%; translate: 0 -50%; width: 62px; height: 104px; }
  .stack.solo span:nth-child(1) { width: 62px; height: 104px; right: 25px; top: 0; rotate: 3deg; background-image: linear-gradient(160deg, #6a4a78, #241829); }

  .friends, .links { max-width: 486px; margin: 110px auto 0; }
  .faces { display: grid; grid-template-columns: repeat(9, 34px); gap: 10px; }
  .faces span { width: 34px; height: 34px; border-radius: 50%; background: #1a1a1c; border: 1px solid #232326; }
  .faces span.f { background: radial-gradient(circle at 50% 38%, #6a6a70 0 22%, transparent 23%), radial-gradient(circle at 50% 100%, #55555a 0 42%, #2a2a2e 43%); }
  .links a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; font-size: 15.4px; color: #d4d4d7; transition: color .2s; }
  .links a span:last-child { color: var(--muted); }
  .links a:hover { color: #fff; }
  .note { max-width: 780px; margin: 60px auto 0; color: #4a4a4f; font-size: 13px; text-align: center; }

  @media (max-width: 640px) {
    :root { --ph: min(60vh, 560px); --slide-w: 100vw; }
    .slide.two .dev:nth-child(2) { display: none; }
    .tablet, .tv, .desktop, .screenrec { width: calc(100vw - 80px); }
    .screenrec { border-radius: 16px; }
    .screenrec video { border-radius: 8px; }
    .tagline { font-size: 16.2px; white-space: normal; align-self: flex-start; }
    .tl-phrase { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    nav { gap: 14px; align-self: flex-start; }
    .arrow { display: none; }
    .caption { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); right: 40px; }
    .hello { grid-template-columns: 1fr; }
    .portrait { max-width: 220px; grid-row: 1; }
    .history h2 { padding-left: 0; }
    .row { grid-template-columns: 64px minmax(0, 1fr); }
    .stack { display: none; }
    .faces { grid-template-columns: repeat(6, 34px); }
  }
  @media (prefers-reduced-motion: reduce) {
    .track, .slide, .tagline, .caption, .info, .info-body { transition: none; }
    .tl-phrase .w, .tl-phrase.out .w, .caption .d .w { animation: none; }
    .slide.enter .dev { animation: none !important; }
  }
