/* ==========================================================================
   FIVE-STAR MYSTERIES — page chrome for the generated daily pages.

   `brand/tokens.css` owns colour and type. `vendor/daily-grid.css` owns the
   puzzle component and reads only tokens. This file owns everything around
   them: the header, the section rhythm, the buttons, the book shelf, the
   footer and the consent notice.

   IT DEFINES NO TOKEN. --ink, --rule, --surface and the rest are tuned in
   tokens.css for the grid's contrast, and a chrome stylesheet that redefined
   one would silently restyle every cell on the page. The two accents this
   file needs that the grid does not are namespaced --fs-*.

   The homepage is hand-owned and uses `brand/home.css` instead. The header
   and footer MARKUP is identical in both so the two never drift; only the
   styling differs, because the homepage header sits over a dark hero and
   these pages have none.
   ========================================================================== */

:root {
  --fs-navy-950: #071321;
  --fs-navy-900: #091a2f;
  --fs-brass-light: #d4af69;
  --fs-wrap: 72rem;
}

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.18; }

/* One measure for every band on the page, so the header, the grid and the
   book shelf line up down the left edge at every width. */
.wrap {
  width: min(100% - 2rem, var(--fs-wrap));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  transform: translateY(-180%);
  background: var(--surface);
  color: var(--fs-navy-900);
  padding: .7rem 1rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); }

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

.site-header {
  background: var(--fs-navy-900);
  color: #f4eddf;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}

.wordmark {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  text-decoration: none;
}
.wordmark__stars {
  margin-bottom: .35rem;
  color: var(--fs-brass-light);
  font-size: .52rem;
  letter-spacing: .52em;
}
.wordmark__name {
  font-family: var(--font-display);
  font-size: clamp(.78rem, 2.7vw, 1.05rem);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: .1rem; }
.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: .35rem .5rem;
  color: inherit;
  font-family: var(--font-data);
  font-size: .62rem;
  letter-spacing: .075em;
  text-decoration: none;
  text-transform: uppercase;
}
.site-nav a:hover { color: var(--fs-brass-light); }

/* ----------------------------------------------------------------- sections */

.section { padding: 2.5rem 0; }
.section + .section { padding-top: 0; }

.eyebrow {
  display: block;
  margin: 0 0 .6rem;
  color: var(--accent);
  font-family: var(--font-data);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.section-title { margin: 0; font-size: clamp(1.9rem, 5.5vw, 2.9rem); }

.lede {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--ink-muted);
  font-size: 1.02rem;
}

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

/* The generated pages use .btn; the hand-written homepage uses .button. Both
   are 48px tall and hit the same 44px minimum target. */
.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--ink);
  padding: .75rem 1rem;
  font-family: var(--font-data);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.btn--primary { background: var(--accent); color: #fbf7ee; }
.btn--primary:hover { background: var(--fs-navy-900); border-color: var(--fs-navy-900); }
.btn--secondary:hover { background: var(--accent-soft); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn[disabled]:hover { background: transparent; color: var(--ink); }
.btn--primary[disabled]:hover { background: var(--accent); color: #fbf7ee; }

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

.books-section {
  margin-top: 3rem;
  padding-block: 3rem;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}

.book-shelf {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 1rem;
  align-items: end;
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
}

.book-shelf__item { margin: 0; min-width: 0; }

.book-shelf__cover-link { display: block; text-decoration: none; }

.book-shelf__cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  box-shadow: 0 1rem 2rem rgba(23, 32, 51, .2);
}

.book-shelf__title {
  display: block;
  margin-top: .8rem;
  font-family: var(--font-display);
  font-size: clamp(.9rem, 3vw, 1.1rem);
  line-height: 1.3;
}

.book-shelf__place {
  display: block;
  margin-top: .2rem;
  color: var(--ink-muted);
  font-family: var(--font-data);
  font-size: .56rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.edition-links { display: grid; gap: .85rem; margin-top: 2.5rem; }
.edition-links > a {
  min-height: 8.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--accent);
  padding: 1.25rem;
  text-decoration: none;
  transition: background-color .18s ease;
}
.edition-links > a:hover { background: var(--accent-soft); }
.edition-links > a:hover span,
.edition-links > a:hover small { color: var(--ink); }
.edition-links span {
  color: var(--accent);
  font-family: var(--font-data);
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.edition-links strong {
  margin-top: .4rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 400;
}
.edition-links small {
  margin-top: .9rem;
  color: var(--ink-muted);
  font-family: var(--font-data);
  font-size: .63rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.editions__note {
  margin: 1.5rem 0 0;
  color: var(--ink-muted);
  font-family: var(--font-data);
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

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

.site-footer {
  margin-top: 3rem;
  padding-block: 2rem;
  background: var(--fs-navy-950);
  color: #b9bec7;
  font-family: var(--font-data);
  font-size: .64rem;
  letter-spacing: .04em;
}
.site-footer__inner {
  display: flex;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.footer-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.site-footer a, .site-footer button { color: inherit; }
.site-footer a { min-height: 44px; display: inline-flex; align-items: center; }
.site-footer button {
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

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

.consent {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 20;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .28);
  padding: 1rem;
}
.consent[hidden] { display: none; }
.consent__inner { display: grid; gap: 1rem; }
.consent__text { margin: 0; font-size: .88rem; }
.consent__actions { display: flex; gap: .65rem; }
.consent button {
  min-height: 44px;
  flex: 1;
  border: 1px solid var(--fs-navy-900);
  background: transparent;
  color: var(--fs-navy-900);
  padding: .6rem .9rem;
  font-family: var(--font-data);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.consent button:first-child { background: var(--fs-navy-900); color: #f4eddf; }

/* Short landscape phones: the notice is fixed, so it has to stop covering
   the puzzle controls rather than merely looking smaller. */
@media (max-width: 46rem) and (max-height: 45rem) {
  body.consent-pending { padding-bottom: 9rem; }
  .consent { inset: auto .5rem .5rem; padding: .5rem; }
  .consent__inner { gap: .5rem; }
  .consent__text { font-size: .75rem; line-height: 1.45; }
}

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

@media (min-width: 40rem) {
  .book-shelf { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1.15rem; }
  .edition-links { grid-template-columns: 1fr 1fr; }
  .consent__inner { grid-template-columns: 1fr auto; align-items: center; }
  .consent__actions button { flex: none; }
}

@media (min-width: 48rem) {
  .section { padding: 3.25rem 0; }
  .site-header__inner { padding-block: 1.25rem; }
  .site-nav { gap: .75rem; }
  .books-section { padding-block: 4rem; }
}

/* 320px: the narrowest supported width. The nav wraps rather than
   overflowing, because a horizontal scrollbar on a puzzle page makes the
   grid's own sideways scroll impossible to aim at. */
@media (max-width: 25rem) {
  .wrap { width: min(100% - 1rem, var(--fs-wrap)); }
  .site-header__inner { flex-direction: column; align-items: flex-start; gap: .25rem; }
  .site-nav { margin-left: -.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
