/* ============================================================
   МОТОЖЭПЭ ГАЙД — общий стиль
   Эстетика: пит-борд (чёрная доска + жёлтые плашки),
   асфальт, поребрики, цвета пяти производителей.
   ============================================================ */

:root {
  /* база */
  --asphalt-50: #f3f4f6;
  --asphalt-100: #e8eaee;
  --asphalt-200: #d6d9df;
  --asphalt-700: #2a2d33;
  --asphalt-900: #131418;
  --board: #16171c;          /* доска пит-борда */
  --plate: #ffd400;          /* жёлтая плашка */
  --plate-ink: #16171c;
  --ink: #1b1d22;
  --muted: #5d626c;
  --paper: #ffffff;
  --kerb-red: #d22b2b;

  /* производители */
  --ducati: #d50000;
  --ktm: #ff6d00;
  --aprilia: #a0006d;
  --yamaha: #1240ab;
  --honda: #00843d;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(19, 20, 24, 0.10);
  --shadow-sm: 0 4px 14px rgba(19, 20, 24, 0.08);

  --font-display: "Unbounded", "Arial Black", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;

  --lean: -1.2deg; /* «угол наклона» — фирменный наклон плашек */
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--asphalt-50);
}

img { max-width: 100%; display: block; }

a { color: inherit; }

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

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}

/* ---------- поребрик-разделитель ---------- */
.kerb {
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    var(--kerb-red) 0 18px,
    #ffffff 18px 36px
  );
  border: 0;
  margin: 0;
}

/* ---------- шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--board);
  color: #fff;
  border-bottom: 3px solid var(--plate);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo__plate {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  background: var(--plate);
  color: var(--plate-ink);
  padding: 6px 10px;
  border-radius: 6px;
  transform: rotate(var(--lean));
}

.logo__sub {
  font-family: var(--font-hand);
  font-size: 19px;
  color: #cfd3da;
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  color: #e8eaee;
  padding: 8px 14px;
  border-radius: 8px;
}

.site-nav a:hover { background: rgba(255, 255, 255, 0.08); }

.site-nav a[aria-current="page"] {
  background: var(--plate);
  color: var(--plate-ink);
}

.nav-toggle { display: none; }

/* ---------- герой ---------- */
.hero {
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(255, 212, 0, 0.14), transparent 60%),
    var(--board);
  color: #fff;
  padding: 64px 0 56px;
}

.hero--page { padding: 44px 0 36px; }

.hero__eyebrow {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--plate);
  margin-bottom: 14px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1.08;
  margin: 0 0 18px;
  text-transform: uppercase;
  max-width: 20ch;
}

.hero h1 .plate-word {
  display: inline-block;
  background: var(--plate);
  color: var(--plate-ink);
  padding: 2px 14px;
  border-radius: 10px;
  transform: rotate(var(--lean));
}

.hero p.lead {
  max-width: 62ch;
  font-size: 18px;
  color: #d5d8de;
  margin: 0;
}

.hero .hand { color: #b9bec7; }

/* ---------- рукописные ремарки автора ---------- */
.hand {
  font-family: var(--font-hand);
  font-size: 21px;
  line-height: 1.35;
  color: var(--muted);
}

.hand--note {
  display: block;
  margin-top: 10px;
}

/* ---------- секции ---------- */
.section { padding: 52px 0; }

.section--alt { background: var(--asphalt-100); }

.section__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(22px, 3.2vw, 32px);
  text-transform: uppercase;
  line-height: 1.15;
  margin: 0 0 10px;
  position: relative;
  padding-left: 18px;
}

.section__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 8px;
  border-radius: 4px;
  background: var(--plate);
  transform: rotate(var(--lean));
}

.section__kicker {
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--muted);
  margin: 0 0 6px;
}

.section > .container > p,
.prose p { max-width: 72ch; }

/* ---------- списки фактов ---------- */
.facts {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.facts li {
  position: relative;
  padding-left: 26px;
}

.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 14px;
  height: 9px;
  border-radius: 3px;
  background: var(--board);
  border-left: 5px solid var(--plate);
}

/* ---------- карточки-разделы на главной ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 30px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--paper);
  border-radius: var(--radius);
  padding: 24px 22px 22px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  border-top: 6px solid var(--plate);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tile:hover {
  transform: translateY(-4px) rotate(-0.4deg);
  box-shadow: var(--shadow);
}

.tile__num {
  align-self: flex-start;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  background: var(--board);
  color: var(--plate);
  padding: 5px 10px;
  border-radius: 6px;
  letter-spacing: 0.06em;
}

.tile h3 {
  font-family: var(--font-display);
  font-size: 21px;
  text-transform: uppercase;
  margin: 2px 0 0;
}

.tile p { margin: 0; color: var(--muted); font-size: 15.5px; }

.tile__cta {
  margin-top: auto;
  font-weight: 700;
  font-size: 15px;
}

/* ---------- заглушки картинок ----------
   Схема: <figure class="ph"><img src="img/..." onerror="this.remove()">
   <figcaption>подпись + размер</figcaption></figure>
   Пока файла нет — видна разлинованная заглушка с подписью.
   Файл появился по нужному пути — картинка закрывает заглушку. */
.ph {
  position: relative;
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    linear-gradient(rgba(22, 23, 28, 0.03), rgba(22, 23, 28, 0.03)),
    repeating-linear-gradient(-45deg, transparent 0 14px, rgba(22, 23, 28, 0.06) 14px 28px),
    var(--asphalt-100);
  border: 2px dashed var(--asphalt-200);
  display: grid;
  place-items: center;
}

.ph img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

.ph figcaption {
  z-index: 1;
  text-align: center;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.ph figcaption strong {
  display: block;
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--asphalt-700);
}

.ph--rider { aspect-ratio: 4 / 5; }
.ph--emblem { aspect-ratio: 1 / 1; width: 132px; flex: 0 0 132px; }
.ph--make { aspect-ratio: 1 / 1; width: 72px; flex: 0 0 72px; border-radius: 50%; }
.ph--wide { aspect-ratio: 16 / 9; max-width: 560px; }

/* ---------- страница правил ---------- */
.rules-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 40px;
  align-items: start;
  padding: 44px 0 60px;
}

.toc {
  position: sticky;
  top: 84px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 16px;
}

.toc h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  margin: 0 0 10px;
  letter-spacing: 0.05em;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.toc a {
  display: block;
  text-decoration: none;
  font-size: 14.5px;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 3px solid transparent;
}

.toc a:hover {
  color: var(--ink);
  background: var(--asphalt-100);
  border-left-color: var(--plate);
}

.rule-block {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px 28px 26px;
  margin-bottom: 26px;
  scroll-margin-top: 90px;
}

.rule-block h2 {
  font-family: var(--font-display);
  font-size: 22px;
  text-transform: uppercase;
  margin: 0 0 4px;
  position: relative;
  padding-left: 16px;
}

.rule-block h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.16em;
  bottom: 0.16em;
  width: 7px;
  border-radius: 4px;
  background: var(--plate);
  transform: rotate(var(--lean));
}

.rule-block h3 {
  font-family: var(--font-display);
  font-size: 16px;
  text-transform: uppercase;
  margin: 22px 0 8px;
}

/* таблицы очков в виде пит-борда */
.points-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 18px;
}

.board-table {
  background: var(--board);
  color: #f2f3f5;
  border-radius: var(--radius-sm);
  padding: 16px 18px 14px;
}

.board-table h3 {
  font-family: var(--font-display);
  color: var(--plate);
  font-size: 15px;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.board-table td {
  padding: 5px 4px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: 15px;
}

.board-table tr:last-child td { border-bottom: 0; }

.board-table td:last-child {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--plate);
}

/* флаги */
.flag-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.flag-list li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
}

.flag {
  width: 56px;
  height: 38px;
  border-radius: 5px;
  border: 1px solid rgba(19, 20, 24, 0.18);
  box-shadow: var(--shadow-sm);
  margin-top: 3px;
}

.flag--yellow { background: #ffd400; }
.flag--red { background: #d22b2b; }
.flag--blue { background: #3d8bfd; }
.flag--yellowred {
  background: repeating-linear-gradient(90deg, #ffd400 0 8px, #d22b2b 8px 16px);
}
.flag--blackorange {
  background: #16171c;
  position: relative;
}
.flag--blackorange::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff6d00;
}
.flag--whitecross {
  background: #fff;
  position: relative;
}
.flag--whitecross::before,
.flag--whitecross::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: #d22b2b;
}
.flag--whitecross::before { width: 6px; height: 26px; }
.flag--whitecross::after { width: 26px; height: 6px; }
.flag--white { background: #fff; }

/* колонки «что делать, если ты пилот» */
.dos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 16px;
}

.dos__col {
  background: var(--asphalt-100);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.dos__col h3 { margin-top: 0; }

/* ---------- команды ---------- */
.make-section {
  padding: 40px 0 8px;
  scroll-margin-top: 80px;
}

.make-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.make-head h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 3.4vw, 34px);
  text-transform: uppercase;
  margin: 0;
  color: var(--make-color, var(--ink));
}

.make-head .hand { margin: 0; }

.team-card {
  --team-color: var(--asphalt-700);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
  scroll-margin-top: 90px;
}

.team-card.is-target {
  outline: 3px solid var(--plate);
  outline-offset: 3px;
}

.team-card__stripe {
  height: 10px;
  background: linear-gradient(90deg, var(--team-color) 0 70%, var(--board) 70% 100%);
}

.team-card__body {
  display: flex;
  gap: 22px;
  padding: 22px 24px 20px;
}

.team-card__info { flex: 1; }

.team-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  margin: 0 0 6px;
}

.team-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.badge {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--asphalt-100);
  color: var(--asphalt-700);
}

.badge--factory { background: var(--board); color: var(--plate); }
.badge--satellite { background: var(--asphalt-100); }

.team-card__riders {
  border-top: 1px dashed var(--asphalt-200);
  padding: 14px 24px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.team-card__riders span.label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 4px;
}

/* чип гонщика */
.rider-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: var(--asphalt-100);
  border-radius: 999px;
  padding: 4px 14px 4px 4px;
  font-weight: 600;
  font-size: 15px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.rider-chip:hover {
  background: var(--plate);
  transform: rotate(var(--lean));
}

.rider-chip__num {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--board);
  color: var(--plate);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}

/* ---------- гонщики ---------- */
.grid-index {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.riders-team {
  padding: 34px 0 6px;
  scroll-margin-top: 80px;
}

.riders-team__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  border-left: 10px solid var(--team-color, var(--board));
  padding-left: 14px;
  margin-bottom: 20px;
  transform: rotate(-0.3deg);
}

.riders-team__head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
  margin: 0;
}

.riders-team__head a {
  font-size: 14.5px;
  color: var(--muted);
}

.rider-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.rider-card {
  --team-color: var(--asphalt-700);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
  scroll-margin-top: 86px;
  display: flex;
  flex-direction: column;
}

.rider-card.is-target {
  outline: 3px solid var(--plate);
  outline-offset: 3px;
}

.rider-card__top {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  padding: 20px 22px 14px;
  border-top: 8px solid var(--team-color);
}

.rider-card__id { display: flex; flex-direction: column; gap: 10px; }

.num-plate {
  align-self: flex-start;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  background: var(--plate);
  color: var(--plate-ink);
  border: 3px solid var(--board);
  border-radius: 10px;
  padding: 8px 12px;
  transform: rotate(var(--lean));
  box-shadow: 3px 3px 0 var(--board);
}

.rider-card__head h3 {
  font-family: var(--font-display);
  font-size: 19px;
  text-transform: uppercase;
  line-height: 1.25;
  margin: 0 0 8px;
}

.rider-card__team {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid var(--team-color);
}

.rider-card__team:hover { color: var(--ink); }

.rider-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  font-size: 12.5px;
  font-weight: 700;
  background: var(--asphalt-100);
  color: var(--asphalt-700);
  border-radius: 6px;
  padding: 3px 9px;
}

.tag--champ { background: var(--board); color: var(--plate); }
.tag--academy { background: #fff3bf; }

.rider-card__facts { padding: 4px 22px 22px; }

.rider-card__facts .facts { gap: 8px; font-size: 15.5px; }

/* ---------- широкие вставки-истории ---------- */
.story {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 26px;
  align-items: start;
}

.story h2 {
  font-family: var(--font-display);
  font-size: 21px;
  text-transform: uppercase;
  margin: 0 0 6px;
}

/* ---------- подвал ---------- */
.site-footer {
  background: var(--board);
  color: #cfd3da;
  padding: 40px 0 30px;
  margin-top: 40px;
}

.site-footer .hand { color: var(--plate); font-size: 24px; margin: 0 0 8px; }

.site-footer p { margin: 6px 0; font-size: 15px; max-width: 70ch; }

.site-footer a { color: #fff; }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 0;
}

.pager a {
  text-decoration: none;
  font-weight: 700;
  background: var(--paper);
  border-radius: 10px;
  padding: 12px 18px;
  box-shadow: var(--shadow-sm);
}

.pager a:hover { background: var(--plate); }

/* ---------- доступность и мелочи ---------- */
:focus-visible {
  outline: 3px solid var(--plate);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--plate);
  color: var(--plate-ink);
  padding: 10px 16px;
  z-index: 100;
  font-weight: 700;
}

.skip-link:focus { left: 12px; top: 12px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile, .rider-chip { transition: none; }
}

/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr; }
  .rules-layout { grid-template-columns: 1fr; }
  .toc { position: static; }
  .points-grid, .dos, .rider-pair { grid-template-columns: 1fr; }
  .story { grid-template-columns: 1fr; }
  .team-card__body { flex-direction: column; }
  .ph--emblem { width: 150px; }
}

@media (max-width: 720px) {
  .site-header__inner { flex-wrap: wrap; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    padding: 7px 12px;
    font: 700 14px var(--font-body);
    cursor: pointer;
  }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    padding-bottom: 10px;
  }
  .site-nav.is-open { display: flex; }
  .rider-card__top { grid-template-columns: 1fr; }
  .ph--rider { max-width: 260px; }
}
