/*
 * GlyphLink site styles.
 *
 * Tokens are the app's "Sumi and Shu" dark palette (GameTheme, Oct 2026) so
 * the site and the game read as one product: warm sumi neutrals, washi text,
 * vermillion (shu) as the one accent, the hanko red for the seal. Every text
 * pairing clears WCAG AA on the surface it sits on; aidocs/seo.md has the
 * measured ratios. Rules carried over from the app: no blurred accent glows,
 * no letter-spaced eyebrow labels, headings in the display face, sentence case.
 */

@font-face {
  font-family: "Zen Maru Gothic";
  src: url("/assets/fonts/zen-maru-gothic-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E;
}

:root {
  color-scheme: dark;

  --bg: #16120f;          /* GameTheme.bg(.dark) */
  --surface: #1f1a16;     /* surface */
  --surface-2: #27211b;   /* surface2 */
  --surface-3: #312a22;   /* surface3 */
  --line: #2e2720;        /* border, a solid hairline */
  --text: #f1eadd;        /* textPrimary */
  --muted: #a99e89;       /* textSecondary */
  --accent: #e0573b;      /* Accent.vermillion */
  --accent-soft: #ee8a70; /* Accent.vermillion.soft, links */
  --accent-deep: #a93a24; /* Accent.vermillion.deep, button edge */
  --on-accent: #1a140f;   /* Accent.ink */
  --seal: #bf3b28;        /* GameTheme.seal */
  --ink: #2a2628;         /* StrokeAnimationView.inkColor, sumi */
  --paper-a: #f6efe2;
  --paper-b: #ebe0cc;
  --paper-text: #6b5a48;
  --rule: rgba(191, 59, 40, 0.38);

  --radius: 16px;
  --wrap: 1080px;
  --gutter: 16px;

  --font-display: "Zen Maru Gothic", ui-rounded, "SF Pro Rounded", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ui: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-cjk: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "PingFang SC",
    "Noto Sans JP", "Noto Sans SC", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-cjk-serif: "Hiragino Mincho ProN", "Songti SC", "Noto Serif CJK JP",
    "Noto Serif JP", serif;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--surface-3) var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

::selection {
  background: rgba(224, 87, 59, 0.38);
  color: var(--text);
}

a {
  color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(238, 138, 112, 0.5);
  transition: color 0.15s var(--ease-out), text-decoration-color 0.15s var(--ease-out);
}

a:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-wrap: balance;
}

.cjk {
  font-family: var(--font-cjk);
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -999px;
}

.skip:focus {
  left: 16px;
  top: 16px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 10;
}

/* ---------- Header ---------- */

.site-header {
  padding: 18px 0;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  line-height: 1;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 32px;
  height: 32px;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 4px;
  font-size: 15px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* ---------- Hero ---------- */

.hero {
  padding: 40px 0 72px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 56px;
  align-items: center;
}

h1 {
  margin: 0 0 20px;
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.lede {
  margin: 0 0 30px;
  max-width: 34em;
  color: var(--muted);
  font-size: 1.12rem;
}

.lede strong {
  color: var(--text);
  font-weight: 600;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  transition: background-color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}

/* The app's GLButton primary: accent fill, ink label, a deep bottom edge. */
.button-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 2px 0 var(--accent-deep), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.button-primary:hover {
  color: var(--on-accent);
  background: var(--accent-soft);
}

.button-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--accent-deep), 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* A status, not a control: the app is in TestFlight, not on the store yet. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--seal);
  flex: none;
}

.note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Practice paper with the stroke animation ---------- */

.paper {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 0 0 auto;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--paper-a), var(--paper-b));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 24px 48px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.paper svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.paper-caption {
  position: absolute;
  left: 18px;
  bottom: 14px;
  margin: 0;
  color: var(--paper-text);
  font-size: 14px;
  font-weight: 700;
}

.stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  /* "both": the hidden first frame applies during the delay too, so the
     round caps do not show as dots before each stroke starts. */
  animation: write 0.78s ease-in-out both;
  animation-delay: calc(var(--i) * 0.62s + 0.35s);
}

.ghost {
  fill: none;
  stroke: rgba(42, 38, 40, 0.09);
  stroke-width: 5.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The accent rides the brush and settles to ink, as it does in the app. */
@keyframes write {
  0% {
    stroke-dashoffset: 1;
    stroke: var(--accent);
    opacity: 0;
  }
  2% {
    opacity: 1;
  }
  62% {
    stroke-dashoffset: 0;
    stroke: var(--accent);
  }
  100% {
    stroke-dashoffset: 0;
    stroke: var(--ink);
  }
}

/* ---------- Tile band ---------- */

.band {
  padding: 8px 0 80px;
}

.band figure {
  margin: 0;
}

.band svg {
  display: block;
  width: 100%;
  height: auto;
}

.band figcaption {
  margin: 16px auto 0;
  max-width: 36em;
  color: var(--muted);
  text-align: center;
  font-size: 16px;
}

.link-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: link 1.1s var(--ease-out) 0.6s both;
}

.link-body {
  stroke: var(--accent);
  stroke-width: 4;
}

.link-core {
  stroke: rgba(242, 232, 214, 0.85);
  stroke-width: 1.2;
}

@keyframes link {
  0% {
    opacity: 0;
  }
  2% {
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* ---------- Sections ---------- */

.section {
  padding: 72px 0;
}

/* The app's SectionTitle: display face, sentence case, over a hairline. */
.section-head {
  margin-bottom: 36px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.section-lede {
  margin: 0;
  max-width: 40em;
  color: var(--muted);
}

/* Game and Learn, side by side: the two modes the app's mode picker offers. */
.modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.mode {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
}

.mode h3 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
}

.mode p {
  margin: 0;
  color: var(--muted);
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  position: relative;
  padding-left: 22px;
  color: var(--muted);
}

.facts li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
}

.facts strong {
  color: var(--text);
  font-weight: 600;
}

/* The in-game status panel: numbers in one well, split by hairlines. Values
   are an example round; numbers stay in the UI face for tabular figures. */
.hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: auto 0 0;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}

.hud-cell {
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 16px 18px 14px;
}

.hud-cell + .hud-cell {
  border-left: 1px solid var(--line);
}

.hud-label {
  color: var(--muted);
  font-size: 13px;
}

.hud-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 8px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.hud-bonus {
  color: var(--accent-soft);
  font-size: 14px;
  font-weight: 700;
}

/* Plain ink: colour on the clock only means hurry, under 30 seconds. */
.hud-track {
  grid-column: 1 / -1;
  height: 5px;
  background: var(--surface-3);
}

.hud-track span {
  display: block;
  width: 74%;
  height: 100%;
  background: rgba(241, 234, 221, 0.85);
}

/* A study card from Learn mode, drawn with real dictionary data for 語. */
.study {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px 20px;
  margin: auto 0 0;
  padding: 20px;
  border-radius: 12px;
  background: var(--surface-2);
}

.study-glyph {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--paper-a), var(--paper-b));
  color: var(--ink);
  font-family: var(--font-cjk-serif);
  font-size: 58px;
  line-height: 1;
}

.study dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
  align-content: center;
  font-size: 15px;
}

.study dt {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.study dd {
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chips li {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13px;
}

.examples {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 15px;
}

.examples li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.examples .cjk {
  font-size: 19px;
}

.examples ruby {
  ruby-align: center;
}

.examples rt {
  color: var(--muted);
  font-size: 11.5px;
}

.examples span:last-child {
  color: var(--muted);
}

/* Multiplayer: the room code the host shares, as the app's six boxes. */
.together {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px 36px;
  align-items: center;
  margin-top: 20px;
  padding: 28px;
  border-radius: var(--radius);
  background: var(--surface);
}

.together h3 {
  margin: 0 0 6px;
  font-size: 1.45rem;
}

.together p {
  margin: 0;
  color: var(--muted);
}

.code {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.code li {
  display: grid;
  place-items: center;
  width: 44px;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- Scripts ---------- */

.scripts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scripts li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
}

.scripts .glyph {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 22px;
}

.scripts b {
  display: block;
  font-weight: 600;
}

.scripts small {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.sources {
  margin: 28px 0 0;
  max-width: 44em;
  color: var(--muted);
  font-size: 15px;
}

/* ---------- Prose pages (privacy, support, terms, play) ---------- */

.prose {
  padding: 32px 0 80px;
}

.prose .wrap {
  max-width: 68ch;
}

.prose h1 {
  font-size: clamp(2.1rem, 4.4vw, 2.9rem);
}

.prose h2 {
  margin-top: 44px;
  font-size: 1.4rem;
}

.prose h3 {
  margin: 28px 0 6px;
  font-size: 1.1rem;
}

.prose p,
.prose li {
  color: var(--muted);
}

.prose li + li {
  margin-top: 6px;
}

.prose strong {
  color: var(--text);
  font-weight: 600;
}

.prose .updated {
  color: var(--muted);
  font-size: 15px;
}

.contact-card {
  margin: 28px 0 0;
  padding: 20px 22px;
  border-radius: 12px;
  background: var(--surface);
}

.contact-card p {
  margin: 0;
}

.contact-card p + p {
  margin-top: 6px;
}

dl.faq dt {
  margin-top: 24px;
  color: var(--text);
  font-weight: 600;
}

dl.faq dd {
  margin: 6px 0 0;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  padding: 36px 0 52px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 24px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin-inline: -10px;
}

.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
}

.site-footer nav a:hover {
  color: var(--text);
}

.credits {
  flex-basis: 100%;
  margin: 8px 0 0;
  font-size: 14px;
}

.credits a {
  color: var(--muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero .wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .paper {
    margin-inline: auto;
    max-width: 360px;
  }

  .modes {
    grid-template-columns: 1fr;
  }

  .together {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-nav .nav-section {
    display: none;
  }

  .hero {
    padding-top: 12px;
  }

  .section {
    padding: 56px 0;
  }

  .mode,
  .together {
    padding: 22px 20px;
  }

  .study {
    gap: 16px 14px;
    padding: 16px;
  }

  .study-glyph {
    width: 64px;
    height: 64px;
    font-size: 40px;
  }

  .hud-cell {
    padding: 14px 12px 12px;
  }

  .hud-value {
    font-size: 22px;
  }

  .code {
    gap: 6px;
  }

  .code li {
    width: 40px;
    height: 50px;
    font-size: 21px;
  }
}

/* No animation for people who asked for none: show the finished state. */
@media (prefers-reduced-motion: reduce) {
  .stroke,
  .link-path {
    animation: none;
    stroke-dashoffset: 0;
  }

  .stroke {
    stroke: var(--ink);
  }

  a,
  .button {
    transition: none;
  }
}

/* Present to screen readers and the heading outline, hidden on screen. */
.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;
}
