/* ==========================================================================
   FRONTIER LOGIC — site styles
   Colour and type come from tokens.css. Nothing here hard-codes a brand
   colour or a font family. Spacing runs on an 8px rhythm.
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* Prevent long labels or grid children from widening the 320px layout. */
.hero__grid > *,
.interior__grid > *,
.tiers > *,
.editions > * { min-width: 0; }

[hidden] { display: none !important; }

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

/* Visible focus everywhere, on every control. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

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

/* --------------------------------------------------------------- skip link */

.skip-link {
  position: absolute;
  left: 8px;
  top: -120px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 600;
  text-decoration: none;
  border-radius: 4px;
  transition: top 0.15s ease;
}

.skip-link:focus { top: 8px; }

/* ---------------------------------------------------------------- helpers */

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.wrap--narrow { max-width: 720px; }

.section { padding: 88px 0; }
.section + .section { padding-top: 0; }

/* Clears the sticky header when an in-page anchor is followed. */
[id] { scroll-margin-top: 88px; }

.eyebrow {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4.2vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 8px 0 0;
}

.lede {
  font-size: 18px;
  color: var(--ink-muted);
  margin: 16px 0 0;
  max-width: 60ch;
}

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: 0;
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: filter 0.15s ease, background-color 0.15s ease;
}

.btn--primary {
  background: var(--accent);
  color: var(--surface);
}

.btn--primary:hover { filter: brightness(0.92); }

.btn--secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}

.btn--secondary:hover { background: var(--surface-2); }

.btn--block { width: 100%; }

/* ----------------------------------------------------------------- header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark span { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: 4px;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--surface-2);
}

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

.hero { padding: 72px 0 88px; }

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 6.4vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 16px 0 0;
  text-wrap: balance;
}

.hero__subtitle {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-muted);
  margin: 16px 0 0;
  max-width: 44ch;
}

.hero__byline {
  font-family: var(--font-data);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 16px 0 0;
}

.hero__body {
  margin: 24px 0 0;
  max-width: 56ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

/* The format facts. Deliberately the first thing under the title. */
.spec-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.spec-strip li {
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 8px 14px;
}

.hero__figure { margin: 0; }

.cover {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 24px 48px -28px rgba(0, 0, 0, 0.45);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* ---------------------------------------------------------- interior look */

.interior__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  margin-top: 40px;
  align-items: start;
}

.photo {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.photo img { width: 100%; }

.photo--detail {
  margin-top: 40px;
  max-width: 520px;
}

.photo figcaption {
  font-size: 14px;
  color: var(--ink-muted);
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 48px;
  margin-bottom: 24px;
}

.steps li:last-child { margin-bottom: 0; }

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 500;
}

.steps h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0 4px;
}

.steps p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 16px;
}

/* ------------------------------------------------------------------ tiers */

.tiers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 40px;
}

.tier { padding: 32px 24px; }

.tier__count {
  font-family: var(--font-data);
  font-size: 40px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
  margin: 0;
}

.tier__label {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 12px 0 0;
}

.tier__note {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--ink-muted);
}

.tiers__total {
  margin: 24px 0 0;
  font-family: var(--font-data);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* --------------------------------------------------------------- editions */

.editions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 40px;
}

.edition {
  display: flex;
  flex-direction: column;
  padding: 32px 24px;
}

.edition__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.edition__name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.edition__price {
  font-family: var(--font-data);
  font-size: 24px;
  font-weight: 500;
  color: var(--accent);
  margin: 0;
  white-space: nowrap;
}

.edition__for {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 16px;
}

.edition__cover {
  width: 100%;
  max-width: 200px;
  margin: 24px auto;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 16px 32px -22px rgba(0, 0, 0, 0.4);
}

.spec-list {
  margin: 0 0 24px;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.spec-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}

.spec-list dt {
  color: var(--ink-muted);
  margin: 0;
}

.spec-list dd {
  margin: 0;
  font-family: var(--font-data);
  font-size: 14px;
  text-align: right;
  overflow-wrap: anywhere;
}

.edition__cta { margin-top: auto; }

.edition__fineprint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}

.editions__note {
  margin: 24px 0 0;
  font-size: 15px;
  color: var(--ink-muted);
  text-align: center;
}

/* ------------------------------------------------------------- book shelf */

/* The printed series on the generated puzzle pages: five covers, which is
   the offer a paragraph about one volume was not making.

   Five abreast on a phone would be five 45px stamps -- present, unreadable,
   and worse than the text they replaced. So the narrow layout is a
   scroll-snapping shelf with covers kept big enough to recognise, and the
   wide layout is the clear five-cover row. */
.book-shelf {
  list-style: none;
  margin: 40px 0 0;
  padding: 0 0 8px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 42vw);
  gap: 24px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.book-shelf__item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}

/* The covers are two different source sizes; one ratio makes the row read
   as a shelf rather than as five unrelated pictures. Both sources are
   within a pixel of 2:3, so nothing meaningful is cropped. */
.book-shelf__cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.book-shelf__title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin: 12px 0 0;
  color: var(--ink);
}

.book-shelf__buy {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin: 8px 0 0;
  font-size: 14px;
}

.book-shelf__buy a {
  display: inline-block;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.book-shelf__buy a:hover { color: var(--accent); }

@media (min-width: 900px) {
  .book-shelf {
    grid-auto-flow: row;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-auto-columns: auto;
    overflow-x: visible;
    scroll-snap-type: none;
  }
}

/* -------------------------------------------------------------------- faq */

.faq { margin-top: 40px; }

.faq__item {
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}

.faq__item:first-child { border-top: 1px solid var(--rule); }

.faq__q {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0;
}

.faq__a {
  margin: 8px 0 0;
  color: var(--ink-muted);
  max-width: 68ch;
}

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

.site-footer {
  border-top: 1px solid var(--rule);
  padding: 48px 0;
  margin-top: 88px;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer p {
  margin: 0;
  font-size: 15px;
  color: var(--ink-muted);
  max-width: 44ch;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.footer-links a,
.footer-links button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.footer-links a:hover,
.footer-links button:hover { background: var(--surface-2); }

/* --------------------------------------------------------- consent notice */

.consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150;
  background: var(--surface);
  border-top: 1px solid var(--rule-strong);
  box-shadow: 0 -8px 32px -20px rgba(0, 0, 0, 0.5);
  padding: 16px 0;
}

.consent__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.consent__text {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  max-width: 62ch;
}

.consent__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.consent__actions .btn {
  min-height: 44px;
  padding: 10px 20px;
  font-size: 15px;
}

/* ------------------------------------------------------------------- prose
   Used by privacy.html. */

.prose h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 40px 0 0;
}

.prose p,
.prose ul { margin: 12px 0 0; }

.prose ul { padding-left: 24px; }

.prose li { margin-bottom: 8px; }

.prose a { color: var(--ink); }

/* ------------------------------------------------------------- breakpoints */

@media (min-width: 700px) {
  .tiers { grid-template-columns: repeat(3, 1fr); }
  .editions { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 64px;
  }
  .interior__grid {
    grid-template-columns: 1.1fr 0.9fr;
    gap: 48px;
  }
  .cover { max-width: 380px; }
}

@media (max-width: 699px) {
  /* Keep the ad landing view focused: section links remain available by scroll,
     while the cover and product format move into the first phone viewport. */
  .site-header__inner {
    min-height: 56px;
    flex-wrap: nowrap;
  }
  .site-nav { display: none; }
  .hero { padding-top: 32px; }
  .hero__grid { gap: 24px; }
  .hero__figure { grid-row: 1; }
  .cover { max-width: 190px; }
}

@media (max-width: 420px) {
  .wrap { padding: 0 16px; }
  .section { padding: 56px 0; }
  .hero { padding-bottom: 56px; }
  .site-footer { margin-top: 56px; }
  .hero__actions .btn,
  .consent__actions .btn { width: 100%; }
}
