/* Folio Puzzles: tokens, base type and the pieces every page shares. */

@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin-opsz-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/newsreader-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
}

:root {
  --paper: #FAF8F4;
  --sheet: #FFFEFB;
  --ink: #1A1917;
  --stone: #5C5A55;
  --hair: #DEDAD0;
  --rule: #C4BFB1;

  --arrow: #B4532F;
  --search: #2F6B4A;
  --crypto: #3F5F82;
  --cross: #6B4466;
  --four: #8C6514;
  --sudoku: #2C6770;
  --spot: #9A4A55;
  --mahjong: #5F6630;
  --jigsaw: #6C4C38;

  --c: var(--ink);
  --sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --gutter: 1.125rem;
}

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

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

body {
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
button { font: inherit; color: inherit; cursor: pointer; }
a, button, label { touch-action: manipulation; }   /* a quick second tap is a tap, not a zoom */
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

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

/* Off-screen by its own height, so it stays hidden however large the text is set. */
.skip {
  position: absolute; left: var(--gutter); top: 0; z-index: 10; transform: translateY(-110%);
  background: var(--ink); color: var(--paper); padding: 0.75rem 1rem; border-radius: 6px;
}
.skip:focus { transform: translateY(0.5rem); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

.wrap { max-width: 44rem; margin: 0 auto; }

/* icons */
.ic {
  width: 1.375rem; height: 1.375rem; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* wordmark and masthead */
.wordmark { display: inline-block; padding: 0.5625rem 0; font: 600 1.625rem/1 var(--serif); letter-spacing: -0.018em; text-decoration: none; }
.wordmark em { font-weight: 400; font-style: italic; }
.mast { padding: 0.25rem var(--gutter) 0; }
.mast-row { display: flex; align-items: center; justify-content: space-between; min-height: 3.375rem; }
.dateline {
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink);
  padding: 0.5rem 0 0.375rem;
  font: 600 0.78125rem/1.2 var(--sans); letter-spacing: 0.09em; text-transform: uppercase;
}

/* controls */
.iconbtn {
  width: 2.75rem; height: 2.75rem; min-width: 44px; min-height: 44px;
  display: grid; place-items: center; border: 0; background: none; border-radius: 8px; text-decoration: none;
}
.btn {
  min-height: 3rem; padding: 0 1.125rem; border-radius: 6px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  font: 600 1rem/1.1 var(--sans); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5625rem;
}
.btn.ghost { background: transparent; color: var(--ink); }
.btn[disabled] { opacity: 0.45; cursor: default; }
.btn .ic { width: 1.1875rem; height: 1.1875rem; }

.badge {
  width: 2.625rem; height: 2.625rem; border-radius: 5px; background: var(--c); color: #fff;
  display: grid; place-items: center; flex: none;
}
.badge .ic { width: 1.5rem; height: 1.5rem; }
.badge.sm { width: 1.75rem; height: 1.75rem; border-radius: 4px; }
.badge.sm .ic { width: 1.0625rem; height: 1.0625rem; stroke-width: 2; }

.kicker { font: 600 0.78125rem/1.2 var(--sans); letter-spacing: 0.11em; text-transform: uppercase; color: var(--stone); }

/* home index */
.lede { padding: 1.5rem var(--gutter) 0.75rem; }

/* the email sign-up, on the home page and the weekly pack's page */
.mail { margin: 1.625rem var(--gutter) 0; padding-top: 1.25rem; border-top: 1px solid var(--hair); }
.mail h2 { font: 500 1.375rem/1.15 var(--serif); }
.mail p { color: var(--stone); font-size: 0.9375rem; margin: 0.25rem 0 0.75rem; }

.lede h1 { font: 500 2.125rem/1.05 var(--serif); font-size: min(2.125rem, 12vw); letter-spacing: -0.018em; overflow-wrap: break-word; }
.lede p { color: var(--stone); margin-top: 0.4375rem; }
.rows { border-top: 1px solid var(--hair); margin: 0.5rem var(--gutter) 0; }
.row {
  display: flex; align-items: center; gap: 0.875rem; min-height: 4.5rem; padding: 0.625rem 0;
  border-bottom: 1px solid var(--hair); text-decoration: none;
}
.row-main { flex: 1; min-width: 0; overflow-wrap: break-word; }
.row-title { display: block; font: 500 1.3125rem/1.15 var(--serif); letter-spacing: -0.005em; }
.row-meta { display: block; color: var(--stone); font-size: 0.9375rem; line-height: 1.3; margin-top: 0.125rem; }
.row-state {
  font: 600 0.9375rem/1.2 var(--sans); color: var(--stone); text-align: right;   /* wraps at large text on a narrow phone */
  display: flex; align-items: center; gap: 0.3125rem; font-variant-numeric: tabular-nums;
}
.row-state.done { color: var(--c); }
.row-state .ic { width: 1.125rem; height: 1.125rem; }
.row:hover .row-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }

/* ad slots: hidden unless demo mode shows a placeholder */
.ad {
  margin: 1.375rem var(--gutter); min-height: 250px; border: 1px dashed var(--rule);
  display: grid; place-items: center; color: #6F6C65;
  font: 600 0.75rem/1 var(--sans); letter-spacing: 0.15em; text-transform: uppercase;
}
.ad.sm { min-height: 100px; }
/* a slot with an ad unit: no frame, its label over it, its space kept before the ad loads */
.ad.live { display: block; place-items: normal; border: 0; }
.ad.live ins { min-height: 250px; }   /* the ad's own space, under its label */
.ad-label { margin: 0 0 0.375rem; color: #6F6C65; font: 600 0.75rem/1 var(--sans); letter-spacing: 0.15em; text-transform: uppercase; text-align: center; }
/* a slot Google could not fill (its tag marked data-ad-status="unfilled") keeps its room, so the
   page does not jump, but no label over an empty box; one still below the screen is folded away
   by the ad code (src/engine/ads.js) */
.ad.live:has(> ins.adsbygoogle[data-ad-status="unfilled"]) > .ad-label { visibility: hidden; }
/* where scripts do not run no ad can load, so a slot with an ad unit is not shown at all */
@media (scripting: none) {
  .ad.live { display: none; }
}

/* footer */
.foot {
  margin: 1.75rem var(--gutter) 2rem; padding-top: 0.875rem; border-top: 3px double var(--ink);
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.125rem; font: 600 0.9375rem/1.4 var(--sans);
}
.foot a { display: inline-block; min-width: 2.75rem; padding: 0.71875rem 0; }   /* 21px line + 23px = a 44px target */

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

/* the slim masthead on pages other than home */
.mast-rule { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); height: 5px; }

/* running text: how-to-play sections and the standing pages */
.prose { padding: 1.5rem var(--gutter) 0.5rem; max-width: 40rem; overflow-wrap: break-word; }   /* a long word (BRYCECANYON) at large text */
.prose.page { padding-top: 1.75rem; }
.prose h1 { font: 500 2.125rem/1.08 var(--serif); letter-spacing: -0.018em; margin-bottom: 1rem; }
.prose h2 { font: 500 1.5rem/1.15 var(--serif); letter-spacing: -0.01em; margin: 1.75rem 0 0.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font: 600 1.0625rem/1.3 var(--sans); margin: 1.25rem 0 0.375rem; }
.prose p { margin: 0 0 0.875rem; }
.prose ol, .prose ul { margin: 0 0 0.875rem; padding-left: 1.375rem; }
.prose li { margin-bottom: 0.5rem; }
.prose a:not(.btn) { text-decoration: underline; }
.notice { color: var(--stone); }

/* the footer holds two rows of links */
.foot nav { display: flex; flex-wrap: wrap; gap: 0 1.125rem; width: 100%; }

/* dialogs: the menu on every page, and a game's how-to-play */
.dlg { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); margin: auto; padding: 0; border: 1px solid var(--ink); border-radius: 6px; background: var(--paper); color: var(--ink); }
.dlg::backdrop { background: rgba(26, 25, 23, 0.55); }
.dlg-body { padding: 1.5rem var(--gutter) 0.5rem; }
.dlg h2:focus { outline: none; }
.dlg-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; padding: 0.75rem var(--gutter); background: var(--paper); border-top: 1px solid var(--hair); }

/* the menu: the site's links, then the settings */
.mast-row .iconbtn { margin-right: -0.6875rem; }   /* the icon, not its 44px target, lines up with the page edge */
.menu h2 { font: 500 1.75rem/1.1 var(--serif); letter-spacing: -0.015em; margin-bottom: 0.875rem; }
.menu-main { display: flex; flex-direction: column; border-top: 1px solid var(--hair); }
.menu-main a { display: flex; align-items: center; min-height: 3rem; border-bottom: 1px solid var(--hair); font: 500 1.1875rem/1.2 var(--serif); text-decoration: none; }
.menu-more { display: flex; flex-wrap: wrap; gap: 0 1.125rem; padding-top: 0.25rem; font: 600 0.9375rem/1.4 var(--sans); }
.menu-more a { display: inline-block; min-width: 2.75rem; padding: 0.71875rem 0; }
.menu nav a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
.menu h3 { margin: 1.5rem 0 0.25rem; padding-top: 1rem; border-top: 1px solid var(--ink); font: 600 1.0625rem/1.3 var(--sans); }
.menu .notice { margin: 0.875rem 0 0.5rem; font-size: 0.9375rem; }

.switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; min-height: 3rem; font-weight: 600; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; cursor: pointer;
  width: 3.25rem; height: 1.875rem; border-radius: 1rem; border: 1px solid var(--stone); background: var(--sheet);
}
.switch input::before {
  content: ""; position: absolute; top: 0.1875rem; left: 0.1875rem; width: 1.375rem; height: 1.375rem; border-radius: 50%;
  background: var(--stone); transition: transform 0.15s ease;
}
.switch input:checked { background: var(--ink); border-color: var(--ink); }
.switch input:checked::before { background: var(--paper); transform: translateX(1.375rem); }

.seg-field { border: 0; padding: 0; margin: 0.375rem 0 0; min-width: 0; }
.seg-field legend { padding: 0; margin-bottom: 0.5rem; font-weight: 600; }
.seg { display: flex; }
.seg label { flex: 1; position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span { display: grid; place-items: center; min-height: 2.75rem; border: 1px solid var(--ink); font: 600 1rem/1 var(--sans); }
.seg label:first-child span { border-radius: 6px 0 0 6px; }
.seg label:last-child span { border-radius: 0 6px 6px 0; border-left: 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }

/* A printable sheet's picture, as it prints: white, with a thin rule (the printable pages). */
.sheet img { display: block; width: min(100%, 16rem); height: auto; background: #FFFFFF; border: 1px solid var(--rule); box-shadow: 0 1px 6px rgb(26 25 23 / 0.1); }
.sheet figcaption { margin-top: 0.5rem; max-width: 38rem; color: var(--stone); font-size: 0.9375rem; line-height: 1.4; }

/* where the system sets the colours, fall back to its own controls and colours */
@media (forced-colors: active) {
  .switch input { appearance: auto; -webkit-appearance: auto; width: 1.5rem; height: 1.5rem; }
  .switch input::before { display: none; }
  .seg input:checked + span { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}
