/* Zriddle content pages (how to play, guides, Einstein's riddle, FAQ...).
   Same "Colour Tiles" colours and Jakarta type as the game (public/css/app.css),
   with the planner look Ben likes from Selfwage (~/Projects/_hub/docs/design/selfwage-style):
   dot-grid page header, ink outlines, hard offset shadows that appear on hover,
   small uppercase labels. The overrides for that look are at the end of this file.
   Every colour, font, radius and shadow is a variable in the blocks below,
   so a reskin only needs edits here. No outside requests. */

@font-face { font-family: 'Jakarta'; src: url('/fonts/plus-jakarta-sans.woff2') format('woff2'); font-weight: 500 800; font-display: swap; }
@font-face { font-family: 'Icons'; src: url('/fonts/noto-emoji-subset.woff2') format('woff2'); font-weight: 500; font-display: block; }

:root {
  /* colours */
  --bg: #ffffff;
  --ink: #0f172a;
  --muted: #55607a;
  --soft: #f1f3f8;          /* grid squares, cards, quiet buttons */
  --soft2: #f6f7fb;         /* clue cards, answer box */
  --line: #e3e6ef;          /* hairlines */
  --accent: #4f46e5;        /* primary button, links, highlights */
  --accent-ink: #ffffff;    /* text on the accent */
  --link: #4338ca;
  --link-hover: #312e81;
  --good: #10b981;
  --bad: #e11d48;           /* "crossed off in this step" mark */
  --todo-bg: #fef3c7;       /* placeholders for the owner to fill in */
  --todo-ink: #92400e;
  /* category rows: tile colour, text colour, pale tint (light), tint (dark) */
  --c0-m: #f43f5e; --c0-f: #be123c; --c0-t: #ffe4e6; --c0-td: #4a1522;
  --c1-m: #ea8a00; --c1-f: #92400e; --c1-t: #fef3c7; --c1-td: #43300c;
  --c2-m: #10b981; --c2-f: #047857; --c2-t: #d1fae5; --c2-td: #0d3b2f;
  --c3-m: #3b82f6; --c3-f: #1d4ed8; --c3-t: #dbeafe; --c3-td: #172f5c;
  --c4-m: #8b5cf6; --c4-f: #6d28d9; --c4-t: #ede9fe; --c4-td: #2f2060;
  --c5-m: #06b6d4; --c5-f: #0e7490; --c5-t: #cffafe; --c5-td: #0d3a45;
  /* colour values shown as swatches */
  --sw-red: #ef4444; --sw-blue: #3b82f6; --sw-green: #22c55e; --sw-yellow: #eab308;
  --sw-purple: #a855f7; --sw-orange: #f97316; --sw-brown: #92400e; --sw-white: #ffffff; --sw-black: #1f2937;
  --tile-icon: #ffffff;
  /* type */
  --font: 'Jakarta', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-icons: 'Icons', 'Noto Emoji', sans-serif;
  --text: 18px;
  --text-small: 16px;
  --head-weight: 800;
  --head-spacing: -0.02em;
  --measure: 68ch;
  /* shapes */
  --r: 16px;
  --r-mid: 14px;
  --r-small: 10px;
  --r-pill: 999px;
  --shadow: none;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1016;
    --ink: #f3f4f8;
    --muted: #a3abc0;
    --soft: #1b1e29;
    --soft2: #171a23;
    --line: #2a2e3c;
    --accent: #818cf8;
    --accent-ink: #0e1016;
    --link: #a5b4fc;
    --link-hover: #c7d2fe;
    --bad: #fb7185;
    --todo-bg: #43300c;
    --todo-ink: #fde68a;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-weight: 500;
  font-size: var(--text);
  line-height: 1.65;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.skip {
  position: absolute; left: 8px; top: -60px; z-index: 10;
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--r-small);
}
.skip:focus { top: 8px; }

/* ---------- header ---------- */
.site-head {
  max-width: 960px; margin: 0 auto; padding: 8px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; min-height: 48px; text-decoration: none; }
.wordmark img { display: block; height: 46px; width: auto; }

.site-nav { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 -8px; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  border-radius: var(--r-pill); font-weight: 700; font-size: var(--text-small);
  color: var(--muted); text-decoration: none;
}
.site-nav a:hover { color: var(--ink); background: var(--soft); }
.site-nav a[aria-current='page'] { color: var(--ink); background: var(--soft); }

/* ---------- page ---------- */
.page { max-width: calc(var(--measure) + 32px); margin: 0 auto; padding: 0 16px 32px; }

.crumbs ol { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: '/'; padding: 0 8px; opacity: 0.6; }
.crumbs a { color: var(--muted); display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

h1, h2, h3, h4 { font-weight: var(--head-weight); letter-spacing: var(--head-spacing); line-height: 1.2; }
h1 { font-size: clamp(31px, 7.5vw, 42px); margin: 4px 0 14px; }
h2 { font-size: clamp(24px, 5.5vw, 29px); margin: 44px 0 10px; }
h3 { font-size: 20px; margin: 28px 0 6px; }
h4 { font-size: var(--text); margin: 22px 0 4px; }

.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose strong { font-weight: 800; }
.lead { font-size: 19px; }

.answer { background: var(--soft2); border-radius: var(--r); padding: 16px 18px; margin: 0 0 24px; }
.answer p:last-child { margin-bottom: 0; }
.note, .example { background: var(--soft2); border-radius: var(--r); padding: 14px 18px; margin: 0 0 20px; }
.note p:last-child, .example p:last-child, .example ol:last-child, .example ul:last-child { margin-bottom: 0; }

/* clue lists, styled like the game's clue cards */
.cluelist { counter-reset: c; list-style: none; padding: 0 !important; }
.cluelist li {
  counter-increment: c; display: flex; gap: 10px; align-items: flex-start;
  background: var(--soft2); border-radius: var(--r); padding: 11px 14px; margin: 0 0 8px !important;
}
.cluelist li::before {
  content: counter(c); flex: none; margin-top: 3px;
  min-width: 24px; height: 24px; line-height: 24px; text-align: center; border-radius: 7px;
  background: var(--line); color: var(--muted); font-weight: 800; font-size: 13px;
}
.clue { display: block; background: var(--soft2); border-radius: var(--r); padding: 11px 14px; margin: 0 0 12px; font-weight: 700; }

/* ---------- play button ---------- */
.cta { margin: 0 0 22px; }
.cta-end { margin: 40px 0 0; text-align: center; }
.btn-play {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 52px; padding: 0 24px; border-radius: var(--r-mid);
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 17px; text-decoration: none; box-shadow: var(--shadow);
}
.btn-play:hover { color: var(--accent-ink); filter: brightness(1.08); }
.btn-play:active { transform: scale(0.98); }
.btn-play svg { width: 16px; height: 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 20px; }
.prose table.data { border-collapse: collapse; width: 100%; font-size: var(--text-small); }
.data th, .data td { padding: 10px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data thead th { font-size: 14px; color: var(--muted); font-weight: 700; }
.data tbody th { font-weight: 800; }
.data .win { background: var(--soft); font-weight: 800; }

/* ---------- value tiles (as in the game) ---------- */
.tile {
  --s: 24px;
  display: inline-grid; place-items: center; width: var(--s); height: var(--s); flex: none;
  border-radius: calc(var(--s) * 0.3); background: var(--m); color: var(--tile-icon);
  font-family: var(--font-icons); font-weight: 500; font-size: calc(var(--s) * 0.62); line-height: 1;
  font-style: normal; font-variant-emoji: text; vertical-align: middle; position: relative; top: -1.5px; margin: 0 2px;
}
.tile.swatch { box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.14); }
.tile.letter { font-family: var(--font); font-weight: 800; font-size: calc(var(--s) * 0.5); }
.r0 { --m: var(--c0-m); --f: var(--c0-f); --t: var(--c0-t); }
.r1 { --m: var(--c1-m); --f: var(--c1-f); --t: var(--c1-t); }
.r2 { --m: var(--c2-m); --f: var(--c2-f); --t: var(--c2-t); }
.r3 { --m: var(--c3-m); --f: var(--c3-f); --t: var(--c3-t); }
.r4 { --m: var(--c4-m); --f: var(--c4-f); --t: var(--c4-t); }
.r5 { --m: var(--c5-m); --f: var(--c5-f); --t: var(--c5-t); }
@media (prefers-color-scheme: dark) {
  .r0 { --t: var(--c0-td); --f: var(--c0-m); } .r1 { --t: var(--c1-td); --f: var(--c1-m); }
  .r2 { --t: var(--c2-td); --f: var(--c2-m); } .r3 { --t: var(--c3-td); --f: var(--c3-m); }
  .r4 { --t: var(--c4-td); --f: var(--c4-m); } .r5 { --t: var(--c5-td); --f: var(--c5-m); }
}
.tile.sw-red { --m: var(--sw-red); } .tile.sw-blue { --m: var(--sw-blue); } .tile.sw-green { --m: var(--sw-green); }
.tile.sw-yellow { --m: var(--sw-yellow); } .tile.sw-purple { --m: var(--sw-purple); } .tile.sw-orange { --m: var(--sw-orange); }
.tile.sw-brown { --m: var(--sw-brown); } .tile.sw-white { --m: var(--sw-white); } .tile.sw-black { --m: var(--sw-black); }

/* ---------- puzzle grid ---------- */
.pgrid { margin: 0 0 24px; overflow-x: auto; }
.pgrid table { border-collapse: separate; border-spacing: 5px; margin-left: -5px; }
.pgrid caption { text-align: left; font-weight: 800; font-size: 15px; padding: 0 5px 2px; caption-side: top; }
.pgrid thead th { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 2px; }
.pgrid tbody th {
  width: 24px; min-width: 24px; padding: 0; border-radius: 9px; background: var(--t); color: var(--f);
}
.pgrid tbody th span {
  display: block; writing-mode: vertical-rl; transform: rotate(180deg); margin: 0 auto;
  font-size: 10px; font-weight: 800; letter-spacing: 0.7px; text-transform: uppercase; white-space: nowrap;
}
.pgrid td.c {
  min-width: 72px; height: 60px; padding: 5px; text-align: center; vertical-align: middle;
  border-radius: var(--r-mid); background: var(--soft);
}
.pgrid td.c.set { background: var(--t); }
.pgrid .cell-in { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; max-width: 100px; margin: 0 auto; }
.pgrid .tile { vertical-align: middle; }
.pgrid .tile.out { opacity: 0.18; filter: grayscale(1); }
.pgrid .tile.out.new { opacity: 0.45; position: relative; }
.pgrid .tile.out.new::after {
  content: ''; position: absolute; left: -3px; right: -3px; top: 50%; height: 2.5px; margin-top: -1px;
  background: var(--bad); transform: rotate(-35deg); border-radius: 2px;
}
.pgrid td.set .tile.on { --s: 38px; }
.pgrid td.new { box-shadow: inset 0 0 0 2.5px var(--accent); }
.legend { font-size: 15px; color: var(--muted); }

/* ---------- link cards (guides hub) ---------- */
.cards { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.cards li { margin: 0 !important; }
.cards a {
  display: block; padding: 14px 18px; min-height: 44px;
  background: var(--soft2); color: var(--ink); text-decoration: none; border-radius: var(--r);
}
.cards a:hover { background: var(--soft); }
.cards b { display: block; font-weight: 800; letter-spacing: var(--head-spacing); font-size: 19px; margin-bottom: 2px; }
.cards span { color: var(--muted); font-size: var(--text-small); }

/* ---------- FAQ ---------- */
.qa { border-top: 1px solid var(--line); }
.qa h2, .qa h3 { font-size: 19px; margin: 18px 0 6px; }

/* placeholders the owner must fill in */
.todo { background: var(--todo-bg); color: var(--todo-ink); padding: 0 5px; border-radius: 5px; font-weight: 700; }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: 28px; padding: 16px 16px 40px; font-size: 15px; color: var(--muted); }
.site-foot nav, .site-foot p { max-width: 960px; margin: 0 auto; }
.site-foot ul { list-style: none; padding: 0; margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 0 2px; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--ink); font-weight: 600; text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
.site-foot p { padding: 0 8px; }

@media (min-width: 700px) {
  .cards { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .btn-play:active { transform: none; }
}

/* ---------- puzzle archive ---------- */
.catlist { list-style: none; padding: 0 !important; }
.catlist li { margin-bottom: 10px; line-height: 2.1; }
.catlist .val { display: inline-block; white-space: nowrap; margin: 0 10px 0 4px; }
.catlist .tile { vertical-align: middle; position: relative; top: -1.5px; }
.reveal { background: var(--soft2); border-radius: var(--r); padding: 4px 16px; margin: 0 0 24px; }
.reveal summary { cursor: pointer; font-weight: 800; min-height: 48px; display: flex; align-items: center; }
.reveal .pgrid { margin: 6px 0 14px; }
.answer-grid .cell-in { flex-direction: column; flex-wrap: nowrap; gap: 3px; }
.answer-grid td.c { background: var(--bg); }
.answer-grid .vl { font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; }
.steps-nav { display: flex; flex-wrap: wrap; gap: 8px; }
.steps-nav a, .daylist .lv a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 15px; border-radius: var(--r-pill);
  background: var(--soft); color: var(--ink); font-weight: 700; text-decoration: none; font-size: var(--text-small);
}
.steps-nav a:hover, .daylist .lv a:hover { background: var(--line); }
.daylist { list-style: none; padding: 0 !important; }
.daylist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0 !important; }
.daylist .dayname { flex: 1 1 220px; color: var(--ink); font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; gap: 8px; }
.daylist .dayname:hover { text-decoration: underline; }
.daylist .lv { display: flex; flex-wrap: wrap; gap: 6px; }
.daylist .lv-note { color: var(--muted); font-size: var(--text-small); }

/* ---------- footer: links grouped in columns ---------- */
.site-foot .foot-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 24px; max-width: 1100px; margin: 0 auto 12px; }
.site-foot .foot-cols h2 { font-size: 14px; margin: 12px 8px 2px; color: var(--ink); letter-spacing: 0; }
.site-foot .foot-cols ul { display: block; margin: 0; }
.site-foot .foot-cols a { min-height: 40px; }

/* ---------- planner look (after the Selfwage style reference) ---------- */
:root { --pop: #8b5cf6; --head-tint: #ede9fe; --dot: rgba(15, 23, 42, 0.13); --hard: 6px 6px 0 var(--pop); }
@media (prefers-color-scheme: dark) { :root { --pop: #a78bfa; --head-tint: #1f1b45; --dot: rgba(255, 255, 255, 0.1); } }

.page-head { position: relative; overflow: hidden; background: linear-gradient(120deg, var(--head-tint) 0%, var(--bg) 72%); border-bottom: 1px solid var(--line); }
.page-head::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, var(--dot) 1.1px, transparent 1.3px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(100deg, #000 20%, transparent 78%); mask-image: linear-gradient(100deg, #000 20%, transparent 78%);
}
.page-head-in { position: relative; max-width: calc(var(--measure) + 32px); margin: 0 auto; padding: 4px 16px 24px; }
.page-head h1 { line-height: 1.1; margin-bottom: 18px; }
.page-head .cta { margin: 0; }
.page { padding-top: 26px; }

.hero-img { margin: 0 6px 30px 0; }
.hero-img img { display: block; width: 100%; height: auto; border: 2px solid var(--ink); border-radius: 18px; box-shadow: var(--hard); }

.kicker { font-weight: 800; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); margin: 0 0 4px; }
.prose > h2 { border-top: 1px solid var(--line); padding-top: 1em; }
.prose > h2::after, .related h2::after { content: ''; display: block; width: 48px; height: 4px; border-radius: 2px; background: var(--pop); margin-top: 8px; }
.prose li::marker { color: var(--link); font-weight: 800; }

.answer { background: var(--soft2); border-left: 5px solid var(--pop); border-radius: 0 12px 12px 0; }

.btn-play { border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn-play:hover { filter: none; transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink); }
.btn-play:active { transform: none; box-shadow: 3px 3px 0 var(--ink); }

.site-nav a { position: relative; border-radius: 8px; }
.site-nav a::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--pop); transform: scaleX(0); transform-origin: left; transition: transform 0.2s ease; }
.site-nav a:hover::after, .site-nav a[aria-current='page']::after { transform: scaleX(1); }

/* link cards: ink outline, lift with a hard shadow on hover, picture on top when the page has one */
.cards { gap: 18px; margin-right: 6px !important; }
.cards a {
  display: flex; flex-direction: column; height: 100%; padding: 14px 18px 16px; overflow: hidden;
  background: var(--bg); border: 1.5px solid var(--ink); border-radius: 14px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cards a:hover { background: var(--bg); transform: translate(-3px, -3px); box-shadow: var(--hard); }
.cards a img { display: block; width: calc(100% + 36px); max-width: none; height: auto; margin: -14px -18px 12px; border-bottom: 1.5px solid var(--ink); background: var(--head-tint); }
.cards b { line-height: 1.25; }
.related { margin-top: 56px; }
.related h2 { margin: 0 0 20px; }
.cards-3 b { font-size: 17px; margin: 0; }
@media (min-width: 700px) { .cards-3 { grid-template-columns: repeat(3, 1fr); } }

/* footer: dark band under a stripe in the six tile colours */
.site-foot { position: relative; margin-top: 56px; padding-top: 30px; border-top: 0; background: #0f172a; color: #b6c0d4; }
.site-foot::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: linear-gradient(90deg, #f43f5e 0 16.6%, #ea8a00 0 33.3%, #10b981 0 50%, #3b82f6 0 66.6%, #8b5cf6 0 83.3%, #06b6d4 0); }
.site-foot a { color: #e5e9f2; }
.site-foot .foot-cols h2 { color: #a5b4fc; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }

@media (prefers-reduced-motion: reduce) {
  .btn-play, .cards a, .site-nav a::after { transition: none; }
  .btn-play:hover, .cards a:hover { transform: none; }
}
