/* ============================================================================
   Glozzer marketing site — shared design system.

   Rebuilt from the blank shell. The look mirrors the app (frontend): the same
   grayscale Palette from `frontend/src/constants/theme.ts` and the same Fraunces
   wordmark, so glozzer.com and the app read as one product.

   V1 app is light-only (dark is shelved, spec §18), so this site deliberately
   commits to a single light look and paints backgrounds explicitly.

   Loaded by every page. Page-specific markup lives in each index.html;
   everything visual lives here.
   ============================================================================ */

/* ── Reset ────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

/* ── Brand wordmark face: the same Fraunces the app bundles (sign-in / sidebar).
   Static SemiBold (weight 600); the file is copied into this site's assets. ── */
@font-face {
  font-family: 'Fraunces';
  src: url('/assets/fonts/Fraunces_72pt-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens: sourced 1:1 from the app's single Palette (theme.ts). ─────────── */
:root {
  --surface: #FFFFFF;   /* page / card */
  --sunken:  #F7F8FA;   /* inset / quiet ground */
  --paper:   #FCFCFD;   /* lyric track (domain) */
  --ink:     #0D1220;   /* primary text + action colour */
  --ink2:    #3B424E;   /* secondary text */
  --muted:   #8A90A0;   /* hints / meta */
  --faint:   #B7BCC8;   /* weakest */
  --line:    #E9EBEF;
  --line2:   #EEF0F3;
  --hover:   #ECEEF1;
  --amber:   #B45309;   /* the one hue: syllable-accent colour (domain) */

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-pill: 999px;

  --shadow-card:  0 6px 18px rgba(13, 18, 32, .05);
  --shadow-focus: 0 8px 24px rgba(13, 18, 32, .10);
  --shadow-pop:   0 10px 30px rgba(13, 18, 32, .12);

  /* Domain accent (amber) tints used by the home interactive demo — a soft fill
     for hover/sync states, a warm hairline, and a quiet selection ground. Sourced
     from --amber; kept here so the demo isn't referencing undefined vars. */
  --accentSoft: #FBF3E9;
  --accentLine: #E4CDA9;
  --selected:   #EDEFF2;

  --font-brand: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Spline Sans', Inter, ui-sans-serif, system-ui, -apple-system,
    'Segoe UI', 'PingFang TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
  --ease-out: cubic-bezier(.23, 1, .32, 1);

  --wrap: 940px;   /* editorial content column */
  --measure: 760px;/* comfortable reading column for docs */
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* <main> is the growing flex column between the (hidden) header and footer, so
   the footer sticks to the bottom and .hero / .doc can fill the viewport. */
main { flex: 1 1 auto; display: flex; flex-direction: column; }

/* Content column shared by hero + footer + docs. */
.container {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: clamp(24px, 6vw, 64px);
  padding-right: clamp(24px, 6vw, 64px);
}

/* ── Site header (injected by layout.js): a slim headroom bar on every page —
   brand · language switch · store badges · web-app link. Pinned to the top,
   hidden on scroll-down and revealed on scroll-up (see layout.js). ──────────── */
:root { --hdr-h: 60px; }
#site-header:empty { display: none; }        /* no-JS: the empty placeholder collapses */
body { padding-top: var(--hdr-h); }          /* leave room for the fixed bar */

.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line2);
  transition: transform .28s var(--ease-out), box-shadow .2s var(--ease-out);
  will-change: transform;
}
.site-header.headroom--unpinned { transform: translateY(-100%); }
.site-header.headroom--pinned { transform: translateY(0); }
.site-header:not(.headroom--top) { box-shadow: var(--shadow-card); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--hdr-h);
}
.site-header .brand {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -.02em;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.hdr-actions { display: flex; align-items: center; gap: 18px; }
.hdr-sep { width: 1px; height: 20px; background: var(--line); flex: 0 0 auto; }

/* Language switch — four real, crawlable links; the current one is marked. */
.langsw { display: flex; align-items: center; gap: 2px; }
.langsw-a {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  line-height: 1;
  transition: color .15s var(--ease-out), background .15s var(--ease-out);
}
.langsw-a:hover { color: var(--ink); background: var(--hover); }
.langsw-a.is-active { color: var(--ink); background: var(--sunken); }

/* Compact store badges for the header (the hero/download band use taller ones). */
.hdr-dl { display: flex; align-items: center; gap: 8px; }
.hdr-badge { position: relative; display: inline-flex; transition: transform 140ms var(--ease-out); }
.hdr-badge:active { transform: scale(.96); }
.hdr-badge img { height: 30px; width: auto; display: block; }

/* QR popover under a header badge — opens DOWNWARD (the bar sits at the top),
   its own class so it never inherits the hero .qrpop's upward positioning and
   doesn't depend on sections.css being loaded on a given page. */
.hdr-qrpop {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) scale(.96);
  transform-origin: top center;
  opacity: 0; visibility: hidden; pointer-events: none; z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 12px; text-align: center;
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out), visibility 160ms;
}
.hdr-qrpop img { width: 128px; height: 128px; display: block; }
.hdr-qrpop > span { display: block; margin-top: 8px; max-width: 128px; font-size: 12px; line-height: 1.35; color: var(--muted); }
.hdr-qrpop::before { /* arrow pointing up at the badge */
  content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: var(--surface);
  filter: drop-shadow(0 -1px 0 var(--line2));
}
@media (hover: hover) and (pointer: fine) {
  .hdr-actions .hdr-badge:hover .hdr-qrpop,
  .hdr-actions .hdr-badge:focus-within .hdr-qrpop {
    opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%) scale(1);
  }
}
.hdr-dl-m .hdr-qrpop { display: none; } /* mobile dropdown: badges link straight to the store */
.mobile-nav .hdr-web { display: none; } /* 暫時隱藏手機下拉選單的 web 版入口（手機 web 版問題多）；桌機頁首入口保留、URL 仍可用 */

/* Web-app link reuses .browserlink; a touch smaller inside the bar. */
.hdr-web { padding: 6px 2px; font-size: 13px; }

/* Hamburger — shown only on the mobile layout. */
.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  padding: 9px;
  border: 0;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.nav-toggle-bar {
  display: block;
  height: 2px; width: 22px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .2s var(--ease-out), opacity .2s var(--ease-out);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile dropdown sheet under the bar. */
.mobile-nav {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--line2);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height .28s var(--ease-out), opacity .2s var(--ease-out);
}
.mobile-nav.open { max-height: 70vh; opacity: 1; }
.mobile-nav-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 18px; padding-top: 20px; padding-bottom: 24px; }
.mobile-nav .langsw-m { gap: 8px; flex-wrap: wrap; }
.mobile-nav .langsw-m .langsw-a { font-size: 15px; padding: 8px 14px; border: 1px solid var(--line); }
.mobile-nav .hdr-dl-m { gap: 12px; }
.mobile-nav .hdr-dl-m .hdr-badge img { height: 40px; }

@media (max-width: 820px) {
  :root { --hdr-h: 54px; }
  .hdr-actions { display: none; }
  .nav-toggle { display: flex; }
  .site-header .brand { font-size: 18px; }
}
@media (min-width: 821px) {
  .mobile-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .site-header, .mobile-nav, .nav-toggle-bar, .hdr-badge, .langsw-a { transition: none; }
}

/* ── Wordmark ─────────────────────────────────────────────────────────────── */
.mark {
  font-family: var(--font-brand);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.025em;
  line-height: 1;
  text-wrap: balance;
}

/* ── Primary action: the app's native CTA (ink pill, white label, press-scale,
   hover-lift, arrow nudge). ───────────────────────────────────────────────── */
.cta {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: #FFFFFF;
  background: var(--ink);
  border: 1px solid var(--ink);
  padding: 13px 22px;
  border-radius: var(--r-pill);
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: transform 120ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.cta:hover { box-shadow: var(--shadow-focus); }
.cta:active { transform: scale(.97); }
.cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.cta .arrow { transition: transform 200ms var(--ease-out); }
.cta:hover .arrow { transform: translateX(3px); }

/* ══ Home — editorial hero ═══════════════════════════════════════════════════ */
.hero {
  flex: 0 0 auto;
  min-height: 100vh; /* first screen; the interactive/feature sections flow below */
  display: flex;
  align-items: center;
  padding: 48px 0;
}
.hero .eyebrow {
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}
.hero .mark { font-size: clamp(64px, 15vw, 128px); letter-spacing: -.04em; }
.hero .tagline {
  font-size: clamp(21px, 3.2vw, 29px);
  color: var(--ink2);
  letter-spacing: .03em;
  margin-top: 18px;
  text-wrap: balance;
}
.hero .rule {
  height: 1px;
  border: 0;
  background: var(--line);
  margin: 34px 0;
}
.hero .cta { margin-top: 0; }

/* ══ Legal / doc pages ═══════════════════════════════════════════════════════ */
.doc { flex: 1 1 auto; padding: 40px 0 72px; }
/* Docs read in a narrower, centered measure than the editorial hero. Masthead
   and body share this column so the wordmark aligns with the text left edge. */
.doc-wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding-left: clamp(24px, 6vw, 64px);
  padding-right: clamp(24px, 6vw, 64px);
}
.doc .masthead { margin-bottom: 48px; }
.doc .masthead .mark {
  font-size: 24px;
  text-decoration: none;
  display: inline-block;
}
.doc h1 {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 44px);
  letter-spacing: -.02em;
  line-height: 1.1;
  text-wrap: balance;
}
.doc .meta { color: var(--muted); font-size: 14px; margin-top: 12px; }
.doc .draft-note {
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.5;
}
.doc h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 40px;
  margin-bottom: 12px;
  letter-spacing: -.01em;
}
.doc p, .doc li { color: var(--ink2); font-size: 16px; line-height: 1.75; }
.doc p { margin-top: 12px; }
.doc ul { margin-top: 12px; padding-left: 22px; }
.doc li { margin-top: 8px; }
.doc a:not(.mark) {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
}
.doc a:not(.mark):hover { text-decoration-color: var(--ink); }
.doc strong { color: var(--ink); font-weight: 600; }

/* ══ Footer (injected by layout.js) — quiet, centered chrome ═════════════════ */
.site-footer {
  padding: 30px 0 40px;
  border-top: 1px solid var(--line2);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.site-footer .container { display: block; }
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .15s var(--ease-out), border-color .15s var(--ease-out);
}
.site-footer a:hover { color: var(--ink2); border-color: var(--line); }
.site-footer .brand-mini { font-family: var(--font-brand); color: var(--ink2); }
.site-footer .sep { color: var(--faint); margin: 0 .5em; }

/* ── Entrance: a single restrained load reveal on the home hero. ───────────── */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.anim { opacity: 0; animation: rise .58s var(--ease-out) forwards; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .anim { animation: none; opacity: 1; transform: none; }
  .cta, .cta .arrow, .site-footer a { transition: none; }
}
