/* Race page styles — /race/<slug>/ */
/* Does NOT duplicate: :root, .container, .grid, .card, .btn, .btn-primary,
   .btn-ghost, .sidebar, .side-head, responsive .grid/.sidebar */

/* ── Status pill ─────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--warn-bg);
  color: var(--warn);
}
.pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--warn);
}
.pill.success {
  background: rgba(2, 184, 117, .12);
  color: var(--success-dk);
}
.pill.success::before {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(2, 184, 117, .18);
}
.pill.muted {
  background: rgba(107, 119, 133, .1);
  color: var(--muted);
}
.pill.muted::before { background: var(--muted-2); }

/* ── Kicker label ────────────────────────────────────── */
.kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Shared race header and section navigation ───────── */
.race-hero {
  position: relative;
  min-height: 176px;
  overflow: hidden;
  color: #fff;
  background: #1d3a63 url("../images/backgrounds/header2024.5093c69e74f8.jpg") center / cover no-repeat;
}
.race-hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.race-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(15, 22, 31, .82) 0%, rgba(15, 22, 31, .58) 48%, rgba(15, 22, 31, .28) 100%);
}
.race-hero-inner {
  position: relative;
  z-index: 1;
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  padding-top: 22px;
  padding-bottom: 24px;
}
.race-hero-copy { min-width: 0; }
.race-hero .pill {
  margin-bottom: 11px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}
.race-hero h1 {
  max-width: 760px;
  color: #fff;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.015em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .3);
}
.race-hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 9px;
  color: rgba(255, 255, 255, .88);
  font-size: 13.5px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .28);
}
.meta-sep {
  width: 3px;
  height: 3px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}
.race-hero-actions { align-self: end; }
.race-hero-actions .btn {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.race-page { padding: 20px 0 56px; }

/* ── Overview layout ─────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas:
    "news summary"
    "news secondary";
  /* Keep a tall news feed from adding empty space below the summary. */
  grid-template-rows: max-content 1fr;
  gap: 0 16px;
  align-items: start;
}
.overview-news { grid-area: news; min-width: 0; }
.overview-summary { grid-area: summary; }
.overview-secondary { grid-area: secondary; }

/* ── Signed-in user's teams ──────────────────────────── */
.owned-teams-card { margin-bottom: 16px; overflow: hidden; }
.owned-teams-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 22px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.owned-teams-head h2,
.owned-teams-empty h2 {
  margin-top: 3px;
  font-size: 19px;
  font-weight: 600;
}
.owned-teams-count {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #e7eef7;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}
.owned-team-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 15px 22px;
  border-top: 1px solid var(--line-soft);
}
.owned-team-row:first-child { border-top: 0; }
.owned-team-number {
  min-width: 54px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #eef1f5;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.owned-team-copy { min-width: 0; }
.owned-team-copy h3 {
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 600;
}
.owned-team-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
}
.owned-team-locked {
  display: inline-block;
  margin-top: 5px;
  color: var(--warn);
  font-size: 12px;
  font-weight: 500;
}
.owned-teams-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
}
.owned-teams-empty p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* ── Outline button (not in theme-2.css) ─────────────── */
.btn-outline {
  background: var(--paper-2);
  color: var(--ink);
  border-color: var(--line);
}
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }

/* ── Sidebar: admin management panel («Управление», can_edit_race) ──
   Shared by race_page.html and teams.html (both load race.css). */
.card-admin {
  border-color: #c5d6f3;
  box-shadow: 0 1px 2px rgba(69, 130, 236, .08),
              0 8px 24px rgba(69, 130, 236, .06);
}
.card-admin .side-head h3 { color: var(--primary); }
.card-admin .side-head h3::before {
  content: "";
  display: inline-block; width: 7px; height: 7px;
  margin-right: 8px; border-radius: 50%;
  background: var(--primary-2); vertical-align: middle;
}
.admin-actions {
  display: flex; flex-direction: column; gap: 8px;
  padding-top: 12px;
}
.admin-actions .btn { width: 100%; justify-content: center; }

/* ── Tabs card ───────────────────────────────────────── */
.tabs-card { padding-bottom: 6px; }
.tabs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
}
.tabs-head h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.tabs-head .badge {
  font-size: 12px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.tab-body { padding: 22px 22px 20px; }

/* ── News posts ──────────────────────────────────────── */
.post {
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.post:first-child { padding-top: 4px; }
.post:last-child { border-bottom: none; padding-bottom: 4px; }
.post-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.post-meta time { font-variant-numeric: tabular-nums; }
.post-title {
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.25;
  margin-bottom: 8px;
}
.post-body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.post-body p { margin: 0 0 8px; }
.post-body p:last-child { margin-bottom: 0; }
.post-foot {
  display: flex; align-items: center; gap: 18px;
  font-size: 13px;
  color: var(--muted);
}
.post-image {
  margin: 0 0 12px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper);
  border: 1px solid var(--line);
}
.post-image img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.post-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
  font-size: 14px;
}

/* ── Admin: add post form card ───────────────────────── */
.post-add-card { margin-bottom: 16px; }
.post-add-card .card-pad { padding: 20px 22px; }
.post-add-card .field-row {
  display: flex; flex-direction: column; gap: 10px;
  margin-bottom: 12px;
}
.post-add-card label {
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
}

/* ── Sidebar: info list ──────────────────────────────── */
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
  align-items: center;
}
.info-list li:first-child { border-top: none; padding-top: 0; }
.info-list li:last-child { padding-bottom: 0; }
.info-list .icon { width: 20px; height: 20px; color: var(--muted); flex-shrink: 0; }
.info-list .label { color: var(--muted); }
.info-list .value {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Sidebar: info card / category CTA ───────────────── */
.info-card-pad { padding-top: 6px; }
.category-cta { padding: 4px 16px 16px; }
.category-cta .btn { width: 100%; justify-content: center; }

/* ── Sidebar: nav-style menu ─────────────────────────── */
.side-menu { list-style: none; padding: 8px 12px 12px; margin: 0; }
.side-menu li a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14px;
  transition: background .12s;
}
.side-menu li a:hover { background: #f4f6f9; color: var(--ink); }
.side-menu li a .icon { color: var(--muted); width: 18px; height: 18px; flex-shrink: 0; }
.side-menu li a .badge {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* ── Sidebar: categories list ────────────────────────── */
/* Short label prominent, full name dim/truncated, then two clearly-labelled
   stats («N команд · M участников») and a separate «осталось K из L / мест
   нет» line — teams and participants never share a unit. */
.cats-menu {
  list-style: none;
  padding: 8px 12px 12px;
  margin: 0;
}
.cats-menu li a {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  transition: background .12s;
}
.cats-menu li a:hover { background: #f4f6f9; }
.cat-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13.5px;
  margin-bottom: 3px;
}
.cat-nm { color: var(--ink); font-weight: 500; flex: 0 0 auto; }
/* Full category name — unobtrusive: dim, smaller, truncated if it doesn't fit
   (hover shows the full text via title). */
.cat-full {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted-2);
  font-weight: 400;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Stat line: «12 команд · 48 участников». Numbers are emphasised, the unit
   words stay muted so the eye never confuses one count for the other. */
.cat-stats {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12.5px;
  color: var(--muted);
}
.cat-stat b {
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.cat-sep { color: var(--muted-2); }
.cat-remaining {
  margin-top: 3px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.cat-remaining.ok { color: var(--primary-2); }
.cat-remaining.none { color: #c0392b; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 920px) {
  .overview-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas:
      "summary"
      "news"
      "secondary";
  }
}
@media (max-width: 720px) {
  .race-hero,
  .race-hero-inner { min-height: 152px; }
  .race-hero-inner {
    grid-template-columns: 1fr;
    gap: 13px;
    padding-top: 18px;
    padding-bottom: 18px;
  }
  .race-hero h1 { font-size: 25px; }
  .race-hero .pill { margin-bottom: 8px; }
  .race-hero-actions { justify-self: start; }
  .owned-team-row { grid-template-columns: auto minmax(0, 1fr); }
  .owned-team-row .btn { grid-column: 2; justify-self: start; }
}
@media (max-width: 600px) {
  .race-page { padding: 12px 0 36px; }
  .race-hero,
  .race-hero-inner { min-height: 144px; }
  .race-hero-shade {
    background: linear-gradient(90deg, rgba(15, 22, 31, .84), rgba(15, 22, 31, .5));
  }
  .race-hero h1 { font-size: 22px; }
  .race-hero-meta { gap: 7px; margin-top: 7px; font-size: 12.5px; }
  .race-hero .pill { padding: 4px 10px; font-size: 12px; }
  .race-hero-actions,
  .race-hero-actions .btn { width: 100%; }
  .owned-teams-head { padding: 15px 16px 12px; }
  .owned-team-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 15px 16px 17px;
  }
  .owned-team-number { justify-self: start; }
  .owned-team-row .btn { grid-column: 1; width: 100%; }
  .owned-teams-empty {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
    padding: 18px 16px;
  }
  .owned-teams-empty .btn { width: 100%; }
  .tab-body { padding: 16px 16px 18px; }
  .post-title { font-size: 17px; }
  .post-body { font-size: 14.5px; }
  .info-list li { grid-template-columns: 22px 1fr auto; gap: 10px; font-size: 14px; }
}
