/* ==========================================================================
   Kings in the Corner - "House Rules and How They Change the Game"
   Loaded only by /house-rules/, after styles.css, pages.css and rules.css.

   The page is built as a card-table ledger: ivory paper pieces and flat felt
   objects, one physical object per rule choice rather than a run of matching
   boxes. No gradients anywhere in this file - the depth comes from paper
   colour and thin rules, which is also what survives a print.

   1. Tokens
   2. Agreement card (blank and completed)
   3. Turn card - draw timing
   4. Tableau pair - empty original positions
   5. Corner marker - King play
   6. Stock counter - an empty stock
   7. Score pad - scoring systems
   8. Card ribbons - colours against suits
   9. Wild-card sleeve - Jokers
  10. Deal note - a King in the opening cross
  11. Ledger table
  12. Responsive
  13. Print
   ========================================================================== */

/* ------------------------------ 1. Tokens ------------------------------- */
.hrpage {
  --hr-felt:      #0C2E1E;
  --hr-felt-2:    #123D28;
  --hr-paper:     #F4EEE1;
  --hr-paper-2:   #EDE5D3;
  --hr-rule:      #CDC2A6;
  --hr-ink:       #2B2A23;
  --hr-ink-2:     #5A5344;
  /* both are measured against the ivory paper: the first pair tried came out
     at 4.11 and 4.50, so they were darkened until every label clears 5:1 */
  --hr-gold:      #7A6021;   /* the chosen rule */
  --hr-slate:     #55636F;   /* the rule not chosen */
  --hr-red:       #A3282C;
  --hr-char:      #22242B;
}

/* --------------------------- 2. Agreement card -------------------------- */
.agreement {
  margin: 20px 0 26px;
  padding: 18px 20px 16px;
  background: var(--hr-paper);
  border: 1px solid var(--hr-rule);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--hr-paper-2), 0 10px 26px rgba(30, 26, 14, .10);
}
.agreement__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--hr-rule);
}
.agreement__title {
  margin: 0;
  font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--hr-ink);
}
.agreement__hint { margin: 0; font-size: 12.5px; color: var(--hr-ink-2); }

.agreement__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px 18px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hr-rule);
}
.agreement__row:last-of-type { border-bottom: 0; }
.agreement__q { font-size: 14.5px; color: var(--hr-ink); }

.agreement__opt {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 32px; padding: 4px 6px;
  border-radius: 3px;
  font-size: 14px; color: var(--hr-slate);
  cursor: pointer;
}
.agreement__opt:hover { background: var(--hr-paper-2); }
.agreement__opt:has(input:checked) { color: var(--hr-gold); font-weight: 600; }

/* a real radio, restyled as the square tick box the sheet asks for */
.agreement input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  flex: none; width: 19px; height: 19px; margin: 0;
  display: grid; place-items: center;
  background: #FFFCF4;
  border: 1.5px solid var(--hr-slate);
  border-radius: 2px;
  cursor: pointer;
}
.agreement input[type="radio"]:checked { border-color: var(--hr-gold); }
.agreement input[type="radio"]:checked::after {
  content: "";
  width: 11px; height: 6px;
  margin-top: -3px;
  border-left: 2.5px solid var(--hr-gold);
  border-bottom: 2.5px solid var(--hr-gold);
  transform: rotate(-48deg);
}
.agreement input[type="radio"]:focus-visible {
  outline: 2px solid var(--hr-ink);
  outline-offset: 2px;
}

.agreement__date {
  display: flex; align-items: baseline; gap: 10px;
  margin: 14px 0 0;
  font-size: 12.5px; color: var(--hr-ink-2);
}
.agreement__date span { flex: 1; border-bottom: 1px solid var(--hr-rule); }

/* the completed sheet: written values instead of a pair of choices */
.agreement--done .agreement__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.agreement--done .agreement__val {
  display: flex; align-items: baseline; gap: 9px;
  font-size: 14px; font-weight: 600; color: var(--hr-gold);
}
.agreement__tick { flex: none; width: 14px; height: 8px; color: var(--hr-gold); }
.agreement__tick path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------ 3. Turn card ---------------------------- */
.turncard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  margin: 20px 0 24px;
  background: var(--hr-paper);
  border: 1px solid var(--hr-rule);
  border-radius: 6px;
  overflow: hidden;
}
.turncard__face { padding: 16px 18px; }
.turncard__face + .turncard__spine + .turncard__face { border-left: 1px solid var(--hr-rule); }
.turncard__label {
  margin: 0 0 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--hr-gold);
}
/* a label on a prop, not a document heading - it used to be an <h4> directly
   under the section's <h2>, which skipped a level */
.turncard__title {
  margin: 0 0 8px;
  font-family: var(--serif); font-size: 17px; font-weight: 700; color: var(--hr-ink);
}
.turncard__face p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--hr-ink-2); }
.turncard__face p:last-child { margin-bottom: 0; }
.turncard__spine {
  display: grid; place-items: center;
  width: 34px;
  background: var(--hr-paper-2);
  border-inline: 1px solid var(--hr-rule);
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--hr-ink-2);
}

/* --------------------------- 4. Tableau pair ---------------------------- */
.tabpair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 20px 0 24px; }
.tabmini {
  --cw: 40px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  padding: 14px 14px 12px;
  background: var(--hr-felt);
  border: 1px solid var(--hr-felt-2);
  border-radius: 8px;
}
.tabmini__h {
  margin: 0 0 10px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.tabmini__row { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--ch); }
.tabmini__row + .tabmini__row { margin-top: 9px; }
.tabmini__slot {
  display: grid; place-items: center;
  width: var(--cw); height: var(--ch);
  border: 1.5px dashed rgba(214, 236, 224, .5);
  border-radius: var(--cr);
  color: #BFD9CC; font-size: 10.5px; text-align: center;
}
.tabmini__note { margin: 10px 0 0; font-size: 13px; line-height: 1.45; color: #D7E7DE; }

/* --------------------------- 5. Corner marker --------------------------- */
.cornermark {
  --cw: 46px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--hr-felt);
  border: 1px solid var(--hr-felt-2);
  border-radius: 8px;
}
.cornermark__plate {
  position: relative;
  display: grid; place-items: center;
  padding: 14px;
  border: 1px solid rgba(214, 236, 224, .35);
  border-radius: 6px;
}
/* the corner notch that marks a King square on a real table */
.cornermark__plate::before,
.cornermark__plate::after {
  content: "";
  position: absolute; width: 14px; height: 14px;
  border: 2px solid var(--gold-light);
}
.cornermark__plate::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.cornermark__plate::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.cornermark__lines { display: grid; gap: 10px; }
.cornermark__line { display: grid; gap: 3px; }
.cornermark__line b {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.cornermark__line span { font-size: 13.5px; line-height: 1.45; color: #D7E7DE; }

/* --------------------------- 6. Stock counter --------------------------- */
.stockcount {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--hr-felt);
  border: 1px solid var(--hr-felt-2);
  border-radius: 8px;
}
.stockcount__stack { position: relative; width: 62px; height: 88px; flex: none; }
.stockcount__stack i {
  position: absolute; inset: 0;
  border-radius: 6px;
  background: #24407F;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .45);
}
.stockcount__stack i:nth-child(1) { transform: translate(-6px, -6px); }
.stockcount__stack i:nth-child(2) { transform: translate(-3px, -3px); }
/* the empty slot sits in front of the depleted stack, so it has to be opaque
   felt - a translucent panel over the blue backs read as another card */
.stockcount__zero {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border: 1.5px dashed rgba(214, 236, 224, .65);
  border-radius: 6px;
  background: var(--hr-felt);
  color: #E6F2EB; font-family: var(--serif); font-size: 26px; font-weight: 700;
}
.stockcount__opts { display: grid; gap: 12px; }
.stockcount__opt { display: grid; gap: 3px; }
.stockcount__opt b {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.stockcount__opt span { font-size: 13.5px; line-height: 1.45; color: #D7E7DE; }

/* ------------------------------ 7. Score pad ---------------------------- */
.scorepad {
  margin: 20px 0 24px;
  padding: 16px 18px 14px;
  background: var(--hr-paper);
  border: 1px solid var(--hr-rule);
  border-radius: 4px;
}
.scorepad__h {
  margin: 0 0 4px;
  font-family: var(--serif); font-size: 17px; color: var(--hr-ink);
}
.scorepad__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.scorepad__col > b {
  display: block;
  padding: 8px 0 6px;
  border-bottom: 2px solid var(--hr-rule);
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--hr-gold);
}
.scorepad__col dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 0; }
.scorepad__col dt,
.scorepad__col dd {
  margin: 0; padding: 7px 0;
  border-bottom: 1px solid var(--hr-rule);
  font-size: 14px; color: var(--hr-ink);
}
.scorepad__col dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.scorepad__col dl > dt:last-of-type,
.scorepad__col dl > dd:last-of-type { border-bottom: 0; }

/* ---------------------------- 8. Card ribbons --------------------------- */
.ribbon {
  --cw: 40px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin: 14px 0;
  padding: 13px 16px;
  background: var(--hr-felt);
  border: 1px solid var(--hr-felt-2);
  border-radius: 8px;
}
.ribbon + .ribbon { margin-top: 10px; }
.ribbon__label { display: grid; gap: 3px; }
.ribbon__label b {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.ribbon__label span { font-size: 13px; line-height: 1.4; color: #D7E7DE; }
.ribbon__cards { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.ribbon__cards .card { flex: none; }

/* -------------------------- 9. Wild-card sleeve ------------------------- */
.sleeve {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 20px;
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--hr-paper);
  border: 1.5px dashed var(--hr-rule);
  border-radius: 6px;
}
.sleeve__card {
  display: grid; place-items: center; align-content: center; gap: 4px;
  width: 76px; height: 108px;
  border: 1.5px solid var(--hr-char);
  border-radius: 7px;
  background: #FFFCF4;
  color: var(--hr-char);
  font-family: var(--serif); font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; text-align: center;
}
.sleeve__card i { font-style: normal; font-size: 26px; color: var(--hr-red); }
.sleeve__list { margin: 0; padding-left: 20px; display: grid; gap: 7px; list-style: square; }
.sleeve__list li { font-size: 14px; line-height: 1.45; color: var(--hr-ink); }
.sleeve__list li::marker { color: var(--hr-gold); }

/* ----------------------------- 10. Deal note ---------------------------- */
.dealnote {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  margin: 20px 0 24px;
  padding: 16px 18px;
  background: var(--hr-felt);
  border: 1px solid var(--hr-felt-2);
  border-radius: 8px;
}
.crossmap {
  --cw: 36px;
  --ch: calc(var(--cw) * 1.44);
  --cr: calc(var(--cw) * .1);
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 5px;
  justify-items: center; align-items: center;
}
.crossmap__corner {
  display: grid; place-items: center;
  width: var(--cw); height: var(--ch);
  border: 1.5px dashed rgba(214, 236, 224, .5);
  border-radius: var(--cr);
  color: #BFD9CC; font-size: 10px; letter-spacing: .06em;
}
.crossmap__stock {
  position: relative;
  width: var(--cw); height: var(--ch);
}
.crossmap__stock i {
  position: absolute; inset: 0;
  border-radius: var(--cr);
  background: #24407F;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .45);
}
.crossmap__stock i:first-child { transform: translate(-3px, -3px); }
.dealnote__note { display: grid; gap: 6px; }
.dealnote__note b {
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-light);
}
.dealnote__note span { font-size: 13.5px; line-height: 1.45; color: #D7E7DE; }

/* --------------------------- 11. Ledger table --------------------------- */
.ltable-wrap { overflow-x: auto; margin: 18px 0 22px; }
.ltable {
  width: 100%;
  border-collapse: collapse;
  background: var(--hr-paper);
  border: 1px solid var(--hr-rule);
  font-size: 14.5px;
}
.ltable caption {
  padding: 0 0 8px;
  text-align: left;
  font-family: var(--serif); font-size: 16px; color: var(--hr-ink);
}
.ltable thead th {
  padding: 9px 13px;
  border-bottom: 2px solid var(--hr-rule);
  text-align: left; vertical-align: bottom;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--hr-gold);
}
.ltable th, .ltable td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--hr-rule);
  text-align: left; vertical-align: top;
}
.ltable tbody th { font-weight: 700; color: var(--hr-ink); }
.ltable td { color: var(--hr-ink-2); }
.ltable tbody tr:last-child th,
.ltable tbody tr:last-child td { border-bottom: 0; }

/* --------------------------- 12. Responsive ----------------------------- */
@media (max-width: 760px) {
  /* every paired choice stacks, and the tick boxes grow to a comfortable
     thumb target with a gap between them */
  .agreement__row { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 10px 0; }
  .agreement--done .agreement__row { grid-template-columns: minmax(0, 1fr); }
  .agreement__q { font-weight: 600; }
  .agreement__opt { min-height: 44px; padding: 6px 8px; }
  .agreement input[type="radio"] { width: 22px; height: 22px; }

  .turncard { grid-template-columns: minmax(0, 1fr); }
  .turncard__spine { width: auto; height: 30px; border-inline: 0; border-block: 1px solid var(--hr-rule); }
  .turncard__face + .turncard__spine + .turncard__face { border-left: 0; }

  .tabpair { grid-template-columns: minmax(0, 1fr); }
  .cornermark, .stockcount, .ribbon, .sleeve, .dealnote { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .cornermark__plate, .stockcount__stack, .sleeve__card { justify-self: start; }
  .scorepad__cols { grid-template-columns: minmax(0, 1fr); gap: 14px; }

  .ltable-wrap { overflow-x: visible; }
  .ltable, .ltable tbody, .ltable tr, .ltable th, .ltable td { display: block; }
  .ltable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ltable tbody tr { border-bottom: 2px solid var(--hr-rule); }
  .ltable tbody tr:last-child { border-bottom: 0; }
  .ltable tbody th { padding-bottom: 2px; }
  .ltable tbody td { padding-top: 2px; }
  .ltable tbody td::before {
    content: attr(data-label) " ";
    color: var(--hr-gold); font-size: 12px; font-weight: 700;
    letter-spacing: .06em; text-transform: uppercase;
    display: block; margin-bottom: 2px;
  }
  .ltable tbody td { border-bottom: 0; }
}

/* ------------------------------ 13. Print ------------------------------- */
@media print {
  /* the sheets are the point of the page, so force the boxes and ticks to
     survive a printer that drops backgrounds */
  .agreement, .turncard, .scorepad, .sleeve, .ltable { background: #FFF; border-color: #666; }
  .agreement input[type="radio"] {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
    border-color: #333; background: #FFF;
  }
  .agreement input[type="radio"]:checked::after { border-color: #333; }
  .agreement__opt, .agreement__q, .turncard__face p, .ltable td { color: #1A1A1A; }
  .agreement__opt:has(input:checked), .agreement--done .agreement__val { color: #6B5A2E; }
  .tabmini, .cornermark, .stockcount, .ribbon, .dealnote { background: #FFF; border-color: #666; }
  .tabmini__h, .cornermark__line b, .stockcount__opt b, .ribbon__label b, .dealnote__note b { color: #6B5A2E; }
  .tabmini__note, .cornermark__line span, .stockcount__opt span, .ribbon__label span,
  .dealnote__note span, .tabmini__slot, .crossmap__corner { color: #1A1A1A; }
  .tabmini__slot, .crossmap__corner { border-color: #777; }
  .stockcount__stack i { background: #FFF; box-shadow: inset 0 0 0 1.5px #555; }
  .stockcount__zero { background: #FFF; color: #1A1A1A; border-color: #777; }
  .cornermark__plate::before, .cornermark__plate::after { border-color: #6B5A2E; }
}
