/*
 * Scorebook design system for Dugout Dynasty.
 *
 * Cool graph-paper background, navy ink, red pencil, and one dark scoreboard-green band with amber lettering.
 * Headlines: Archivo (condensed). Body: Source Serif 4. Loaded from layouts/scorebook.twig.
 *
 * Components: .wrap .display .btn .bar .hero .scorecard .band .split .steps .on-board .rules .closer
 *             .flash .page-head .doc .doc-nav .prose .note .pager .site-foot
 */

:root {
    --paper: #f2f5f0;
    --sheet: #ffffff;
    --rule: #d3dfd6;
    --ink: #14213d;
    --ink-soft: #4a5568;
    --red: #c4352b;
    --red-dark: #9f2920;
    --board: #0e2a20;
    --chalk: #eaf2ec;
    --chalk-dim: #a9c2b3;
    --amber: #ffb43c;
    --display: "Archivo", "Arial Narrow", Arial, sans-serif;
    --text: "Source Serif 4", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--text);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.on-board :focus-visible { outline-color: var(--amber); }
.sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wrap { width: min(100% - 2.5rem, 72rem); margin-inline: auto; }

/* Type */
.display {
    font-family: var(--display);
    font-weight: 850;
    font-variation-settings: "wdth" 68;
    font-stretch: 68%;
    letter-spacing: -0.005em;
    line-height: 0.94;
    margin: 0;
}

/* Top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 1.25rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--display); font-weight: 850; font-variation-settings: "wdth" 80; font-stretch: 80%; font-size: 1.5rem; letter-spacing: 0.005em; }
.brand svg { width: 1.6rem; height: 1.6rem; }
.bar-nav { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; font-family: var(--display); font-weight: 600; font-size: 0.95rem; }
.bar-nav a { text-decoration: none; }
.bar-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* Buttons */
.btn {
    display: inline-block; padding: 0.8rem 1.4rem; border: 2px solid var(--ink);
    font-family: var(--display); font-weight: 750; font-size: 1.05rem; text-decoration: none; line-height: 1.2;
    border-radius: 2px; transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-small { padding: 0.5rem 1rem; font-size: 0.95rem; }

/* Hero: scorebook paper */
.hero {
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--rule) 1px, transparent 1px),
        linear-gradient(90deg, var(--rule) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: -1px -1px;
    border-bottom: 2px solid var(--ink);
}
.hero-grid { display: grid; gap: 2.5rem; padding-block: 1.5rem 4.5rem; align-items: center; }
.hero h1 { font-size: clamp(3.2rem, 8.5vw, 6.5rem); }
.hero-lede { max-width: 31rem; font-size: 1.2rem; margin: 1.5rem 0 2rem; }
.cta-row { display: flex; gap: 0.9rem; flex-wrap: wrap; }

/* Scorecard */
.scorecard { margin: 0; background: var(--sheet); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.scorecard-scroll { overflow-x: auto; }
.scorecard table { width: 100%; border-collapse: collapse; min-width: 22rem; }
.scorecard th, .scorecard td { border: 1px solid var(--rule); padding: 0; }
.scorecard thead th { font-family: var(--display); font-weight: 650; font-size: 0.8rem; color: var(--ink-soft); padding: 0.4rem; text-align: center; background: var(--paper); }
.scorecard thead th:first-child { text-align: left; padding-left: 0.9rem; }
.scorecard tbody th { text-align: left; padding: 0.55rem 0.9rem; min-width: 10.5rem; font-weight: 400; }
.p-name { display: block; font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 80; font-stretch: 80%; font-size: 1.2rem; line-height: 1.15; }
.p-note { display: block; font-size: 0.82rem; line-height: 1.3; color: var(--ink-soft); margin-top: 0.15rem; }
.inn { width: 3.6rem; height: 3.6rem; text-align: center; }
.dia { display: block; width: 100%; height: 100%; padding: 0.25rem; }
.dia-base { fill: none; stroke: var(--rule); stroke-width: 3; stroke-linejoin: round; }
.dia-run { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: pencil 0.55s ease-out forwards; animation-delay: calc(var(--d) * 85ms + 500ms); }
.dia-run.is-run { stroke: var(--red); }
.dia-fill { fill: var(--red); opacity: 0; animation: ink-in 0.3s ease-out forwards; animation-delay: calc(var(--d) * 85ms + 950ms); }
.dia-out { font-family: var(--display); font-weight: 800; font-size: 25px; fill: var(--ink); }
.scorecard figcaption { padding: 0.7rem 0.9rem; border-top: 2px solid var(--ink); font-size: 0.9rem; color: var(--ink-soft); }
.scorecard figcaption strong { color: var(--ink); font-weight: 650; }
@keyframes pencil { to { stroke-dashoffset: 0; } }
@keyframes ink-in { to { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) {
    .dia-run { animation: none; stroke-dashoffset: 0; }
    .dia-fill { animation: none; opacity: 0.9; }
    html { scroll-behavior: auto; }
}

/* Sections */
.band { padding-block: 5rem; }
h2.display { font-size: clamp(2.4rem, 5.5vw, 3.8rem); }
.split { display: grid; gap: 2.5rem; }
.split-lede { max-width: 26rem; margin-top: 1.25rem; color: var(--ink-soft); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.steps li { display: grid; grid-template-columns: 3.75rem 1fr; gap: 0.75rem; padding: 1.4rem 0; border-bottom: 1px solid var(--rule); }
.step-n { font-family: var(--display); font-weight: 850; font-variation-settings: "wdth" 68; font-stretch: 68%; font-size: 3.2rem; line-height: 0.9; color: var(--red); }
.step-t { font-weight: 700; font-size: 1.3rem; line-height: 1.25; margin: 0 0 0.3rem; }
.step-d { margin: 0; max-width: 38rem; }

/* Rules: the scoreboard */
.on-board { background: var(--board); color: var(--chalk); border-block: 2px solid var(--ink); }
.on-board .split-lede { color: var(--chalk-dim); }
.on-board h2 { color: var(--amber); }
.rules { margin: 0; }
.rules div { display: grid; grid-template-columns: 1fr; gap: 0.1rem; padding: 0.95rem 0; border-bottom: 1px dashed rgba(169, 194, 179, 0.4); }
.rules div:first-child { border-top: 1px dashed rgba(169, 194, 179, 0.4); }
.rules dt { color: var(--chalk-dim); font-size: 0.95rem; }
.rules dd { margin: 0; font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 80; font-stretch: 80%; font-size: 1.8rem; line-height: 1.15; color: var(--amber); text-shadow: 0 0 14px rgba(255, 180, 60, 0.35); }
.rules dd.long { font-family: var(--text); font-weight: 600; font-variation-settings: normal; font-stretch: normal; font-size: 1.1rem; line-height: 1.45; text-shadow: none; }

/* Closing call to action */
.closer { background: var(--sheet); border-bottom: 2px solid var(--ink); }
.closer h2 { max-width: 40rem; }
.closer p { max-width: 34rem; margin: 1.25rem 0 2rem; }

/* Footer */
.site-foot { padding-block: 2.5rem; font-size: 0.95rem; color: var(--ink-soft); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; }
.foot nav { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.foot p { margin: 0; max-width: 34rem; }

@media (min-width: 960px) {
    .hero-grid { grid-template-columns: 5fr 7fr; gap: 3.5rem; }
    .scorecard { transform: rotate(-1.2deg); }
    .split { grid-template-columns: 4fr 7fr; gap: 4rem; }
    .rules div { grid-template-columns: 13rem 1fr; align-items: baseline; gap: 1.5rem; }
}
@media (max-width: 600px) {
    .inn-5, .inn-6 { display: none; }
    .inn { width: 3.1rem; height: 3.1rem; }
    .scorecard { box-shadow: 5px 5px 0 var(--ink); }
    .band { padding-block: 3.5rem; }
}


/* ---------- Flash messages ---------- */
.flash { margin: 1.25rem 0 0; padding: 0.85rem 1.1rem; border: 2px solid var(--ink); border-radius: 2px; background: var(--sheet); font-size: 1rem; }
.flash-success { border-left-width: 8px; border-left-color: #2f7d4f; }
.flash-error { border-left-width: 8px; border-left-color: var(--red); }

/* ---------- Page header for inner pages ---------- */
.page-head {
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--rule) 1px, transparent 1px),
        linear-gradient(90deg, var(--rule) 1px, transparent 1px);
    background-size: 28px 28px;
    background-position: -1px -1px;
    border-bottom: 2px solid var(--ink);
}
.page-head .bar { padding-bottom: 0.5rem; }
.page-head-body { padding-block: 2.5rem 3rem; }
.page-head h1 { font-size: clamp(2.8rem, 7vw, 4.8rem); max-width: 46rem; }
.page-lede { max-width: 38rem; font-size: 1.2rem; margin: 1.1rem 0 0; }

/* ---------- Documentation layout (guide) ---------- */
.doc { display: grid; gap: 2rem; padding-block: 3rem 5rem; }
.doc-nav h2 { font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 80; font-stretch: 80%; font-size: 1.3rem; margin: 0 0 0.6rem; }
.doc-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.doc-nav a { display: block; padding: 0.3rem 0; text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 1rem; border-bottom: 2px solid transparent; }
.doc-nav a:hover { border-bottom-color: var(--rule); }
.doc-nav a[aria-current="page"] { border-bottom-color: var(--red); color: var(--red-dark); font-weight: 800; }

.prose { max-width: 42rem; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-family: var(--display); font-weight: 850; font-variation-settings: "wdth" 72; font-stretch: 72%; font-size: clamp(1.9rem, 4vw, 2.5rem); line-height: 1; margin: 3rem 0 0.9rem; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 1.2rem; font-weight: 700; line-height: 1.3; margin: 1.75rem 0 0.4rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { margin: 0 0 1.25rem; padding-left: 1.4rem; }
.prose li { margin-bottom: 0.45rem; padding-left: 0.2rem; }
.prose li::marker { color: var(--red); }
.prose strong { font-weight: 650; }
.prose a { color: var(--red-dark); text-underline-offset: 3px; }
.prose a:hover { color: var(--ink); }
.prose code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.88em; background: var(--sheet); border: 1px solid var(--rule); padding: 0.05rem 0.35rem; border-radius: 2px; }

.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 0.98rem; background: var(--sheet); border: 2px solid var(--ink); }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.8rem; border: 1px solid var(--rule); vertical-align: top; }
.prose thead th { background: var(--paper); font-family: var(--display); font-weight: 700; font-size: 0.9rem; }

.note { margin: 1.5rem 0; padding: 1rem 1.2rem; background: var(--sheet); border: 2px solid var(--ink); border-left: 8px solid var(--red); border-radius: 2px; }
.note > :last-child { margin-bottom: 0; }
.note-title { font-family: var(--display); font-weight: 800; font-size: 1.05rem; margin: 0 0 0.3rem; }

.pager { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 3.5rem; padding-top: 1.25rem; border-top: 2px solid var(--ink); font-family: var(--display); font-weight: 700; }
.pager a { text-decoration: none; }
.pager a:hover { text-decoration: underline; text-underline-offset: 4px; }

.guide-index { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 2px solid var(--ink); }
.guide-index li { padding: 0; margin: 0; border-bottom: 1px solid var(--rule); }
.guide-index a { display: block; padding: 1rem 0; text-decoration: none; color: var(--ink); }
.guide-index a:hover .gi-title { color: var(--red-dark); text-decoration: underline; text-underline-offset: 4px; }
.gi-title { display: block; font-family: var(--display); font-weight: 800; font-variation-settings: "wdth" 80; font-stretch: 80%; font-size: 1.5rem; line-height: 1.15; }
.gi-desc { display: block; color: var(--ink-soft); margin-top: 0.15rem; }

@media (min-width: 960px) {
    .doc { grid-template-columns: 14rem minmax(0, 1fr); gap: 4rem; }
    .doc-nav { position: sticky; top: 1.5rem; align-self: start; }
    .doc-nav ul { display: block; }
    .doc-nav a { border-bottom: 0; border-left: 4px solid transparent; padding: 0.4rem 0 0.4rem 0.8rem; }
    .doc-nav a:hover { border-left-color: var(--rule); }
    .doc-nav a[aria-current="page"] { border-left-color: var(--red); }
}

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { left: 0.5rem; top: 0.5rem; }

.page-head-bar { border-bottom: 2px solid var(--ink); background: var(--paper); }

/* ---------- Docs tables: dark header, off-white body, light-blue hover ---------- */
.prose table { background: #f9fafb; border-color: #312e81; }
.prose thead th { background: #312e81; color: #ffffff; }
.prose tbody th { background: #f9fafb; }
.prose tbody tr:hover td, .prose tbody tr:hover th { background: #dbeafe; }
