/* Tomato Factory — site styles
   One stylesheet, no build step. Colors and type live in the tokens below. */

:root {
  --paper: #ffffff;
  --surface: #fff1ec;
  --ink: #1c1a45;
  --ink-soft: #4b4876;
  --line: #e6e2ef;
  --tomato: #ee3a23;
  --tomato-text: #c42812;
  --leaf: #17804a;
  --sun: #ffc62e;
  --belt: #1c1a45;
  --belt-edge: #2e2b66;
  --slab: #1c1a45;

  --display: "Bowlby One", "Arial Black", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;

  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius-lg: 28px;
  --radius-md: 16px;
  --radius-sm: 10px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14123a;
    --surface: #1f1c50;
    --ink: #f4f2ff;
    --ink-soft: #b9b5e0;
    --line: #2f2c66;
    --tomato: #ff5a40;
    --tomato-text: #ff7a63;
    --leaf: #3cc47c;
    --belt: #0c0a2a;
    --belt-edge: #2a2760;
    --slab: #07061c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14123a;
  --surface: #1f1c50;
  --ink: #f4f2ff;
  --ink-soft: #b9b5e0;
  --line: #2f2c66;
  --tomato: #ff5a40;
  --tomato-text: #ff7a63;
  --leaf: #3cc47c;
  --belt: #0c0a2a;
  --belt-edge: #2a2760;
  --slab: #07061c;
  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--tomato-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.05; letter-spacing: -0.01em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 7vw, 5.25rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1em; text-wrap: pretty; }

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

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */

.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--display); font-size: 1.25rem; letter-spacing: -0.01em; }
.brand svg { width: 38px; height: 38px; flex: none; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 600; padding: 8px 14px; border-radius: 999px; }
.nav a:hover { background: var(--surface); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

.nav-toggle { display: none; background: none; border: 0; color: var(--ink); padding: 8px; margin-right: -8px; cursor: pointer; }
.nav-toggle svg { width: 28px; height: 28px; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0; padding: 8px var(--gutter) 20px; background: var(--paper); border-bottom: 1px solid var(--line); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 14px 12px; border-radius: var(--radius-sm); font-size: 1.125rem; }
}

/* ---------- Buttons ---------- */

.btn { display: inline-flex; align-items: center; gap: 10px; font: 700 1rem/1 var(--body); padding: 16px 24px; border-radius: 999px; text-decoration: none; border: 2px solid var(--ink); color: var(--ink); background: transparent; cursor: pointer; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--tomato); border-color: var(--tomato); color: #fff; }
.btn-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

.store-badge { display: inline-block; line-height: 0; border-radius: 10px; }
.store-badge img { height: 52px; width: auto; }
.store-note { font-size: 0.9375rem; color: var(--ink-soft); }

/* ---------- Hero + conveyor ---------- */

.hero { padding: clamp(48px, 9vw, 112px) 0 0; overflow: hidden; }
.hero h1 { max-width: 13ch; }
.hero .lede { font-size: clamp(1.125rem, 2vw, 1.3rem); color: var(--ink-soft); max-width: 46ch; margin-bottom: 32px; }

.factory { position: relative; margin-top: clamp(48px, 7vw, 88px); }

.belt {
  position: relative;
  background: var(--belt);
  padding: 34px 0 44px;
  overflow: hidden;
  border-top: 6px solid var(--belt-edge);
}
.belt::after {
  /* the rollers along the bottom edge */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 10px; height: 18px;
  background: radial-gradient(circle at 9px 9px, var(--belt-edge) 7px, transparent 8px) 0 0 / 36px 18px repeat-x;
  animation: rollers 1.6s linear infinite;
}
@keyframes rollers { to { background-position: -36px 0; } }

.belt-track { display: flex; width: max-content; animation: belt 110s linear infinite; }
.belt:hover .belt-track, .belt:focus-within .belt-track { animation-play-state: paused; }
@keyframes belt { to { transform: translateX(-50%); } }

.belt-item { flex: none; display: grid; justify-items: center; gap: 12px; text-decoration: none; color: #fff; width: 132px; margin-right: 28px; }
.belt-item img { width: 116px; height: 116px; border-radius: 26px; box-shadow: 0 10px 0 rgb(0 0 0 / 0.28); transition: transform 0.25s ease; }
a.belt-item:hover img, a.belt-item:focus-visible img { transform: translateY(-8px) rotate(-4deg); }
.belt-item span { font-size: 0.875rem; font-weight: 600; opacity: 0.85; text-align: center; line-height: 1.25; }
.belt-item.crate img { background: var(--sun); }

@media (max-width: 640px) {
  .belt-item { width: 100px; }
  .belt-item img { width: 88px; height: 88px; border-radius: 20px; }
}

/* ---------- Sections ---------- */

.section { padding: clamp(64px, 10vw, 128px) 0; }
.section-tight { padding: clamp(48px, 7vw, 80px) 0; }
.section-surface { background: var(--surface); }
.section-head { max-width: 640px; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head p { color: var(--ink-soft); font-size: 1.125rem; }

/* Featured game */
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.feature-art { position: relative; aspect-ratio: 1; max-width: 460px; width: 100%; justify-self: center; }
.feature-art .stairs { position: absolute; inset: 0; }
.feature-art .icon { position: absolute; width: 30%; height: auto; aspect-ratio: 1; left: 67.5%; top: 7%; border-radius: 22%; box-shadow: 0 8px 0 var(--slab); transform: rotate(-8deg); }
.feature-copy .meta { color: var(--ink-soft); margin-bottom: 20px; }
.feature-copy p.big { font-size: 1.25rem; }
@media (max-width: 820px) { .feature { grid-template-columns: 1fr; } .feature-art { max-width: 320px; } }

/* Game list rows */
.game-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 3vw, 40px); }
.game-list li { display: grid; grid-template-rows: auto auto 1fr auto; gap: 6px; }
.game-list img { width: 96px; height: 96px; border-radius: 22px; margin-bottom: 14px; border: 1px solid var(--line); }
.game-list h3 { margin: 0; }
.game-list h3 a { color: var(--ink); text-decoration: none; }
.game-list h3 a:hover { color: var(--tomato-text); }
.game-list p { color: var(--ink-soft); margin: 0; }
.game-list .more { font-weight: 700; margin-top: 10px; }
.game-list.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1020px) { .game-list.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .game-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .game-list, .game-list.four { grid-template-columns: 1fr; } }

/* Other apps: compact rows */
.app-rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.app-rows li { display: flex; align-items: center; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.app-rows img { width: 56px; height: 56px; border-radius: 13px; flex: none; }
.app-rows div { flex: 1; min-width: 0; }
.app-rows strong { display: block; }
.app-rows span { color: var(--ink-soft); font-size: 0.9375rem; }
.app-rows a.link { font-weight: 700; white-space: nowrap; }

/* Studio strip */
.studio { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.studio p { font-size: 1.125rem; }
.studio .facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 2px solid var(--ink); }
.studio .facts li { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.studio .facts b { font-family: var(--display); font-weight: 400; font-size: 1.35rem; }
@media (max-width: 820px) { .studio { grid-template-columns: 1fr; } }

/* ---------- Vault timeline ---------- */

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 88px; top: 8px; bottom: 8px; width: 3px; background: var(--line); border-radius: 3px; }
.timeline > li { display: grid; grid-template-columns: 88px 1fr; gap: 0 36px; padding: 0 0 36px; position: relative; }
.timeline > li::before { content: ""; position: absolute; left: 82px; top: 10px; width: 15px; height: 15px; border-radius: 50%; background: var(--tomato); border: 3px solid var(--paper); }
.timeline .year { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; }
.timeline ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline ul li b { font-weight: 700; }
.timeline ul li > span:not(.live) { display: block; color: var(--ink-soft); font-size: 0.975rem; line-height: 1.4; }
.timeline .live { display: inline-block; font-size: 0.8125rem; font-weight: 700; color: var(--leaf); border: 1.5px solid currentColor; border-radius: 999px; padding: 0 8px; margin-left: 6px; vertical-align: 2px; }
@media (max-width: 540px) {
  .timeline::before { left: 6px; }
  .timeline > li { grid-template-columns: 1fr; padding-left: 32px; }
  .timeline > li::before { left: 0; }
}

/* ---------- Game detail page ---------- */

.game-hero { padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 64px); }
.game-hero .wrap { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 4vw, 48px); align-items: center; }
.game-hero img.icon { width: clamp(120px, 18vw, 200px); height: auto; border-radius: 22%; box-shadow: 0 12px 0 var(--slab); }
.game-hero h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); margin-bottom: 0.3em; }
.game-hero .tag { font-size: 1.25rem; color: var(--ink-soft); max-width: 42ch; margin-bottom: 24px; }
@media (max-width: 640px) { .game-hero .wrap { grid-template-columns: 1fr; } }

.game-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.game-body .prose { max-width: 62ch; }
.game-body aside { border-top: 2px solid var(--ink); }
.game-body aside dl { margin: 0; }
.game-body aside div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.game-body aside dt { color: var(--ink-soft); }
.game-body aside dd { margin: 0; font-weight: 600; text-align: right; }
@media (max-width: 820px) { .game-body { grid-template-columns: 1fr; } }

.shots { display: flex; gap: 20px; overflow-x: auto; padding: 8px 0 24px; scroll-snap-type: x mandatory; }
.shots img { flex: none; height: clamp(360px, 50vw, 520px); width: auto; border-radius: 22px; border: 1px solid var(--line); scroll-snap-align: start; }

/* ---------- Prose / legal ---------- */

.page-head { padding: clamp(48px, 8vw, 96px) 0 clamp(24px, 4vw, 40px); }
.page-head p { font-size: 1.2rem; color: var(--ink-soft); max-width: 56ch; }
.page-head .updated { font-size: 0.9375rem; }

.doc { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); padding-bottom: clamp(64px, 10vw, 120px); }
.doc nav { position: sticky; top: 96px; align-self: start; font-size: 0.9375rem; }
.doc nav ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.doc nav a { display: block; padding: 6px 0 6px 16px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-soft); text-decoration: none; }
.doc nav a:hover { color: var(--ink); border-left-color: var(--tomato); }
@media (max-width: 860px) { .doc { grid-template-columns: 1fr; } .doc nav { position: static; } }

.prose { max-width: 68ch; }
.prose h2 { font-size: 1.75rem; margin-top: 2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-family: var(--body); font-weight: 700; font-size: 1.15rem; margin: 1.6em 0 0.4em; letter-spacing: 0; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose li::marker { color: var(--tomato); }
.prose .callout { background: var(--surface); border-radius: var(--radius-md); padding: 20px 24px; margin: 0 0 1.5em; }
.prose .callout p:last-child { margin: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.5em; font-size: 0.975rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 700; }
.table-scroll { overflow-x: auto; }

/* Placeholder text that still needs a real value before launch */
.todo { background: var(--sun); color: #1c1a45; padding: 0 4px; border-radius: 4px; font-weight: 700; }

/* ---------- Support ---------- */

.support-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
@media (max-width: 860px) { .support-grid { grid-template-columns: 1fr; } }

.contact-card { background: var(--surface); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 40px); }
.contact-card h2 { font-size: 1.9rem; }
.email-big { font-weight: 700; font-size: clamp(1.15rem, 2.4vw, 1.45rem); overflow-wrap: anywhere; }

.form { display: grid; gap: 18px; margin-top: 24px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form .hint { font-weight: 400; color: var(--ink-soft); font-size: 0.9rem; }
.form input, .form select, .form textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--sun); }
.form textarea { min-height: 150px; resize: vertical; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 540px) { .form .row { grid-template-columns: 1fr; } }
.form-status { font-size: 0.95rem; color: var(--ink-soft); min-height: 1.5em; margin: 0; }
.form-status.is-ok { color: var(--leaf); font-weight: 600; }
.form-status.is-error { color: var(--tomato-text); font-weight: 600; }
.form button[disabled] { opacity: 0.6; cursor: progress; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status-note { color: var(--ink-soft); max-width: 42ch; margin-bottom: 16px; }

.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 2px solid var(--ink); }
.faq summary { cursor: pointer; list-style: none; padding: 18px 40px 18px 0; font-weight: 700; font-size: 1.075rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 6px; top: 50%; width: 12px; height: 12px; border-right: 3px solid var(--tomato); border-bottom: 3px solid var(--tomato); transform: translateY(-70%) rotate(45deg); transition: transform 0.2s ease; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq details > div { padding: 0 0 20px; color: var(--ink-soft); max-width: 62ch; }
.faq details > div p:last-child { margin: 0; }

/* ---------- News ---------- */

.post-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); max-width: 820px; }
.post-list li { padding: 28px 0; border-bottom: 1px solid var(--line); }
.post-list time { color: var(--ink-soft); font-size: 0.9375rem; }
.post-list h2, .post-list h3 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 4px 0 8px; }
.post-list h2 a, .post-list h3 a { color: var(--ink); text-decoration: none; }
.post-list h2 a:hover, .post-list h3 a:hover { color: var(--tomato-text); }
.post-list p { color: var(--ink-soft); margin: 0; max-width: 62ch; }

.post { padding-bottom: clamp(64px, 10vw, 120px); }
.post .prose { font-size: 1.125rem; }
.post .prose img { border-radius: var(--radius-md); margin: 1.5em 0; }
.back { display: inline-block; margin-bottom: 20px; font-weight: 600; }

/* ---------- Footer ---------- */

.site-footer { background: var(--belt); color: #e9e7ff; padding: clamp(48px, 7vw, 80px) 0 32px; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.footer-grid .brand { color: #fff; margin-bottom: 12px; }
.footer-grid p { color: #bdb9e6; max-width: 34ch; font-size: 0.975rem; }
.footer-grid h2 { font-family: var(--body); font-size: 0.95rem; font-weight: 700; color: #bdb9e6; margin: 0 0 12px; letter-spacing: 0; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 48px; padding-top: 24px; border-top: 1px solid #2e2b66; font-size: 0.9rem; color: #bdb9e6; }
@media (max-width: 820px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }

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

.lost { min-height: 60vh; display: grid; align-content: center; padding: 64px 0; }
.lost h1 { max-width: 12ch; }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .belt { overflow-x: auto; }
}
