/* ===========================================================================
 * blackjackrankfa.com — editorial / research-publication design.
 * Warm paper background, a single deep red accent, rules instead of shadows,
 * oversized rank numerals and score meters.
 * ======================================================================== */

:root {
  --paper: #faf7f2;
  --paper-2: #f2ece1;
  --card: #ffffff;
  --rule: #ddd4c6;
  --rule-strong: #c3b7a4;
  --ink: #22201c;
  --ink-2: #4b463e;
  --muted: #7a7266;
  --accent: #9b1c31;
  --accent-soft: #f6e7e9;
  --gold: #9a7b1f;
  --ok: #2c6b45;
  --bad: #a53326;
  --radius: 4px;
  --wrap: 72rem;
  --serif: Georgia, "Times New Roman", serif;

  /* table theme tokens consumed by game.css */
  --bjc-felt: #f2ece1;
  --bjc-felt-edge: #c3b7a4;
  --bjc-felt-text: #22201c;
  --bjc-surface: #ffffff;
  --bjc-border: #ddd4c6;
  --bjc-text: #22201c;
  --bjc-muted: #7a7266;
  --bjc-accent: #9b1c31;
  --bjc-accent-ink: #ffffff;
  --bjc-secondary: #2c6b45;
  --bjc-win: #2c6b45;
  --bjc-loss: #a53326;
  --bjc-radius: 4px;
  --bjc-chip: #9b1c31;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  font-size: 16.5px;
  line-height: 2;
}
body.nav-locked { overflow: hidden; }

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: min(var(--wrap), 100% - 2rem); margin-inline: auto; }

.skip { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--accent); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { inset-inline-start: 0; }

h1, h2, h3, h4 { line-height: 1.42; margin: 0 0 .6rem; font-weight: 800; }
h1 { font-size: clamp(1.55rem, 4.2vw, 2.35rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.2rem, 2.8vw, 1.6rem); margin-top: 2.3rem; padding-bottom: .35rem; border-bottom: 2px solid var(--ink); display: inline-block; }
h3 { font-size: 1.08rem; margin-top: 1.5rem; }
p { margin: 0 0 1.05rem; }
main ul, main ol { padding-inline-start: 1.3rem; margin: 0 0 1.05rem; }
main li { margin-bottom: .45rem; }

.lead { font-size: 1.08rem; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.kicker { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 .3rem; }

/* --------------------------------------------------------------- masthead */

.masthead { background: var(--paper); border-bottom: 3px double var(--ink); }
.masthead-top { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; font-size: .74rem; color: var(--muted); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.issue { margin: 0; }
.issue-end { text-align: end; }

.head-inner { display: flex; align-items: center; gap: 1rem; min-height: 62px; }
.brand img { display: block; }

.nav-btn { margin-inline-start: auto; width: 44px; height: 44px; display: grid; place-content: center; gap: 5px; background: transparent; border: 1px solid var(--rule-strong); border-radius: var(--radius); cursor: pointer; }
.nav-btn span { display: block; width: 20px; height: 2px; background: var(--ink); }

.site-nav { display: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--ink); font-size: .92rem; font-weight: 700; }
.site-nav a[aria-current="page"] { color: var(--accent); border-bottom: 2px solid var(--accent); }
.site-nav.is-open { display: block; position: absolute; inset-inline: 0; background: var(--paper); border-bottom: 1px solid var(--rule); padding: .5rem 1rem 1rem; z-index: 60; max-height: 80vh; overflow-y: auto; }
.site-nav.is-open li { border-bottom: 1px solid var(--rule); }
.site-nav.is-open a { display: block; padding: .7rem .2rem; }

@media (min-width: 64rem) {
  .nav-btn { display: none; }
  .site-nav { display: flex; margin-inline-start: auto; position: static; padding: 0; border: 0; }
  .site-nav ul { display: flex; gap: 1.3rem; }
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1.05rem; border-radius: var(--radius);
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; background: var(--ink); color: var(--paper); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #7d1527; border-color: #7d1527; color: #fff; }
.btn-sm { min-height: 40px; font-size: .82rem; padding: .25rem .7rem; }
.btn-lg { min-height: 52px; font-size: 1rem; padding-inline: 1.5rem; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------------- hero */

.hero { background: var(--paper-2); border-bottom: 1px solid var(--rule); padding: 2rem 0 1.6rem; }
.hero h1 { margin-bottom: .6rem; max-width: 42rem; }
.hero p { max-width: 44rem; color: var(--ink-2); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 1.4rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--rule-strong); }
.hero-meta div { min-width: 7rem; }
.hero-meta b { display: block; font-family: var(--serif); font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.hero-meta span { font-size: .78rem; color: var(--muted); }

/* --------------------------------------------------------------- podium */

.podium { display: grid; gap: .8rem; margin: 1.4rem 0; }
@media (min-width: 52rem) { .podium { grid-template-columns: repeat(3, 1fr); } }

.podium-card { background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--ink); padding: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.podium-card.is-first { border-top-color: var(--accent); }
.podium-rank { font-family: var(--serif); font-size: 3rem; line-height: 1; font-weight: 700; color: var(--accent); }
.podium-card h3 { margin: 0; font-size: 1.15rem; }
.podium-score { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; }
.podium-score small { font-size: .8rem; color: var(--muted); font-family: inherit; }

/* ---------------------------------------------------------------- ranking */

.rank-row {
  display: grid; gap: .8rem; align-items: center;
  grid-template-columns: auto 1fr; padding: 1rem 0; border-bottom: 1px solid var(--rule);
}
@media (min-width: 52rem) { .rank-row { grid-template-columns: 3.4rem 6rem 1fr 12rem 9rem; } }
.rank-num { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; color: var(--accent); line-height: 1; text-align: center; }
.rank-body { min-width: 0; }
.rank-body h3 { margin: 0 0 .15rem; font-size: 1.05rem; }
.rank-body p { margin: 0; font-size: .87rem; color: var(--ink-2); }
.rank-scores { display: grid; gap: .3rem; }
.rank-actions { display: grid; gap: .35rem; }

.meter { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .4rem; align-items: center; font-size: .76rem; }
.meter-label { color: var(--muted); }
.meter-track { height: 6px; background: var(--paper-2); border: 1px solid var(--rule); position: relative; }
.meter-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent); }
.meter-value { font-family: var(--serif); font-weight: 700; min-width: 2rem; text-align: end; }
.meter.is-empty .meter-value { color: var(--muted); font-family: inherit; font-weight: 400; font-size: .74rem; }

.brand-logo { display: grid; place-items: center; background: #1a1713; border: 1px solid #1a1713; border-radius: var(--radius); padding: .4rem .55rem; width: 92px; height: 46px; }
.brand-logo img { max-height: 32px; width: auto; object-fit: contain; }

/* --------------------------------------------------------------- sections */

.section { padding: 2rem 0; }
.section-rule { border-top: 1px solid var(--rule); }
.section-head { margin-bottom: 1rem; max-width: 46rem; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--muted); margin: 0; }

.panel { background: var(--card); border: 1px solid var(--rule); padding: 1rem 1.05rem; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

.grid { display: grid; gap: .85rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 46rem) { .grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 64rem) { .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.card { background: var(--card); border: 1px solid var(--rule); padding: .95rem; min-width: 0; }
.card h3 { margin-top: 0; font-size: 1rem; }
.card p { font-size: .9rem; color: var(--ink-2); margin-bottom: .5rem; }

.pull {
  border-inline-start: 4px solid var(--accent); background: var(--accent-soft);
  padding: .85rem 1rem; margin: 1.2rem 0; font-size: .95rem;
}
.pull p:last-child { margin-bottom: 0; }

.data-note { border: 1px dashed var(--rule-strong); padding: .7rem .9rem; font-size: .85rem; color: var(--muted); margin: 1rem 0; background: var(--paper-2); }

/* -------------------------------------------------------------- breadcrumb */

.crumbs { padding: .8rem 0 .1rem; font-size: .8rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; }
.crumbs li { color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-inline-end: .3rem; color: var(--rule-strong); }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------------ tables */

.table-scroll { overflow-x: auto; margin: 1rem 0; border-block: 1px solid var(--ink); }
table { border-collapse: collapse; width: 100%; min-width: 44rem; font-size: .88rem; }
caption { text-align: start; font-size: .84rem; color: var(--muted); padding: .6rem 0; }
th, td { padding: .6rem .65rem; border-bottom: 1px solid var(--rule); text-align: start; }
thead th { border-bottom: 2px solid var(--ink); font-size: .78rem; letter-spacing: .04em; white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; font-family: var(--serif); }
.table-plain { min-width: 0; }
.table-plain th, .table-plain td { white-space: normal; }

th button.sortbtn { background: none; border: 0; font: inherit; font-size: .78rem; font-weight: 700; color: var(--ink); cursor: pointer; padding: .5rem .35rem; min-height: 40px; }
th button.sortbtn::after { content: " ⇅"; opacity: .45; }
th button.sortbtn[data-sort-dir="desc"]::after { content: " ↓"; color: var(--accent); opacity: 1; }
th button.sortbtn[data-sort-dir="asc"]::after { content: " ↑"; color: var(--accent); opacity: 1; }

.pending { color: var(--muted); font-size: .82rem; }

/* ---------------------------------------------------------------- article */

.article { max-width: 46rem; }
.byline { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .5rem 0 .8rem; border-bottom: 1px solid var(--rule); }
.byline-team { font-weight: 700; color: var(--ink-2); }
.byline-sep { opacity: .5; }

.toc { border-block: 1px solid var(--rule); padding: .8rem 0; margin: 1.1rem 0 1.5rem; }
.toc h2 { margin: 0 0 .35rem; font-size: .88rem; border: 0; padding: 0; }
.toc ol { margin: 0; padding-inline-start: 1.1rem; }
.toc a { color: var(--ink); font-size: .88rem; }

/* --------------------------------------------------------------- comments */

.comment { border-bottom: 1px solid var(--rule); padding: .8rem 0; }
.comment-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .25rem; }
.comment-name { font-weight: 700; font-size: .9rem; }
.comment p { margin: 0 0 .3rem; font-size: .92rem; }
.comment time { font-size: .77rem; color: var(--muted); }
.comment.is-pending { border-inline-start: 3px solid var(--rule-strong); padding-inline-start: .6rem; }
.comment-badge { font-size: .7rem; padding: .08rem .45rem; border: 1px solid var(--rule); color: var(--muted); }
.stars { font-size: .85rem; }
.stars-on { color: var(--gold); }
.stars-off { color: var(--rule); }

.form-grid { display: grid; gap: .65rem; max-width: 40rem; }
@media (min-width: 42rem) { .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; } }
label { display: block; font-size: .84rem; font-weight: 700; margin-bottom: .2rem; }
input, select, textarea { width: 100%; font: inherit; font-size: .92rem; padding: .55rem .65rem; min-height: 44px; border: 1px solid var(--rule-strong); background: #fff; color: var(--ink); border-radius: var(--radius); }
textarea { min-height: 6.5rem; resize: vertical; }
.form-status { font-size: .85rem; color: var(--accent); min-height: 1.3rem; }

/* -------------------------------------------------------------------- faq */

.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: .75rem 0; font-weight: 700; font-size: .95rem; list-style: none; display: flex; justify-content: space-between; gap: .5rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); }
.faq details[open] summary::after { content: "−"; }
.faq .faq-a { padding: 0 0 .8rem; color: var(--ink-2); font-size: .92rem; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- related */

.related { margin: 2rem 0 1rem; padding-top: 1.1rem; border-top: 3px double var(--rule-strong); }
.related h2 { margin-top: 0; font-size: 1rem; border: 0; padding: 0; }
.related-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
@media (min-width: 46rem) { .related-list { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.related-list li { margin: 0; padding-inline-start: .7rem; border-inline-start: 2px solid var(--rule-strong); }
.related-list a { font-weight: 700; font-size: .92rem; }
.related-list span { display: block; font-size: .8rem; color: var(--muted); }

/* ------------------------------------------------------------------- misc */

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 2.3rem; margin-bottom: .85rem; }
.steps li::before { content: counter(s); position: absolute; inset-inline-start: 0; top: .3rem; width: 1.7rem; height: 1.7rem; display: grid; place-items: center; border: 1px solid var(--ink); font-family: var(--serif); font-weight: 700; font-size: .85rem; }

.split-list { display: grid; gap: .7rem; }
@media (min-width: 46rem) { .split-list { grid-template-columns: 1fr 1fr; } }
.list-good li::marker { color: var(--ok); }
.list-bad li::marker { color: var(--bad); }

.game-shell { padding: 1rem 0; }

/* ----------------------------------------------------------------- footer */

.site-foot { margin-top: 2.6rem; border-top: 3px double var(--ink); padding: 1.8rem 0 1.4rem; }
.foot-grid { display: grid; gap: 1.3rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .foot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .foot-grid { grid-template-columns: repeat(4, 1fr); } }
.foot-col h2 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .5rem; border: 0; padding: 0; }
.foot-col ul { list-style: none; padding: 0; margin: 0; }
.foot-col li { margin-bottom: .35rem; }
.foot-col a { color: var(--ink-2); font-size: .86rem; }
.foot-bottom { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .82rem; color: var(--muted); }
.foot-copy { margin: .5rem 0 0; }

/* -------------------------------------------------------------------- 404 */

.err-wrap { text-align: center; padding: 3rem 0 1.5rem; }
.err-code { font-family: var(--serif); font-size: clamp(3rem, 12vw, 5.5rem); font-weight: 700; color: var(--accent); line-height: 1; margin: 0; }

[hidden] { display: none !important; }
