/* WaynePlay legal pages, styled after the ONET ANIMAL game UI: the moonlit forest
   backdrop, white panels with a thick ink outline and a solid "lip" under every
   pressable thing, sunny yellow for the active choice, Nunito like the game. */
@font-face {
  font-family: "Nunito";
  src: url("/assets/nunito.ttf?v=bb55a5ca5c") format("truetype");
  font-weight: 200 1000;
  font-display: swap;
}
:root {
  --ink: #082a44;
  --ink-soft: #315d7b;
  --paper: #ffffff;
  --paper-tint: #eef6fd;
  --sun: #ffcc20;
  --sun-deep: #f0a81c;
  --leaf: #75cf72;
  --sky: #2f8fd8;
  --night: #0d3557;
  --radius-panel: 28px;
  --radius-control: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--night);
  font: 17px/1.6 "Nunito", system-ui, sans-serif;
  font-weight: 600;
}
/* Fixed forest behind everything (a pseudo-element: background-attachment: fixed
   is unreliable on mobile Safari). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8, 42, 68, .25), rgba(8, 42, 68, .62)),
    url("/assets/forest.webp?v=15efdda41f") center / cover no-repeat,
    var(--night);
}
a { color: var(--sky); font-weight: 800; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 3px; border-radius: 10px; }

.shell { max-width: 820px; margin: 0 auto; padding: 20px 16px 48px; }

/* Top bar: logo left, language picker right. */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.top .logo { display: block; width: min(300px, 58vw); }
.top .logo img { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 0 rgba(8, 42, 68, .45)); }

/* Chunky controls shared by tabs, buttons and the picker. */
.chunk {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 18px;
  font: inherit; font-weight: 800; color: var(--ink); text-decoration: none;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius-control);
  box-shadow: 0 5px 0 var(--ink);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.chunk:hover { background: var(--paper-tint); }
.chunk:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.chunk.is-current, .chunk[aria-current="page"] { background: var(--sun); }

/* Language picker: a real button + listbox, not the system <select>. */
.lang-picker { position: relative; }
.lang-picker img { width: 30px; height: 20px; border-radius: 4px; border: 2px solid var(--ink); object-fit: cover; }
.lang-picker .caret {
  width: 10px; height: 10px; margin: -4px 2px 0 2px;
  border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(45deg); transition: transform .12s ease;
}
.lang-picker [aria-expanded="true"] .caret { transform: translateY(5px) rotate(-135deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 12px); z-index: 10;
  min-width: 200px; margin: 0; padding: 8px; list-style: none; white-space: nowrap;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
}
.lang-menu[hidden] { display: none; }
.lang-menu li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; font-weight: 800; cursor: pointer;
}
.lang-menu li:hover, .lang-menu li.is-active { background: var(--paper-tint); }
.lang-menu li[aria-selected="true"] { background: var(--sun); }
.lang-menu li[aria-selected="true"]::after { content: "✓"; margin-left: auto; }

/* Page switcher between the two documents. */
.tabs { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 20px; }

/* The document panel, with the game's animals peeking over its top edge. */
.panel {
  position: relative;
  margin-top: 96px;
  padding: 28px 32px 32px;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: var(--radius-panel);
  box-shadow: 0 9px 0 var(--ink);
}
.panel .mascots {
  position: absolute; right: 18px; top: -118px;
  width: 168px; height: auto; pointer-events: none;
}
.panel h1 {
  margin: 0 150px 4px 0;
  font-size: clamp(1.7rem, 4.6vw, 2.4rem); line-height: 1.15; font-weight: 900; letter-spacing: -.01em;
}
.updated { margin: 0 0 8px; color: var(--ink-soft); font-weight: 700; }
.lead {
  margin: 20px 0 8px; padding: 16px 20px;
  background: var(--paper-tint); border: 3px solid var(--ink); border-radius: 20px;
}

/* Clauses are numbered: a sunny token like a matched tile. */
.clauses { counter-reset: clause; }
.clauses h2 {
  counter-increment: clause;
  display: flex; align-items: center; gap: 12px;
  margin: 30px 0 8px; font-size: 1.25rem; line-height: 1.3; font-weight: 900;
}
.clauses h2::before {
  content: counter(clause);
  flex: none; display: grid; place-items: center;
  width: 38px; height: 38px;
  background: var(--sun); border: 3px solid var(--ink); border-radius: 11px;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 1.05rem; font-weight: 900;
}
.clauses p, .clauses ul, .clauses .table-wrap { margin-left: 50px; }
.clauses ul { padding-left: 20px; }
li { margin: 6px 0; }
li::marker { color: var(--leaf); }

.table-wrap { overflow-x: auto; border: 3px solid var(--ink); border-radius: 18px; }
table { border-collapse: collapse; width: 100%; min-width: 460px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; }
th { background: var(--paper-tint); font-weight: 900; }
tr + tr td { border-top: 2px solid var(--paper-tint); }

/* Index page: one big panel with the two documents as chunky choices. */
.home .panel h1 { margin-right: 150px; }
.choices { display: grid; gap: 14px; margin-top: 22px; }
.choices .chunk { justify-content: space-between; font-size: 1.1rem; min-height: 60px; }

.footer { margin-top: 28px; color: #e6f2fb; font-weight: 700; text-align: center; text-shadow: 0 2px 0 rgba(8, 42, 68, .6); }
.footer a { color: var(--sun); }

[data-lang-block][hidden] { display: none; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .shell { padding-top: 14px; }
  .panel { margin-top: 74px; padding: 22px 18px 24px; border-radius: 24px; }
  .panel .mascots { width: 118px; top: -84px; right: 8px; }
  .panel h1, .home .panel h1 { margin-right: 92px; }
  .clauses p, .clauses ul, .clauses .table-wrap { margin-left: 0; }
  .tabs .chunk { flex: 1 1 140px; justify-content: center; }
  .lang-picker .label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .chunk, .lang-picker .caret { transition: none; }
}

/* One language at a time, chosen before first paint by the inline head script:
   every bilingual string is in the markup, so nothing flashes while site.js loads. */
html[data-lang="vi"] [data-lang-block="en"],
html[data-lang="en"] [data-lang-block="vi"],
html[data-lang="vi"] [data-l="en"],
html[data-lang="en"] [data-l="vi"] { display: none !important; }
.lang-picker .current { display: inline-flex; align-items: center; gap: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
