/* Manamon Vorarat — 01_Landing Page
   Built from a 1440px-wide Figma frame. One design pixel = var(--u),
   so the layout scales with the window and keeps the collage proportions. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: 80px; }
body { background: #fff; color: #000; font-family: "Hanken Grotesk", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: none; }
a { color: inherit; text-decoration: none; }
p, h1, h2, address { margin: 0; font-style: normal; font-weight: inherit; }

.page { background: #fff; container-type: inline-size; position: relative; width: 100%; max-width: 1920px; margin: 0 auto; }
.page { --u: calc(100cqw / 1440); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10; background: transparent; /* Figma: nav background at 0% opacity */
  color: #fff; mix-blend-mode: difference; /* text inverts what it scrolls over: black on white, white on dark */
  height: calc(70 * var(--u));
  font-weight: 500; font-size: calc(14 * var(--u));
}
.nav > * { position: absolute; }
.nav__logo { left: calc(50 * var(--u)); top: calc(24 * var(--u)); } /* Figma: "M" mark at x 50, y 24 */
.nav__logo img, .nav__logo .nav__mark { display: block; width: calc(20 * var(--u)); height: auto; overflow: visible; } /* 20 × 22 */
.nav__links a { position: absolute; top: calc(25 * var(--u)); text-decoration: none; white-space: nowrap; }
.nav__links a:nth-child(1) { left: calc(278 * var(--u)); }
.nav__links a:nth-child(2) { left: calc(391 * var(--u)); }
.nav__links a:nth-child(3) { left: calc(505 * var(--u)); }
.works__all:hover, .footer a:hover { opacity: .55; }
.nav__loc { right: calc(50 * var(--u)); top: calc(27 * var(--u)); }

/* ---------- Hero ---------- */
.hero { position: relative; height: calc(830 * var(--u)); }
.hero > * { position: absolute; }
.hero__wordmark { left: calc(47 * var(--u)); top: calc(110 * var(--u)); /* Figma y 180 − 70 nav */ width: calc(1339 * var(--u)); }
.hero__wordmark img, .hero__mark { display: block; width: 100%; height: auto; overflow: visible; }
.hero__l { will-change: transform; }
.hero__bio {
  left: calc(50 * var(--u)); top: calc(483 * var(--u)); width: calc(658 * var(--u)); /* Figma y 553 − 70 nav */
  font-weight: 500; font-size: calc(16 * var(--u)); line-height: calc(22 * var(--u)); /* Figma: Hanken Grotesk Medium 16 / 22 */
}
.hero__contact {
  left: calc(1178 * var(--u)); top: calc(483 * var(--u)); width: calc(212 * var(--u));
  font-style: normal; font-weight: 500; font-size: calc(16 * var(--u)); line-height: calc(22 * var(--u)); white-space: nowrap; /* Figma: Hanken Grotesk Medium 16 / 22 */
}

/* ---------- Selected works ---------- */
.works { position: relative; height: calc(2237 * var(--u)); } /* Figma: y 900 → footer at 3137 */
.works__head { position: absolute; left: calc(50 * var(--u)); right: calc(49 * var(--u)); top: calc(22 * var(--u)); display: flex; justify-content: space-between; font-weight: 500; font-size: calc(16 * var(--u)); } /* Figma: "Selected Works" left, "See All Works" right, y 922 − 900 */
.works__head h2 { font-size: inherit; }
.works__all { text-decoration: underline; text-underline-offset: 0.15em; }
.works__divider { position: absolute; left: calc(51 * var(--u)); top: calc(87 * var(--u)); width: calc(1340 * var(--u)); height: auto; }

.gallery { position: absolute; inset: 0; pointer-events: none; }
.gallery > .work { pointer-events: auto; }
.work { position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); width: calc(var(--w) * var(--u)); }
.work__media { position: relative; overflow: hidden; background: #d9d9d9; height: calc(var(--h) * var(--u)); }
.work__media > img { position: absolute; transition: transform .8s cubic-bezier(0.65, 0, 0.35, 1); }
.work:hover .work__media > img { transform: scale(1.08); }
.work__cap {
  position: absolute; top: calc(var(--cap) * var(--u)); left: calc(var(--capx, 0) * var(--u)); width: max-content; max-width: calc(428 * var(--u));
  font-size: calc(14 * var(--u)); line-height: 1.2; font-weight: 400;
}
.work__cap strong { display: block; font-weight: 600; }

.work__media > img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.work--silp            { --x: 391; --y: 126;  --w: 317; --h: 211.33; --cap: 231; }
.work--bitter          { --x: 733; --y: 126;  --w: 657; --h: 493.68; --cap: 514; }
.work--glan            { --x: 50;  --y: 448;  --w: 430; --h: 657;    --cap: 677; }
.work--sheung-wan      { --x: 619; --y: 731;  --w: 430; --h: 286.67; --cap: 307; }
.work--seashell-museum { --x: 960; --y: 1129; --w: 431; --h: 538.46; --cap: 559; }
.work--comm-ba-in      { --x: 278; --y: 1321; --w: 542; --h: 345.53; --cap: 367; }
.work--the-arche       { --x: 505; --y: 1805; --w: 430; --h: 321.25; --cap: 341; }

/* ---------- Footer (Figma component 01_Footer) ---------- */
.footer {
  position: relative; height: calc(300 * var(--u));
  background: #000;
  color: #fff; font-weight: 500; font-size: calc(14 * var(--u));
}
.footer__contact > *, .footer__social > * { position: absolute; white-space: nowrap; left: calc(50 * var(--u)); }
.footer__contact > :nth-child(1) { top: calc(63 * var(--u)); }
.footer__contact > :nth-child(2) { top: calc(86 * var(--u)); }
.footer__city                    { top: calc(141 * var(--u)); }
.footer__contact small           { top: calc(219 * var(--u)); font-size: calc(12 * var(--u)); font-weight: 400; } /* Figma: Regular 12 */
.footer__social > * { top: calc(63 * var(--u)); }
.footer__social > *:nth-child(1) { left: calc(391 * var(--u)); }
.footer__social > *:nth-child(2) { left: calc(505 * var(--u)); }
.footer__social > *:nth-child(3) { left: calc(619 * var(--u)); }

/* ---------- Small screens: same content, stacked ---------- */
@media (max-width: 720px) {
  .page { --u: 1px; }
  .nav { height: 56px; font-size: 13px; }
  .nav__logo { left: 20px; top: 18px; } .nav__logo img, .nav__logo .nav__mark { width: 20px; }
  .nav__links a { top: 20px; }
  .nav__links a:nth-child(1) { left: auto; right: 150px; } .nav__links a:nth-child(2) { left: auto; right: 80px; } .nav__links a:nth-child(3) { left: auto; right: 20px; }
  .nav__loc { display: none; }
  .nav__links { inset: 0; }

  .hero, .works, .footer { height: auto; padding: 0 20px; }
  .hero > *, .works__head, .works__divider, .gallery, .work, .work__cap,
  .footer__contact > *, .footer__social > * { position: static; }
  .hero { padding-top: 24px; display: grid; gap: 28px; }
  .hero__wordmark { width: 100%; }
  .hero__bio { width: auto; font-size: 17px; line-height: 1.4; }
  .hero__bio br { display: none; }
  .hero__contact { font-size: 13px; }

  .works { padding-top: 48px; }
  .works__head { font-size: 17px; }
  .works__divider { width: 100%; margin: 16px 0 28px; }
  .gallery { display: grid; gap: 36px; }
  .work { width: 100%; }
  .work__media { height: auto; aspect-ratio: var(--w) / var(--h); }
  .work__cap { margin-top: 12px; max-width: none; font-size: 13px; }

  .footer { margin-top: 60px; padding: 32px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; font-size: 13px; }
  .footer__contact, .footer__social { display: flex; flex-direction: column; gap: 6px; }
  .footer__social { flex-direction: row; gap: 20px; }
  .footer__city { margin-top: 14px; }
  .footer__contact small { margin-top: 24px; }
}

/* ---------- Page transition: slides in from the bottom, smooth ease-in-out ----------
   Driven by nav.js on every click (works in all browsers): the current page drifts up and fades out,
   then the next page rises in from the bottom and fades in. */
body { overflow-x: clip; } /* no sideways scrollbar while a page is off to the side */
html.is-leaving .page  { animation: page-leave 240ms cubic-bezier(0.65, 0, 0.35, 1) both; pointer-events: none; }
html.is-entering .page { animation: page-enter 420ms cubic-bezier(0.65, 0, 0.35, 1) both; }
@keyframes page-leave { to   { transform: translateY(-6vh); opacity: 0; } }
@keyframes page-enter { from { transform: translateY(18vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { html.is-leaving .page, html.is-entering .page { animation: none; } }

/* Nav items that have no prototype link in Figma */
.nav__links > span { position: absolute; top: calc(25 * var(--u)); text-decoration: none; white-space: nowrap; left: calc(391 * var(--u)); }
.nav__logo:not(a) { cursor: default; }
a.work { cursor: pointer; }
div.work { cursor: default; }

/* ---------- Generic frame canvas for inner pages ----------
   Coordinates are measured from the top of the Figma frame (nav included). */
.canvas { position: relative; height: calc(var(--frame-h) * var(--u)); margin-top: calc(-70 * var(--u)); }
.abs { position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); }
.abs[style*="--w"] { width: calc(var(--w) * var(--u)); }
.tile { position: absolute; left: calc(var(--x) * var(--u)); top: calc(var(--y) * var(--u)); width: calc(var(--w) * var(--u)); height: calc(var(--h) * var(--u)); overflow: hidden; background: var(--bg, #d9d9d9); display: block; }
.tile > img { position: absolute; left: calc(var(--ix, 0) * var(--u)); top: calc(var(--iy, 0) * var(--u)); width: calc(var(--iw, var(--w)) * var(--u)); height: calc(var(--ih, var(--h)) * var(--u)); object-fit: cover; transition: transform .8s cubic-bezier(0.65, 0, 0.35, 1); }
a.tile:hover > img, .aw .tile:hover > img { transform: scale(1.08); }
.cap { font-size: calc(14 * var(--u)); line-height: 1.2; width: calc(428 * var(--u)); }
.cap strong { display: block; font-weight: 600; }
.t20 { font-size: calc(20 * var(--u)); font-weight: 500; white-space: nowrap; }
.t16 { font-size: calc(16 * var(--u)); font-weight: 500; white-space: nowrap; } /* All Works filter tabs (Figma: 16px Medium) */
.u { text-decoration: underline; text-underline-offset: 0.15em; }
.divider { width: calc(1340 * var(--u)); height: auto; }

/* All Works */
.aw .tile > img[src$="missing"] { display: none; }

/* About */
.about-bio { width: calc(1339 * var(--u)); font-size: calc(32 * var(--u)); font-weight: 600; line-height: 1.2; }
.h20b { font-size: calc(20 * var(--u)); font-weight: 700; white-space: nowrap; }
.list { font-size: calc(14 * var(--u)); line-height: 1.2; }
.list p { margin-bottom: calc(2 * var(--u)); }
.list strong { font-weight: 600; } /* e.g. "Native" / "Fluent" under Language Skills */
.yr { font-size: calc(14 * var(--u)); font-weight: 600; width: calc(89 * var(--u)); line-height: 1.2; }
.exp { font-size: calc(14 * var(--u)); width: calc(315 * var(--u)); line-height: 1.2; }
.exp strong { font-weight: 600; }

@media (max-width: 720px) {
  .nav__links > span { left: auto; right: 80px; top: 20px; }
  .canvas { height: auto; margin-top: 0; padding: 24px 20px 48px; display: flex; flex-direction: column; gap: 14px; }
  .canvas > * { position: static !important; width: auto !important; }
  .tile { height: auto !important; aspect-ratio: var(--w) / var(--h); position: relative !important; }
  .tile > img { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; }
  .cap, .exp, .list, .yr { font-size: 13px; width: auto; margin-bottom: 18px; }
  .t20, .h20b { font-size: 17px; white-space: normal; margin-top: 12px; }
  .about-bio { font-size: 20px; }
  .divider { width: 100% !important; }
  .canvas .order { order: var(--o); }
}
.exp-row { display: contents; }
@media (max-width: 720px) { .exp-row { display: flex; gap: 12px; } .exp-row .yr { flex: 0 0 80px; } }

/* ---- Inner-page nav: any of the three items can be a link or plain text ---- */
.nav__links--split > * { position: absolute; top: calc(25 * var(--u)); text-decoration: none; white-space: nowrap; }
.nav__links--split > :nth-child(1) { left: calc(278 * var(--u)); }
.nav__links--split > :nth-child(2) { left: calc(391 * var(--u)); }
.nav__links--split > :nth-child(3) { left: calc(505 * var(--u)); }
.tile > img { left: 0; top: 0; width: 100%; height: 100%; }

/* Individual work */
.iw-title { font-size: calc(24 * var(--u)); font-weight: 600; width: calc(430 * var(--u)); line-height: 1.2; }
.iw-sub { font-size: calc(16 * var(--u)); font-weight: 600; line-height: 1.2; white-space: nowrap; }  /* year + roles (Figma: 16px SemiBold) */
.iw-meta { font-size: calc(14 * var(--u)); font-weight: 600; line-height: 1.2; white-space: nowrap; }
.iw-meta--reg { font-weight: 400; }
.iw-desc { font-size: calc(14 * var(--u)); width: calc(430 * var(--u)); line-height: 1.2; }
.iw-video { background: #000; }                                                                          /* YouTube preview (Figma Frame 51) */
.iw-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.iw-video__link, .iw-video__link img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.iw-video__link img { object-fit: contain; }                                                             /* thumbnail fallback when opened from the folder */
.iw-lettering { background: #fff; }
.more-head { width: calc(1340 * var(--u)); display: flex; justify-content: space-between; }
.more-head .t20, .more-head .t16 { margin: 0; }

@media (max-width: 720px) {
  .nav__links--split > :nth-child(1) { left: auto; right: 150px; top: 20px; }
  .nav__links--split > :nth-child(2) { left: auto; right: 80px; top: 20px; }
  .nav__links--split > :nth-child(3) { left: auto; right: 20px; top: 20px; }
  .tab { display: none; }
  .iw-title { font-size: 22px; } .iw-meta, .iw-desc { font-size: 13px; white-space: normal; } .iw-sub { font-size: 15px; white-space: normal; }
  .more-head { margin-top: 32px; }
}
@media (max-width: 720px) {
  .canvas .abs, .canvas .tile { position: static !important; }
  .canvas .abs { width: auto !important; }
  .canvas .tile { position: relative !important; width: 100% !important; left: auto !important; top: auto !important; }
  .more-head { display: flex !important; }
}

/* ---------- Loading page (shown once per visit, then slides away) ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; background: #fff;
  container-type: inline-size;
  animation: loader-out 700ms cubic-bezier(0.65, 0, 0.35, 1) 1600ms forwards;
}
/* Figma 01_Loading Page: wordmark 663px wide, centred in the frame */
.loader__mark {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: calc(663 * 100cqw / 1440); height: auto; overflow: hidden;
}
/* Landing page handoff: the wordmark flies into the hero title while the white fades out */
.loader--handoff { animation: none; }
/* The mark is resized with real width/left/top (not a scale transform) so the vector stays sharp
   and lands pixel-identical to the hero wordmark — no flash on the swap. */
.loader--handoff .loader__mark.is-flying {
  transition: left 1000ms cubic-bezier(0.65, 0, 0.35, 1), top 1000ms cubic-bezier(0.65, 0, 0.35, 1), width 1000ms cubic-bezier(0.65, 0, 0.35, 1);
}
html.is-handoff #wordmark { visibility: hidden; }
/* Rest of the landing page stays hidden until the logo lands, then eases in one by one */
html.is-handoff .nav, html.is-handoff .hero__bio, html.is-handoff .hero__contact,
html.is-handoff .works, html.is-handoff .footer { opacity: 0; }
html.is-intro .nav          { animation: intro-fade 1400ms cubic-bezier(0.65, 0, 0.35, 1) both; }
html.is-intro .hero__bio    { animation: intro-rise 1600ms cubic-bezier(0.65, 0, 0.35, 1) 300ms both; }
/* Bio disciplines: text roll on hover — the word slides up out of its mask and an italic copy rolls in from below */
.skill { display: inline-block; vertical-align: top; clip-path: inset(0 -0.3em); } /* clips top/bottom only, so italics aren't cut at the sides */
.skill > span { display: inline-block; position: relative; transition: transform 500ms cubic-bezier(0.65, 0, 0.35, 1); }
.skill > span::after { content: attr(data-text); content: attr(data-text) / ""; /* "/ ''" stops screen readers reading it twice */ position: absolute; left: 0; top: 100%; font-style: italic; white-space: nowrap; }
.skill:hover > span { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { .skill > span { transition: none; } }
html.is-intro .hero__contact{ animation: intro-rise 1600ms cubic-bezier(0.65, 0, 0.35, 1) 550ms both; }
html.is-intro .works,
html.is-intro .footer       { animation: intro-rise 1600ms cubic-bezier(0.65, 0, 0.35, 1) 800ms both; }
@keyframes intro-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes intro-rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.loader__l { transform: translateY(105%); animation: letter-up 800ms cubic-bezier(0.65, 0, 0.35, 1) forwards; animation-delay: calc(var(--i) * 80ms + 150ms); }
@keyframes letter-up { to { transform: translateY(0); } }
@keyframes loader-out { to { transform: translateY(-100%); visibility: hidden; } }
html.is-loading { overflow: hidden; }
@media (max-width: 720px) {
  .loader__mark { width: 60%; }
}
@media (prefers-reduced-motion: reduce) {
  .loader__l { animation: none; transform: none; }
  .loader { animation-duration: 1ms; animation-delay: 900ms; }
}

.nav__mark { fill: currentColor; } /* logo follows the nav's blended colour */

/* ---------- Nav hover: the "M" stretches into the wide M (Figma M_Animation) — animated in nav.js; Works / About get an underline ---------- */

/* ---------- Custom cursor (Figma: 01_Cursor, #9AFFEB) ----------
   Mint on light areas (multiply: tints what is underneath), pink #FFA6F0 on dark areas
   (screen: glows over dark pictures). Only on devices with a real mouse. */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
  .cursor {
    display: block; position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none;
    width: 30px; height: 30px; margin: -15px 0 0 -15px;
    mix-blend-mode: multiply;
    opacity: 0; transition: opacity 300ms cubic-bezier(0.65, 0, 0.35, 1);
  }
  .cursor.is-dark { mix-blend-mode: screen; }
  .cursor.is-visible { opacity: 1; }
  .cursor__dot {
    position: absolute; left: 50%; top: 50%; translate: -50% -50%;
    width: 30px; height: 30px; border-radius: 15px; background: #9AFFEB;
    transition: transform 350ms cubic-bezier(0.65, 0, 0.35, 1), background-color 300ms cubic-bezier(0.65, 0, 0.35, 1),
                width 400ms cubic-bezier(0.65, 0, 0.35, 1), height 400ms cubic-bezier(0.65, 0, 0.35, 1), border-radius 400ms cubic-bezier(0.65, 0, 0.35, 1);
  }
  .cursor.is-dark .cursor__dot { background: #FFA6F0; }
  .cursor.is-link .cursor__dot { transform: scale(1.5); }  /* over anything clickable */
  .cursor.is-down .cursor__dot { transform: scale(0.85); } /* while pressing */
}

/* Live Bangkok time under "BKK, TH" */
.nav__loc { text-align: right; }
.nav__time { display: block; font-variant-numeric: tabular-nums; } /* digits keep equal width so the clock doesn't jiggle */

/* ---------- About page: dark version (Figma: black page, white text, white footer) ---------- */
.page--dark { background: #000; color: #fff; }
body:has(.page--dark) { background: #000; }          /* no white flash around the page while it slides in */
.page--dark .divider { filter: invert(1); }          /* dashed line turns white */
.page--dark .footer { background: #fff; color: #000; }

/* ---------- Cursor speech bubble (Figma: 01_Hello_Bubble) over elements with data-cursor (About portrait) ----------
   The circle morphs into a pink pill (40px tall, fully rounded, #FFA6F0) with a tail at the bottom-left whose tip
   sits exactly on the mouse pointer. Text: Hanken Grotesk SemiBold 20px, black, centred. */
@media (hover: hover) and (pointer: fine) {
  .cursor__dot { transition-property: transform, background-color, width, height, border-radius, translate; transition-duration: 350ms, 300ms, 400ms, 400ms, 400ms, 400ms; transition-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
  .cursor__label {
    position: absolute; left: 50%; top: 50%; translate: -50% -50%;
    font-family: "Hanken Grotesk", system-ui, sans-serif; font-weight: 600; font-size: 20px; line-height: 1; color: #000; white-space: nowrap;
    min-width: 77px; text-align: center;                            /* Figma text box is 77px wide → bubble exactly 153px */
    opacity: 0; scale: 0.8;
    transition: opacity 250ms cubic-bezier(0.65, 0, 0.35, 1), scale 400ms cubic-bezier(0.65, 0, 0.35, 1);
  }
  .cursor__dot::after {                                             /* the tail (Figma Vector 27: 54×18, joined to the pill) */
    content: ""; position: absolute; left: 10px; top: calc(100% - 2px); width: 54px; height: 18px;
    background: inherit; clip-path: polygon(32.38% 0, 0 100%, 100% 0);
    opacity: 0; transition: opacity 250ms cubic-bezier(0.65, 0, 0.35, 1);
  }
  .cursor.is-label { mix-blend-mode: normal; }                      /* solid bubble so the word stays readable */
  .cursor.is-label .cursor__dot {
    transform: none; width: var(--label-w, 153px); height: 40px; border-radius: 20px; background: #FFA6F0;
    translate: -10px -56px;                                       /* tail tip lands on the pointer */
    transform-origin: 10px 56px;
  }
  .cursor.is-label .cursor__dot::after { opacity: 1; transition-delay: 150ms; }
  .cursor.is-label.is-down .cursor__dot { transform: scale(0.95); }
  .cursor.is-label .cursor__label { opacity: 1; scale: 1; transition-delay: 120ms, 0ms; }
}

/* ---------- About portrait: grows on hover (from its top-left corner, so it stays clear of the nav and ends just above the bio) ---------- */
.tile--grow { transform-origin: left top; transition: transform 600ms cubic-bezier(0.65, 0, 0.35, 1); z-index: 1; }
@media (hover: hover) { .tile--grow:hover { transform: scale(1.3); } }
@media (prefers-reduced-motion: reduce) { .tile--grow { transition: none; } }

/* ---------- Landing hero replays its intro when you scroll back up to it (class set in nav.js) ---------- */
.hero.is-replay-mark .hero__mark { overflow: hidden; } /* letters rise out of the wordmark's own box, like the loader */
.hero.is-replay-mark .hero__l { animation: letter-up-from 900ms cubic-bezier(0.65, 0, 0.35, 1) both; animation-delay: calc(var(--i) * 70ms); }
.hero.is-replay .hero__bio     { animation: intro-rise 1300ms cubic-bezier(0.65, 0, 0.35, 1) 350ms both; }
.hero.is-replay .hero__contact { animation: intro-rise 1300ms cubic-bezier(0.65, 0, 0.35, 1) 550ms both; }
@keyframes letter-up-from { from { transform: translateY(105%); } to { transform: translateY(0); } }

/* ---------- Nav links: underline draws in from the left on hover, and stays under the page you're on (aria-current="page") ---------- */
.nav__links a {
  padding-bottom: 0.12em;
  background: linear-gradient(currentColor, currentColor) no-repeat right bottom / 0% 1px; /* leaves toward the right */
  transition: background-size 400ms cubic-bezier(0.65, 0, 0.35, 1);
}
.nav__links a:hover, .nav__links a[aria-current="page"] { background-position: left bottom; background-size: 100% 1px; }
@media (prefers-reduced-motion: reduce) { .nav__links a { transition: none; } }

/* ---------- Scroll reveal ([data-reveal], e.g. the About bio): rises in every time it scrolls into view ---------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1000ms cubic-bezier(0.65, 0, 0.35, 1), transform 1200ms cubic-bezier(0.65, 0, 0.35, 1); }
.reveal.is-in { opacity: 1; transform: none; }


/* Thai text (e.g. นฤมิตข้ามสมุทร on the About page) uses Google Sans, as in Figma — loaded on about.html */
[lang="th"] { font-family: "Google Sans", sans-serif; }

/* ---------- "download CV": grows a little on hover (same feel as the nav logo) ---------- */
.grow-hover { transform-origin: left center; transition: transform 400ms cubic-bezier(0.65, 0, 0.35, 1); }
.grow-hover:hover { transform: scale(1.15); }
@media (prefers-reduced-motion: reduce) { .grow-hover { transition: none; } }

/* ---------- Archives page (Figma: 01_Archives Page) — scattered film photos on black ---------- */
.arc__title { text-align: center; font-weight: 500; }
.arc .tile { background: #111; }                  /* dark placeholder while a photo loads */
.tile--flip > img { transform: scaleX(-1); }      /* mirrored in Figma */
@media (max-width: 720px) {
  .arc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
  .arc .arc__title { grid-column: 1 / -1; text-align: center; margin-bottom: 8px; }
}
/* Fade in on scroll: each Archives photo rises in as it comes into view, staggered left → right by its position */
.arc .tile.reveal { transform: translateY(12px); transition-duration: 700ms, 800ms; transition-delay: calc(var(--x) * 0.08ms); } /* gentler than the default reveal */
.arc .tile.reveal.is-in { transform: none; }
.arc .tile { cursor: pointer; }

/* Full-screen photo viewer (Archives) */
html.is-lightbox { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.95);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 350ms cubic-bezier(0.65, 0, 0.35, 1), visibility 0s 350ms;
}
.lightbox.is-open { opacity: 1; visibility: visible; transition: opacity 350ms cubic-bezier(0.65, 0, 0.35, 1); }
.lightbox__img {
  max-width: 84vw; max-height: 82vh; width: auto; height: auto; object-fit: contain;
  scale: 0.96; transition: scale 500ms cubic-bezier(0.65, 0, 0.35, 1), opacity 250ms ease;
}
.lightbox.is-open .lightbox__img { scale: 1; }
.lightbox__img.is-swapping { opacity: 0; }
.lightbox__img.is-flip { transform: scaleX(-1); }
.lightbox__btn {
  position: absolute; background: none; border: 0; padding: 12px; color: #fff; cursor: pointer;
  font: 500 14px "Hanken Grotesk", sans-serif;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 0.2em; transition: text-decoration-color 250ms;
}
.lightbox__btn:hover, .lightbox__btn:focus-visible { text-decoration-color: currentColor; outline: none; }
.lightbox__close { top: 16px; right: 38px; }
.lightbox__prev { left: 38px; top: 50%; translate: 0 -50%; }
.lightbox__next { right: 38px; top: 50%; translate: 0 -50%; }
.lightbox__count { position: absolute; bottom: 24px; left: 50%; translate: -50% 0; color: #fff; font-size: 14px; font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .lightbox__img { max-width: 100vw; max-height: 74vh; }
  .lightbox__prev { left: 8px; top: auto; bottom: 14px; translate: none; }
  .lightbox__next { right: 8px; top: auto; bottom: 14px; translate: none; }
  .lightbox__close { right: 12px; }
}
@media (prefers-reduced-motion: reduce) { .lightbox, .lightbox.is-open, .lightbox__img { transition: none; } }

/* ---------- Project page: left text sticks while the images scroll, until the last image ends (just before More Works) ----------
   .iw-side is the invisible track from Figma (x 50, y 148, 430 wide, down to the bottom of the last still); the text inside it is sticky. */
.iw-side { position: absolute; left: calc(50 * var(--u)); top: calc(148 * var(--u)); width: calc(544 * var(--u)); height: calc(var(--side-h, 4563) * var(--u)); } /* runs from y 148 to the bottom of the last image (--side-h set per page) */
.iw-side__inner { position: sticky; top: calc(148 * var(--u)); height: calc(var(--inner-h, 508) * var(--u)); }
@media (max-width: 720px) { .iw-side, .iw-side__inner { display: contents; } } /* phones: simple stacked layout */

/* ---------- Work pages (Figma 01–15_Individual Work Page) ---------- */
.wk-title { font-size: calc(24 * var(--u)); font-weight: 600; width: calc(544 * var(--u)); line-height: normal; }  /* SemiBold 24 */
.wk-sub   { font-size: calc(16 * var(--u)); font-weight: 500; line-height: normal; white-space: nowrap; }        /* Medium 16 */
.wk-desc  { font-size: calc(14 * var(--u)); font-weight: 300; width: calc(430 * var(--u)); line-height: normal; } /* Light 14 */
.wk-desc strong { font-weight: 600; }
.wk-desc--side { width: calc(var(--w) * var(--u)); }
.wk-label { font-size: calc(14 * var(--u)); font-weight: 300; line-height: normal; }                               /* Light 14 */
.wk-value { font-size: calc(14 * var(--u)); font-weight: 500; line-height: normal; white-space: nowrap; }             /* Medium 14, one line per name (Figma line breaks kept as <br>) */
.wk .tile { background: transparent; }
@media (max-width: 720px) {
  .wk-title { font-size: 22px; } .wk-sub { font-size: 15px; white-space: normal; }
  .wk-desc, .wk-label, .wk-value { font-size: 13px; width: auto; }
}
