/* =====================================================================
   SIRIN GUNKLOY — Letterform Archive
   Shared design system
   ===================================================================== */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..900;1,9..144,300..900&family=Space+Grotesk:wght@300..700&family=Noto+Serif+Thai:wght@200..900&family=Playpen+Sans:wght@400;500;600&family=Playpen+Sans+Thai:wght@400;500;600&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* Palette — monochrome gallery: black on gallery-white, neutral greys */
  --ink:        #141414;
  --ink-soft:   #1f1f1f;
  --paper:      #f7f7f5;   /* gallery white */
  --paper-dim:  #ececea;
  --vermilion:  #141414;   /* "accent" is now black — fully monochrome */
  --gold:       #9a9a9a;   /* mid grey (was warm gold) */
  --muted:      #8c8c8c;
  /* Decorative hairlines removed for a cleaner, line-free look (client 2026-06-20).
     Kept as tokens (now transparent) so every divider/frame/grid-seam vanishes at
     once and can be reinstated by restoring these two values. */
  --line:       transparent;
  --line-dark:  transparent;

  /* Semantic (dark gallery default) */
  --bg:        var(--ink);
  --fg:        var(--paper);
  --fg-dim:    var(--muted);
  --accent:    var(--vermilion);
  --hairline:  var(--line);

  /* Type */
  --serif:  'Fraunces', 'Noto Serif Thai', Georgia, serif;
  --thai:   'Noto Serif Thai', 'Fraunces', serif;
  --grotesk:'Space Grotesk', system-ui, -apple-system, sans-serif;
  /* Reading/body face — Playpen Sans, a typeface Sirin contributed to
     (Latin) with its Thai sibling for Thai runs */
  --body:   'Playpen Sans', 'Playpen Sans Thai', system-ui, -apple-system, sans-serif;

  /* Fluid type scale */
  --fs-mega:   clamp(3.5rem, 14vw, 16rem);
  --fs-h1:     clamp(2.6rem, 8vw, 7rem);
  --fs-h2:     clamp(2rem, 5vw, 4.5rem);
  --fs-h3:     clamp(1.4rem, 3vw, 2.4rem);
  --fs-body:   clamp(1rem, 1.05vw, 1.18rem);
  --fs-small:  0.78rem;

  /* Spacing / layout */
  --pad-x:     clamp(1.5rem, 6.5vw, 9rem);
  --maxw:      1720px;
  --ease:      cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io:   cubic-bezier(0.65, 0, 0.35, 1);
  --nav-h:     clamp(64px, 8vh, 92px);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
body {
  font-family: var(--grotesk);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input[type="range"], input[type="checkbox"], input[type="radio"] { accent-color: var(--ink); }
ul { list-style: none; }
::selection { background: var(--accent); color: var(--paper); }

/* ---------- Typographic helpers ---------- */
.serif   { font-family: var(--serif); }
.thai    { font-family: var(--thai); font-weight: 500; }
.kicker {
  font-family: var(--grotesk);
  font-size: var(--fs-small);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
/* eyebrow dash removed for the line-free look */
.kicker::before { content: none; }
.accent { color: var(--accent); }

/* ---------- Reading/body type: Playpen Sans (the studio's own face) ----------
   Applied to running text only — headings stay serif, UI labels stay grotesk.
   The second selector group re-points `.thai` runs inside reading content so
   Thai also renders in Playpen Sans Thai (via the --body fallback stack). */
p, .prose, .lede, .body-read,
.sheet__row dd, .arc-info__card dd,
.step p, .tl p, .map-loc__desc, .collab .nt, .contact-info p,
.font-item__meta, .arc-card__foot, .cmp-meta__title, .cmp-meta__dl dd, .desk__hint,
p .thai, .prose .thai, .lede .thai, .sheet__row dd .thai, .arc-info__card dd .thai,
.step p .thai, .tl p .thai, .map-loc__desc .thai, .collab .nt .thai, .contact-info p .thai,
.arc-card__foot .thai, .cmp-meta__title .thai, .desk__hint .thai {
  font-family: var(--body);
}

/* Reveal-on-scroll primitives (driven by GSAP / IntersectionObserver fallback) */
[data-reveal] { opacity: 0; transform: translateY(28px); }
.is-inview [data-reveal], [data-reveal].is-inview { opacity: 1; transform: none; }

/* ---------- Layout ---------- */
.shell { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad-x); }
section { position: relative; }

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed; top: 0; left: 0; width: 9px; height: 9px;
  background: var(--accent); border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 9999;
  mix-blend-mode: difference;
}
.cursor-ring {
  position: fixed; top: 0; left: 0; width: 42px; height: 42px;
  border: 1px solid var(--paper); border-radius: 50%;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 9998;
  transition: width .35s var(--ease), height .35s var(--ease), opacity .35s, background .35s, border-color .35s;
  mix-blend-mode: difference;
}
.cursor-ring.is-hover { width: 74px; height: 74px; background: rgba(241,236,225,0.08); }
.cursor-ring.is-hover::after {
  content: attr(data-label); position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 9px; letter-spacing: .15em;
  text-transform: uppercase; color: var(--paper);
}
.cursor, .cursor-ring { display: none; } /* utilitarian: native pointer like the reference archive */

/* ---------- Preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 10000; background: var(--ink);
  display: grid; place-items: center; color: var(--paper);
  transition: transform .7s var(--ease), opacity .5s var(--ease);
}
.preloader__inner { text-align: center; width: min(440px, 76vw); }
.preloader__glyph {
  font-family: var(--serif); font-weight: 300; line-height: 1;
  font-size: clamp(5rem, 22vw, 12rem); color: var(--paper);
}
.preloader__bar { height: 1px; background: rgba(247,247,245,.18); margin-top: 1.4rem; overflow: hidden; }
.preloader__bar > span { display: block; height: 100%; width: 0; background: var(--paper); }
.preloader__pct {
  display: flex; justify-content: space-between;
  font-size: var(--fs-small); letter-spacing: .2em; color: var(--muted); margin-top: .8rem;
}
/* CSS-driven reveal — slides away on `is-loaded` (no JS/GSAP rAF dependency) */
body.is-loaded .preloader { transform: translateY(-100%); opacity: 0; pointer-events: none; }

/* ---------- Top navigation ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 900; height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding-inline: var(--pad-x);
  mix-blend-mode: difference; color: var(--paper);
}
.nav__brand { font-family: var(--serif); font-size: 1.25rem; font-weight: 500; letter-spacing: -0.01em; }
.nav__brand small { font-family: var(--grotesk); font-size: .6rem; letter-spacing: .25em; display: block; opacity: .6; text-transform: uppercase; }
.nav__right { display: flex; align-items: center; gap: clamp(1rem, 2.5vw, 2.4rem); }
.lang-toggle { display: flex; gap: .35rem; font-size: var(--fs-small); letter-spacing: .12em; }
.lang-toggle button { opacity: .45; transition: opacity .3s; }
.lang-toggle button[aria-pressed="true"] { opacity: 1; }
.lang-toggle span { opacity: .35; }
.nav__menu-btn {
  display: flex; align-items: center; gap: .6rem; font-size: var(--fs-small);
  letter-spacing: .2em; text-transform: uppercase;
}
.nav__menu-btn .bars { position: relative; width: 24px; height: 8px; }
.nav__menu-btn .bars::before, .nav__menu-btn .bars::after {
  content: ""; position: absolute; left: 0; width: 100%; height: 1.5px; background: currentColor;
  transition: transform .4s var(--ease);
}
.nav__menu-btn .bars::before { top: 0; }
.nav__menu-btn .bars::after { bottom: 0; }
body.menu-open .nav__menu-btn .bars::before { transform: translateY(3px) rotate(45deg); }
body.menu-open .nav__menu-btn .bars::after { transform: translateY(-3px) rotate(-45deg); }

/* ---------- Fullscreen menu overlay ---------- */
.menu {
  position: fixed; inset: 0; z-index: 800; background: var(--ink-soft);
  display: grid; grid-template-columns: 1.4fr 1fr;
  clip-path: inset(0 0 100% 0); pointer-events: none;
}
body.menu-open .menu { pointer-events: auto; }
.menu__nav { padding: calc(var(--nav-h) + 4vh) var(--pad-x) 4vh; display: flex; flex-direction: column; justify-content: center; }
.menu__list { display: flex; flex-direction: column; gap: clamp(.4rem, 1.4vh, 1rem); }
.menu__item { overflow: hidden; }
.menu__link {
  font-family: var(--serif); font-size: clamp(2.2rem, 6vw, 5rem); font-weight: 350;
  line-height: 1.02; color: var(--paper); display: inline-flex; align-items: baseline; gap: 1rem;
  transition: color .4s, padding-left .5s var(--ease);
}
.menu__link .idx { font-family: var(--grotesk); font-size: .7rem; color: var(--muted); letter-spacing: .1em; }
.menu__link .th { font-family: var(--thai); font-size: .42em; color: var(--muted); }
.menu__link:hover { color: var(--accent); padding-left: 1.2rem; }
.menu__aside {
  border-left: 1px solid var(--line); padding: calc(var(--nav-h) + 4vh) var(--pad-x) 4vh;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1.6rem; color: var(--muted);
}
.menu__aside h4 { font-size: var(--fs-small); letter-spacing: .25em; text-transform: uppercase; color: var(--paper); margin-bottom: .6rem; }
.menu__aside a:hover { color: var(--accent); }
@media (max-width: 860px) { .menu { grid-template-columns: 1fr; } .menu__aside { display: none; } }

/* ---------- Buttons / links ---------- */
/* Line-free buttons: no stroke. Secondary = a soft tint of the current text
   colour (works on any light/dark background); primary (--solid) = filled ink. */
.btn {
  display: inline-flex; align-items: center; gap: .8em; padding: .9em 1.6em;
  border-radius: 100px; font-size: var(--fs-small);
  letter-spacing: .18em; text-transform: uppercase;
  background: color-mix(in srgb, currentColor 10%, transparent);
  transition: background .3s var(--ease), color .3s var(--ease), opacity .3s var(--ease);
}
.btn:hover { background: color-mix(in srgb, currentColor 20%, transparent); }
.btn--solid { background: var(--accent); color: var(--paper); }
.btn--solid:hover { background: var(--accent); opacity: .85; }

.link-underline { position: relative; display: inline-block; }
.link-underline::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .45s var(--ease);
}
.link-underline:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: var(--paper); padding: clamp(4rem, 10vh, 9rem) 0 2.5rem; border-top: 1px solid var(--line); }
.footer__cta { font-family: var(--serif); font-weight: 300; font-size: var(--fs-h2); line-height: 1.05; max-width: 16ch; }
.footer__cta a { color: var(--accent); }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; margin-top: clamp(3rem, 8vh, 6rem); }
.footer__col h5 { font-size: var(--fs-small); letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-bottom: 1rem; }
.footer__col li { margin-bottom: .5rem; }
.footer__col a:hover { color: var(--accent); }
.footer__bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: clamp(3rem, 7vh, 5rem); padding-top: 1.5rem; border-top: 1px solid var(--line); font-size: var(--fs-small); color: var(--muted); }
@media (max-width: 720px) { .footer__grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; white-space: nowrap; border-block: 1px solid var(--hairline); padding: 1.2rem 0; }
.marquee__track { display: inline-flex; gap: 3rem; will-change: transform; }
.marquee__track span { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 300; }
.marquee__track .dot { color: var(--accent); }

/* ---------- Section heading block ---------- */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; flex-wrap: wrap; margin-bottom: clamp(2rem, 6vh, 4rem); }
.section-head h2 { font-family: var(--serif); font-weight: 350; font-size: var(--fs-h2); line-height: 1.02; letter-spacing: -0.01em; }
.section-head .meta { text-align: right; color: var(--fg-dim); font-size: var(--fs-small); letter-spacing: .15em; text-transform: uppercase; }

/* ---------- Paper section variant ---------- */
.section--paper { background: var(--paper); color: var(--ink); --fg: var(--ink); --fg-dim: var(--muted); --hairline: var(--line-dark); }
.section--paper ::selection { background: var(--ink); color: var(--paper); }

/* ---------- Utility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

/* Lang visibility */
body[data-lang="th"] .i18n-en { display: none; }
body[data-lang="en"] .i18n-th { display: none; }
/* Menu links carry a standalone Thai label for EN mode; hide it in TH mode so it isn't doubled */
body[data-lang="th"] .menu__link > .th { display: none; }

/* Keep the nav brand subtitle on one line; drop it on the narrowest screens */
.nav__brand small { white-space: nowrap; }
@media (max-width: 560px) { .nav__brand small { display: none; } }
