/* ==========================================================================
   Kings in the Corner - Rules page
   Loaded after styles.css (tokens, cards, header, footer) and pages.css
   (dark header, page hero, two-column layout, sidebar panels).

   Every instructional diagram on this page is real HTML + CSS: the cards are
   .card elements from styles.css, the arrows are inline SVG paths coloured
   here, and no text is baked into an image.

   1. Page tokens
   2. Fact strip
   3. Prose
   4. Worked example shell
   5. Diagram surface
   6. Card piles and empty slots
   7. Arrows and markers
   8. Scoring + turn lists
   9. Responsive
  10. Print
   ========================================================================== */

/* --------------------------- 1. Page tokens ----------------------------- */
.rules {
  --felt-diag:  #004F35;
  --felt-diag2: #0A6042;
  --wood-diag:  #8B4A22;
  --ok:         #66E2A7;
  --ok-ink:     #0F7A4C;
  --no:         #E0413A;
  --future:     #9FB4AA;
  --cap:        #F0C863;
  --slot:       #E0B44C;

  --ipage: #F4F8F7;
}

/* --------------------------- 2. Fact strip ------------------------------ */
.factstrip {
  position: relative;
  max-width: var(--shell);
  margin: -34px auto 0;
  padding: 0 24px;
}
.factstrip__inner {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--ipanel);
  border: 1px solid var(--iline);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(12, 30, 55, .09);
}
.factstrip li { padding: 16px 22px; }
.factstrip li + li { border-left: 1px solid var(--line-soft); }
.factstrip b {
  display: block;
  font-family: var(--serif); font-size: 26px; color: var(--ink); line-height: 1.1;
}
.factstrip span { font-size: 13.5px; color: var(--muted); }

/* The shared .eyebrow is felt green, which disappears on the felt hero. */
.phero__eyebrow { color: var(--gold-b); margin-bottom: 10px; }

/* ------------------------------ 3. Prose -------------------------------- */
.rsec { margin-bottom: 34px; }
.rsec > h2 {
  font-size: clamp(24px, 2.6vw, 33px);
  margin-bottom: 14px;
}
.rsec > h2::after {
  content: "";
  display: block;
  width: 58px; height: 4px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--gold-b);
}
.rsec h3 { font-size: 20px; }

.prose p { font-size: 16px; line-height: 1.65; color: var(--text); margin-bottom: 14px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong, .prose b { color: var(--ink); }

.prose ul, .prose ol { margin: 0 0 16px; display: grid; gap: 9px; }
.prose ul li {
  position: relative; padding-left: 26px;
  font-size: 15.5px; line-height: 1.6; color: var(--text);
}
.prose ul li::before {
  content: "";
  position: absolute; left: 8px; top: .62em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold-b-dk);
}
.prose ol { counter-reset: rstep; }
.prose ol li {
  counter-increment: rstep;
  position: relative; padding-left: 34px;
  font-size: 15.5px; line-height: 1.6; color: var(--text);
}
.prose ol li::before {
  content: counter(rstep) ".";
  position: absolute; left: 0; top: 0;
  width: 26px; text-align: right;
  font-weight: 700; color: var(--gold-b-dk);
}

.panelcard {
  padding: 22px 26px;
  background: var(--ipanel);
  border: 1px solid var(--iline);
  border-radius: 12px;
  margin-bottom: 26px;
}

.housenote {
  padding: 14px 18px;
  border-left: 4px solid var(--gold-b);
  background: var(--tips-bg);
  border-radius: 0 8px 8px 0;
  font-size: 15px; color: var(--text);
}

/* ----------------------- 4. Worked example shell ------------------------ */
.example {
  padding: 20px 22px 22px;
  margin-top: 30px;                 /* separate each box from the text above it */
  margin-bottom: 26px;
  background: var(--ipanel);
  border: 1px solid var(--iline);
  border-radius: 12px;
}
.example__pill {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border: 1px solid #BFE3CE;
  border-radius: 999px;
  background: #EAF6EF;
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: #17784C;
}
.example h3 { font-size: 22px; margin-bottom: 12px; }
.example .prose p { font-size: 15.5px; margin-bottom: 10px; }
.example dl { margin: 0 0 12px; }
.example dl div { display: flex; gap: 8px; font-size: 15.5px; line-height: 1.6; }
.example dt { color: var(--ink); font-weight: 600; }
.example dd { margin: 0; color: var(--text); }

.imgdesc {
  margin-top: 14px;
  padding: 12px 16px;
  background: #F1F4F3;
  border-radius: 8px;
  font-size: 13.5px; line-height: 1.55; color: var(--muted);
}

/* --------------------------- 5. Diagram surface ------------------------- */
.diag {
  --cw: 62px;                       /* one card size for the whole article */
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  position: relative;
  /* boards sat almost flush against the text above and below them */
  margin: 20px 0 24px;
  padding: 7px;
  border-radius: 14px;
  background: linear-gradient(180deg, #A0562A, var(--wood-diag) 45%, #5F3116);
  box-shadow: var(--shadow-lg);
}
.diag__felt {
  position: relative;
  padding: 20px 18px 16px;
  border-radius: 8px;
  background: radial-gradient(120% 100% at 50% 35%, var(--felt-diag2), var(--felt-diag) 70%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, .35);
  overflow-x: auto;
}

.diag__row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  min-width: min-content;
}
.diag__col { display: grid; justify-items: center; gap: 8px; min-width: var(--cw); }
.diag__label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #EAF3EC;
  white-space: nowrap;
}
.diag__sub {
  margin-top: 6px;
  font-size: 12px; color: #A9C7B6; text-align: center;
}
.diag__cap {
  margin-top: 16px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  text-align: center; color: var(--cap);
}

/* Setup diagram: a cross of four piles with four diagonal corners. */
.diag__grid {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 16px 26px;
  justify-content: center;
}
.diag__cell { display: grid; justify-items: center; gap: 7px; }

/* --------------------- 6. Card piles and empty slots -------------------- */
/* Piles read base card first, exposed card last, overlapped so every
   rank and suit stays visible. */
.pile-row { display: flex; }
.pile-row .card + .card { margin-left: calc(var(--cw) * -.58); }
.pile-row .card { box-shadow: 0 3px 7px rgba(0, 0, 0, .38), inset 0 0 0 1px rgba(0, 0, 0, .12); }

.pile-col { display: grid; }
.pile-col .card + .card { margin-top: calc(var(--ch) * -.72); }

.slot {
  display: grid; place-items: center;
  width: var(--cw); height: var(--ch);
  border: 2px solid var(--slot);
  border-radius: var(--cr);
  background: rgba(0, 0, 0, .12);
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--slot);
}
.slot--corner { border-style: solid; }

.stock {
  position: relative;
  width: var(--cw); height: var(--ch);
}
.stock .card--back { position: absolute; inset: 0; width: 100%; height: 100%; }
.stock .card--back:nth-child(1) { transform: translate(3px, 3px); }

/* the green outline that marks a complete pile moving together */
.movegroup {
  padding: 5px;
  border: 2px solid var(--ok);
  border-radius: calc(var(--cr) + 5px);
  box-shadow: 0 0 0 3px rgba(102, 226, 167, .18);
}

.handlabel {
  display: inline-block;
  padding: 5px 12px;
  border: 1px dashed rgba(255, 255, 255, .5);
  border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #EAF3EC;
}

/* --------------------------- 7. Arrows ---------------------------------- */
.arrow { width: 96px; height: 56px; flex: none; overflow: visible; }
.arrow path { fill: none; stroke-width: 3.4; stroke-linecap: round; }
.arrow--ok path      { stroke: var(--ok); }
.arrow--no path      { stroke: var(--no); }
.arrow--future path  { stroke: var(--future); stroke-dasharray: 6 7; stroke-width: 3; }

.arrow--down { width: 56px; height: 74px; }

.movewrap { position: relative; display: grid; place-items: center; }
.movewrap .xmark {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--no); color: #fff;
  font-size: 17px; font-weight: 700; line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

/* numbered green arrows for multi-move examples */
.movewrap .step-no {
  position: absolute; left: 50%; top: 4px;
  transform: translateX(-50%);
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok); color: #06301D;
  font-size: 12px; font-weight: 700;
}

/* ---------------------- 8. Scoring + turn lists ------------------------- */
.scorebox {
  min-width: 200px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .2);
  color: #FFFFFF;
}
.scorebox h4 {
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: #FFFFFF;
}
.scorebox dl { display: grid; gap: 5px; margin: 0; }
/* .example dt/dd set dark ink for light backgrounds; this panel is on felt */
.example .scorebox dt,
.example .scorebox dd,
.scorebox dt, .scorebox dd { color: #FFFFFF; }
.scorebox dl div { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.scorebox .total {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  font-weight: 700; color: #FFFFFF;
}

.turnsteps { counter-reset: tstep; display: grid; gap: 8px; }
.turnsteps li {
  counter-increment: tstep;
  position: relative; padding-left: 36px;
  font-size: 15.5px; line-height: 1.6; color: var(--text);
}
.turnsteps li::before {
  content: counter(tstep);
  position: absolute; left: 0; top: .1em;
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--nav); color: #fff;
  font-size: 12.5px; font-weight: 700;
}

/* --------------------------- 9. Responsive ------------------------------ */
@media (max-width: 1080px) {
  .factstrip { padding-inline: 16px; }
}

@media (max-width: 900px) {
  .factstrip__inner { grid-template-columns: repeat(2, 1fr); }
  .factstrip li:nth-child(3) { border-left: 0; }
  .factstrip li:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .factstrip b { font-size: 22px; }

  .diag { --cw: 54px; --ch: calc(var(--cw) * 1.44); --cr: calc(var(--cw) * .1); }
  .diag__felt { padding: 16px 12px 12px; }

  /* Before/after comparisons stack vertically on small screens. */
  .diag__row--stack { flex-direction: column; gap: 14px; }
  .diag__row--stack .arrow { transform: rotate(90deg); width: 64px; height: 44px; }
  .diag__row--stack .arrow--down { transform: none; }

  .example { padding: 16px; }
  .example h3 { font-size: 19px; }
  .panelcard { padding: 18px; }
}

@media (max-width: 560px) {
  .diag { --cw: 46px; --ch: calc(var(--cw) * 1.44); --cr: calc(var(--cw) * .1); }
  .diag__grid { gap: 12px 14px; }
  .diag__label { font-size: 10px; letter-spacing: .06em; }
  .factstrip__inner { grid-template-columns: 1fr; }
  .factstrip li + li { border-left: 0; border-top: 1px solid var(--line-soft); }
}

/* ----------------------------- 10. Print -------------------------------- */
@media print {
  .example, .diag, .panelcard { break-inside: avoid; page-break-inside: avoid; }
  .layout__side, .hdr, .ftr { display: none; }
  .layout { grid-template-columns: 1fr; }
}

/* Sidebar "Keep Learning" links are text inside .qrules rows; give them a
   real target height. */
.rules .qrules a {
  display: inline-flex; align-items: center; min-height: 26px;
  font-weight: 600;
}

/* ==========================================================================
   11. Article diagrams (how-to-play / basic + advanced strategy)
   The guide designs add a board title, numbered cards and side-by-side
   strong/weak comparisons on top of the /rules/ diagram system.
   ========================================================================== */

.diag__title {
  margin-bottom: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #EAF3EC;
}

/* a card that carries a move number */
.numcard { position: relative; display: inline-block; }
.numcard__n {
  position: absolute; top: -9px; left: -9px; z-index: 2;
  display: grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok); color: #06301D;
  font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

/* labelled empty space: "OPEN CORNER", "EMPTY SPACE" */
.slot--label {
  width: calc(var(--cw) * 1.1);
  padding: 4px;
  font-size: 10px; line-height: 1.25; text-align: center;
}

/* two-panel comparison */
.compare {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  align-items: start;
}
.compare__panel {
  padding: 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .18);
  border: 1px solid rgba(255, 255, 255, .12);
}
.compare__label {
  display: inline-block; margin-bottom: 10px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
.compare__panel--good .compare__label { background: rgba(102, 226, 167, .18); color: var(--ok); }
.compare__panel--bad  .compare__label { background: rgba(224, 65, 58, .18);  color: #F2938E; }
.compare__note { margin-top: 10px; font-size: 12px; color: #A9C7B6; }

/* numbered stages inside one board */
.stages { display: grid; gap: 14px; }
.stage { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage__n {
  display: grid; place-items: center; flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #EAF3EC;
  font-size: 12px; font-weight: 700;
}

@media (max-width: 700px) {
  .compare { grid-template-columns: 1fr; }
}

/* ==========================================================================
   12. Mobile reading rhythm
   At 390px the article column is only ~358px wide. The desktop line-height
   (1.6-1.68) and 14px paragraph gaps read very loose there, so tighten the
   vertical rhythm rather than shrinking the text below a comfortable size.
   ========================================================================== */
@media (max-width: 700px) {
  .prose p        { font-size: 15.5px; line-height: 1.5; margin-bottom: 11px; }
  .prose ul,
  .prose ol       { gap: 6px; margin-bottom: 13px; }
  .prose ul li,
  .prose ol li    { font-size: 15px; line-height: 1.5; }
  .prose ol li    { padding-left: 30px; }

  .rsec           { margin-bottom: 26px; }
  .rsec > h2      { margin-bottom: 10px; }
  .rsec > h2::after { margin-top: 8px; }

  .example        { margin-top: 22px; margin-bottom: 20px; }
  .example .prose p { font-size: 15px; margin-bottom: 9px; }
  .example dl div { font-size: 15px; line-height: 1.5; }

  .turnsteps      { gap: 6px; }
  .turnsteps li   { font-size: 15px; line-height: 1.5; }
  .imgdesc        { font-size: 13px; line-height: 1.45; }
  .housenote      { font-size: 14.5px; line-height: 1.5; }
}

/* ==========================================================================
   13. Article sub-headings and diagram labels
   Bare <h3>s inside .rsec had no margin at all (h1-h4 are reset to margin:0
   and only .example h3 had spacing), so sub-headings collided with the text
   above them. Diagram labels also needed a good/bad colour.
   ========================================================================== */
.rsec h3 { margin: 26px 0 8px; }
.rsec .example h3 { margin: 0 0 12px; }   /* keep the worked-example heading tight */

.diag__sub--good { color: var(--ok); }
.diag__sub--bad  { color: #F2938E; }

/* empty ORIGINAL spaces are neutral; only corners are gold (King only) */
.slot--original {
  border-color: rgba(255, 255, 255, .34);
  color: rgba(255, 255, 255, .55);
}

/* .stages sits on felt, so its text must be light */
.stage { color: #EAF3EC; }
.stage__n { color: #EAF3EC; }

/* a second, quieter caption line under a board */
.diag__cap--sub {
  margin-top: 4px;
  font-size: 11.5px; letter-spacing: .06em;
  color: rgba(240, 200, 99, .72);
}

/* dim a destination the example is arguing against */
.is-dim { opacity: .45; }

/* Boards and comparison panels need to breathe away from surrounding copy. */
.example .diag:last-child { margin-bottom: 4px; }
.compare { margin: 6px 0 10px; }
.stages  { margin: 6px 0 10px; }
.scorebox { margin-block: 4px; }

@media (max-width: 700px) {
  .diag { margin: 16px 0 18px; }
  /* the worked-example box sat close to the paragraph above it */
  .example { margin-top: 30px; margin-bottom: 24px; padding: 18px 16px; }
  .example__pill { margin-bottom: 12px; }
  .example h3 { margin-bottom: 14px; }
}
