/* Seven Worlds public pages.
 *
 * The palette, the two typefaces and the engraved rules are the game's own, not
 * a website approximation of them: Cinzel and Sarabun are the exact files the
 * app bundles, subset here to Latin, and every colour is a token from
 * lib/core/theme/app_colors.dart. Somebody arriving from the Play listing
 * should recognise the surface.
 *
 * There is no inline style anywhere in these pages. Production Traefik serves
 * them under style-src 'self' with no 'unsafe-inline', and a page that needs an
 * exception to render is a page that stops rendering the day the header is
 * tightened.
 */

@font-face {
  font-family: 'Cinzel';
  src: url('/assets/fonts/Cinzel-Regular.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/assets/fonts/Sarabun-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Sarabun';
  src: url('/assets/fonts/Sarabun-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  --ground: #14082b;
  --deep-purple: #1a0a2e;
  --card: #1e1e2c;
  --card-warm: #241634;
  --ink-black: #1c1c1e;
  --gold: #d4af37;
  --gold-hi: #f0d9a0;
  --parchment: #f5e6c8;
  --saffron: #ff9933;
  --correct: #4caf50;
  --danger: #e53935;

  --text: var(--parchment);
  --text-dim: rgba(245, 230, 200, 0.66);
  --text-faint: rgba(245, 230, 200, 0.44);
  --hairline: rgba(212, 175, 55, 0.28);
  --hairline-soft: rgba(212, 175, 55, 0.14);

  --display: 'Cinzel', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --body: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --cipher: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --measure: 68ch;
  --column: 1080px;
  --pad: 20px;
  --radius: 12px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--ground);
  background-image:
    radial-gradient(120% 68% at 50% -8%, rgba(212, 175, 55, 0.16), transparent 62%),
    radial-gradient(88% 52% at 12% 4%, rgba(255, 153, 51, 0.09), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold-hi);
  text-decoration-color: var(--hairline);
  text-underline-offset: 3px;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

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

.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 20;
  padding: 10px 14px;
  background: var(--deep-purple);
  border: 1px solid var(--gold);
  border-radius: 8px;
}

.wrap {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---- masthead ---------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(20, 8, 43, 0.86);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.masthead__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand__mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}

.brand__name {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--gold-hi);
}

.masthead__link {
  font-size: 13px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-dim);
}

.masthead__link:hover {
  color: var(--gold-hi);
}

/* ---- hero -------------------------------------------------------------- */

.hero {
  padding: 54px 0 40px;
  text-align: center;
}

.hero__wordmark {
  width: min(360px, 78%);
  margin: 0 auto 26px;
  display: block;
}

/* The signature: the headline arrives enciphered and resolves in front of the
 * reader. It is the thing the game asks you to do, performed by the page
 * itself. The plaintext is what lives in the HTML — the script enciphers it on
 * load and then decodes it — so a reader with no JavaScript, or with reduced
 * motion, simply gets the sentence. */
.decode {
  font-family: var(--display);
  font-size: clamp(30px, 8.4vw, 60px);
  line-height: 1.08;
  letter-spacing: 0.012em;
  margin: 0 auto 18px;
  max-width: 15ch;
  color: var(--text);
  text-wrap: balance;
}

.decode__line {
  display: block;
}

.decode__line--accent {
  color: var(--gold);
}

.decode span[data-locked='false'] {
  color: var(--saffron);
  opacity: 0.72;
}

.hero__lede {
  max-width: 54ch;
  margin: 0 auto 28px;
  color: var(--text-dim);
  font-size: 17px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  min-height: 52px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  color: #2a1c05;
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 1px solid rgba(255, 240, 200, 0.55);
  box-shadow: 0 10px 34px rgba(212, 175, 55, 0.24);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 40px rgba(212, 175, 55, 0.32);
}

.cta:active {
  transform: translateY(0);
}

.cta--quiet {
  background: transparent;
  color: var(--gold-hi);
  border-color: var(--hairline);
  box-shadow: none;
}

.cta--danger {
  background: linear-gradient(180deg, #a33, #8b0000);
  color: #ffeaea;
  border-color: rgba(255, 170, 170, 0.4);
  box-shadow: none;
}

.hero__note {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-faint);
}

/* A thin band of cipher glyphs under the hero. It is the same alphabet the
 * decode runs on, drifting slowly, and it is the only ambient motion on the
 * page. */
.frieze {
  overflow: hidden;
  border-top: 1px solid var(--hairline-soft);
  border-bottom: 1px solid var(--hairline-soft);
  padding: 9px 0;
  margin-top: 34px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

.frieze__run {
  display: flex;
  gap: 18px;
  width: max-content;
  font-family: var(--cipher);
  font-size: 12px;
  letter-spacing: 0.42em;
  color: rgba(212, 175, 55, 0.36);
  animation: drift 46s linear infinite;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

/* ---- sections ---------------------------------------------------------- */

.section {
  padding: 44px 0;
}

.section--tight {
  padding: 30px 0;
}

/* The engraved rule is the app's own section device: a small-caps label with a
 * hairline struck out from it. It marks a section without pretending the
 * sections are a numbered sequence, which they are not. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--hairline), transparent);
}

.section__title {
  font-family: var(--display);
  font-size: clamp(23px, 5.2vw, 32px);
  line-height: 1.18;
  margin: 0 0 12px;
  color: var(--text);
}

.section__body {
  max-width: var(--measure);
  color: var(--text-dim);
  margin: 0 0 16px;
}

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

/* ---- mode cards -------------------------------------------------------- */

.modes {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

@media (min-width: 620px) {
  .modes {
    grid-template-columns: 1fr 1fr;
  }
}

.mode {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-warm), var(--ink-black));
  transition: transform 200ms ease, border-color 200ms ease;
}

.mode:hover {
  transform: translateY(-3px);
  border-color: var(--hairline);
}

.mode__glyph {
  display: block;
  width: 26px;
  height: 26px;
  margin-bottom: 12px;
  color: var(--gold);
}

.mode__name {
  font-family: var(--display);
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--text);
}

.mode__text {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-dim);
}

/* ---- figures ----------------------------------------------------------- */

.figures {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, 1fr);
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 620px) {
  .figures {
    grid-template-columns: repeat(4, 1fr);
  }
}

.figure {
  padding: 16px 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  background: rgba(30, 30, 44, 0.55);
  text-align: center;
}

.figure__value {
  display: block;
  font-family: var(--display);
  font-size: 25px;
  color: var(--gold-hi);
}

.figure__label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---- documents --------------------------------------------------------- */

.doc {
  padding: 34px 0 10px;
}

.doc__title {
  font-family: var(--display);
  font-size: clamp(27px, 6.4vw, 40px);
  line-height: 1.12;
  margin: 0 0 10px;
}

.doc__meta {
  font-size: 13px;
  color: var(--text-faint);
  margin: 0 0 6px;
}

.doc__body {
  max-width: var(--measure);
}

.doc__body h2 {
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.3;
  margin: 34px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline-soft);
  color: var(--gold-hi);
}

.doc__body h3 {
  font-family: var(--body);
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--text);
}

.doc__body p,
.doc__body li {
  color: var(--text-dim);
}

.doc__body li {
  margin-bottom: 7px;
}

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

.toc {
  margin: 20px 0 8px;
  padding: 16px 18px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  background: rgba(30, 30, 44, 0.5);
}

.toc__title {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 8px;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 1;
  font-size: 14.5px;
}

@media (min-width: 620px) {
  .toc ol {
    columns: 2;
    column-gap: 28px;
  }
}

.table-scroll {
  overflow-x: auto;
  margin: 14px 0 18px;
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 460px;
}

th,
td {
  padding: 11px 13px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline-soft);
  color: var(--text-dim);
}

th {
  font-family: var(--body);
  font-weight: 600;
  color: var(--gold-hi);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ---- deletion ---------------------------------------------------------- */

.panel {
  padding: 22px 20px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--card-warm), var(--ink-black));
  margin: 20px 0;
  max-width: var(--measure);
}

.panel--quiet {
  border-color: var(--hairline-soft);
  background: rgba(30, 30, 44, 0.5);
}

.panel__title {
  font-family: var(--display);
  font-size: 19px;
  margin: 0 0 8px;
}

.steps {
  margin: 0 0 4px;
  padding-left: 20px;
}

.steps li {
  margin-bottom: 8px;
  color: var(--text-dim);
}

.field {
  display: block;
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 13px 14px;
  min-height: 50px;
  font-family: var(--body);
  font-size: 16px;
  color: var(--text);
  background: rgba(18, 10, 34, 0.9);
  border: 1px solid var(--hairline);
  border-radius: 10px;
}

.input::placeholder {
  color: var(--text-faint);
}

.input:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18);
}

.form__actions {
  margin-top: 18px;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(229, 57, 53, 0.5);
  background: rgba(229, 57, 53, 0.12);
  color: #ffd9d7;
  font-size: 14.5px;
}

.notice--good {
  border-color: rgba(76, 175, 80, 0.5);
  background: rgba(76, 175, 80, 0.12);
  color: #d8f3d9;
}

.ledger {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin: 18px 0 6px;
}

@media (min-width: 700px) {
  .ledger {
    grid-template-columns: 1fr 1fr;
  }
}

.ledger__side {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--hairline-soft);
  background: rgba(30, 30, 44, 0.5);
}

.ledger__head {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.ledger__side--gone .ledger__head {
  color: #ff9d99;
}

.ledger__side--kept .ledger__head {
  color: var(--gold-hi);
}

.ledger__side ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14.5px;
}

.ledger__side li {
  margin-bottom: 6px;
  color: var(--text-dim);
}

/* ---- footer ------------------------------------------------------------ */

.footer {
  margin-top: 46px;
  border-top: 1px solid var(--hairline-soft);
  padding: 30px 0 40px;
  font-size: 14px;
  color: var(--text-faint);
}

.footer__grid {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .footer__grid {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

.footer h2 {
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 10px;
}

.footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer li {
  margin-bottom: 7px;
}

.footer a {
  color: var(--text-dim);
  text-decoration: none;
}

.footer a:hover {
  color: var(--gold-hi);
  text-decoration: underline;
}

.footer__legal {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---- scroll reveal ----------------------------------------------------- */

/* The hiding is gated on the .js class the script itself sets on <html>.
 * Without that gate a blocked, failed or slow script leaves half the page
 * invisible while still taking up its space — which is what it did: the privacy
 * link, the modes and the Museum section were all sitting there at zero opacity.
 * Content is never hidden by default; the reveal is the enhancement. */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 620ms ease, transform 620ms ease;
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Motion is decoration here, so all of it goes. What stays is every word and
 * every control: the decode script writes the plaintext straight in, the
 * reveals resolve to their finished state, and the frieze simply stops. */
@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .frieze__run {
    animation: none;
  }

  .cta,
  .mode {
    transition: none;
  }

  .cta:hover,
  .mode:hover {
    transform: none;
  }
}
