/*
  Premise — marketing site.

  The tokens below are the game's own, lifted from
  shared/src/commonMain/kotlin/com/mio/premise/presentation/theme/Color.kt.
  One accent, one signal, a neutral ladder of grounds lit from above.
  If the app's palette changes, change it here too — nowhere else.
*/

:root {
  --background: #0b0c0e;
  --surface: #14171a;
  --surface-sunken: #07080a;
  --page-wash-top: #111419;

  --edge-light: rgba(255, 255, 255, 0.06);
  --edge-dark: rgba(0, 0, 0, 0.25);

  --text: #f0eeeb;
  --text-secondary: rgba(240, 238, 235, 0.7);
  --text-tertiary: rgba(240, 238, 235, 0.5);

  --accent: #e8a24a;
  --signal: #5cc4e8;

  --hairline: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.24);
  --border-high: rgba(255, 255, 255, 0.6);
  --board-border: rgba(255, 255, 255, 0.36);
  --grid: rgba(255, 255, 255, 0.2);

  --wall-fill: rgba(240, 238, 235, 0.12);
  --wall-border: rgba(240, 238, 235, 0.3);
  --you-border: rgba(240, 238, 235, 0.85);
  --block-shade: rgba(0, 0, 0, 0.32);

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --shell: 68rem;

  /* The game's own easing: nothing here moves faster than the board does. */
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background-color: var(--background);
  /* A neutral wash behind the page, so a flat ground reads as a space rather than a void. */
  background-image: linear-gradient(180deg, var(--page-wash-top) 0%, var(--background) 46rem);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--text);
  text-decoration-color: var(--border);
  text-underline-offset: 0.25em;
  transition: color 180ms var(--ease), text-decoration-color 180ms var(--ease);
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1rem;
  z-index: 20;
  border: 1px solid var(--border);
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------------------------------------------------------------- type ---- */

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

/* Everything systemic is mono and tracked wide — labels, counters, act numbers.
   Archivo carries prose; the mono is the game's instrument panel. */
.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0;
}

.lede {
  font-size: clamp(1.0625rem, 0.98rem + 0.42vw, 1.25rem);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0;
}

.hairline {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 0;
}

/* ------------------------------------------------------------- topbar ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--background) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 240ms var(--ease), background-color 240ms var(--ease);
}
.topbar[data-scrolled="true"] {
  border-bottom-color: var(--hairline);
  background: color-mix(in srgb, var(--background) 92%, transparent);
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
}
.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}
.topbar__home:hover { color: var(--text); }
.topbar nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.topbar nav a { color: var(--text-tertiary); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }
@media (max-width: 34rem) {
  .topbar nav a[data-optional] { display: none; }
}

/* -------------------------------------------------------------- block ---- */

/*
  The accent block. One shape, three sizes — the board draws it as a piece, the
  masthead as the game's emblem. It is lit from above, which is where every
  other surface's light in this palette comes from.
*/
.block {
  position: relative;
  overflow: hidden;
  background: var(--accent);
  border-radius: 0.1em;
  width: 1em;
  height: 1em;
  flex: none;
}
.block::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 0.1em;
  background: var(--block-shade);
}

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

.hero {
  position: relative;
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 7vw, 5.5rem);
  overflow: hidden;
}
/* Compose has no outer box-shadow, so the title's glow is a radial gradient. Same here. */
.hero::before {
  content: "";
  position: absolute;
  top: -22rem;
  left: 50%;
  width: min(58rem, 150vw);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 13%, transparent) 0%,
    transparent 62%
  );
  pointer-events: none;
}
.hero__inner {
  position: relative;
  display: grid;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 60rem) {
  .hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); }
}

.hero__emblem { font-size: 2.25rem; margin-bottom: 1.75rem; }

.wordmark {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2.5rem, 1.6rem + 4.4vw, 4.25rem);
  letter-spacing: 0.14em;
  line-height: 1;
  margin: 0 0 1.5rem;
  /* The tracking pushes the last glyph off optical centre; pull it back. */
  text-indent: 0.14em;
}

.hero .lede { max-width: 34ch; font-size: clamp(1.125rem, 1rem + 0.6vw, 1.4375rem); color: var(--text); }
.hero__sub { margin-top: 1.125rem; max-width: 42ch; color: var(--text-secondary); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 1.75rem;
  padding: 0.375rem 0.75rem 0.375rem 0.625rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.status__dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 60%, transparent);
  animation: pulse 3.2s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--signal) 55%, transparent); }
  50%      { box-shadow: 0 0 0 0.375rem transparent; }
}

/* ------------------------------------------------------------ actions ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.8125rem 1.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: inset 0 1px 0 var(--edge-light), 0 1px 2px var(--edge-dark);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms var(--ease), border-color 180ms var(--ease),
    background-color 180ms var(--ease), color 180ms var(--ease);
}
.btn:hover { border-color: var(--border-high); color: var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #17120a;
  font-weight: 600;
}
.btn--primary:hover {
  color: #17120a;
  background: color-mix(in srgb, var(--accent) 88%, #fff);
  border-color: color-mix(in srgb, var(--accent) 88%, #fff);
}

/* A store badge that is not a link yet says so, rather than pretending. */
.btn--pending {
  cursor: default;
  color: var(--text-tertiary);
  border-style: dashed;
  background: transparent;
  box-shadow: none;
}
.btn--pending:hover { transform: none; border-color: var(--border); color: var(--text-tertiary); }
.btn__note {
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  border-left: 1px solid var(--hairline);
  padding-left: 0.625rem;
}
.btn svg { flex: none; }

/* --------------------------------------------------------------- demo ---- */

.demo {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  background: var(--surface-sunken);
  box-shadow: inset 0 1px 0 var(--edge-light), 0 18px 40px -24px #000;
}
.demo__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}
.demo__moves { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.16em; color: var(--text-tertiary); }

.board {
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  aspect-ratio: 1;
  border: 1px solid var(--board-border);
  background: var(--background);
  touch-action: none;
  cursor: grab;
}
.board:active { cursor: grabbing; }
.board__cell {
  position: relative;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--grid);
  border-bottom: 1px solid var(--grid);
}
.board__cell[data-last-col] { border-right: 0; }
.board__cell[data-last-row] { border-bottom: 0; }

.piece { position: absolute; display: grid; place-items: center; }

.piece--wall {
  inset: 0;
  background: var(--wall-fill);
  box-shadow: inset 0 0 0 1px var(--wall-border);
}
.piece--block { width: 62%; height: 62%; font-size: 1px; }
.piece--you {
  width: 46%;
  height: 46%;
  border: 2px solid var(--you-border);
  border-radius: 50%;
}
.piece--goal {
  width: 44%;
  height: 44%;
  border: 2px solid var(--signal);
  /* No outer box-shadow in the game either — the glow is a radial gradient behind. */
  filter: drop-shadow(0 0 0.5rem color-mix(in srgb, var(--signal) 45%, transparent));
}

/* The board answers every input, including the ones it refuses. */
.board[data-state="refused"] { animation: refuse 220ms var(--ease); }
@keyframes refuse {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-3px); }
  75%      { transform: translateX(3px); }
}
.board[data-state="solved"] { animation: solved 700ms var(--ease); }
@keyframes solved {
  0%   { box-shadow: inset 0 0 0 0 transparent; }
  30%  { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}

.demo__hint {
  margin: 0.875rem 0 0;
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: center;
  min-height: 1.2em;
}
.demo__reset {
  display: block;
  margin: 0.5rem auto 0;
  padding: 0.25rem 0.5rem;
  border: 0;
  background: none;
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.demo__reset:hover { color: var(--text); }

/* ------------------------------------------------------------ section ---- */

.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section--tight { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section__head { max-width: var(--measure); margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__head .label { margin-bottom: 1rem; }
.section__head h2 {
  font-size: clamp(1.625rem, 1.3rem + 1.6vw, 2.375rem);
  margin-bottom: 1rem;
}

/* A rule stated, then broken — the shape of the game, and of this list. */
.claims {
  display: grid;
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  overflow: hidden;
}
@media (min-width: 46rem) { .claims { grid-template-columns: repeat(3, 1fr); } }
.claim {
  background: var(--background);
  padding: clamp(1.5rem, 3vw, 2rem);
}
.claim__n {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.875rem;
}
.claim h3 { font-size: 1.0625rem; margin-bottom: 0.5rem; }
.claim p { margin: 0; color: var(--text-secondary); font-size: 0.9375rem; }

/* ------------------------------------------------------------- facts ---- */

.facts {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}
.fact { border-top: 1px solid var(--hairline); padding-top: 1.125rem; }
.fact dt {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}
.fact dd {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.fact dd small {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
  margin-top: 0.25rem;
}

/* ------------------------------------------------------------ privacy ---- */

.pledge {
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-sunken) 100%);
  box-shadow: inset 0 1px 0 var(--edge-light);
  padding: clamp(1.75rem, 4vw, 3rem);
}
.pledge__grid {
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: start;
}
@media (min-width: 52rem) {
  .pledge__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
}
.nots { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6875rem; }
.nots li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}
.nots li::before {
  content: "—";
  color: var(--accent);
  font-family: var(--mono);
  flex: none;
}
.nots strong { color: var(--text); font-weight: 500; }

/* --------------------------------------------------------------- cta ---- */

.cta { text-align: center; }
.cta h2 { font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.125rem); margin-bottom: 1rem; }
.cta p { color: var(--text-secondary); max-width: 42ch; margin: 0 auto; }
.cta .actions { justify-content: center; }

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

.footer {
  border-top: 1px solid var(--hairline);
  padding-block: 2.5rem 3rem;
  margin-top: clamp(2rem, 6vw, 4rem);
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  align-items: center;
  justify-content: space-between;
}
.footer__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.footer nav a { color: var(--text-tertiary); text-decoration: none; }
.footer nav a:hover { color: var(--text); }
.footer__legal {
  margin: 1.75rem 0 0;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

/*
  Privacy and Terms. A legal page nobody can read is a legal page nobody reads —
  so: one column, real measure, and the summary first.
*/
.doc { padding-block: clamp(2.5rem, 6vw, 4rem) 2rem; }
.doc__head { max-width: var(--measure); margin-bottom: 2.5rem; }
.doc__head h1 {
  font-size: clamp(1.875rem, 1.5rem + 1.9vw, 2.75rem);
  margin-block: 1rem 1.25rem;
}
.doc__dates {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0;
}

.summary {
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: 0 0.75rem 0.75rem 0;
  background: var(--surface);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  max-width: var(--measure);
}
.summary p { margin: 0; color: var(--text); }
.summary p + p { margin-top: 0.875rem; color: var(--text-secondary); }

.doc__body { max-width: var(--measure); }
.doc__body section { margin-bottom: clamp(2rem, 4vw, 2.75rem); }
.doc__body h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--hairline);
}
.doc__body h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-block: 1.5rem 0.5rem;
}
.doc__body p { margin: 0 0 1rem; color: var(--text-secondary); }
.doc__body p:last-child { margin-bottom: 0; }
.doc__body strong { color: var(--text); font-weight: 500; }
.doc__body ul { margin: 0 0 1rem; padding-left: 1.125rem; color: var(--text-secondary); }
.doc__body li { margin-bottom: 0.4375rem; }
.doc__body li::marker { color: var(--text-tertiary); }
.doc__body .none {
  font-family: var(--mono);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.toc {
  border: 1px solid var(--hairline);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2.5rem;
  max-width: var(--measure);
}
.toc p { margin: 0 0 0.75rem; }
.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.875rem;
}
@media (max-width: 34rem) { .toc ol { columns: 1; } }
.toc li { margin-bottom: 0.375rem; break-inside: avoid; }
.toc a { color: var(--text-secondary); text-decoration: none; }
.toc a:hover { color: var(--accent); }

/* --------------------------------------------------------------- 404 ---- */

.notfound {
  min-height: 70vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: 4rem;
}
.notfound h1 { font-size: clamp(1.75rem, 1.4rem + 1.7vw, 2.5rem); margin-block: 1.5rem 1rem; }
.notfound p { color: var(--text-secondary); margin-bottom: 2rem; }

/* ----------------------------------------------------------- support ---- */

/*
  The App Store requires a support URL, and a reviewer will open it. So the
  contact route comes first and is impossible to miss; the FAQ below it exists
  so that most people never need to use it.
*/
.contact {
  border: 1px solid var(--hairline);
  border-radius: 0.875rem;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-sunken) 100%);
  box-shadow: inset 0 1px 0 var(--edge-light);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  max-width: var(--measure);
}
.contact p { margin: 0 0 1rem; color: var(--text-secondary); }
.contact__email {
  display: inline-block;
  font-family: var(--mono);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.3125rem);
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  margin-block: 0.25rem 1.25rem;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.contact__email:hover { color: var(--accent); border-bottom-color: var(--accent); }
.contact ul { margin: 0; padding-left: 1.125rem; color: var(--text-secondary); font-size: 0.9375rem; }
.contact li { margin-bottom: 0.375rem; }
.contact li::marker { color: var(--text-tertiary); }

/* A question and its answer, kept close enough to read as one unit. */
.faq { margin-bottom: clamp(2rem, 4vw, 2.75rem); }
.faq h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-block: 1.75rem 0.5rem;
}
.faq h3:first-of-type { margin-top: 0; }
.faq p { margin: 0 0 0.75rem; color: var(--text-secondary); }
.faq ol, .faq ul { margin: 0 0 0.75rem; padding-left: 1.125rem; color: var(--text-secondary); }
.faq li { margin-bottom: 0.3125rem; }
.faq li::marker { color: var(--text-tertiary); }

/* An in-app path: Pause → Settings → About. Mono, because it is a UI label. */
.path {
  font-family: var(--mono);
  font-size: 0.8125em;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 0.25rem;
  padding: 0.1em 0.4em;
  white-space: nowrap;
}
