/* GLN hero 01 · Still air */

:root {
  /* layout unit: 1px up to 1440, 1.5px at 2560; running text grows to 1.3px */
  --u: clamp(1px, calc(1px + (100vw - 1440px) / 2240), 1.5px);
  --t: clamp(1px, calc(1px + (100vw - 1440px) / 3733), 1.3px);
  --gut: max(20px, 5.4vw);
  --hdr: calc(96 * var(--u));

  --room: #20262A;
  --room-deep: #161A1D;
  --ink: #ECE8E1;
  --ink-2: #B9C0C5;
  --ink-3: #939CA2;
  --line: rgb(230 225 216 / .2);
  --line-2: rgb(230 225 216 / .34);
  --paper: #E6E1D8;

  --serif: "Newsreader", "Newsreader Fallback", "Times New Roman", serif;
  --sans: "Public Sans", "Public Sans Fallback", Arial, sans-serif;
  --ease-out: cubic-bezier(.16, .84, .24, 1);
  --ease-io: cubic-bezier(.62, 0, .2, 1);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--room-deep); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--room-deep);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: calc(17 * var(--t));
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; }
a { color: inherit; }
p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; z-index: 20; left: var(--gut); top: 10px;
  padding: 10px 16px; background: var(--ink); color: #15191c; text-decoration: none; border-radius: 4px;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 3px; }

/* ---------- header ---------- */
.site-header {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: calc(36 * var(--u));
  height: var(--hdr);
  padding: 0 var(--gut);
}
.wordmark {
  margin-right: auto;
  font-family: var(--serif);
  font-weight: 400;
  font-variation-settings: "opsz" 24;
  font-size: calc(27 * var(--u));
  letter-spacing: .06em;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 0;
}
.nav { display: flex; gap: calc(34 * var(--u)); }
.nav a {
  color: var(--ink-2); text-decoration: none;
  font-size: calc(15 * var(--t));
  padding: 12px 0;
  transition: color .25s;
}
.nav a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: calc(52 * var(--u));
  padding: 0 calc(26 * var(--u));
  border-radius: 999px;
  background: var(--paper);
  color: #171b1e;
  font: 500 calc(16 * var(--t)) / 1 var(--sans);
  letter-spacing: .005em;
  text-decoration: none;
  transition: background-color .25s, color .25s;
}
.btn:hover { background: #fff8ee; }
.btn-quiet {
  min-height: calc(44 * var(--u));
  padding: 0 calc(20 * var(--u));
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: calc(15 * var(--t));
}
.btn-quiet:hover { background: rgb(230 225 216 / .08); }
.link {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-2);
  text-decoration-thickness: 1px;
  text-underline-offset: .35em;
  transition: text-decoration-color .25s;
}
.link:hover { text-decoration-color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  --tip-x: 64%;
  --tip-y: 73%;
  --s: max(1px, calc(1px + (100svh - 900px) / 740));   /* incense scale: 1 at 900 tall, ~1.5 at 1271 */
  position: relative;
  min-height: max(100svh, 560px);
  overflow: hidden;
  isolation: isolate;
  touch-action: pan-y pinch-zoom;   /* a sideways drag reaches the smoke; vertical still scrolls */
  /* The room. The shader in smoke.js paints exactly these gradients; keep them in sync. */
  background-color: var(--room-deep);
  background-image:
    radial-gradient(55% 85% at -8% 38%, rgb(200 212 222 / .1), rgb(200 212 222 / 0)),
    radial-gradient(120% 95% at 58% 44%, #20262A 0%, #1F2529 38%, #1A1F22 72%, #161A1D 100%);
}
.scene { position: absolute; inset: 0; z-index: 0; }
.poster {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: var(--tip-x) var(--tip-y);
  opacity: 0;
  transition: opacity .45s ease;
}
html:not(.live) .poster-gln { background-image: url(img/still-gln-1600.webp); opacity: 1; }
html:not(.live) .hero:has(#air-ac:checked) .poster-ac { background-image: url(img/still-ac-1600.webp); opacity: 1; }
@media (min-width: 1700px) {
  html:not(.live) .poster-gln { background-image: url(img/still-gln.webp); }
  html:not(.live) .hero:has(#air-ac:checked) .poster-ac { background-image: url(img/still-ac.webp); }
}
.smoke {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0;
  transition: opacity .3s ease;
}
.smoke.on { opacity: 1; }
html.poster-render .smoke { transition: none; }

/* the incense stick, drawn in CSS so it's there at first paint */
.incense { position: absolute; left: var(--tip-x); top: var(--tip-y); width: 0; height: 0; z-index: 1; }
.stick {
  position: absolute;
  left: calc(-1.3 * var(--s)); top: calc(1 * var(--s));
  width: calc(2.6 * var(--s));
  height: 62vh;
  transform-origin: 50% 0;
  transform: rotate(3.2deg);
  border-radius: 1px;
  background:
    linear-gradient(180deg, #8d8883 0, #6a6560 calc(3 * var(--s)), #3a3734 calc(7 * var(--s)), rgb(18 19 20 / 0) calc(12 * var(--s))),
    linear-gradient(90deg, #403f3d 0, #1b1b1b 55%, #0f1011 100%);
}
.fire { position: absolute; left: 0; top: 0; }
.ember {
  position: absolute;
  left: calc(-2.4 * var(--s)); top: calc(-2.2 * var(--s));
  width: calc(4.8 * var(--s)); height: calc(5.6 * var(--s));
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(closest-side, #fff0d2 0, #ffc27a 30%, #ff7b2c 62%, rgb(230 80 20 / 0) 100%);
}
.glow {
  position: absolute;
  left: calc(-44 * var(--s)); top: calc(-44 * var(--s));
  width: calc(88 * var(--s)); height: calc(88 * var(--s));
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 150 70 / .30), rgb(255 120 50 / .10) 32%, rgb(255 110 40 / .03) 62%, rgb(255 110 40 / 0));
  mix-blend-mode: screen;
  transition: transform 1.2s var(--ease-out);
}
.hero:has(#air-ac:checked) .glow { transform: scale(1.35); }
.hero:has(#air-ac:checked) .ember { filter: brightness(1.15); }

/* note where the draft comes from (air-conditioner state only) */
.draft-note {
  position: absolute; z-index: 1;
  right: var(--gut);
  top: calc(var(--hdr) + 22 * var(--u));
  display: flex; flex-direction: column; align-items: flex-end; gap: calc(10 * var(--u));
  font-size: calc(14 * var(--t));
  letter-spacing: .01em;
  color: var(--ink-3);
  opacity: 0;
  transition: opacity .5s ease;
}
.draft-line {
  width: calc(96 * var(--u)); height: calc(64 * var(--u));
  margin-right: calc(4 * var(--u));
  overflow: visible;
}
.draft-line path {
  fill: none; stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke;
  stroke-dasharray: 3 7;
}
.hero:has(#air-ac:checked) .draft-note { opacity: 1; transition-delay: .25s; }
.motion .hero:has(#air-ac:checked) .draft-line path { animation: draft-dash 1.4s linear infinite; }
@keyframes draft-dash { to { stroke-dashoffset: -20; } }

/* copy */
.hero-copy {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: inherit;
  width: min(100%, calc(var(--gut) + 50vw));
  padding: calc(var(--hdr) + 40 * var(--u)) var(--gut) calc(52 * var(--u));
  pointer-events: none;
}
.hero-copy > * { pointer-events: auto; }
.h1 {
  margin: 0 0 calc(30 * var(--u)) -0.045em;
  font-family: var(--serif);
  font-weight: 300;
  font-variation-settings: "opsz" 72;
  font-size: min(calc(196 * var(--u)), 13.6vw, 26svh);
  line-height: .92;
  letter-spacing: -.028em;
  color: var(--ink);
  white-space: nowrap;
}
.h1-line-mask { padding-block: .16em .12em; margin-block: -.16em -.12em; }
.sub {
  max-width: 29em;
  font-size: calc(18 * var(--t));
  line-height: 1.55;
  color: var(--ink-2);
  text-wrap: pretty;
}
.actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: calc(14 * var(--u)) calc(30 * var(--u));
  margin-top: calc(30 * var(--u));
}
.actions .link { font-size: calc(16 * var(--t)); }

/* the air toggle */
.air {
  margin: calc(52 * var(--u)) 0 0; padding: 0; border: 0; min-width: 0;
}
.air legend {
  padding: 0; margin-bottom: calc(12 * var(--u));
  font-size: calc(14 * var(--t));
  color: var(--ink-3);
}
.seg {
  position: relative;
  display: inline-grid; grid-template-columns: auto auto;
  padding: 4px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line);
  background: rgb(22 26 29 / .35);
}
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.seg label {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: calc(10 * var(--u));
  min-height: max(44px, calc(46 * var(--u)));
  padding: 0 calc(20 * var(--u)) 0 calc(16 * var(--u));
  border-radius: 999px;
  font-size: calc(15.5 * var(--t));
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  transition: color .35s ease, background-color .35s ease;
}
.seg label svg { width: calc(12 * var(--u)); height: calc(16 * var(--u)); overflow: visible; }
.seg label path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.seg input:checked + label { background: var(--paper); color: #171b1e; }
.seg label:hover { color: var(--ink); }
.seg input:checked + label:hover { color: #171b1e; }
.seg input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: 3px; }
/* with JS, one thumb slides between the two options */
.seg.has-thumb input:checked + label { background: transparent; }
.seg .thumb {  /* spans the control and is clipped to the checked option, so it moves without re-layout */
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; right: 0;
  clip-path: inset(0 calc(100% - var(--tx, 4px) - var(--tw, 0px)) 0 var(--tx, 4px) round 999px);
  background: var(--paper);
  display: none;
}
.seg.has-thumb .thumb { display: block; }
.seg.has-thumb.ready .thumb { transition: clip-path .5s var(--ease-io); }

.readout {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px calc(12 * var(--u));
  margin-top: calc(14 * var(--u));
  font-size: calc(15 * var(--t));
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.readout .ro-wrap { display: grid; }
.ro { transition: opacity .35s ease, visibility .35s; }
.ro-ac { display: none; }
.hero:has(#air-ac:checked) .ro-gln { display: none; }
.hero:has(#air-ac:checked) .ro-ac { display: inline; }
.tag {
  font-size: calc(12.5 * var(--t));
  letter-spacing: .02em;
  color: var(--ink-3);
  padding: 1px 7px 2px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- intro (CSS first, so nothing waits on a CDN) ---------- */
.js.motion .site-header,
.js.motion .reveal { opacity: 0; }
.js.motion .h1 { opacity: 0; }
.js.motion.go .site-header { animation: fade .5s .02s var(--ease-out) both; }
.js.motion.go .sub { animation: fade .6s .12s var(--ease-out) both; }
.js.motion.go .actions { animation: fade .6s .2s var(--ease-out) both; }
.js.motion.go .air { animation: fade .6s .28s var(--ease-out) both; }
/* fallback if GSAP/SplitText never arrive; main.js cancels it when it takes over */
.js.motion.go .h1 { animation: fade .6s .45s ease both; }
.js.motion .h1.is-split { opacity: 1; animation: none; }
.js.motion .fire { opacity: 0; }
.js.motion.go .fire { animation: ember-up 1.1s .05s var(--ease-out) both; }
.js.motion .glow { animation: flicker 3.9s 1.2s infinite; }
.js.motion .ember { animation: flicker-core 2.7s 1.2s infinite; }
.js.motion .hero:has(#air-ac:checked) .glow { animation-duration: 1.7s; }
.js.motion .hero:has(#air-ac:checked) .ember { animation-duration: 1.1s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ember-up { 0% { opacity: 0; filter: brightness(.4); } 35% { opacity: .75; } 100% { opacity: 1; filter: brightness(1); } }
@keyframes flicker {
  0% { opacity: 1; } 11% { opacity: .84; } 19% { opacity: .96; } 33% { opacity: .9; } 46% { opacity: 1; }
  58% { opacity: .82; } 64% { opacity: .93; } 79% { opacity: .88; } 90% { opacity: .99; } 100% { opacity: 1; }
}
@keyframes flicker-core { 0%, 100% { opacity: 1; } 23% { opacity: .9; } 51% { opacity: .97; } 72% { opacity: .87; } }

/* ---------- follow-on ---------- */
.more {
  position: relative;
  padding: calc(150 * var(--u)) var(--gut) calc(120 * var(--u));
  background: linear-gradient(180deg, #161A1D, #14181A);
}
.more-title {
  max-width: 17em;
  margin: 0 0 calc(34 * var(--u));
  font-family: var(--serif);
  font-weight: 300;
  font-variation-settings: "opsz" 60;
  font-size: min(calc(58 * var(--u)), 8.6vw);
  line-height: 1.06;
  letter-spacing: -.012em;
  color: var(--ink);
  text-wrap: balance;
}
.more p { max-width: 34em; font-size: calc(18 * var(--t)); line-height: 1.6; }
.more .back { margin-top: calc(40 * var(--u)); }

.site-footer {
  padding: calc(30 * var(--u)) var(--gut) calc(40 * var(--u));
  background: #14181A;
  border-top: 1px solid rgb(230 225 216 / .08);
  font-size: calc(14 * var(--t));
  color: var(--ink-3);
}

/* ---------- stacked layout: phones and portrait tablets ---------- */
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  :root { --hdr: 72px; }
  /* the tip sits at 37% of the first screen, whatever height the copy gives the hero */
  .hero { --tip-x: 50%; --tip-y: calc(max(100svh, 560px) * .37); --s: 1px; }
  .poster {
    bottom: auto; height: max(100svh, 560px);
    background-position: 50% 37%;
    -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent);
    mask-image: linear-gradient(180deg, #000 80%, transparent);
  }
  .nav { display: none; }
  .site-header { gap: 16px; }
  .wordmark { font-size: 24px; }
  .stick {
    height: 8svh;
    -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent);
    mask-image: linear-gradient(180deg, #000 45%, transparent);
  }
  .hero-copy {
    width: 100%;
    padding: calc(max(100svh, 560px) * .37 + 8svh + 16px) var(--gut) 24px;
  }
  .h1 { font-size: min(19vw, 15svh, 136px); margin-bottom: 16px; }
  .sub { font-size: 16px; line-height: 1.5; max-width: 32em; }
  .actions { margin-top: 20px; gap: 8px 24px; }
  .btn { min-height: 48px; }
  .air { margin-top: 26px; }
  .draft-note { top: calc(var(--hdr) + 6px); }
  .more { padding: 96px var(--gut) 88px; }
}
@media (min-width: 600px) and (max-aspect-ratio: 1/1) {
  .sub { font-size: 18px; max-width: 30em; }
}
@media (max-width: 380px) {
  .seg label { padding: 0 14px 0 12px; gap: 8px; }
}

/* posters for the stacked layout */
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  html:not(.live) .poster-gln { background-image: url(img/still-gln-tall.webp); }
  html:not(.live) .hero:has(#air-ac:checked) .poster-ac { background-image: url(img/still-ac-tall.webp); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ---------- language switch ---------- */
.lang { display: inline-flex; align-items: center; flex: none; margin-right: calc(-8 * var(--u)); }
.lang__b {
  min-height: 44px; min-width: 40px; padding: 0 6px;
  background: none; border: 0; cursor: pointer;
  font: 400 calc(14 * var(--t)) / 1 var(--sans);
  letter-spacing: .02em;
  color: var(--ink-3);
  transition: color .25s;
}
.lang__b--zh { font-family: "GLN Sans SC", "GLN SC Fallback", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif; letter-spacing: 0; }
.lang__b:hover, .lang__b[aria-pressed="true"] { color: var(--ink); }
.lang__b[aria-pressed="true"] { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: .45em; text-decoration-thickness: 1px; }
.lang__sep { color: var(--ink-3); opacity: .6; font-size: calc(13 * var(--t)); }
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  .site-header { gap: 8px; }
  .lang { margin-right: 4px; }
  .lang__b { min-width: 36px; padding: 0 4px; }
}

/* ---------- Chinese ---------- */
:root { --zh-sans: "GLN Sans SC", "GLN SC Fallback", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", sans-serif;
        --zh-serif: "GLN Serif SC", "Songti SC", "SimSun", var(--zh-sans); }
html:lang(zh) { --sans: "Public Sans", "Public Sans Fallback", var(--zh-sans); }
html:lang(zh) body { line-height: 1.8; letter-spacing: 0; line-break: strict; }
html:lang(zh) .h1 {
  font-family: "Newsreader", var(--zh-serif);
  font-size: min(calc(132 * var(--u)), 9.2vw, 19svh);
  line-height: 1.3; letter-spacing: 0; margin-left: 0;
}
html:lang(zh) .sub { max-width: 27em; line-height: 1.85; }
html:lang(zh) .draft-note, html:lang(zh) .tag, html:lang(zh) .btn { letter-spacing: 0; }
html:lang(zh) .more-title {
  font-family: "Newsreader", var(--zh-serif);
  font-size: min(calc(46 * var(--u)), 7vw);
  line-height: 1.38; letter-spacing: 0; max-width: 14em;
}
html:lang(zh) .more p { max-width: 30em; line-height: 1.85; }
html:lang(zh) .readout { line-height: 1.6; }
@media (max-width: 899px), (max-aspect-ratio: 1/1) {
  html:lang(zh) .h1 { font-size: min(14.5vw, 11svh, 104px); }
  html:lang(zh) .sub { font-size: 16px; line-height: 1.8; }
}
