/* ============================================================
   Олимпиады 2026/27 — стили
   Тема: data-theme="dark" (по умолчанию) | "light"
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #0e0e0e;
  --bg-hover: #171717;
  --bg-inset: #000000;
  --text: #ffffff;
  --text-2: #a3a3a3;
  --text-3: #6b6b6b;
  --accent: #ffd60a;            /* жёлтый акцент */
  --accent-ink: #000000;        /* текст на жёлтом */
  --accent-dim: rgba(255, 214, 10, 0.08);
  --border: #1f1f1f;
  --border-2: #2e2e2e;
  --th-bg: #0a0a0a;
  --row-alt: #0a0a0a;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --date-past: #fb7185;         /* розовый для прошедших дат */
  --date-future: #4ade80;       /* светло-зелёный для будущих дат */
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f6f5f2;                /* тёплая бумага */
  --bg-elev: #ffffff;
  --bg-hover: #f0eee8;
  --bg-inset: #efede7;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --accent: #b45309;            /* глубокий янтарный */
  --accent-ink: #ffffff;
  --accent-dim: rgba(180, 83, 9, 0.08);
  --border: #e5e2db;
  --border-2: #d6d2c8;
  --th-bg: #efede7;
  --row-alt: #faf9f6;
  --shadow: 0 8px 30px rgba(28, 25, 23, 0.10);
  --date-past: #dc2626;         /* красный для прошедших дат */
  --date-future: #16a34a;       /* зелёный для будущих дат */
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; }

/* ---------- Кнопка темы (правый верхний угол) ---------- */

#themeToggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border-2);
  background: var(--bg-elev);
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, transform 0.15s;
}

#themeToggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

/* ---------- Шапка ---------- */

.hero {
  padding: 72px 24px 44px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(1200px 300px at 70% -60px, var(--accent-dim), transparent 70%),
    var(--bg);
}

.hero-inner {
  max-width: none;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  /* одна строка на всю ширину; перенос — только если экран уже текста */
}

.hero-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-left { max-width: 760px; }

/* ---------- Часы в шапке ---------- */

.hero-clock {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.clock-date {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 2px;
}

.clock-time {
  font-family: var(--mono);
  font-size: clamp(30px, 3.2vw, 44px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.clock-time .sec { color: var(--accent); }

.kicker {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hero h1 .accent { color: var(--accent); }

.subtitle { margin: 0 0 22px; max-width: 760px; color: var(--text-2); font-size: 16px; }
.subtitle strong { color: var(--text); }

.meta-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--bg-elev);
}

/* ---------- Контент ---------- */

.page { max-width: none; margin: 0 auto; padding: 12px 28px 64px; }

.section { margin-top: 44px; }

.section > h2 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section > h2::before {
  content: "";
  width: 4px;
  height: 20px;
  border-radius: 2px;
  background: var(--accent);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-head h2 { margin: 0; }

/* ---------- Фильтры ---------- */

.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--bg-elev);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip-btn .cb {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--text-3);
  display: inline-block;
  transition: all 0.15s;
}

.chip-btn:hover { border-color: var(--accent); color: var(--text); }

.chip-btn.is-active { color: var(--text); border-color: var(--accent); }
.chip-btn.is-active .cb { background: var(--accent); border-color: var(--accent); position: relative; }
.chip-btn.is-active .cb::after {
  content: "";
  position: absolute;
  left: 3.5px;
  top: 0.5px;
  width: 4px;
  height: 8px;
  border: solid var(--accent-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border-2);
  border-radius: 11px;
  background: var(--bg-elev);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.seg-btn:hover { color: var(--text); }

.seg-btn.is-active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

html[data-theme="light"] .seg-btn.is-active { color: #fff; }

/* ---------- Таблицы ---------- */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--th-bg);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }

/* Узкие колонки не переносятся и занимают минимум места */
.col-date, .col-level, .col-stage, .col-format { white-space: nowrap; }

/* Широкие колонки делят остаток */
.col-note { min-width: 260px; }
.col-name { min-width: 170px; max-width: 300px; }
.col-link { max-width: 220px; }

tbody tr { transition: background-color 0.1s; }

tbody tr:hover { background: var(--bg-hover); }

/* Статусные строки */
tr.row-done { opacity: 0.55; }
tr.row-done .cell-date, tr.row-done .cell-name { text-decoration: line-through; text-decoration-color: var(--text-3); text-decoration-thickness: 1px; }

tr.row-active {
  background: var(--accent-dim);
  box-shadow: inset 3px 0 0 var(--accent);
}

tr.row-active:hover { background: var(--accent-dim); filter: brightness(1.25); }

/* Разделитель месяцев: жёлтый заголовок + горизонтальная линия на всю ширину */
tr.month-row td {
  position: relative;
  padding: 16px 14px 11px;
  border-bottom: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-inset);
}

tr.month-row td::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent) 45%, transparent) 50%,
    transparent 88%);
}

/* ---------- Ячейки ---------- */

.cell-date { font-weight: 600; }

/* Цвет дат: прошедшие — красные/розовые, будущие — зелёные (классы ставит JS по дате браузера) */
.cell-date.date-past { color: var(--date-past); }
.cell-date.date-future { color: var(--date-future); }
.cell-date.date-past .date-end,
.cell-date.date-future .date-end { color: inherit; opacity: 0.7; }

.cell-date .date-end {
  display: block;
  font-weight: 400;
  color: var(--text-3);
  font-size: 12.5px;
  margin-top: 1px;
}

.cell-date .date-end::before { content: "→ "; color: var(--text-3); }

.cell-name { font-weight: 600; }

.cell-level { white-space: nowrap; color: var(--text-2); }

.cell-stage { white-space: nowrap; color: var(--text-2); }

.cell-format { white-space: nowrap; color: var(--text-2); }

.cell-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.cell-link a {
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px dashed var(--text-3);
  padding-bottom: 1px;
  transition: all 0.15s;
}

.cell-link a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.cell-note { color: var(--text-2); font-size: 13.5px; }

.cell-note a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); }
.cell-note a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.cell-note strong { color: var(--text); }

/* Эмодзи с хинтом */
[data-emoji] {
  cursor: help;
  border-bottom: 1px dotted transparent;
}

/* Подпись под таблицей */
.table-foot {
  margin: 10px 4px 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.table-foot .foot-past { color: var(--date-past); }
.table-foot .foot-future { color: var(--date-future); }

/* ---------- Сводка ---------- */

#summary .cell-qual, #summary .cell-final { white-space: nowrap; color: var(--text-2); }

/* ---------- О данных ---------- */

.about ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.about li {
  color: var(--text-2);
  font-size: 13.5px;
  padding-left: 18px;
  position: relative;
}

.about li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
}

.about strong { color: var(--text); }

/* ---------- Футер ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 22px 24px 30px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}

/* ---------- Тултип ---------- */

#tooltip {
  position: fixed;
  z-index: 100;
  max-width: 340px;
  padding: 8px 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

#tooltip.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Мобильная версия (не приоритет) ---------- */

@media (max-width: 900px) {
  .hero { padding: 64px 16px 32px; }
  .page { padding: 8px 10px 48px; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .cell-note, .col-note { width: auto; min-width: 200px; }
  .about { padding: 0 4px; }
}
