/* Play Free Puzzles: one stylesheet for the shell. Games add their own, loaded only on their page. */

:root {
  --cream: #FBF6EE;
  --paper: #FFFDF8;
  --sand: #F3EADB;
  --line: #E4D7C3;
  --ink: #2A2420;
  --ink-soft: #5B5047;
  --terracotta: #A94E27;      /* 5.3:1 on cream */
  --terracotta-dark: #8A3E1E;
  --sage: #4F6E55;
  --honey: #C98B2B;
  --focus: #1F5FAE;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .07);
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1180px;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  font-size: 125%;            /* 20px base: big by default */
  color-scheme: light;
}
html[data-text="large"] { font-size: 150%; }  /* 24px */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter) 3rem; }
img { max-width: 100%; height: auto; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; color: var(--ink); }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.6rem); margin: 1.2rem 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.6rem); margin: 2rem 0 .6rem; }
p, li { max-width: 40em; }
a { color: var(--terracotta); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--terracotta-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.small { font-size: .85rem; color: var(--ink-soft); }
.lede { font-size: 1.12rem; color: var(--ink-soft); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; font-weight: 700; color: var(--sage); margin: 0; }

.skip { position: absolute; left: -999px; top: 0; background: var(--paper); padding: .6rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 56px; padding: .7rem 1.6rem; border-radius: 999px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 2px solid transparent;
}
.btn-primary { background: var(--terracotta); color: #fff; }
.btn-primary:hover { background: var(--terracotta-dark); color: #fff; }
.link-btn {
  background: none; border: 0; padding: .4rem .2rem; font: inherit; font-size: .85rem;
  color: var(--ink-soft); text-decoration: underline; cursor: pointer; min-height: 44px;
}

/* ---- header / footer ---- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem;
  width: 100%; max-width: var(--maxw); margin: 0 auto; padding: .8rem var(--gutter);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand span { font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; }
.brand img { width: 2rem; height: 2rem; }
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.1rem; }
.site-nav a { color: var(--ink); font-weight: 600; text-decoration: none; padding: .5rem 0; }
.site-nav a:hover { text-decoration: underline; }
.text-size {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 48px; padding: .4rem 1rem;
  border: 2px solid var(--line); border-radius: 999px; background: var(--paper);
  font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
.text-size .plus { font-size: .8em; vertical-align: super; }
.text-size[aria-pressed="true"] { border-color: var(--terracotta); background: #FBE9DF; }

.site-footer {
  border-top: 1px solid var(--line); background: var(--sand);
  padding: 2rem var(--gutter) 2.5rem; text-align: center;
}
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.5rem; margin: .8rem 0; }
.site-footer nav a { color: var(--ink); }
.footer-promise { margin: 0 auto; font-weight: 600; }

/* ---- host bubble (shared) ---- */
.host-bubble {
  position: relative; margin: 0; padding: .8rem 1rem; background: var(--paper);
  border: 2px solid var(--line); border-radius: var(--radius); font-size: 1rem; line-height: 1.4;
}

/* ---- home ---- */
.hero {
  display: grid; grid-template-columns: 1fr minmax(180px, 300px); gap: 1rem 2.5rem; align-items: center;
  padding: 1rem 0 0;
}
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.2rem); margin-top: .5rem; }
.hero-host { margin: 0; position: relative; }
.hero-host img {
  display: block; width: 100%; aspect-ratio: 432 / 600; object-fit: cover; object-position: 50% 78%;
  border-radius: 28px; background: var(--sand);
}
.hero-host .host-bubble { margin-top: -2.5rem; margin-left: -1.5rem; margin-right: .5rem; box-shadow: var(--shadow); }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr 140px; gap: 1rem; }
  .hero-host .host-bubble { display: none; }
  .hero-host img { aspect-ratio: 3 / 4; border-radius: 20px; }
}
@media (max-width: 440px) {
  .hero { grid-template-columns: 1fr; }
  .hero-host { display: none; }
}

.daily {
  margin-top: 2.5rem; padding: 1.4rem 1.6rem; border-radius: var(--radius);
  background: linear-gradient(135deg, #F6E4CF, #EFE6D3); border: 2px solid var(--line);
}
.daily h2 { margin: .2rem 0 .3rem; }
.daily p { margin: .2rem 0; }

.cards {
  list-style: none; padding: 0; margin: 1rem 0 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 1.1rem;
}
.card a {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; height: 100%;
  padding: 1.3rem 1.3rem 1.4rem; border-radius: var(--radius); background: var(--paper);
  border: 2px solid var(--line); box-shadow: var(--shadow); text-decoration: none; color: var(--ink);
  transition: transform .15s ease, border-color .15s ease;
}
.card a:hover { border-color: var(--terracotta); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .card a, .card a:hover { transition: none; transform: none; } }
.card img { width: 4.5rem; height: 4.5rem; margin-bottom: .4rem; }
.card-name { font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; }
.card-short { color: var(--ink-soft); font-size: .95rem; }
.badge {
  position: absolute; top: 1rem; right: 1rem; padding: .15rem .6rem; border-radius: 999px;
  background: var(--sand); color: var(--ink-soft); font-size: .72rem; font-weight: 700;
}

.promise-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 1rem; }
.promise-list li { background: var(--paper); border-radius: var(--radius); padding: 1.1rem 1.3rem; border: 2px solid var(--line); }
.promise-list strong { display: block; font-family: var(--font-head); font-size: 1.15rem; margin-bottom: .2rem; }

/* ---- game page ---- */
.crumbs { padding-top: .8rem; font-size: .9rem; color: var(--ink-soft); }
.crumbs a { color: var(--ink-soft); }
.game-title { margin-top: .3rem; }
.play { display: grid; grid-template-columns: 1fr 240px; gap: 1.2rem; align-items: start; }
.stage {
  min-height: min(70vh, 640px); background: var(--paper); border: 2px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); display: grid; place-items: center; overflow: hidden;
  touch-action: manipulation;
}
.stage-soon { text-align: center; padding: 2rem; }
.stage-soon h2 { margin-top: .8rem; }
.stage-soon p { margin: 0 auto; }

.host { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.host-frame {
  position: relative; aspect-ratio: 432 / 560; border-radius: var(--radius); overflow: hidden; background: var(--sand);
}
.host-frame img, .host-frame video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 80%;
}
.host-frame video { transition: opacity .25s linear; }
.host-toggle { align-self: center; }
html[data-host="off"] .host-frame, html[data-host="off"] .host-bubble { display: none; }
html[data-host="off"] .play { grid-template-columns: 1fr; }
html[data-host="off"] .host { position: static; align-items: flex-end; }

@media (max-width: 860px) {
  .play { grid-template-columns: 1fr; }
  .host { position: static; flex-direction: row; align-items: center; order: -1; }
  .host-frame { width: 96px; flex: none; aspect-ratio: 1; border-radius: 50%; }
  .host-frame img, .host-frame video { object-position: 50% 25%; transform: scale(1.7); transform-origin: 50% 34%; }
  .host-bubble { flex: 1; }
  .host-toggle { flex: none; }
}

.about { margin-top: 1rem; }
.about ol li, .about ul li { margin: .35rem 0; }
.more { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding-left: 1.1rem; }

/* ---- consent card (js/analytics.js, Europe only) ---- */
[data-consent-settings][hidden] { display: none !important; }
.consent {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 50;
  width: min(560px, calc(100% - 32px)); transform: translate(-50%, 24px); opacity: 0;
  transition: transform .3s ease, opacity .3s ease;
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem;
  background: var(--paper); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; box-shadow: 0 12px 40px rgba(60, 40, 20, .18); font-size: .9rem; line-height: 1.45;
}
.consent.consent-in { transform: translate(-50%, 0); opacity: 1; }
.consent p { margin: 0; flex: 1 1 280px; }
.consent strong { display: block; font-family: var(--font-head); font-size: 1.05rem; margin-bottom: .15rem; }
.consent-btns { display: flex; gap: .6rem; flex: 1 1 220px; }
.consent-btns .btn { flex: 1; min-height: 52px; padding: .5rem 1rem; }
.consent-allow { background: var(--terracotta); color: #fff; }
.consent-deny { background: var(--sand); color: var(--ink); border-color: var(--line); }
body.playing .consent { display: none; }
@media (prefers-reduced-motion: reduce) { .consent { transition: none; } }

/* ---- prose pages ---- */
.prose { max-width: 44em; }
.promise-points li { margin: .7rem 0; }
