/* Baltic design — loaded after styles.css when site.json has "design": "baltic".
   Set "design": "classic" (or remove the key) to roll back to the original look.

   Palette
   ─────────────────────────────────────────────────────────────────────────
   Deep sea      #0d1b2a  header, buttons, dark-theme background
   Steel blue    #2c4257  muted text, table rules
   Fog           #8fa3b0  secondary text, draw dots
   Amber         #d99a2b  eyebrows, chart line, link underlines
   Amber (text)  #b87d18  amber for text on light backgrounds — 4.6:1 on white
   Amber light   #f0c069  accent in the dark theme, mark in the logo
   Brick         #7d3b2e  losses, dividers, history

   Fonts: Playfair Display (SIL OFL 1.1, see assets/fonts/OFL-PlayfairDisplay.txt),
   self-hosted — no CDN. */

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/assets/fonts/playfair-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --sea: #0d1b2a;
  --steel: #2c4257;
  --fog: #8fa3b0;
  --amber: #d99a2b;
  --amber-text: #b87d18;
  --amber-light: #f0c069;
  --brick: #7d3b2e;
  --font-display: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;

  --bg: #eef1f4;
  --bg-soft: #f7f8f9;
  --bg-tint: rgba(44, 66, 87, 0.07);
  --bg-gradient:
    radial-gradient(circle at top right, rgba(217, 154, 43, 0.14), transparent 30rem),
    linear-gradient(180deg, #f3f5f7 0%, #e9edf1 55%, #eef1f4 100%);
  --header-bg: rgba(238, 241, 244, 0.88);
  --card-bg: rgba(250, 251, 252, 0.92);
  --ink: #0d1b2a;
  --ink-soft: #2c4257;
  --muted: #5d7080;
  --blue: var(--steel);
  --blue-dark: var(--sea);
  --accent-ink: #fbf6ec;
  --line: rgba(44, 66, 87, 0.16);
  --shadow: 0 22px 60px rgba(13, 27, 42, 0.12);
  --shadow-soft: 0 14px 40px rgba(13, 27, 42, 0.1);
  --surface: var(--card-bg);
  --accent: var(--amber-text);
  --radius: 20px;
  /* brick pattern: two courses of 60×24 bricks, joints offset by half a brick */
  --brick-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='48' viewBox='0 0 60 48'%3E%3Cpath d='M0 .5h60M0 24.5h60M0 48.5h60M.5 0v24M30.5 24v24' fill='none' stroke='%237d3b2e' stroke-opacity='.55'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --bg: #08121c;
  --bg-soft: #0d1b2a;
  --bg-tint: rgba(240, 192, 105, 0.07);
  --bg-gradient:
    radial-gradient(circle at top right, rgba(240, 192, 105, 0.1), transparent 28rem),
    linear-gradient(180deg, #08121c 0%, #0b1826 60%, #08121c 100%);
  --header-bg: rgba(8, 18, 28, 0.86);
  --card-bg: rgba(16, 32, 47, 0.92);
  --ink: #e8eef3;
  --ink-soft: #c3cfd9;
  --muted: var(--fog);
  --blue: var(--amber-light);
  --blue-dark: #16283a;
  --amber: var(--amber-light);
  --amber-text: var(--amber-light);
  --accent-ink: #fbf6ec;
  --line: rgba(143, 163, 176, 0.22);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.4);
  --accent: var(--amber-light);
  --brick-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='48' viewBox='0 0 60 48'%3E%3Cpath d='M0 .5h60M0 24.5h60M0 48.5h60M.5 0v24M30.5 24v24' fill='none' stroke='%23b0654f' stroke-opacity='.5'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #08121c;
    --bg-soft: #0d1b2a;
    --bg-tint: rgba(240, 192, 105, 0.07);
    --bg-gradient:
      radial-gradient(circle at top right, rgba(240, 192, 105, 0.1), transparent 28rem),
      linear-gradient(180deg, #08121c 0%, #0b1826 60%, #08121c 100%);
    --header-bg: rgba(8, 18, 28, 0.86);
    --card-bg: rgba(16, 32, 47, 0.92);
    --ink: #e8eef3;
    --ink-soft: #c3cfd9;
    --muted: var(--fog);
    --blue: var(--amber-light);
    --blue-dark: #16283a;
    --amber: var(--amber-light);
    --amber-text: var(--amber-light);
    --accent-ink: #fbf6ec;
    --line: rgba(143, 163, 176, 0.22);
    --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 14px 40px rgba(0, 0, 0, 0.4);
    --accent: var(--amber-light);
    --brick-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='48' viewBox='0 0 60 48'%3E%3Cpath d='M0 .5h60M0 24.5h60M0 48.5h60M.5 0v24M30.5 24v24' fill='none' stroke='%23b0654f' stroke-opacity='.5'/%3E%3C/svg%3E");
  }
}

/* ── Typography ─────────────────────────────────────────────────────────── */

h1,
h2,
.lead-card-body h2,
.rubric-card h3,
.rubric-card h2,
.article-card h3,
.player-head h1,
.opp-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.012em;
  text-wrap: balance;
  hyphens: auto;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(2.3rem, 4.6vw, 4.2rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.9rem);
  line-height: 1.08;
}

h3 {
  letter-spacing: -0.01em;
}

.article-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.article-body blockquote {
  border-left: 3px solid var(--amber);
  font-family: var(--font-display);
  font-style: italic;
}

.eyebrow,
.card-source,
.tl-pts {
  color: var(--amber-text);
}

.eyebrow {
  letter-spacing: 0.16em;
  font-weight: 800;
}

.text-link,
.site-nav a,
.site-footer a,
.article-body a {
  text-decoration-color: var(--amber);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration-color: var(--amber);
  text-decoration-thickness: 3px;
}

/* ── Header, logo, buttons ───────────────────────────────────────────────── */

.brand-mark {
  background: var(--sea);
  color: var(--amber-light);
  border-radius: 12px;
  box-shadow: inset 0 -4px 0 rgba(240, 192, 105, 0.3);
}

.button {
  border-color: var(--sea);
  background: var(--sea);
  color: var(--accent-ink);
  box-shadow: 0 12px 28px rgba(13, 27, 42, 0.22);
}

.button:hover,
.button:focus-visible {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--sea);
}

.button-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.button-ghost:hover,
.button-ghost:focus-visible {
  background: transparent;
  color: var(--ink);
  border-color: var(--amber);
}

:root[data-theme="dark"] .button:not(.button-ghost) {
  background: var(--amber-light);
  border-color: var(--amber-light);
  color: var(--sea);
}

:root[data-theme="dark"] .button:not(.button-ghost):hover {
  background: var(--accent-ink);
  border-color: var(--accent-ink);
}

/* ── Cards: amber notch that grows along the top edge, cool veil on covers ── */

.lead-card,
.article-card,
.match-card,
.cta-box,
.rubric-card,
.opp-card,
.tg-post,
.tg-channel,
.facts {
  border-radius: var(--radius);
}

.article-card,
.rubric-card,
.match-card,
.opp-card {
  position: relative;
  box-shadow: none;
}

.article-card::before,
.rubric-card::before,
.match-card::before,
.opp-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 22px;
  z-index: 2;
  width: 44px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--amber);
  transition: width 0.35s ease, left 0.35s ease;
}

.article-card:hover::before,
.rubric-card:hover::before,
.match-card:hover::before,
.opp-card:hover::before,
.article-card:focus-within::before,
.rubric-card:focus-within::before {
  left: 0;
  width: 100%;
  border-radius: 0;
}

.article-card:hover,
.rubric-card:hover {
  transform: none;
  border-color: rgba(217, 154, 43, 0.5);
  box-shadow: var(--shadow-soft);
}

.card-media,
.lead-media,
.article-figure {
  position: relative;
}

.card-media::after,
.lead-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(13, 27, 42, 0.04) 0%, rgba(13, 27, 42, 0.28) 100%);
  mix-blend-mode: multiply;
}

.card-media img,
.lead-media img {
  filter: saturate(0.86) contrast(1.03);
}

.lead-media {
  border-bottom: 4px solid var(--amber);
}

.card-badge {
  background: var(--amber);
  color: var(--sea);
}

/* ── Brick: a texture for tinted sections and a course above the footer ──── */

.section-tint {
  position: relative;
  background-color: var(--bg-soft);
}

.section-tint::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--brick-pattern);
  background-size: 60px 48px;
  opacity: 0.18;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}

.section-tint {
  isolation: isolate;
}

.site-footer {
  border-top: 0;
  padding-top: 40px;
}

.site-footer::before {
  content: "";
  display: block;
  height: 24px;
  margin: -40px 0 32px;
  background-color: var(--brick);
  background-image: var(--brick-pattern);
  background-size: 60px 48px;
  background-position: 0 -12px;
}

:root[data-theme="dark"] .site-footer::before {
  background-color: #4a2a22;
}

.article-body hr {
  height: 8px;
  border: 0;
  background-color: var(--brick);
  background-image: var(--brick-pattern);
  background-size: 60px 48px;
  opacity: 0.85;
}

/* ── Results, standings, chart, timeline: amber wins, fog draws, brick losses */

.form-w,
.tl-w .tl-dot,
.chart-dot.form-w { background: var(--amber); border-color: var(--amber); color: var(--sea); }
.form-d,
.tl-d .tl-dot,
.chart-dot.form-d { background: var(--fog); border-color: var(--fog); color: var(--sea); }
.form-l,
.tl-l .tl-dot,
.chart-dot.form-l { background: var(--brick); border-color: var(--brick); color: #fbf6ec; }

.chart-dot.form-w { fill: var(--amber); }
.chart-dot.form-d { fill: var(--fog); }
.chart-dot.form-l { fill: var(--brick); }
.chart-line { stroke: var(--amber); }
.chart-pace-0 { stroke: var(--fog); }
.chart-pace-1 { stroke: var(--brick); }
.chart-dot { stroke: var(--bg); }
.chart-swatch.chart-pace-0 { color: var(--fog); border-color: var(--fog); }
.chart-swatch.chart-pace-1 { color: var(--brick); border-color: var(--brick); }
.chart-swatch-line { border-top-color: var(--amber); }

.is-current .tl-dot { border-color: var(--amber); box-shadow: 0 0 0 5px rgba(217, 154, 43, 0.28), 0 0 18px rgba(217, 154, 43, 0.45); }
.tl-track::before { background: rgba(44, 66, 87, 0.25); }
:root[data-theme="dark"] .tl-track::before { background: rgba(143, 163, 176, 0.3); }

.standings-table tr.is-baltika td {
  background: transparent;
  font-weight: 700;
}

.standings-table tr.is-baltika td:first-child {
  box-shadow: inset 4px 0 0 var(--amber);
}

.standings-table th {
  color: var(--steel);
}

:root[data-theme="dark"] .standings-table th {
  color: var(--fog);
}

.scoreline strong {
  background: var(--sea);
  color: var(--amber-light);
  border-radius: 12px;
}

.chip[aria-pressed="true"],
.tag:hover {
  border-color: var(--amber);
}

/* ── Focus and motion ────────────────────────────────────────────────────── */

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }

  .article-card:hover,
  .rubric-card:hover,
  .button:hover {
    transform: none;
  }
}

/* ── Scoreboard: serif digits, bigger crests, the frame colour tells the result */

.scoreline {
  position: relative;
  gap: 10px 18px;
  margin: 22px 0;
  padding: 18px 16px 16px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card-bg) 70%, var(--bg) 30%);
}

.scoreline-w { border-color: var(--amber); box-shadow: inset 0 0 0 1px rgba(217, 154, 43, 0.35); }
.scoreline-l { border-color: var(--brick); box-shadow: inset 0 0 0 1px rgba(125, 59, 46, 0.3); }
.scoreline-d { border-color: var(--fog); }
.scoreline-upcoming { border-style: dashed; }

.scoreline strong {
  min-width: 5.2ch;
  padding: 8px 18px;
  border-radius: 12px;
  background: var(--sea);
  color: var(--amber-light);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums lining-nums;
}

.scoreline-upcoming strong {
  color: var(--fog);
  font-size: 1.8rem;
}

:root[data-theme="dark"] .scoreline strong {
  background: #04090f;
}

.scoreline .team {
  gap: 10px;
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.15;
}

/* Compact boards (match cards, article aside): crest above the name, so a
   name like «Крылья Советов» never runs under the score */
.match-card:not(.match-card-wide) .scoreline .team,
.article-match .scoreline .team {
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  text-align: center;
}

.match-card:not(.match-card-wide) .scoreline .team > span,
.article-match .scoreline .team > span {
  overflow-wrap: break-word;
}

.match-card:not(.match-card-wide) .scoreline strong,
.article-match .scoreline strong {
  min-width: 4ch;
  padding: 6px 10px;
  font-size: 1.85rem;
  letter-spacing: 0;
}

.scoreline .team .crest,
.match-card-wide .scoreline .team .crest { width: 44px; height: 44px; }

.match-card-wide .scoreline {
  max-width: none;
}

.match-card-wide .scoreline strong {
  font-size: 2.8rem;
}

/* one team over the other on narrow screens: a horizontal board always cramps there */
@media (max-width: 600px) {
  .scoreline,
  .match-card-wide .scoreline {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
  }

  .scoreline .team,
  .match-card-wide .scoreline .team:first-child,
  .match-card-wide .scoreline .team:last-child {
    flex-direction: row;
    justify-content: center;
  }

  .scoreline strong,
  .match-card-wide .scoreline strong {
    width: min(100%, 220px);
    font-size: 2.6rem;
  }
}

/* ── Covers as one system: category label in the corner, amber edge for full texts */

.card-media::before {
  content: attr(data-category);
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(13, 27, 42, 0.78);
  color: #fbf6ec;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
}

.card-media::after {
  background: linear-gradient(180deg, rgba(13, 27, 42, 0.12) 0%, rgba(13, 27, 42, 0.32) 100%);
}

.card-media img,
.lead-media img {
  filter: saturate(0.9) contrast(1.02);
}

.article-card.card-full {
  box-shadow: inset 3px 0 0 var(--amber);
}

.article-card.card-full::before {
  display: none;
}

/* ── Page rhythm: matches page alternates bands, articles get air ───────── */

:root {
  --bg-sunken: rgba(44, 66, 87, 0.06);
}

:root[data-theme="dark"] {
  --bg-sunken: rgba(0, 0, 0, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-sunken: rgba(0, 0, 0, 0.28);
  }
}

.page-matches > .section.container:nth-of-type(odd):not(:first-of-type) {
  padding-top: 56px;
  padding-bottom: 56px;
  background: var(--bg-sunken);
  box-shadow: 0 0 0 100vmax var(--bg-sunken);
  clip-path: inset(0 -100vmax);
}

.article-body {
  max-width: 68ch;
  font-size: 1.08rem;
  line-height: 1.68;
}

.article-body p {
  margin-bottom: 1.55em;
}

.article-body > p:first-of-type {
  font-size: 1.24rem;
  line-height: 1.5;
  color: var(--ink);
}

.article-body h2 {
  margin-top: 2.2em;
}

/* ── Type features: ligatures and old-style figures in serif headings, tabular in data */

h1,
h2,
.lead-card-body h2,
.rubric-card h3,
.rubric-card h2,
.article-body h2 {
  font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
}

.standings-table,
.tl-score,
.tl-pts,
.tl-round,
.facts dd,
.countdown,
.chart-tick {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Squad cards: sea-tinted stage under the cutouts, amber shirt numbers */
.squad-photo,
.player-photo img {
  background:
    radial-gradient(ellipse at 50% 100%, rgba(13, 27, 42, 0.28), transparent 70%),
    var(--bg-sunken);
}

.squad-num {
  font-family: "Playfair Display", Georgia, serif;
  color: var(--amber-text);
  text-shadow: none;
}

.squad-body h3 {
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 700;
}

.squad-stats dd {
  font-variant-numeric: tabular-nums lining-nums;
}
