/* CharlX Studio — the home page only (/ and /zh/).
   ---------------------------------------------------------------------------
   The app pages keep site.css. This file is the studio's own identity:

   - The page wears one of Huxle's twelve colours, a different one each day
     (studio.js). --day is the colour, --on-day is its measured ink from
     pool.js — never a derived "contrasting" colour, see pool.js header.
   - The apps are shown as paint chips: a field of colour, then a caption.
   - System typefaces only, nothing downloaded (CSP font-src 'self'). The
     display voice comes from weight and tracking, the labels from SF Mono. */

:root {
  --day: #C24A38;
  --on-day: #fff;
  --paper: #FFFFFF;
  --ink: #000000;
  --grey: #6E6E73;
  --line: #D2D2D7;
  --tint: #F5F5F7;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang TC", "Helvetica Neue", "Noto Sans TC", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --gut: clamp(16px, 4vw, 56px);
  --max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure { margin: 0; }

:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: 2px; }

.sr {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }
.mono {
  font: 500 12px/1.4 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Colour changes are the page's one motion. */
@media (prefers-reduced-motion: no-preference) {
  .hero, .contact, .piece-day, .swatch-field { transition: background-color .6s ease, color .6s ease; }
}

/* ── Top bar ─────────────────────────────────────────────────────────── */
.top {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  color: var(--on-day);
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 22px; padding-bottom: 22px;
}
.wordmark {
  font-weight: 800; font-size: 19px; letter-spacing: -.03em; text-decoration: none;
}
.wordmark span { font-weight: 400; }
.nav { display: flex; align-items: center; gap: clamp(14px, 2.4vw, 32px); font-size: 15px; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.nav .lang { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; }
.nav .lang i { font-style: normal; padding: 0 4px; opacity: .6; }
@media (max-width: 640px) { .nav .hide-s { display: none; } }

/* ── Hero: the page in today's colour ────────────────────────────────── */
.hero {
  background: var(--day);
  color: var(--on-day);
  min-height: 100svh;
  display: flex;
}
.hero .wrap {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-rows: 1fr auto;
  gap: 40px 48px;
  padding-top: 120px; padding-bottom: var(--gut);
}
.hero-words { grid-column: 1; grid-row: 1; align-self: end; }
.hero-tag { margin-bottom: clamp(20px, 3vw, 36px); }
.hero h1 {
  font-weight: 800;
  font-size: clamp(56px, 13.2vw, 210px);
  line-height: .86;
  letter-spacing: -.055em;
  margin-left: -.04em;
}
.hero h1 span { display: block; }
:lang(zh) .hero h1 { letter-spacing: -.02em; line-height: 1; font-size: clamp(56px, 14vw, 200px); }
.hero-lede {
  max-width: 30ch;
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.4;
  letter-spacing: -.01em;
  align-self: end;
}
:lang(zh) .hero-lede { max-width: 22em; }

/* The chips that repaint the page. Real buttons; ring marks the current. */
.repaint { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.repaint .mono { margin-right: 6px; }
.repaint button {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid var(--on-day); cursor: pointer;
  background: var(--c);
}
.repaint button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--day), 0 0 0 5px var(--on-day); }
.repaint button:focus-visible { outline-offset: 6px; }

/* The swatch: a paint chip naming the colour the page is wearing. */
.swatch {
  grid-column: 2; grid-row: 1 / span 2; align-self: start; margin-top: clamp(0px, 4vh, 48px);
  background: var(--paper); color: var(--ink);
  padding: 10px 10px 16px;
}
.swatch-field { background: var(--day); aspect-ratio: 5 / 4; }
.swatch-name { margin-top: 14px; font-weight: 800; font-size: 26px; letter-spacing: -.03em; line-height: 1.05; }
.swatch-name small { font-weight: 400; font-size: 17px; letter-spacing: 0; margin-left: 8px; color: var(--grey); }
.swatch dl { margin-top: 10px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font: 12px/1.6 var(--mono); }
.swatch dt { color: var(--grey); }
.swatch-why { margin-top: 12px; font-size: 13px; line-height: 1.45; color: var(--grey); }

@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; grid-template-rows: auto; }
  .hero-words, .swatch { grid-column: 1; grid-row: auto; }
  .swatch { margin-top: 0; }
  .swatch { width: 100%; display: grid; grid-template-columns: 96px 1fr; gap: 0 14px; padding: 10px; }
  .swatch-field { aspect-ratio: auto; grid-row: span 3; }
  .swatch-name { margin-top: 2px; font-size: 22px; }
  .swatch-why { display: none; }
}

/* ── Sections ────────────────────────────────────────────────────────── */
.sec { padding: clamp(80px, 11vw, 160px) 0; }
.sec-head {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 24px;
  padding-bottom: clamp(32px, 4vw, 56px);
}
.sec-head h2 {
  font-weight: 800; font-size: clamp(36px, 5.4vw, 80px);
  line-height: .95; letter-spacing: -.045em;
}
:lang(zh) .sec-head h2 { letter-spacing: -.01em; line-height: 1.1; }
.sec-head p:not(.mono) { margin-top: 16px; max-width: 46ch; color: var(--grey); }
@media (max-width: 760px) { .sec-head { grid-template-columns: 1fr; } }

/* ── Work: each app as a paint chip ──────────────────────────────────── */
.work { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); }
.piece { text-decoration: none; display: flex; flex-direction: column; }
.piece-huxle { grid-column: span 7; }
.piece-mote  { grid-column: span 5; }
.piece-tono  { grid-column: span 12; }
@media (max-width: 860px) { .piece-huxle, .piece-mote { grid-column: span 12; } }

.piece-art { position: relative; overflow: hidden; flex: 1; min-height: 0; }
.piece-huxle .piece-art, .piece-mote .piece-art { aspect-ratio: 4 / 5; }
.piece-tono .piece-art { aspect-ratio: 21 / 8; }
@media (max-width: 860px) { .piece-tono .piece-art { aspect-ratio: 4 / 3; } }

/* Huxle: the phone stands in today's colour. */
.piece-day { background: var(--day); }
.piece-huxle img {
  position: absolute; left: 50%; bottom: -14%; width: 50%;
  transform: translateX(-50%) rotate(-4deg);
  border-radius: 9% / 4.2%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08);
}
/* Mote: its own card on a grey field. */
.piece-mote .piece-art { background: #E8E8EA; }
.piece-mote img {
  position: absolute; left: 50%; top: 50%; width: 60%;
  transform: translate(-50%, -50%) rotate(3deg);
}
/* Tono: the eight lights its looks are sorted by, as stripes. */
.stripes { position: absolute; inset: 0; display: flex; margin: 0; padding: 0; list-style: none; }
.stripes li {
  flex: 1; background: var(--c); color: var(--on, #000);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: clamp(8px, 1.2vw, 16px);
  font: 500 11px/1.3 var(--mono); letter-spacing: .04em;
}
.stripes li b { font: 600 clamp(13px, 1.3vw, 17px)/1.2 var(--sans); letter-spacing: 0; writing-mode: vertical-rl; margin-bottom: 8px; }
@media (max-width: 860px) { .stripes li span { display: none; } }

.piece-cap {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: baseline;
  padding: 16px 0 0; border-top: 0;
}
.piece-name { font-weight: 800; font-size: clamp(28px, 3vw, 44px); letter-spacing: -.04em; line-height: 1; }
.piece-line { grid-column: 1; color: var(--grey); font-size: 17px; }
.piece-status { grid-column: 2; grid-row: 1; justify-self: end; }
.piece-go { grid-column: 2; grid-row: 2; justify-self: end; font-size: 15px; }
.piece:hover .piece-go { text-decoration: underline; text-underline-offset: 4px; }
.piece:hover .piece-art > * { transition: transform .5s ease; }
@media (prefers-reduced-motion: no-preference) {
  .piece-huxle:hover img { transform: translateX(-50%) rotate(0deg) translateY(-3%); }
  .piece-mote:hover img  { transform: translate(-50%, -50%) rotate(0deg); }
}
.piece:focus-visible { outline-offset: 6px; }

/* ── Claims ──────────────────────────────────────────────────────────── */
.claims-sec { background: var(--tint); }
.claims { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.claim {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px 24px;
  padding: 28px 0 32px; border-bottom: 1px solid var(--line);
}
.claim .mono { color: var(--grey); padding-top: 8px; }
.claim h3 { font-weight: 700; font-size: clamp(22px, 2.2vw, 30px); letter-spacing: -.025em; line-height: 1.15; }
.claim p:last-child { margin-top: 10px; max-width: 58ch; }
.claim-body { min-width: 0; }
@media (max-width: 760px) { .claim { grid-template-columns: 1fr; } }

/* ── Contact: back in today's colour ─────────────────────────────────── */
.contact { background: var(--day); color: var(--on-day); }
.contact p:not(.mono) { margin-top: 16px; max-width: 46ch; font-size: 19px; }
.contact .mailto {
  display: inline-block; margin-top: clamp(28px, 4vw, 56px);
  font-weight: 800; font-size: clamp(30px, 7vw, 112px);
  letter-spacing: -.05em; line-height: 1; text-decoration: none;
  overflow-wrap: anywhere;
  border-bottom: .06em solid currentColor;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.foot { padding: 28px 0 40px; font-size: 14px; color: var(--grey); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { text-decoration: none; color: var(--ink); }
.foot a:hover { text-decoration: underline; }
.repaint:has([data-chips]:empty) { display: none; }
