/* Article and tool pages (/rules/*, /tools/*).
 *
 * Loaded on top of style.css and built entirely from its design tokens, so
 * both themes and any future palette change carry over for free. Nothing
 * here restyles a shared class — the header, footer and buttons stay exactly
 * as they are everywhere else on the site.
 */

.content-body { background: var(--bg); }

.content-main {
  max-width: 820px;
  padding: 24px 20px 64px;
}

.content-header-link {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-red, #fff);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
}
.content-header-link:hover { background: var(--accent-hover); }

.content-crumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 18px;
}
.content-crumbs a { color: var(--text-muted); text-decoration: none; }
.content-crumbs a:hover { color: var(--accent); text-decoration: underline; }
.content-crumb-current { color: var(--text); }

/* ── article ───────────────────────────────────────────────────────── */
.content-article h1 {
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.content-lead {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0 0 28px;
}

.content-section { margin: 0 0 30px; }

.content-section h2 {
  font-size: 22px;
  line-height: 1.3;
  margin: 32px 0 12px;
  color: var(--text);
}

.content-section p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 14px;
}

.content-section ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

.content-section li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 8px;
}

/* ── FAQ ───────────────────────────────────────────────────────────── */
.content-faq .faq-item {
  border-top: 1px solid var(--border);
  padding: 16px 0 4px;
}
.content-faq h3 {
  font-size: 17px;
  margin: 0 0 8px;
  color: var(--text);
}
.content-faq p {
  color: var(--text-muted);
  margin: 0 0 8px;
}

/* ── call to action ────────────────────────────────────────────────── */
.content-cta {
  margin: 36px 0 28px;
  padding: 24px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.content-cta h2 { margin: 0 0 8px; font-size: 20px; color: var(--text); }
.content-cta p { margin: 0 0 18px; color: var(--text-muted); line-height: 1.6; }
.content-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.content-cta-actions .btn-primary,
.content-cta-actions .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
}
.content-cta-actions .btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.content-cta-actions .btn-ghost:hover { background: var(--hover); }

/* ── related links ─────────────────────────────────────────────────── */
.content-related h2 { font-size: 16px; color: var(--text-muted); margin: 0 0 10px; font-weight: 600; }
.content-related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.content-related a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.content-related a:hover { border-color: var(--accent); color: var(--accent); }

/* ── chess clock ───────────────────────────────────────────────────── */
.clock-tool { margin: 0 0 32px; }

.clock-faces {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.clock-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 28px 12px;
  min-height: 150px;
  border-radius: 18px;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, background .15s;
}
.clock-face:hover { border-color: var(--border-strong); }
.clock-face.is-active { border-color: var(--accent); background: var(--surface); }
.clock-face.is-low .clock-time { color: var(--danger); }
.clock-face.is-flagged { opacity: .65; border-color: var(--danger); }

.clock-name { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.clock-time {
  font-size: clamp(34px, 9vw, 52px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.clock-meta { font-size: 12px; color: var(--text-muted); }
.clock-flag { font-size: 12px; font-weight: 700; color: var(--danger); min-height: 15px; }

.clock-controls {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.clock-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.clock-preset {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.clock-preset.active { background: var(--accent); border-color: var(--accent); color: var(--on-red, #fff); }

.clock-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.clock-field, .elo-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  flex: 1 1 160px;
}
.clock-field input, .elo-field input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}
.clock-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.clock-buttons .btn-primary, .clock-buttons .btn-ghost {
  padding: 11px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: 1px solid transparent;
}
.clock-buttons .btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.clock-sound { font-size: 13px; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; }
.clock-hint { font-size: 13px; color: var(--text-muted); margin: 12px 2px 0; line-height: 1.6; }

/* ── elo calculator ────────────────────────────────────────────────── */
.elo-tool { margin: 0 0 32px; }
.elo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.elo-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px 12px;
  margin: 0;
}
.elo-fieldset legend { font-size: 13px; color: var(--text-muted); font-weight: 600; padding: 0 4px; }
.elo-radio { display: flex; gap: 8px; align-items: center; font-size: 15px; color: var(--text); padding: 3px 0; }
.elo-kbox { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
/* Inside the K column the field must not grow: .elo-field carries
   `flex: 1 1 160px` for the horizontal rows, and in a column that made the
   input stretch to the height of the tallest grid cell, stranding the
   auto-pick checkbox at the bottom of an empty box. */
.elo-kbox .elo-field { flex: 0 0 auto; }
.elo-auto { font-size: 13px; color: var(--text-muted); display: inline-flex; gap: 6px; align-items: center; }

.elo-out {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.elo-stat {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.elo-stat span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.elo-stat strong { font-size: 24px; font-variant-numeric: tabular-nums; color: var(--text); }
.elo-stat-main { border-color: var(--accent); }
.elo-stat strong[data-dir="up"] { color: var(--ok); }
.elo-stat strong[data-dir="down"] { color: var(--danger); }
.elo-help { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 14px 2px 0; }

@media (max-width: 560px) {
  .clock-faces { grid-template-columns: 1fr; }
  .content-main { padding: 16px 14px 48px; }
}
