/* Tri Nguyen — a short film in five scenes. One carbon atom (drawn on a fixed canvas behind
   the page) travels through all of them: nucleus -> SATE's five layers -> the two dates ->
   a thread through Before UB -> a small atom beside the email.
   Cool white paper, ink text, one accent: UB blue. Bricolage Grotesque + Source Serif 4. */
:root {
  --paper: #f6f7f9;
  --surface: #ffffff;
  --ink: #1b1f27;
  --muted: #5e6573;
  --rule: #dadde3;
  --blue: #005bbb;
  --blue-soft: #e3edf9;
  --spark: #e56a54;
  --scrim: rgba(12, 16, 22, .88);

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --text: "Source Serif 4", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #11141a; --surface: #181c24; --ink: #e8ebf0; --muted: #a0a7b4; --rule: #2a303b;
    --blue: #5ea2ee; --blue-soft: #18263a; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #11141a; --surface: #181c24; --ink: #e8ebf0; --muted: #a0a7b4; --rule: #2a303b;
  --blue: #5ea2ee; --blue-soft: #18263a; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  transition: none;
  font: 400 1.1875rem/1.7 var(--text);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--blue); color: #fff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; }
.skip:focus { left: 16px; }

.w {
  max-width: 1200px; margin: 0 auto;
  padding-left: max(56px, env(safe-area-inset-left, 0px));
  padding-right: max(56px, env(safe-area-inset-right, 0px));
  --rail: -30px;
}
.textlink { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.textlink:hover { text-decoration-thickness: 2px; }

/* ---------- The film canvas sits behind everything ---------- */
.film { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }
/* graphite grain: a faint texture so no colour field is perfectly flat */
.grain {
  position: fixed; inset: -50%; z-index: 0; pointer-events: none; opacity: .09; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1.4 -.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, .foot { position: relative; z-index: 1; }
.slot { position: relative; }

/* ---------- Top bar ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--paper); }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.top__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 60px; }
.top__name { font: 700 1.0625rem/1 var(--display); text-decoration: none; letter-spacing: -.01em; }
.top__nav { display: flex; gap: 26px; font: 500 .9375rem/1 var(--display); }
.top__nav a { text-decoration: none; color: var(--muted); padding: 6px 0; transition: color .25s ease; }
.top__nav a:hover { color: var(--ink); }
.top__nav a.is-active { color: var(--blue); }
.top__progress { height: 1px; background: var(--rule); }
.top__progress span { display: block; height: 100%; background: var(--blue); transform-origin: left; transform: scaleX(0); }

/* ---------- Scene 1: about ---------- */
.about { position: relative; min-height: calc(100svh - 61px); display: grid; align-content: center; padding-block: 48px 96px; }
.about__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: clamp(32px, 6vw, 96px); align-items: center; }
.about__text { min-width: 0; will-change: transform, opacity; }
.about__name {
  font-size: clamp(3.5rem, 9vw, 8rem); line-height: .92; font-weight: 750; letter-spacing: -.045em;
  font-variation-settings: "opsz" 96;
}
.about__name .ln { display: inline-block; overflow: hidden; padding-bottom: .14em; margin-bottom: -.14em; vertical-align: top; }
.about__name .ln > span { display: inline-block; }
.about__vn { margin-top: 14px; font: 400 1.1875rem/1.3 var(--display); color: var(--muted); }
.about__role { margin-top: 28px; font: 500 1.0625rem/1.5 var(--display); }
.about__role a { color: var(--blue); text-decoration: none; }
.about__role a:hover { text-decoration: underline; text-underline-offset: 3px; }
.about__bio { margin-top: 24px; display: grid; gap: 14px; max-width: 32em; font-size: 1.25rem; }
.about__links { list-style: none; margin: 24px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 24px; font: 500 1rem/1 var(--display); }
.about__links a { color: var(--blue); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.slot--atom { width: 100%; max-width: 480px; aspect-ratio: 1; justify-self: center; }
/* periodic-table tile, so the atom reads as carbon */
.element {
  position: absolute; right: -2%; top: -4%; z-index: 2; width: 118px; padding: 10px 12px 12px;
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "z mass" "sym sym" "name name" "conf conf";
  background: var(--surface); border: 1.5px solid var(--spark); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 40, 90, .08); font-family: var(--display); color: var(--ink);
  will-change: transform, opacity; animation: enter .9s var(--ease) .6s both;
}
.element__z { grid-area: z; font-weight: 700; font-size: .9375rem; color: var(--spark); }
.element__mass { grid-area: mass; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.element__sym { grid-area: sym; font-size: 3rem; line-height: 1; font-weight: 750; letter-spacing: -.03em; margin: 4px 0 2px; }
.element__name { grid-area: name; font-size: .9375rem; font-weight: 600; }
.element__conf { grid-area: conf; font: 400 .8125rem/1.3 var(--text); color: var(--muted); margin-top: 3px; font-variant-numeric: lining-nums; }
.cue {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0; display: grid; justify-items: center; gap: 10px;
  font: 500 .8125rem/1 var(--display); color: var(--muted);
}
.cue span { width: 1px; height: 40px; background: linear-gradient(var(--rule), var(--blue)); transform-origin: top; animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Page-load: the name rises line by line, the rest follows once */
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes enter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.about__name .ln > span { animation: rise 1s var(--ease) both; }
.about__name .ln:nth-child(2) > span { animation-delay: .08s; }
.about__text > :not(.about__name) { animation: enter .9s var(--ease) both; }
.about__vn { animation-delay: .25s !important; }
.about__role { animation-delay: .33s !important; }
.about__bio { animation-delay: .41s !important; }
.about__links { animation-delay: .49s !important; }
.cue { animation: enter 1s var(--ease) 1s both; }

/* ---------- Sections ---------- */
.sec { position: relative; padding-block: 0 clamp(112px, 13vw, 176px); }
.sec__grid { display: grid; gap: 40px; border-top: 1px solid var(--rule); padding-top: 36px; }
.sec__name { font-size: clamp(2.25rem, 4.4vw, 3.5rem); font-weight: 700; letter-spacing: -.035em; line-height: 1; }
.sec__name span { display: block; margin-top: 12px; font: 400 1.125rem/1.4 var(--text); color: var(--muted); letter-spacing: 0; }
.sec__body { position: relative; min-width: 0; display: grid; gap: 80px; }
.wide { width: 100%; }
.lead { font: 500 clamp(1.5rem, 2.6vw, 2.125rem)/1.25 var(--display); letter-spacing: -.022em; }
[data-in] { will-change: transform, opacity; }

/* Scene 2: research. The slot is empty: the canvas draws the rings and the device here. */
.sate { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: clamp(32px, 5vw, 80px); align-items: center; }
.sate__text { display: grid; gap: 20px; max-width: 32em; }
.slot--layers { width: 100%; aspect-ratio: 1; }

/* Scene 3: news. The dots are placeholders the electrons land on. */
.news { display: grid; max-width: 820px; }
.news > div { position: relative; display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); font-size: 1.25rem; }
.news > div:first-child { padding-top: 0; }
.news .dot { position: absolute; left: calc(var(--rail) - 5px); top: calc(18px + .85em); width: 12px; height: 12px; margin-top: -6px; }
.news > div:first-child .dot { top: .84em; }
.news dt { font: 500 1.0625rem/1.7 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }

/* Scene 4: before UB. The rail is where the canvas draws the thread. */
.thread-host { padding-left: 0; }
.rail { position: absolute; left: var(--rail); top: 6px; bottom: 0; width: 2px; }
.work { position: relative; display: grid; gap: 16px; }
.work { gap: 20px; }
.work h3 { font-size: clamp(1.625rem, 2.6vw, 2.125rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; transition: color .5s var(--ease); }
.work h3.is-lit { color: var(--blue); }
.work > p { max-width: 36em; }
.hint { color: var(--muted); font-size: 1rem; margin-top: -8px; }

.video { position: relative; margin-top: 8px; background: #000; overflow: hidden; border-radius: 6px; will-change: clip-path; }
.video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
.video__play {
  position: absolute; left: 18px; bottom: 18px; display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px; border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: #1b1f27; font: 600 .9375rem/1 var(--display);
  transition: transform .15s ease-out, background-color .2s ease;
}
.video__play:hover { background: #fff; }
.video__play:active { transform: scale(.96); }
.video__icon { width: 28px; height: 28px; border-radius: 50%; background: var(--blue); position: relative; flex: none; }
.video__icon::after { content: ""; position: absolute; left: 11px; top: 8px; border-left: 9px solid #fff; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.video.is-playing .video__play { opacity: 0; pointer-events: none; transition: opacity .25s ease; }

.photos { display: grid; gap: 10px; }
.photos--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.photos--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shot { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--rule); cursor: zoom-in; will-change: transform; }
.shot img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform .8s var(--ease); }
.shot:hover img { transform: scale(1.04); }

.awards { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); max-width: 920px; }
.awards li { border-bottom: 1px solid var(--rule); }
.award {
  width: 100%; display: grid; grid-template-columns: 140px 1fr; gap: 24px; align-items: baseline;
  padding: 16px 0; font-size: 1.1875rem; border: 0; background: none; text-align: left; cursor: zoom-in; font: inherit; transition: color .2s ease;
}
.award:hover { color: var(--blue); }
.award__year { font: 500 1rem/1.68 var(--display); color: var(--muted); font-variant-numeric: tabular-nums; }
.award img { display: none; }
.peek {
  position: fixed; left: 0; top: 0; z-index: 40; width: 240px; pointer-events: none; opacity: 0;
  border-radius: 4px; overflow: hidden; background: #fff; box-shadow: 0 18px 50px rgba(12, 16, 22, .25); will-change: transform, opacity;
}
.peek img { width: 100%; height: auto; display: block; }

/* Scene 5: contact */
.contact { grid-template-columns: minmax(0, 1fr) 240px; align-items: center; }
.contact__text { display: grid; gap: 22px; min-width: 0; }
.slot--mini { width: 100%; aspect-ratio: 1; }
.mail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 18px; }
.mail a { font: 700 clamp(1.75rem, 4.6vw, 3.75rem)/1.1 var(--display); letter-spacing: -.025em; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.mail a:hover { color: var(--blue); }
.copy {
  border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); padding: 8px 14px; cursor: pointer;
  font: 500 .875rem/1 var(--display); transition: border-color .2s ease, color .2s ease, transform .12s ease-out;
}
.copy:hover { border-color: var(--blue); color: var(--blue); }
.copy:active { transform: scale(.96); }
.contact__more { line-height: 2; font-size: 1.25rem; }
.sec--last { padding-bottom: clamp(80px, 12vh, 140px); }
.foot { padding-block: 0 40px; color: var(--muted); font-size: .9375rem; }
.foot .w { border-top: 1px solid var(--rule); padding-top: 20px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 95;
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--paper); font: 500 .9375rem/1 var(--display);
  transition: transform .35s var(--ease), opacity .25s ease;
}
.toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 90; }
.lightbox__scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; }
.lightbox__img { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; touch-action: none; cursor: grab; border-radius: 4px; }
.lightbox__cap {
  position: absolute; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: max-content; max-width: min(90vw, 640px); text-align: center; color: #e8ebf0; font: 400 1rem/1.5 var(--text); opacity: 0;
}
.lightbox__btn {
  position: absolute; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; opacity: 0; transition: background-color .2s ease;
}
.lightbox__btn:hover { background: rgba(255,255,255,.24); }
.lightbox__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: calc(16px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); }
.lightbox__prev { left: max(16px, env(safe-area-inset-left, 0px)); top: 50%; margin-top: -22px; }
.lightbox__next { right: max(16px, env(safe-area-inset-right, 0px)); top: 50%; margin-top: -22px; }
.lightbox.is-single .lightbox__prev, .lightbox.is-single .lightbox__next { display: none; }

/* ---------- Phone ---------- */
@media (max-width: 860px) {
  .w { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); --rail: -16px; }
  .element { width: 96px; right: -4%; padding: 8px 10px 10px; }
  .element__sym { font-size: 2.25rem; }
  .sec__name { font-size: 2.25rem; }
  .news > div, .award { font-size: 1.0625rem; }
  .top__nav { display: none; }
  .about { min-height: 0; padding-block: 24px 120px; }
  .about__grid { grid-template-columns: 1fr; gap: 12px; }
  .slot--atom { order: -1; max-width: 300px; justify-self: start; margin-left: -16px; }
  .cue { display: none; }
  .sec__grid { grid-template-columns: 1fr; gap: 18px; }
  .sate { grid-template-columns: 1fr; }
  .slot--layers { order: -1; max-width: 320px; width: 100%; justify-self: center; }

  .photos--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .news > div, .award { grid-template-columns: 1fr; gap: 0; }
  .contact { grid-template-columns: 1fr; }
  .slot--mini { order: -1; width: 120px; }
  .mail a { font-size: 1.625rem; }
  .lightbox__prev, .lightbox__next { top: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); margin-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (prefers-reduced-transparency: reduce) { .top { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; } }
@media (hover: none) { .peek { display: none; } }
