/* Strażnica - the game's UI on the web.
   Tokens from Assets/_Project/UI/tokens.uss and docs/GAME_DESIGN.md §15:
   ink on aged paper, lacquered dark wood, cinnabar and ochre accents,
   plague magenta only where a nest is. Pixel art at whole-number scale. */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('/assets/fonts/pixelify.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans';
  src: url('/assets/fonts/noto-regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans';
  src: url('/assets/fonts/noto-bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #2b2520;
  --ink-soft: #5a4e42;
  --paper: #efe6cf;
  --paper-shade: #e2d5b6;
  --panel: #2a2420;
  --panel-deep: #1d1915;
  --wood: #5a3a24;
  --cinnabar: #c0392b;
  --ochre: #c9a227;
  --jade: #5fae84;
  --mist: #b9c6c9;
  --night: #1a1622;
  --plague: #d63ab4;

  --pixel: 'Pixelify Sans', 'Noto Sans', system-ui, sans-serif;
  --text: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --gutter: 16px;
  --max: 1200px;
  --section: 88px;
  --touch: 44px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--text);
  overflow-x: clip;
}

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

h1, h2, h3, .promise, .clock, .days, .footer-name, .brand span, .facts-line, summary, .store-btn, .btn, dt {
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
}

h1, h2, h3 {
  font-family: var(--pixel);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h2 { font-size: clamp(32px, 7vw, 56px); }
h3 { font-size: 24px; line-height: 1.15; }
p { margin: 0 0 1em; }

a { color: inherit; text-decoration-color: var(--cinnabar); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--cinnabar); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; }

code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.88em; overflow-wrap: break-word; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 820px; }
.center { text-align: center; }
.small { font-size: 14px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 10;
  background: var(--paper); color: var(--ink); padding: 10px 14px; font-weight: 700;
}
.skip:focus { top: 8px; }

/* Pixel art: square pixels, whole-number scale set per image below. */
.px, .panel, .day, .doc-hero { image-rendering: pixelated; }

/* The game's lacquered wood frame around paper (9-slice 16 px, drawn at 2x). */
.panel, .summary-box {
  border: 32px solid transparent;
  border-image: url('/assets/ui/panel.png') 16 / 32px stretch;
  background: var(--paper) url('/assets/ui/paper.png') 0 0 / 96px 96px repeat;
  background-clip: padding-box;
  padding: 4px 8px;
  color: var(--ink);
}

/* Header ---------------------------------------------------------------- */
.site-header { background: var(--panel); color: var(--paper); }
.header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "brand lang" "nav nav";
  align-items: center;
  column-gap: 12px;
  padding-top: 6px;
}
.brand {
  grid-area: brand;
  display: inline-flex; align-items: center; gap: 10px;
  min-height: var(--touch);
  text-decoration: none; color: var(--paper);
}
.brand img { width: 32px; height: 32px; image-rendering: pixelated; }
.brand span { font: 600 24px/1 var(--pixel); }
.main-nav { grid-area: nav; display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 -10px; }
.main-nav a, .lang-switch a {
  display: inline-flex; align-items: center; min-height: var(--touch); padding: 0 10px;
  color: var(--paper); text-decoration: none; font-weight: 700; font-size: 15px;
}
.main-nav a:hover, .lang-switch a:hover { color: var(--ochre); }
.main-nav a[aria-current="page"] { color: var(--ochre); }
.lang-switch { grid-area: lang; display: flex; }
.lang-switch a { min-width: var(--touch); justify-content: center; font-family: var(--pixel); font-size: 17px; }
.lang-switch a[aria-current="true"] { color: var(--panel); background: var(--ochre); }

/* Hero ------------------------------------------------------------------ */
.hero { position: relative; background: var(--panel-deep); }
.hero-art img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 55% 40%; }
.hero-wrap { position: relative; margin-top: -72px; padding-bottom: 40px; }
.hero-panel { max-width: 600px; }
.hero h1 {
  font-size: clamp(48px, 13.4vw, 96px);
  font-weight: 700;
  line-height: 0.95;
  margin: 0 0 12px;
}
.promise { font: 600 clamp(22px, 5.6vw, 30px)/1.2 var(--pixel); margin: 0 0 14px; text-wrap: balance; }
.lead { font-size: 18px; }
.facts-line {
  list-style: none; margin: 16px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px 0;
  font: 500 17px/1.3 var(--pixel); color: var(--ink-soft);
}
.facts-line li:not(:last-child)::after { content: "·"; padding: 0 10px; color: var(--cinnabar); }

/* Store buttons: dark lacquered wood with the gold edge of the in-game buttons. */
.store-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.store-btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 6px 14px 6px 12px;
  background: var(--panel); color: var(--paper);
  border: 2px solid var(--ochre);
  text-decoration: none; font: 700 17px/1.1 var(--text);
}
.store-btn small { display: block; font: 400 12px/1.2 var(--text); letter-spacing: 0; opacity: 0.85; }
.store-btn .icon { width: 22px; height: 22px; flex: none; }
.store-btn.is-soon { background: var(--paper-shade); color: var(--ink-soft); border: 2px dashed var(--ink-soft); }
a.store-btn:hover { color: var(--ochre); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--touch);
  padding: 8px 18px; background: var(--panel); color: var(--paper);
  border: 2px solid var(--ochre); text-decoration: none; font: 600 18px/1.1 var(--pixel);
}
.btn:hover { color: var(--ochre); }
.btn-paper { background: var(--paper); color: var(--ink); border-color: var(--wood); }
.btn-paper:hover { color: var(--cinnabar); }
.icon { width: 24px; height: 24px; }
.icon-sm { width: 18px; height: 18px; }

/* Sections -------------------------------------------------------------- */
.section { padding: var(--section) 0; }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-lead { font-size: 18px; max-width: 62ch; }

/* The day: paper ground, a wooden day track with the HUD clock on it. */
.day { background: var(--paper) url('/assets/ui/paper.png') 0 0 / 96px 96px repeat; }
.day-loop { list-style: none; margin: 0; padding: 0; display: grid; gap: 48px; }
.day-step { display: grid; gap: 16px; }
.day-art {
  margin: 0; min-height: 168px; padding: 20px 0 0;
  display: flex; align-items: flex-end; justify-content: flex-start;
  border-bottom: 10px solid var(--wood);
}
.px-expedition { width: 238px; }
.px-forge { width: 192px; }
.px-dissection { width: 184px; }
.clock {
  display: inline-block; vertical-align: 0.1em; margin-right: 6px; padding: 3px 8px 2px;
  background: var(--panel); color: var(--paper); font: 700 16px/1 var(--text); font-variant-numeric: tabular-nums;
}
.day-text h3 { margin-bottom: 8px; }
.day-text p { max-width: 46ch; }
.night-line {
  margin: 56px 0 0; padding: 18px 20px;
  background: var(--night); color: var(--paper);
  font: 600 clamp(20px, 4.6vw, 26px)/1.25 var(--pixel);
}
.night-line .clock { background: var(--paper); color: var(--night); }

/* The nests: a field of night. The only place the plague colour appears. */
.nests { background: var(--night); color: var(--paper); }
.nests a { color: var(--paper); }
.nests-grid { display: grid; gap: 40px; }
.nests-art { margin: 0; }
.nests-art img { width: 100%; max-width: 360px; max-height: 520px; object-fit: cover; object-position: 50% 40%; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 36px; }
.stage { display: grid; gap: 12px; }
.stage-art { display: flex; align-items: flex-end; min-height: 96px; }
.px-seed { width: 96px; }
.px-nest { width: 166px; }
.px-mother { width: 292px; }
.stage h3 { margin-bottom: 6px; }
.days {
  display: inline-block; vertical-align: 0.12em; margin-left: 6px; padding: 3px 8px 2px;
  background: var(--plague); color: #0b0910; font: 700 16px/1 var(--text); font-variant-numeric: tabular-nums;
}
.stage p { max-width: 52ch; color: #e6dcc4; }
.nests-choice { margin: 40px 0 0; font: 600 clamp(22px, 5vw, 30px)/1.2 var(--pixel); text-wrap: balance; }

/* Screens: dark wood, a strip of phones that scrolls sideways on small screens. */
.screens { background: var(--panel); color: var(--paper); }
.screens .section-head { margin-bottom: 32px; }
.shot-strip {
  list-style: none; margin: 0 auto; max-width: var(--max); padding: 4px var(--gutter) 20px;
  display: flex; gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  scrollbar-color: var(--wood) transparent;
}
.shot-strip li { flex: 0 0 220px; scroll-snap-align: start; }
.phone { margin: 0; }
.phone img {
  width: 100%; aspect-ratio: 621 / 1344; object-fit: cover;
  border: 6px solid var(--panel-deep); border-radius: 22px; background: var(--panel-deep);
}
.phone figcaption, .desktop-shot figcaption { margin-top: 12px; font: 500 17px/1.25 var(--pixel); }
.desktop-shot { margin: 48px 0 0; }
.desktop-shot img { width: 100%; border: 6px solid var(--panel-deep); }

/* The watchtower. */
.tower { background: var(--paper-shade); }
.tower-grid { display: grid; gap: 40px; }
.week-title { margin-top: 32px; }
.week {
  list-style: none; margin: 0 0 28px; padding: 4px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px;
  background: var(--wood);
}
.week li { background: var(--paper); padding: 8px 12px; display: flex; gap: 10px; align-items: baseline; }
.week b { font: 600 18px/1 var(--pixel); min-width: 2.4em; color: var(--cinnabar); }
.week span { font-weight: 700; }
.week .quiet { background: var(--paper-shade); }
.week .quiet span { font-weight: 400; color: var(--ink-soft); }
.tower-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.tower-points li { position: relative; padding-left: 24px; max-width: 56ch; }
.tower-points li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 10px; background: var(--ochre); }
.tower-art { margin: 0; }
.tower-art img { width: 100%; max-width: 360px; }

/* Pay once: a paper notice on a wall of wood. */
.pay { background: var(--wood); }
.pay-panel { max-width: 920px; margin: 0 auto; }
.pay-panel h2 { font-size: clamp(30px, 6.4vw, 48px); }
.pay-list { margin: 24px 0 8px; display: grid; gap: 4px; }
.pay-list div { background: var(--paper-shade); padding: 12px 14px; }
.pay-list dt { font: 600 22px/1.15 var(--pixel); }
.pay-list dd { margin: 4px 0 0; }
.pay-note { margin: 20px 0 0; font-size: 15px; color: var(--ink-soft); }

/* Footer ---------------------------------------------------------------- */
.site-footer { background: var(--panel); color: var(--paper); padding: 56px 0 32px; }
.site-footer a { color: var(--paper); }
.site-footer a:hover { color: var(--ochre); }
.footer-name {
  margin: 0 0 32px; font: 700 clamp(56px, 13vw, 200px)/0.85 var(--pixel);
  color: #4a3d33; white-space: nowrap;
}
.footer-grid { display: grid; gap: 32px; }
.footer-grid h2 { font-size: 20px; margin-bottom: 8px; color: var(--ochre); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li a { display: inline-flex; align-items: center; min-height: var(--touch); }
.footer-about .brand { margin-bottom: 8px; }
.footer-about p { max-width: 40ch; }
.lang-switch-footer { margin: 8px 0 0; }
.footer-base { margin-top: 40px; padding-top: 20px; border-top: 4px solid var(--wood); color: #d9cdb2; }
.footer-base p { margin: 0 0 6px; }

/* Legal and support pages ------------------------------------------------ */
.doc-hero { background: var(--paper) url('/assets/ui/paper.png') 0 0 / 96px 96px repeat; padding: 56px 0 24px; }
.doc-hero h1 { font-size: clamp(40px, 10vw, 72px); font-weight: 700; margin-bottom: 12px; }
.doc-meta { color: var(--ink-soft); }
.doc { padding-bottom: 80px; }
.summary-box { image-rendering: pixelated; padding: 0 8px; margin: 8px 0 32px; }
.summary-box h2, .toc-title { font-size: 26px; }
.toc { background: var(--paper-shade); padding: 20px 20px 12px; margin-bottom: 40px; }
.toc ol { margin: 0; padding-left: 0; list-style: none; columns: 1; }
.toc li a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; }
.toc li a:hover { text-decoration: underline; text-decoration-color: var(--cinnabar); }
.prose section { margin-bottom: 36px; scroll-margin-top: 16px; }
.prose h2 { font-size: clamp(24px, 5vw, 30px); }
.prose ul { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.check-list { list-style: none; padding-left: 0 !important; }
.check-list li { position: relative; padding-left: 28px; }
.check-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.42em; width: 14px; height: 8px;
  border-left: 3px solid var(--jade); border-bottom: 3px solid var(--jade); transform: rotate(-45deg);
}
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 2px solid var(--paper-shade); }
th { background: var(--panel); color: var(--paper); font: 600 16px/1.2 var(--pixel); }
.app-card { background: var(--paper-shade); padding: 16px 20px; }
.app-card dl { margin: 0; display: grid; gap: 4px 20px; }
.app-card dt { font-weight: 700; }
.app-card dd { margin: 0 0 8px; }
mark.todo { background: var(--ochre); color: var(--ink); padding: 0 4px; }

.support-grid { display: grid; gap: 16px; margin: 8px 0 48px; }
.support-grid h2 { font-size: clamp(28px, 6vw, 34px); }
.big-mail { font: 600 clamp(22px, 6vw, 30px)/1.2 var(--pixel); margin: 4px 0 16px; }
.big-mail a { text-decoration: none; }
.card-mail .btn { margin-bottom: 18px; }
.card-mail ul, .delete-data ul { padding-left: 20px; margin: 0 0 12px; }
.where { margin: 0; }
.where dt { font: 600 19px/1.2 var(--pixel); margin-top: 12px; }
.where dt:first-child { margin-top: 0; }
.where dd { margin: 2px 0 0; }
.faq { margin-bottom: 48px; }
.faq-list { display: grid; gap: 4px; }
.faq-list details { background: var(--paper-shade); }
.faq-list summary {
  cursor: pointer; list-style: none; position: relative;
  min-height: var(--touch); padding: 12px 48px 12px 16px;
  font: 600 19px/1.3 var(--pixel);
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; position: absolute; right: 16px; top: 10px; font: 700 24px/1 var(--pixel); color: var(--cinnabar); }
.faq-list details[open] summary::after { content: "–"; }
.faq-list details p { margin: 0; padding: 0 16px 16px; max-width: 68ch; }
.delete-data { margin-bottom: 32px; scroll-margin-top: 16px; }
.doc-links { color: var(--ink-soft); }

.not-found { padding: 96px 0; }
.px-seed-404 { width: 128px; margin: 0 auto 24px; }
.not-found h1 { font-size: clamp(32px, 7vw, 52px); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 24px; }

/* Wider screens ---------------------------------------------------------- */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .week { grid-template-columns: repeat(4, 1fr); }
  .shot-strip { display: grid; grid-template-columns: repeat(3, 1fr); overflow: visible; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .support-grid { grid-template-columns: 1fr 1fr; }
  .toc ol { columns: 2; column-gap: 32px; }
}

@media (min-width: 900px) {
  :root { --gutter: 32px; --section: 136px; }
  .header-row { grid-template-columns: auto 1fr auto; grid-template-areas: "brand nav lang"; padding-top: 0; }
  .main-nav { justify-content: flex-end; margin: 0 8px 0 0; }

  .hero { min-height: clamp(640px, 86vh, 880px); display: flex; align-items: center; }
  .hero-art { position: absolute; inset: 0; }
  .hero-art img { width: 100%; height: 100%; aspect-ratio: auto; object-position: 22% 45%; }
  .hero-wrap { margin-top: 0; padding: 64px var(--gutter); display: flex; justify-content: flex-end; }
  .hero-panel { width: 600px; }

  .day-loop { grid-template-columns: 1.25fr 1fr 1fr; gap: 0 40px; }
  .day-art { min-height: 300px; }
  .px-expedition { width: 357px; }
  .px-forge { width: 256px; }
  .px-dissection { width: 276px; }

  .nests-grid { grid-template-columns: 360px 1fr; gap: 72px; align-items: start; }
  .nests-art img { max-height: none; }
  .nests-art { position: sticky; top: 32px; }
  .stage { grid-template-columns: 300px 1fr; align-items: end; gap: 24px; }
  .px-nest { width: 249px; }

  .shot-strip { grid-template-columns: repeat(6, 1fr); }
  .desktop-shot figcaption { font-size: 22px; }

  .tower-grid { grid-template-columns: 1fr 360px; gap: 72px; align-items: center; }
  .week { grid-template-columns: repeat(7, 1fr); }
  .week li { flex-direction: column; gap: 6px; padding: 12px 10px; }

  .pay-list { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1.2fr; }
}


/* Motion: CSS only, transform and opacity, 150-300 ms, never without consent. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  @keyframes slide-paper { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

  .hero-panel { animation: slide-paper 280ms var(--ease-out) 80ms both; }

  .store-btn, .btn, .phone img, .main-nav a, .lang-switch a {
    transition: transform 160ms var(--ease-out), color 160ms var(--ease-out);
  }
  a.store-btn:hover, .btn:hover { transform: translateY(-2px); }
  a.store-btn:active, .btn:active { transform: translateY(1px); transition-duration: 80ms; }
  .phone:hover img { transform: translateY(-6px); }
  .faq-list details[open] p { animation: rise 220ms var(--ease-out) both; }

  @supports (animation-timeline: view()) {
    .section-head, .day-step, .stage, .nests-choice, .night-line, .shot-strip, .desktop-shot, .tower-copy > *, .tower-art, .pay-panel {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 5% entry 55%;
    }
    .day-step:nth-child(2), .stage:nth-child(2) { animation-range: entry 15% entry 65%; }
    .day-step:nth-child(3), .stage:nth-child(3) { animation-range: entry 25% entry 75%; }
  }
}
