/* ==========================================================================
   tomsix.xyz — F1 race reminder
   Modern, calm, card-based UI. Light & dark themes.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --surface-3: #e8eaed;

  --text: #1f2023;
  --text-2: #5f6368;
  --text-3: #8b9198;

  --line: #e7e9ec;
  --line-2: #d9dce1;

  --accent: #e10600;
  --accent-soft: rgba(225, 6, 0, 0.08);

  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.08), 0 2px 6px rgba(60, 64, 67, 0.05);
  --shadow-md: 0 1px 2px rgba(60, 64, 67, 0.06), 0 16px 40px -18px rgba(60, 64, 67, 0.28);
  --shadow-hover: 0 2px 4px rgba(60, 64, 67, 0.08), 0 24px 48px -20px rgba(60, 64, 67, 0.32);

  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 16px;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;

  --maxw: 1120px;
  --header-h: 72px;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e0f11;
  --surface: #17191c;
  --surface-2: #1f2226;
  --surface-3: #2a2e33;

  --text: #f1f3f4;
  --text-2: #b6bbc2;
  --text-3: #858c94;

  --line: #26292d;
  --line-2: #33373c;

  --accent: #ff5a52;
  --accent-soft: rgba(255, 90, 82, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.5), 0 16px 40px -18px rgba(0, 0, 0, 0.8);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.55), 0 24px 48px -20px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img,
svg {
  display: block;
}

img {
  max-width: 100%;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--text);
  color: var(--bg);
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 28px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 26px;
  height: var(--header-h);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topnav a {
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topnav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tz {
  position: relative;
}

.tz__button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tz__button:hover,
.tz__button[aria-expanded="true"] {
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
}

.tz__button svg {
  flex-shrink: 0;
  color: var(--text-3);
}

.tz__chevron {
  transition: transform 0.2s ease;
}

.tz__button[aria-expanded="true"] .tz__chevron {
  transform: rotate(180deg);
}

.tz__value {
  max-width: 178px;
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tz__panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: min(310px, calc(100vw - 36px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.tz__search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.tz__search svg {
  flex-shrink: 0;
  color: var(--text-3);
}

.tz__input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.tz__input::placeholder {
  color: var(--text-3);
}

.tz__input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.tz__list {
  max-height: min(320px, 55vh);
  margin: 6px 0 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  scrollbar-width: thin;
}

.tz__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
}

.tz__option:hover,
.tz__option.is-active {
  background: var(--surface-2);
  color: var(--text);
}

.tz__option.is-selected {
  color: var(--text);
  font-weight: 600;
}

.tz__check {
  display: none;
  flex-shrink: 0;
}

.tz__option.is-selected .tz__check {
  display: block;
}

.tz__empty {
  padding: 14px 10px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 54px;
  height: 32px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  transition: background-color 0.22s ease, border-color 0.22s ease;
}

.theme-toggle:hover {
  border-color: var(--line-2);
}

.theme-toggle__thumb {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.22s ease;
}

.theme-toggle[aria-checked="true"] {
  border-color: var(--text);
  background: var(--text);
}

.theme-toggle[aria-checked="true"] .theme-toggle__thumb {
  transform: translateX(22px);
}

.theme-toggle__moon {
  display: none;
}

.theme-toggle[aria-checked="true"] .theme-toggle__sun {
  display: none;
}

.theme-toggle[aria-checked="true"] .theme-toggle__moon {
  display: block;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-top: 56px;
  padding-bottom: 20px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero__title {
  margin-top: 18px;
  max-width: 880px;
  font-size: clamp(46px, 7.2vw, 92px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero__title em {
  font-style: normal;
  color: var(--accent);
}

.hero__f1 {
  margin-left: 0.14em;
}

.hero__lead {
  margin-top: 24px;
  max-width: 620px;
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.65;
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Next race banner
   -------------------------------------------------------------------------- */

.next {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 22px;
  margin-top: 32px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.next:hover {
  border-color: var(--line-2);
}

.next:focus-within {
  border-color: var(--line-2);
}

.next__flag img {
  width: 52px;
  height: 36px;
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}

.next__info {
  min-width: 0;
}

.next__top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.next__round {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.next__gp {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next__session {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.next__session strong {
  color: var(--text);
  font-weight: 600;
}

.next__session .zone {
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.countdown {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 0 4px;
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 34px;
}

.countdown__value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.countdown__label {
  margin-top: 5px;
  color: var(--text-3);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.next__chevron {
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition: transform 0.22s ease;
}

.next.is-open .next__chevron {
  transform: rotate(180deg);
}

.next-schedule {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.next-schedule .sched {
  padding: 4px 20px 8px;
}

/* --------------------------------------------------------------------------
   Chips, badges, buttons
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.chip__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip--live {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip--live .chip__dot {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}

.btn--primary:hover {
  box-shadow: var(--shadow-sm);
}

.btn--ghost {
  border: 1px solid var(--line-2);
  color: var(--text);
}

.btn--ghost:hover {
  background: var(--surface-2);
}

.btn--quiet {
  height: 34px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 12.5px;
}

.btn--quiet:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--text-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn--sm {
  width: 30px;
  height: 30px;
  border-color: transparent;
}

.icon-btn--sm:hover {
  background: var(--surface-2);
}

.icon-btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Season / race groups
   -------------------------------------------------------------------------- */

.season {
  padding-top: 16px;
  padding-bottom: 96px;
}

.group {
  margin-top: 0;
}

.group + .group {
  margin-top: 48px;
}

.group__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.group__title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.group__count {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 500;
}

.group__action {
  margin-left: auto;
}

.gcal-btn {
  gap: 8px;
}

.gcal-btn__icon {
  flex: 0 0 auto;
}

.race-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.race {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.race:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
}

.race.is-open {
  border-color: var(--line-2);
  box-shadow: var(--shadow-md);
}

.race.is-focus {
  border-color: var(--text-3);
}

.race.is-done {
  background: color-mix(in srgb, var(--surface) 62%, var(--bg));
}

.race__head {
  display: grid;
  grid-template-columns: 46px 38px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 16px 20px;
  text-align: left;
}

.race__round {
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.race__flag {
  display: grid;
  place-items: center;
}

.race__flag img {
  width: 34px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}

.race__main {
  min-width: 0;
}

.race__name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.race.is-done .race__name {
  color: var(--text-2);
  font-weight: 500;
}

.race__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 3px;
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.race__state {
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.race.is-focus .race__state {
  color: var(--text);
}

.race__chevron {
  color: var(--text-3);
  transition: transform 0.22s ease;
}

.race.is-open .race__chevron {
  transform: rotate(180deg);
}

.race__body {
  border-top: 1px solid var(--line);
}

.sched {
  padding: 2px 20px 0;
  list-style: none;
}

.sched__row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 62px 58px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.sched__row:last-child {
  border-bottom: 0;
}

.sched__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
}

.sched__row.is-next .sched__dot {
  background: var(--text);
}

.sched__row.is-live .sched__dot {
  background: var(--text);
  box-shadow: 0 0 0 4px var(--surface-3);
}

.sched__main {
  min-width: 0;
}

.sched__name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.sched__meta {
  display: block;
  margin-top: 1px;
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.sched__time {
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.sched__state {
  color: var(--text-3);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: right;
  text-transform: uppercase;
  white-space: nowrap;
}

.sched__row.is-done {
  color: var(--text-3);
}

.sched__row.is-done .sched__name {
  font-weight: 500;
}

.sched__empty {
  padding: 14px 0;
  color: var(--text-3);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.foot {
  border-top: 1px solid var(--line);
  padding: 34px 0 44px;
}

.foot__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
}

.foot__note {
  flex: 1 1 420px;
  max-width: 620px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.65;
}

.foot__note a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.foot__note a:hover {
  color: var(--text);
}

.foot__tz {
  color: var(--text-3);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 100;
  padding: 14px 18px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Google Calendar dialog
   -------------------------------------------------------------------------- */

body:has(dialog[open]) {
  overflow: hidden;
}

.sheet {
  width: min(470px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 40px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-xl);
  background: transparent;
  color: var(--text);
  overflow: visible;
}

.sheet::backdrop {
  background: rgba(12, 14, 17, 0.5);
}

.sheet__card {
  max-height: calc(100vh - 40px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
  overflow-y: auto;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}

.sheet__icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--surface-2);
}

.sheet__titles {
  min-width: 0;
}

.sheet__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.02em;
}

.sheet__sub {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.sheet__close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-left: auto;
  border-radius: 999px;
  color: var(--text-3);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sheet__close:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sheet__steps {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.sheet__step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.sheet__num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 700;
}

.sheet__step strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}

.sheet__step div > span {
  display: block;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.sheet__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.sheet__actions .btn {
  height: 42px;
}

.sheet__actions .btn--primary {
  flex: 1 1 230px;
}

.sheet__actions .btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.sheet__hint {
  margin-top: 13px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: no-preference) {
  .sheet[open] .sheet__card {
    animation: sheet-in 0.18s ease-out;
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .next {
    grid-template-columns: 52px minmax(0, 1fr) 22px;
    grid-template-areas:
      "flag info chev"
      "count count count";
    gap: 16px 18px;
  }

  .next__flag { grid-area: flag; }
  .next__info { grid-area: info; }
  .next__chevron { grid-area: chev; align-self: start; }
  .countdown { grid-area: count; justify-content: flex-start; padding-top: 4px; }

  .race__state {
    display: none;
  }

  .race__head {
    grid-template-columns: 40px 34px minmax(0, 1fr) 22px;
    gap: 14px;
  }
}

@media (max-width: 760px) {
  .topnav {
    display: none;
  }

  .tools {
    margin-left: 0;
    flex: 1;
    justify-content: space-between;
  }

  .tz__panel {
    right: auto;
    left: 0;
  }

  .hero {
    padding-top: 40px;
    padding-bottom: 16px;
  }

  .hero__title {
    font-size: clamp(40px, 11vw, 64px);
  }

  .hero__lead {
    margin-top: 18px;
    font-size: 15.5px;
  }

  .next {
    margin-top: 24px;
  }

  .next__gp {
    font-size: 19px;
  }

  .season {
    padding-top: 8px;
    padding-bottom: 56px;
  }

  .foot {
    padding: 26px 0 30px;
  }

  .race__head {
    padding: 14px 16px;
    gap: 12px;
  }

  .race__meta {
    font-size: 11.5px;
  }

  .sched {
    padding-inline: 16px;
  }
}

@media (max-width: 620px) {
  .wrap {
    padding-inline: 18px;
  }

  .topbar__inner {
    gap: 12px;
    height: 60px;
  }

  .tools {
    gap: 8px;
  }

  .tz__button {
    height: 34px;
    padding: 0 10px;
    gap: 6px;
  }

  .tz__globe {
    display: none;
  }

  .tz__value {
    max-width: 168px;
    font-size: 11.5px;
  }

  .tz__input {
    font-size: 16px;
  }

  .theme-toggle {
    width: 50px;
    height: 30px;
  }

  .theme-toggle__thumb {
    width: 22px;
    height: 22px;
  }

  .theme-toggle[aria-checked="true"] .theme-toggle__thumb {
    transform: translateX(18px);
  }

  .hero__lead {
    display: none;
  }

  .next {
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    grid-template-areas:
      "flag info chev"
      "count count count";
    gap: 10px 12px;
    padding: 12px 14px;
    border-radius: 18px;
  }

  .next__flag img {
    width: 38px;
    height: 27px;
    border-radius: 5px;
  }

  .next__top {
    gap: 6px;
    margin-bottom: 4px;
  }

  .next__round {
    font-size: 10px;
  }

  .next .chip {
    height: 21px;
    padding: 0 9px;
    font-size: 10px;
  }

  .next__gp {
    font-size: 17px;
  }

  .next__session {
    margin-top: 2px;
    font-size: 11.5px;
  }

  .next__chevron svg {
    width: 16px;
    height: 16px;
  }

  .season {
    padding-bottom: 40px;
  }

  .group__action {
    width: 100%;
    margin-left: 0;
  }

  .gcal-btn {
    width: 100%;
  }

  .sheet__card {
    padding: 20px;
  }

  .sheet__actions {
    flex-direction: column;
    gap: 8px;
  }

  .sheet__actions .btn,
  .sheet__actions .btn--primary {
    flex: 0 0 auto;
    width: 100%;
  }

  .foot {
    padding: 22px 0 24px;
  }

  .countdown {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
    padding-top: 0;
  }

  .countdown__unit {
    flex: 1;
    min-width: 0;
  }

  .countdown__value {
    font-size: 18px;
  }

  .countdown__label {
    margin-top: 3px;
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .race__head {
    grid-template-columns: 34px 30px minmax(0, 1fr) 20px;
    gap: 10px;
    padding: 13px 14px;
  }

  .race__round {
    font-size: 12.5px;
  }

  .race__flag img {
    width: 28px;
    height: 19px;
  }

  .race__name {
    font-size: 14.5px;
  }

  .race__meta .place {
    display: none;
  }

  .sched__row {
    grid-template-columns: 8px minmax(0, 1fr) 54px;
    gap: 10px;
    padding: 11px 0;
  }

  .sched__state {
    display: none;
  }

  .sched__meta .dur,
  .sched__meta .dur-sep {
    display: none;
  }

  .foot__inner {
    flex-direction: column;
    gap: 12px;
  }

  .foot__note {
    flex: 0 0 auto;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .topbar__inner {
    gap: 8px;
  }

  .tz__value {
    max-width: 150px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .tz__value {
    max-width: 132px;
  }
}

@media (max-width: 340px) {
  .topbar__inner {
    gap: 6px;
  }

  .tz__value {
    max-width: 110px;
  }
}