/* Dodatki: motyw ciemny, animacje, pokaz zdjęć w hero, kalendarz, oś czasu, rekordy, media kit. */

/* ---------- Motyw ciemny ---------- */
[data-theme="dark"] {
  --ink: #070d0a; --paper: #0d1611; --card: #15221a; --text: #e6eee8; --muted: #9db0a4; --line: #243629; --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #070d0a; --paper: #0d1611; --card: #15221a; --text: #e6eee8; --muted: #9db0a4; --line: #243629; --shadow: 0 10px 30px rgba(0, 0, 0, .45); color-scheme: dark; }
  :root:not([data-theme="light"]) .achv.big li.hl { background: #1b2a14; }
  :root:not([data-theme="light"]) .tag, :root:not([data-theme="light"]) .team-card img { background: var(--card); }
  :root:not([data-theme="light"]) input, :root:not([data-theme="light"]) textarea, :root:not([data-theme="light"]) select { background: var(--card); color: var(--text); }
  :root:not([data-theme="light"]) .tbl tfoot th, :root:not([data-theme="light"]) .tbl tfoot td { background: #1a2a20; }
  :root:not([data-theme="light"]) .tile .num, :root:not([data-theme="light"]) .rec-time, :root:not([data-theme="light"]) .facts b, :root:not([data-theme="light"]) .achv.big strong, :root:not([data-theme="light"]) .facts-box dd, :root:not([data-theme="light"]) .cat .big { color: var(--lime); }
  :root:not([data-theme="light"]) .more { color: var(--lime); }
  :root:not([data-theme="light"]) .btn.ghost.dark { color: var(--text); border-color: var(--text); }
  :root:not([data-theme="light"]) .btn.ghost.dark:hover { background: var(--text); color: var(--ink); }
  :root:not([data-theme="light"]) .cal-date { background: #1d4a31; }
  :root:not([data-theme="light"]) .next-race { background: linear-gradient(120deg, #123021, #1d4a31); }
}
[data-theme="dark"] .achv.big li.hl { background: #1b2a14; }
[data-theme="dark"] .tag, [data-theme="dark"] .team-card img { background: var(--card); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: var(--card); color: var(--text); }
[data-theme="dark"] .tbl tfoot th, [data-theme="dark"] .tbl tfoot td { background: #1a2a20; }
[data-theme="dark"] .tile .num, [data-theme="dark"] .rec-time, [data-theme="dark"] .facts b, [data-theme="dark"] .achv.big strong, [data-theme="dark"] .facts-box dd, [data-theme="dark"] .cat .big { color: var(--lime); }
[data-theme="dark"] .more { color: var(--lime); }
[data-theme="dark"] .btn.ghost.dark { color: var(--text); border-color: var(--text); }
[data-theme="dark"] .btn.ghost.dark:hover { background: var(--text); color: var(--ink); }
[data-theme="dark"] .cal-date { background: #1d4a31; }
[data-theme="dark"] .next-race { background: linear-gradient(120deg, #123021, #1d4a31); }
.theme-toggle { background: transparent; border: 1px solid rgba(255, 255, 255, .35); color: #fff; width: 38px; height: 38px; border-radius: 999px; font-size: 1.1rem; cursor: pointer; margin-left: 6px; line-height: 1; }
.theme-toggle:hover { background: rgba(255, 255, 255, .15); }
html:not(.js) .theme-toggle { display: none; }

/* ---------- Animacje przy przewijaniu ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.d1 { transition-delay: .08s; } .js .reveal.d2 { transition-delay: .16s; } .js .reveal.d3 { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } html { scroll-behavior: auto; } }

/* ---------- Menu "Więcej" ---------- */
.more-menu { position: relative; }
.more-menu summary { list-style: none; cursor: pointer; padding: 8px 14px; border-radius: 999px; opacity: .9; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary::after { content: ' \25BE'; }
.more-menu[open] summary, .more-menu summary:hover { background: rgba(255, 255, 255, .1); opacity: 1; }
.more-pop { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: #12231a; border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; padding: 8px; display: grid; box-shadow: 0 18px 40px rgba(0, 0, 0, .4); }
.more-pop a { border-radius: 10px; }
@media (max-width: 900px) {
  .more-menu summary { display: none; }
  .more-pop { position: static; display: contents; background: none; border: 0; box-shadow: none; padding: 0; }
}

/* ---------- Hero: pokaz zdjęć z zawodów (6 slajdów po 7 s) ---------- */
.hero-slides { position: absolute; inset: 0; z-index: 0; }
.hero-slides img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 30%; opacity: 0; animation: heroSlide 42s infinite; animation-delay: calc(var(--i) * 7s); will-change: opacity, transform; }
@keyframes heroSlide {
  0% { opacity: 0; transform: scale(1.02); }
  3% { opacity: 1; }
  17% { opacity: 1; }
  21% { opacity: 0; transform: scale(1.14); }
  100% { opacity: 0; transform: scale(1.14); }
}
.hero.has-slides { background-image: none; }
.hero.has-slides::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(7, 13, 10, .9) 0%, rgba(7, 13, 10, .6) 55%, rgba(7, 13, 10, .3) 100%), linear-gradient(180deg, rgba(7, 13, 10, .25), rgba(7, 13, 10, .75)); }
.hero.has-slides .hero-inner { position: relative; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .hero-slides img { animation: none; } .hero-slides img:first-child { opacity: 1; } }

/* ---------- Odliczanie do startu ---------- */
.next-race { background: linear-gradient(120deg, var(--forest), var(--moss)); color: #fff; border-radius: var(--radius); padding: 28px clamp(18px, 4vw, 40px); display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; box-shadow: var(--shadow); }
.next-race h2 { margin: 0 0 6px; color: #fff; }
.next-race .eyebrow { margin-bottom: 6px; }
.next-race p { margin: 0; opacity: .9; }
.cd { display: flex; gap: 10px; }
.cd div { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); border-radius: 14px; padding: 10px 14px; min-width: 74px; text-align: center; }
.cd b { display: block; font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--lime); }
.cd span { font-size: .78rem; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 760px) { .next-race { grid-template-columns: 1fr; } }

/* ---------- Kalendarz ---------- */
.cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.cal-list li { display: grid; grid-template-columns: 92px 1fr auto; gap: 18px; align-items: center; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; }
.cal-date { text-align: center; background: var(--forest); color: #fff; border-radius: 14px; padding: 8px 4px; }
.cal-date b { display: block; font-size: 1.8rem; line-height: 1.05; }
.cal-date span { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.cal-list h3 { margin: 0 0 2px; }
.cal-list .muted { margin: 0; }
@media (max-width: 640px) { .cal-list li { grid-template-columns: 70px 1fr; } .cal-list li > :last-child { grid-column: 1 / -1; } }

/* ---------- Oś czasu ---------- */
.timeline { position: relative; margin: 20px 0 10px; padding-left: 34px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 3px; background: linear-gradient(var(--lime), var(--moss)); border-radius: 3px; }
.tl-item { position: relative; margin-bottom: 36px; }
.tl-item::before { content: ''; position: absolute; left: -31px; top: 12px; width: 17px; height: 17px; border-radius: 50%; background: var(--lime); border: 4px solid var(--paper); box-shadow: 0 0 0 2px var(--moss); }
.tl-year { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 600; margin: 0 0 4px; }
.tl-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); margin-bottom: 14px; }
.tl-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tl-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tl-pick { display: block; text-decoration: none; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; transition: transform .2s; }
.tl-pick:hover { transform: translateY(-3px); }
.tl-pick img, .tl-pick .ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--forest); }
.tl-pick div.tl-txt { padding: 10px 14px 12px; }
.tl-pick strong { display: block; line-height: 1.25; }
.tl-pick small { color: var(--muted); }

/* ---------- Rekordy ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.rec-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.rec-card h3 { margin: 0 0 6px; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .1em; }
.rec-time { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 600; line-height: 1.05; color: var(--forest); font-variant-numeric: tabular-nums; }
.rec-card p { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }
.bars { display: grid; gap: 6px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 44px 1fr 72px; gap: 10px; align-items: center; font-size: .88rem; font-variant-numeric: tabular-nums; }
.bar-row i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--moss), var(--lime)); }

/* ---------- Dla marek ---------- */
.kit-hero { background: linear-gradient(120deg, #070d0a, #14301f); color: #fff; padding: 64px 0 56px; }
.kit-hero h1 { color: #fff; }
.kit-hero .lead { color: rgba(255, 255, 255, .85); max-width: 720px; }
.kit-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 26px; }
.kit-numbers .tile { background: rgba(255, 255, 255, .08); box-shadow: none; border: 1px solid rgba(255, 255, 255, .15); }
.kit-numbers .tile .num { color: var(--lime); } .kit-numbers .tile .lbl { color: rgba(255, 255, 255, .8); }
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.pkg { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; border-top: 5px solid var(--lime); }
.pkg.hl { border-top-color: var(--sun); }
.pkg h3 { margin-bottom: 6px; }

/* ---------- Inne ---------- */
.lang-switch { font-size: .85rem; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 5px 11px; text-decoration: none; margin-left: 6px; color: #fff; }
.share-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------- Mapa trasy (Leaflet + OpenStreetMap) ---------- */
.route-map { height: clamp(300px, 55vw, 460px); border-radius: var(--radius); overflow: hidden; background: #cfd8cf; box-shadow: var(--shadow); margin: 0 0 6px; position: relative; z-index: 0; }
.route-note { font-size: .85rem; margin-bottom: 1.4em; }
[data-theme="dark"] .route-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .route-map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9); } }
.route-pin { width: 16px; height: 16px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .5); }
.route-pin.start { background: #2d8a4e; } .route-pin.finish { background: #ff6b2c; }
