/* Shared styles for playquads.com content pages (rules, guides, blog).
   The homepage keeps its own inline styles; this file is for everything that
   reads like an article. Palette = the app's default "wood" skin
   (src/theme.js), same tokens as web/index.html. Deliberately light-only, to
   match the homepage and the store graphics. */
:root {
  --screen: #f4ebd9;
  --panel: #ece0c6;
  --chip: #e3d3b0;
  --boardbg: #a37a52;
  --cell: #c99a5c;
  --cell-hi: #ecc37c;
  --ink: #4a3419;
  --sub: #7a5c33;
  --accent: #b5651d;
  --accent-ink: #9a5416;
  --on-accent: #f4ebd9;
  --dark-piece: #43290f;
  --dark-edge: #241505;
  --light-piece: #f0d8ac;
  /* src/components/Piece.js darkens lightEdge (#c19a63) by 35% for light
     pieces so they hold up on the tan cell colour. */
  --light-edge: #7d6440;
  --edge-line: #d9c9ae;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--screen);
  color: var(--ink);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; }

/* ---------------- Header ---------------- */
.site-header {
  border-bottom: 1px solid var(--edge-line);
  padding: .7rem 1.25rem;
}
.site-header .bar {
  max-width: 60rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .5rem 1.25rem;
  flex-wrap: wrap;
}
.site-header .brand {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  color: var(--accent);
  text-decoration: none;
  margin-right: auto;
}
.site-header nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; font-size: .9375rem; }
.site-header nav a { color: var(--ink); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--accent-ink); text-decoration: underline; }
.site-header .nav-play {
  background: var(--accent);
  color: var(--on-accent);
  padding: .35rem .8rem;
  border-radius: .6rem;
  font-weight: 700;
}
.site-header .nav-play:hover { color: var(--on-accent); text-decoration: none; opacity: .9; }

/* ---------------- Article ---------------- */
main.article { max-width: 44rem; margin: 0 auto; padding: 2rem 1.25rem 3.5rem; }
.crumbs { font-size: .8125rem; color: var(--sub); margin: 0 0 1.25rem; }
.crumbs a { color: var(--sub); }
.crumbs span[aria-hidden] { margin: 0 .35rem; }
.kicker {
  display: block;
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: .5rem;
}
h1 {
  font-size: clamp(1.85rem, 5.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -.015em;
  line-height: 1.12;
  margin: 0 0 1rem;
}
h2 { font-size: 1.45rem; line-height: 1.25; font-weight: 780; margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.125rem; line-height: 1.3; margin: 1.75rem 0 .5rem; }
p { margin: 0 0 1.1rem; }
.lede { font-size: 1.125rem; color: var(--sub); }
ul, ol { margin: 0 0 1.1rem; padding-left: 1.35rem; }
li { margin-bottom: .45rem; }
li::marker { color: var(--accent); }
strong { font-weight: 700; }
.meta { font-size: .875rem; color: var(--sub); margin: -.25rem 0 1.5rem; }

/* Answer-first summary: the paragraph an answer engine is most likely to
   lift, so it sits directly under the H1. */
.answer {
  background: var(--panel);
  border-left: 4px solid var(--accent);
  border-radius: .5rem .9rem .9rem .5rem;
  padding: 1rem 1.2rem;
  margin: 0 0 1.75rem;
}
.answer p:last-child, .note p:last-child { margin-bottom: 0; }
.note {
  font-size: .9375rem;
  color: var(--sub);
  background: var(--panel);
  border-radius: .9rem;
  padding: .9rem 1.1rem;
  margin: 1.5rem 0;
}
.note strong { color: var(--ink); }

.toc {
  border: 1px solid var(--edge-line);
  border-radius: .9rem;
  padding: .9rem 1.2rem .5rem;
  margin: 0 0 2rem;
  font-size: .9375rem;
}
.toc strong { display: block; margin-bottom: .35rem; }
.toc ol { margin-bottom: .5rem; }
.toc li { margin-bottom: .2rem; }

.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; min-width: 30rem; }
th, td { text-align: left; vertical-align: top; padding: .6rem .7rem; border-bottom: 1px solid var(--edge-line); }
th { color: var(--sub); font-weight: 700; font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin: 1.75rem 0; }
.cta, .btn {
  display: inline-block;
  padding: .85rem 1.4rem;
  border-radius: .9rem;
  text-decoration: none;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
  cursor: pointer;
}
.cta:hover, .btn:hover { color: var(--on-accent); opacity: .92; }
.cta.secondary, .btn.secondary { background: transparent; color: var(--accent-ink); border-color: var(--edge-line); }
.btn { padding: .6rem 1.1rem; font-size: .9375rem; }

.faq { display: grid; gap: .6rem; margin: 0 0 1.5rem; }
.faq details { background: var(--panel); border-radius: .9rem; padding: 0 1.1rem; }
.faq summary { cursor: pointer; font-weight: 700; padding: .9rem 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '+'; color: var(--accent); font-weight: 800; margin-right: .6rem; }
.faq details[open] summary::before { content: '\2212'; }
.faq details p { color: var(--ink); font-size: .9375rem; }

.related { border-top: 1px solid var(--edge-line); margin-top: 2.5rem; padding-top: 1.25rem; }
.related h2 { font-size: 1.125rem; margin-top: 0; }

/* ---------------- Board diagrams ----------------
   Markup: .board > [corner, A-D labels, then per row: row label + 4 .cell].
   Cells are numbered left-to-right, top-to-bottom: A1 is top-left, D4 is
   bottom-right. A piece is <i class="pc ..."> with one class per trait that
   is ON: t = tall (drawn big), d = dark, q = square, o = hollow. No class
   means short / light / round / solid. Mirrors src/components/Piece.js. */
.board-fig { margin: 1.5rem auto 1.75rem; max-width: 21rem; }
.board-fig.small { max-width: 15rem; }
.board {
  --hole: var(--cell);
  display: grid;
  grid-template-columns: 1.1rem repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px 10px 4px;
  background: var(--boardbg);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(36, 21, 5, .18);
}
.board .lbl {
  font-size: .6875rem;
  font-weight: 700;
  color: #f4ebd9;
  display: grid;
  place-items: center;
  line-height: 1;
  min-height: 1rem;
}
.cell {
  aspect-ratio: 1;
  background: var(--cell);
  border-radius: 22%;
  display: grid;
  place-items: center;
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
}
.cell.hi { background: var(--cell-hi); --hole: var(--cell-hi); }
.cell.target { box-shadow: inset 0 0 0 3px var(--accent), 0 0 0 2px #f4ebd9; }
.cell.bad { box-shadow: inset 0 0 0 3px #7c1d12; }
.cell .tag {
  position: absolute;
  font-size: .6875rem;
  font-weight: 800;
  color: var(--ink);
  opacity: .75;
}
.board-fig figcaption { font-size: .875rem; color: var(--sub); text-align: center; margin-top: .6rem; line-height: 1.45; }

.pc {
  display: block;
  position: relative;
  width: 47%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--light-piece);
  border: 2px solid var(--light-edge);
  box-shadow: 0 2px 4px rgba(36, 21, 5, .22);
}
.pc.t { width: 78%; }
.pc.d { background: var(--dark-piece); border-color: var(--dark-edge); }
.pc.q { border-radius: 18%; }
.pc.o::after {
  content: '';
  position: absolute;
  inset: 28%;
  border-radius: inherit;
  background: var(--hole);
  border: 1px solid;
  border-color: inherit;
}

/* A piece shown inline in running text or in a row of choices. */
.chip {
  --hole: var(--chip);
  display: inline-grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  vertical-align: middle;
  background: var(--chip);
  border-radius: .5em;
  margin: 0 .1em;
}
.chip .pc.t { width: 82%; }
.chip .pc { width: 52%; }
.pieces-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1.25rem; align-items: center; }
.pieces-row .chip { width: 3rem; height: 3rem; }

.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin: 1rem 0 1.5rem; }
.legend div { background: var(--panel); border-radius: .9rem; padding: .75rem .9rem; display: flex; gap: .75rem; align-items: center; font-size: .9375rem; }
.legend .pair { display: flex; gap: .3rem; }
.legend .pair .chip { width: 2.4rem; height: 2.4rem; background: var(--cell); --hole: var(--cell); }

/* ---------------- Daily puzzle player ---------------- */
.player { background: var(--panel); border-radius: 1.1rem; padding: 1rem; margin: 1.5rem 0 2rem; }
.player .board-fig { margin: .5rem auto 1rem; }
.player .status { font-weight: 700; text-align: center; margin: 0 0 .25rem; min-height: 1.6em; }
.player .hint { font-size: .875rem; color: var(--sub); text-align: center; margin: 0 0 .75rem; }
.player button.cell:not(:disabled) { cursor: pointer; }
.player button.cell:not(:disabled):hover { background: var(--cell-hi); --hole: var(--cell-hi); }
.player button.cell:focus-visible, .player .offer button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.player .offer { display: flex; justify-content: center; gap: .75rem; flex-wrap: wrap; margin: 0 0 .75rem; }
.player .offer button {
  --hole: var(--cell);
  width: 4rem; height: 4rem;
  display: grid; place-items: center;
  background: var(--cell);
  border: 2px solid var(--chip);
  border-radius: .8rem;
  cursor: pointer;
  padding: 0;
}
.player .offer button:hover { border-color: var(--accent); }
.player .hand { display: flex; justify-content: center; align-items: center; gap: .75rem; margin: 0 0 .75rem; font-size: .9375rem; }
.player .hand .chip { width: 3.25rem; height: 3.25rem; background: var(--cell); --hole: var(--cell); }
.player .result { text-align: center; }
.player .controls { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.day-tabs { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; margin: 0 0 .75rem; }
.day-tabs button { font: inherit; font-size: .875rem; border: 1px solid var(--edge-line); background: var(--screen); color: var(--ink); border-radius: 999px; padding: .3rem .8rem; cursor: pointer; }
.day-tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------------- Blog index ---------------- */
.post-list { list-style: none; padding: 0; display: grid; gap: .9rem; }
.post-list li { background: var(--panel); border-radius: 1rem; padding: 1rem 1.2rem; margin: 0; }
.post-list a { font-weight: 750; font-size: 1.0625rem; text-decoration: none; color: var(--ink); }
.post-list a:hover { color: var(--accent-ink); text-decoration: underline; }
.post-list p { margin: .3rem 0 0; font-size: .9375rem; color: var(--sub); }

/* ---------------- Footer ---------------- */
.site-footer {
  border-top: 1px solid var(--edge-line);
  text-align: center;
  font-size: .8125rem;
  color: var(--sub);
  padding: 1.75rem 1.25rem 2.5rem;
  line-height: 2;
}
.site-footer a { color: var(--sub); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sep { margin: 0 .4rem; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .legend { grid-template-columns: 1fr; }
  .site-header .bar { gap: .4rem .9rem; }
}
