/* Cờ Tư Lệnh website. Palette and type follow docs/art-direction-co-tu-lenh.md ("Sa bàn chỉ huy"). */

@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Be Vietnam Pro";
  src: url("/fonts/be-vietnam-pro-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("/fonts/oswald-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Brand palette */
  --olive-dark: #2f3a1f;
  --olive-deep: #252e18;
  --olive: #4e5b31;
  --khaki: #c9b78e;
  --paper: #ede3cc;
  --ink: #3a2a1c;
  --ink-2: #5e4a36;
  --brass: #b8893a;
  --gold: #e3b341;
  --red: #a11d1a;
  --red-press: #861714;
  --bezel: #141a0d;

  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Be Vietnam Pro", -apple-system, "Segoe UI", sans-serif;

  /* Fluid type scale, about 1.25 */
  --step--1: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  --step-1: clamp(1.1875rem, 1.1rem + 0.4vw, 1.375rem);
  --step-2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --step-3: clamp(1.875rem, 1.5rem + 1.8vw, 2.75rem);
  --step-4: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
  --leading-display: 1.18;
  --leading-body: 1.65;
  --tracking-display: 0.02em;
  --tracking-caps: 0.1em;
  --measure: 62ch;

  /* 4 pt spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --section-y: clamp(64px, 6vw + 32px, 144px);
  --gutter: clamp(16px, 4vw, 48px);
  --container: 1200px;
  --header-h: 72px;

  --radius: 8px;
  --radius-sm: 6px;

  --dur-press: 120ms;
  --dur-state: 220ms;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-press: 0ms; --dur-state: 0ms; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--olive-dark);
  color: var(--paper);
  font: 400 var(--step-0) / var(--leading-body) var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-wrap: balance;
}
p { margin: 0; max-width: var(--measure); text-wrap: pretty; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Links */
.text-link {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-color: var(--brass);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color var(--dur-state) var(--ease-out),
    text-underline-offset var(--dur-state) var(--ease-out);
}
.text-link:hover { text-decoration-color: var(--gold); text-underline-offset: 0.35em; }

/* Header */
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  text-decoration: none;
  font: 600 var(--step-1) / 1 var(--font-display);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
}
.brand img { width: 36px; height: 36px; border-radius: 22%; }
.site-nav { display: flex; gap: var(--space-5); }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--khaki);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--dur-state) var(--ease-out);
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--paper); }

/* Hero */
.hero {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-2) var(--section-y);
}
.hero__poster { margin: 0; }
.hero__poster img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  border-radius: var(--radius);
}
.hero__eyebrow {
  display: block;
  margin-bottom: var(--space-3);
  color: var(--gold);
  font-size: var(--step--1);
  letter-spacing: var(--tracking-caps);
}
.hero h1 { font-size: var(--step-4); }
.hero__lede {
  margin-top: var(--space-5);
  max-width: 36ch;
  font-size: var(--step-1);
  line-height: 1.55;
}
.store-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-7);
  color: var(--gold);
  font: 600 var(--step-0) / 1.2 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}
.store-status::before {
  content: "";
  width: var(--space-6);
  height: 2px;
  background: var(--brass);
}

@media (min-width: 720px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    align-items: center;
    gap: clamp(32px, 6vw, 96px);
    padding-block: var(--space-5) var(--space-8);
  }
  .hero__poster img {
    aspect-ratio: 2 / 3;
    max-height: max(480px, calc(100dvh - var(--header-h) - 96px));
  }
  .hero h1 { font-size: clamp(2.5rem, 1rem + 3.4vw, 4rem); }
}

/* Sections */
.section { padding-block: var(--section-y); border-top: 1px solid var(--olive); }
.section-head { display: grid; gap: var(--space-4); margin-bottom: var(--space-8); }
.section-head h2 { font-size: var(--step-3); }
.section-head p { color: var(--khaki); }

/* Screens */
.screens__list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(72%, 280px);
  gap: var(--space-5);
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter) var(--space-4);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  list-style: none;
}
.shot { scroll-snap-align: start; }
.shot img {
  width: 100%;
  aspect-ratio: 600 / 1301;
  border: 4px solid var(--bezel);
  border-radius: 13.5% / 6.2%;
}
.shot h3 { margin-top: var(--space-5); font-size: var(--step-1); }
.shot p { margin-top: var(--space-2); color: var(--khaki); font-size: var(--step--1); }

@media (min-width: 1000px) {
  .screens__list {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-6);
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  .shot:nth-child(even) { margin-top: var(--space-8); }
}

/* Pieces on a dó-paper sheet, the way the app shows them in Học chơi */
.sheet {
  background: var(--paper) url("/img/paper-tile.webp") repeat;
  background-size: 512px;
  color: var(--ink);
  border: 1px solid var(--brass);
  border-radius: var(--radius);
}
.sheet :focus-visible { outline-color: var(--red); }
.pieces__sheet { padding: clamp(24px, 3vw, 40px); }
.pieces__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6) var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pieces__list li { display: grid; justify-items: center; gap: var(--space-2); text-align: center; }
.pieces__list img { width: min(100%, 88px); aspect-ratio: 1; }
.pieces__list span { font-size: var(--step--1); font-weight: 600; line-height: 1.3; text-wrap: balance; }
@media (min-width: 480px) { .pieces__list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 640px) { .pieces__list { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .pieces__list { grid-template-columns: repeat(11, minmax(0, 1fr)); } }

/* Facts */
.facts { display: grid; gap: var(--space-8); }
.fact { display: grid; gap: var(--space-4); align-content: start; }
.fact h2 { font-size: var(--step-2); }
.fact p { color: var(--khaki); }
.fact .text-link { justify-self: start; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (min-width: 900px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-9); } }

/* Footer */
.site-footer {
  background: var(--olive-deep);
  border-top: 1px solid var(--olive);
  padding-block: var(--space-7);
  color: var(--khaki);
  font-size: var(--step--1);
}
.site-footer .container { display: grid; gap: var(--space-4); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }
.site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--paper);
  text-decoration-color: var(--brass);
  text-underline-offset: 0.25em;
}
.site-footer nav a:hover { text-decoration-color: var(--gold); }
@media (min-width: 900px) {
  .site-footer .container { grid-template-columns: 1fr auto; align-items: center; }
}

/* Document pages: privacy, support, 404 */
.doc { padding-block: var(--space-5) var(--section-y); }
.doc .sheet {
  background-image: url("/img/paper-tile-light.webp");
  max-width: 760px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 64px);
}
.doc h1 { font-size: var(--step-3); color: var(--ink); }
.doc__meta { margin-top: var(--space-3); color: var(--ink-2); font-size: var(--step--1); }
.doc__lead { margin-top: var(--space-6); font-size: var(--step-1); line-height: 1.55; }
.doc h2 { margin-top: var(--space-8); font-size: var(--step-1); letter-spacing: 0.04em; }
.doc h3 {
  margin-top: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: 0;
  line-height: var(--leading-body);
  text-transform: none;
}
.doc h2 + p, .doc h2 + ul, .doc h3 + p { margin-top: var(--space-3); }
.doc p + p, .doc ul + p, .doc p + ul { margin-top: var(--space-4); }
.doc ul { margin-bottom: 0; padding-left: 1.25em; }
.doc li + li { margin-top: var(--space-2); }
.doc li::marker { color: var(--brass); }
.doc a:not(.button) {
  color: var(--red);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
.doc a:not(.button):hover { text-decoration-thickness: 2px; }
.qa { margin-top: var(--space-4); }
.qa > div { padding-block: var(--space-5); border-top: 1px solid var(--khaki); }
.qa > div:last-child { padding-bottom: 0; }
.qa h3 { margin-top: 0; }
.qa h3 + p { margin-top: var(--space-2); }

/* Contact block on the support page */
.contact {
  display: grid;
  gap: var(--space-4);
  justify-items: start;
  margin-top: var(--space-6);
}
.contact__address { font-weight: 600; overflow-wrap: anywhere; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  background: var(--red);
  color: var(--paper);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  font: 600 var(--step-0) / 1 var(--font-display);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-state) var(--ease-out);
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); background: var(--red-press); }
