/* fiddlefinger site pages (home, about, privacy, 404). Needs tokens.css and shell.css first. Tokens only, no raw hex.
   Game pages don't load this file. */

body.ff-site { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; }
.site-wrap {
  width: 100%; max-width: var(--site-max); margin: 0 auto;
  padding-left: max(var(--space-4), env(safe-area-inset-left, 0px)); padding-right: max(var(--space-4), env(safe-area-inset-right, 0px));
}
.site-main { flex: 1; display: flex; flex-direction: column; gap: var(--space-6); padding-bottom: var(--space-7); }

/* ---------- header: the wordmark is the home link (inline SVG so it follows the theme) ---------- */
.site-header { display: flex; align-items: center; gap: var(--space-3); min-height: 64px; padding-top: max(var(--space-3), env(safe-area-inset-top, 0px)); padding-bottom: var(--space-2); }
.site-logo { display: inline-flex; align-items: center; min-height: var(--tap); padding: 4px 0; margin: 0; border-radius: var(--r-sm); }
.site-logo svg { height: 34px; width: auto; }
.site-header .site-logo { margin-left: -2px; }
@media (min-width: 720px) { .site-logo svg { height: 44px; } .site-header { min-height: 84px; } }

/* ---------- home intro ---------- */
.hm-intro { display: flex; flex-direction: column; gap: var(--space-1); }
.hm-lead { font: var(--weight-heavy) var(--text-lg)/var(--lh-snug) var(--font-body); }
.hm-sub { font: var(--weight-body) var(--text-md)/1.4 var(--font-body); color: var(--muted); }
@media (min-width: 720px) {
  .hm-lead { font-size: 26px; }
  .hm-sub { font-size: var(--text-lg); }
}
.site-h2 { font: var(--weight-heavy) var(--text-xl)/var(--lh-snug) var(--font-body); }

/* ---------- home game grid (tiles reuse .ff-tile from shell.css) ---------- */
.hm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); } }
@media (min-width: 900px) { .hm-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.hm-grid li { display: flex; }
/* 7 tiles: the first (Snug) is featured and spans a full row of 2 / 3, or two of 4 columns, so no row is ever left with a lone tile */
.hm-grid li:first-child { grid-column: span 2; }
@media (min-width: 640px) { .hm-grid li:first-child { grid-column: span 3; } }
@media (min-width: 900px) { .hm-grid li:first-child { grid-column: span 2; } }
.hm-grid li:first-child .ff-tile.hm-tile { min-height: 124px; }
/* phones: the dailies come straight after the intro so the heading and first card sit above the fold */
@media (max-width: 719px) { .hm-intro { order: -2; } .hm-daily { order: -1; } }
.ff-tile.hm-tile { flex: 1; min-height: 148px; gap: 3px; padding: var(--space-4) var(--space-3) calc(var(--space-3) + var(--bevel) + 2px); }
.hm-tile .ff-tile-motif { width: 46px; height: 46px; margin: -6px -4px auto 0; }
.hm-tile .ff-tile-name { font-size: 26px; margin-top: var(--space-2); }
.hm-best { margin-top: var(--space-1); font: var(--weight-heavy) var(--text-sm)/1.3 var(--font-body); font-variant-numeric: tabular-nums; }
@media (min-width: 640px) {
  .ff-tile.hm-tile { min-height: 176px; padding: var(--space-5) var(--space-4) calc(var(--space-4) + var(--bevel) + 2px); }
  .hm-tile .ff-tile-motif { width: 56px; height: 56px; }
  .hm-tile .ff-tile-name { font-size: var(--display-md); }
  .hm-tile .ff-tile-tag { font-size: var(--text-md); }
}
.ff-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

/* Live-feeling tiles: one tile at a time gets a short, finite nudge of its motif (site JS adds .is-nudge).
   Nothing runs under reduced motion, offscreen, in a hidden tab, or after a quiet spell (see index.html). */
.hm-tile .ff-tile-motif svg * { transform-box: fill-box; transform-origin: 50% 50%; }
.hm-tile.is-nudge[data-slug="snug"] .ff-tile-motif rect:last-child { animation: hm-drop 700ms var(--ease-back); }
.hm-tile.is-nudge[data-slug="popsheet"] .ff-tile-motif svg > circle { animation: hm-pop 600ms var(--ease-back); }
.hm-tile.is-nudge[data-slug="tend"] .ff-tile-motif svg { transform-origin: 50% 95%; animation: hm-sway 1100ms var(--ease-in-out); }
.hm-tile.is-nudge[data-slug="uptick"] .ff-tile-motif rect:last-child { animation: hm-flick 700ms var(--ease-back); }
.hm-tile.is-nudge[data-slug="plonk"] .ff-tile-motif rect:last-child { animation: hm-slide 800ms var(--ease-out); }
.hm-tile.is-nudge[data-slug="strum"] .ff-tile-motif path { stroke-dasharray: 60; animation: hm-draw 900ms var(--ease-out); }
.hm-tile.is-nudge[data-slug="gloop"] .ff-tile-motif circle:first-child { transform-origin: 50% 100%; animation: hm-squish 700ms var(--ease-back); }
@keyframes hm-drop { 0% { transform: translateY(-9px); opacity: .2; } 60% { transform: translateY(1px); opacity: 1; } }
@keyframes hm-pop { 0% { transform: scale(1); } 35% { transform: scale(.55); } 70% { transform: scale(1.12); } }
@keyframes hm-sway { 25% { transform: rotate(-7deg); } 60% { transform: rotate(5deg); } 85% { transform: rotate(-2deg); } }
@keyframes hm-flick { 40% { transform: translate(2px, -4px) rotate(9deg); } }
@keyframes hm-slide { 0% { transform: translateX(12px); } 70% { transform: translateX(-1px); } }
@keyframes hm-draw { 0% { stroke-dashoffset: 60; } 100% { stroke-dashoffset: 0; } }
@keyframes hm-squish { 40% { transform: scale(1.12, .86); } 70% { transform: scale(.95, 1.06); } }
@media (prefers-reduced-motion: reduce) { .hm-tile.is-nudge .ff-tile-motif * , .hm-tile.is-nudge .ff-tile-motif svg { animation: none !important; } }

/* ---------- Today's dailies strip ---------- */
.hm-daily { display: flex; flex-direction: column; gap: var(--space-3); }
.hm-daily-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.hm-date { font: var(--weight-strong) var(--text-sm)/1.4 var(--font-body); color: var(--muted); }
.hm-streak { display: inline-flex; align-items: center; gap: 6px; font: var(--weight-heavy) var(--text-sm)/1.4 var(--font-body); color: var(--accent-text); }
.hm-streak svg, .hm-day-state svg { width: 18px; height: 18px; flex-shrink: 0; }
/* A row that scrolls sideways inside itself on phones (never the page); all seven fit side by side on desktop. */
.hm-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: var(--space-3);
  list-style: none; margin: 0 calc(-1 * var(--space-4)); padding: 2px var(--space-4) calc(var(--space-2) + var(--bevel-card));
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding: 0 var(--space-4);
  scrollbar-width: thin;
}
.hm-strip li { display: flex; scroll-snap-align: start; }
/* scroll cue on phones: the next card peeks in and the right edge fades while there is more to scroll */
@media (max-width: 999px) {
  .hm-strip.has-more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); }
}
@media (min-width: 1000px) { .hm-strip { grid-auto-flow: row; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0; padding: 2px 0 calc(var(--space-2) + var(--bevel-card)); overflow: visible; } }
.hm-day {
  flex: 1; display: flex; flex-direction: column; gap: 2px; min-height: 108px; padding: var(--space-3);
  background: var(--surface); color: var(--ink); text-decoration: none; border-radius: var(--r-md);
  box-shadow: 0 var(--bevel) 0 var(--surface-edge); transition: transform var(--dur-press) var(--ease-out);
}
.hm-day:active { transform: scale(.96); }
.hm-day-chip {
  width: 34px; height: 34px; margin-bottom: var(--space-1); display: grid; place-items: center; border-radius: 10px;
  background: var(--tile); color: var(--tile-ink);
  box-shadow: inset 0 -3px 0 rgba(var(--shadow-rgb), .3); box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--tile) 70%, #000);
}
.hm-day-chip svg { width: 22px; height: 22px; }
.hm-day-name { font: 400 var(--text-xl)/1.1 var(--font-display); }
.hm-day-state { display: inline-flex; align-items: center; gap: 4px; font: var(--weight-heavy) var(--text-sm)/1.3 var(--font-body); color: var(--link); text-decoration: underline; text-underline-offset: .18em; }
.hm-day.is-done .hm-day-state { color: var(--muted); text-decoration: none; }
.hm-day.is-streak .hm-day-state { color: var(--accent-text); }
.hm-day-score { font: 400 var(--text-md)/1.2 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .hm-day:active, .ff-tile:active { transform: none; filter: brightness(.94); } }

/* ---------- prose pages (about, privacy, 404) ---------- */
.prose { display: flex; flex-direction: column; gap: var(--space-4); max-width: 60ch; }
.prose h1 { font: var(--weight-heavy) 28px/1.15 var(--font-body); letter-spacing: -.01em; }   /* a sentence or title: Figtree (BRAND 4) */
.prose h2 { font: var(--weight-heavy) var(--text-xl)/var(--lh-snug) var(--font-body); margin-top: var(--space-4); }
.prose p, .prose li { font: var(--weight-body) var(--text-md)/1.55 var(--font-body); }
.prose .lead { font-size: var(--text-lg); font-weight: var(--weight-strong); }
.prose ul { padding-left: 1.3em; display: flex; flex-direction: column; gap: var(--space-1); }
.prose code { font: var(--weight-strong) var(--text-sm)/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--panel); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
.prose .note { font-size: var(--text-sm); color: var(--muted); }
.prose details { background: var(--surface); border-radius: var(--r-md); box-shadow: 0 var(--bevel) 0 var(--surface-edge); }
.prose summary { min-height: var(--tap); display: flex; align-items: center; padding: var(--space-2) var(--space-4); cursor: pointer; font-weight: var(--weight-heavy); border-radius: var(--r-md); }
.prose details > :not(summary) { margin: 0 var(--space-4) var(--space-4); }
.prose pre { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--weight-body) var(--text-sm)/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink); }
.prose dl { display: grid; gap: var(--space-2); margin: 0 var(--space-4) var(--space-4); }
.prose dt { font-weight: var(--weight-heavy); }
.prose dd { margin: 0 0 var(--space-2); font-size: var(--text-sm); line-height: 1.6; }
.prose dd code { margin-right: 2px; display: inline-block; margin-bottom: 3px; }
@media (min-width: 720px) { .prose p, .prose li { font-size: var(--text-lg); } .prose h1 { font-size: 36px; } }
.prose-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.status-good { color: var(--good); font-weight: var(--weight-heavy); }

/* game list with accent chips (about, 404, footer) */
.site-games { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.prose .site-games { padding-left: 0; }
.site-games a { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); padding: 4px 0; text-decoration: none; color: var(--ink); border-radius: var(--r-sm); }
.site-games .hm-day-chip { margin: 0; flex-shrink: 0; }
.site-games b { font: 400 var(--text-xl)/1.1 var(--font-display); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .2em; text-decoration-color: var(--line); }
.site-games span.tag { display: block; font: var(--weight-strong) var(--text-sm)/1.3 var(--font-body); color: var(--muted); }

/* ---------- footer (site pages) ---------- */
.site-footer { border-top: 2px solid var(--line); padding-top: var(--space-6); padding-bottom: max(var(--space-6), env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: var(--space-5); }
.site-footer h2 { font: var(--weight-heavy) var(--text-xl)/var(--lh-snug) var(--font-body); margin-bottom: var(--space-3); }

/* ---------- 404 ---------- */
.nf { align-items: flex-start; padding-top: var(--space-6); }
.nf .ff-btn { align-self: flex-start; }
.site-logo-h { margin: 0; font-size: inherit; }   /* home: the h1 holds the wordmark link */
