/* ==========================================================================
   Kings in the Corner - "Disputed Moves: A Referee's Notebook"
   Loaded only by /disputed-moves/, after styles.css, pages.css and rules.css.

   A referee's match notebook: a rule card pinned beside the reader, then a
   run of numbered cases separated by a thin rule rather than boxed up. The
   verdict is a stamp, but the word "Legal" or "Illegal" is text inside it and
   the reasoning sits beside it, so colour is never the only signal.

   1. Tokens
   2. Layout: cases and the pinned rule card
   3. The rule card
   4. A case file
   5. Stamps
   6. Card evidence
   7. Responsive
   8. Print
   ========================================================================== */

/* ------------------------------ 1. Tokens ------------------------------- */
.refpage {
  --r-paper:   #F6F1E4;
  --r-edge:    #1C1B16;   /* the narrow black border on the rule card */
  --r-rule:    #C6BCA4;
  --r-ink:     #23221B;
  --r-ink-2:   #55503F;
  --r-legal:   #2C6244;   /* muted green */
  --r-illegal: #9B2F2C;   /* muted red */
  --r-felt:    #0C2E1E;
  --r-felt-2:  #123D28;
}

/* --------------- 2. Layout: cases beside the pinned card ---------------- */
.reflayout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 34px;
  padding-block: 30px 44px;
}
.reflayout > * { min-width: 0; }
.refaside { grid-column: 2; grid-row: 1; position: sticky; top: 86px; }
.casefiles { grid-column: 1; grid-row: 1; }

/* ---------------------------- 3. Rule card ------------------------------ */
.rulecard {
  padding: 16px 18px 14px;
  background: var(--r-paper);
  border: 2px solid var(--r-edge);
  border-radius: 2px;
}
.rulecard__h {
  margin: 0;
  font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--r-ink);
}
.rulecard__sub {
  margin: 2px 0 10px;
  font-size: 12.5px; color: var(--r-ink-2);
}
.rulecard dl {
  margin: 0;
  border-top: 1px solid var(--r-edge);
}
.rulecard dt {
  margin: 0; padding: 9px 0 1px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--r-ink-2);
}
.rulecard dd {
  margin: 0; padding: 0 0 9px;
  border-bottom: 1px solid var(--r-rule);
  font-size: 14px; line-height: 1.4; color: var(--r-ink);
}
.rulecard dd:last-of-type { border-bottom: 0; }
.rulecard__date {
  display: flex; align-items: baseline; gap: 8px;
  margin: 12px 0 0; padding-top: 10px;
  border-top: 1px solid var(--r-edge);
  font-size: 11.5px; color: var(--r-ink-2);
}
.rulecard__date span { flex: 1; border-bottom: 1px solid var(--r-rule); }

/* ---------------------------- 4. A case file ---------------------------- */
.case {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 0 20px;
  padding-block: 34px;
  border-top: 1px solid var(--iline);
}
.case:first-of-type { border-top: 0; padding-top: 6px; }
.case__no {
  grid-row: 1 / span 20;
  margin: 0;
  font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1;
  /* var(--r-rule) is a hairline colour and measured 1.76:1 as text */
  color: #8A7F63;
  font-variant-numeric: tabular-nums lining-nums;
}
.case > :not(.case__no) { grid-column: 2; }
.case h2 { margin: 0 0 12px; font-size: clamp(20px, 2.2vw, 25px); }
.case p { margin: 0 0 9px; }
.case p:last-child { margin-bottom: 0; }
.case b { color: var(--ink); }

/* the verdict line: stamp on the left, the reason beside it */
.verdict {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: start; gap: 14px;
  margin-top: 14px;
}
.verdict__text { margin: 0; }
.verdict__text > b { display: block; margin-bottom: 3px; }

/* ------------------------------- 5. Stamps ------------------------------ */
.stamp {
  display: inline-grid; place-items: center;
  min-width: 84px; min-height: 34px;
  padding: 5px 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(-3deg);
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap;
}
.stamp--legal { color: var(--r-legal); }
.stamp--illegal { color: var(--r-illegal); transform: rotate(2deg); }
/* a second, non-colour cue: the illegal stamp is double-ruled */
.stamp--illegal { box-shadow: inset 0 0 0 4px #FFF, inset 0 0 0 6px currentColor; }

@media (prefers-reduced-motion: reduce) {
  .stamp { transform: none; }
}

/* --------------------------- 6. Card evidence --------------------------- */
.evidence {
  --cw: 46px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  margin: 14px 0 4px;
  padding: 14px 16px 12px;
  background: var(--r-felt);
  border: 1px solid var(--r-felt-2);
  border-radius: 8px;
}
.evidence__row {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 14px;
}
.evidence__row + .evidence__row { margin-top: 12px; }
.evidence__label {
  flex: none; min-width: 108px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.evidence .card { box-shadow: 0 6px 14px rgba(0, 0, 0, .38); }
.evidence__pile { display: flex; gap: 5px; }
.evidence__slot {
  display: grid; place-items: center;
  min-width: var(--cw); height: var(--ch);
  padding: 4px 8px;
  border: 1.5px dashed rgba(214, 236, 224, .55);
  border-radius: var(--cr);
  color: #C3DCCF; font-size: 10.5px; line-height: 1.2; text-align: center;
}
.evidence__note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; color: #D7E7DE; }

/* --------------------------- 7. Responsive ------------------------------ */
@media (max-width: 1024px) {
  /* source order puts the rule card first, so on one column it lands
     directly under the title - and it must not be pinned there */
  .reflayout { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-block: 20px 32px; }
  .refaside, .casefiles { grid-column: 1; grid-row: auto; }
  .refaside { position: static; }
}

@media (max-width: 640px) {
  .case { grid-template-columns: minmax(0, 1fr); gap: 0; padding-block: 26px; }
  .case__no { grid-row: auto; margin-bottom: 4px; font-size: 22px; }
  .case > :not(.case__no) { grid-column: 1; }
  .verdict { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .evidence { --cw: 38px; --ch: calc(var(--cw) * 1.44); --cr: calc(var(--cw) * .1); padding: 12px; }
  .evidence__label { min-width: 0; flex-basis: 100%; }
}

/* ------------------------------- 8. Print ------------------------------- */
@media print {
  .reflayout { grid-template-columns: minmax(0, 1fr); }
  .refaside { position: static; }
  .case { break-inside: avoid; page-break-inside: avoid; }
  .evidence { break-inside: avoid; page-break-inside: avoid; background: #FBF8F0; border-color: #8C846E; }
  .evidence__label { color: #6B5A2E; }
  .evidence__note, .evidence__slot { color: #1A1A1A; }
  .evidence__slot { border-color: #8C846E; }
  .rulecard { background: #FBF8F0; }
  .stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .stamp--illegal { box-shadow: inset 0 0 0 4px #FBF8F0, inset 0 0 0 6px currentColor; }
  .case__no { color: #8C846E; }
}
