/* modern.css — R33 refinement layer
   Loads after site.css, pages.css and skate26.css (and before page-level <head> sections and mobile-responsive.css), so breakpoints
   and layout stay where they are. Only finishing work lives here: elevation, form controls, touch behaviour, scrollbars,
   page transitions. Every rule is either a progressive enhancement or a bug fix for a state the older files left unstyled. */

/* ---------- elevation: one cool-tinted, layered scale (the neutral shadows read flat on the cobalt palette) ---------- */
:root {
  --shadow-sm: 0 1px 2px rgb(16 24 64 / .07), 0 1px 1px rgb(16 24 64 / .04);
  --shadow: 0 1px 2px rgb(16 24 64 / .06), 0 10px 26px -12px rgb(16 24 64 / .26);
  --shadow-md: var(--shadow);
  --shadow-lg: 0 2px 6px rgb(16 24 64 / .06), 0 28px 56px -26px rgb(16 24 64 / .42);
}
[data-bs-theme="dark"] {
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .55);
  --shadow: 0 1px 2px rgb(0 0 0 / .5), 0 12px 30px -12px rgb(0 0 0 / .75);
  --shadow-md: var(--shadow);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / .5), 0 30px 60px -24px rgb(0 0 0 / .85);
}

/* ---------- typography ---------- */
body { font-kerning: normal; font-optical-sizing: auto; }
/* digits keep their width, so counters and table columns line up instead of jittering (not on single prices: tabular digits look airy there) */
:where(.stat-tile, table, time, [data-count]) { font-variant-numeric: tabular-nums; }
/* a long CMS title or an unbroken token must wrap inside its card instead of widening the page */
:where(h1, h2, h3, h4, h5, h6, .course-title, .article-card-body p) { overflow-wrap: break-word; }

/* ---------- forms ---------- */
:where(input, select, textarea, progress, meter) { accent-color: var(--lime); }
.form-control, .form-select { caret-color: var(--lime); }
.form-control::placeholder { color: var(--muted); opacity: 1; }
.form-control:focus, .form-select:focus { border-color: var(--lime); box-shadow: var(--ring); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--surface-2); }
.form-control:disabled, .form-select:disabled { cursor: not-allowed; }
/* browser validation: show the error only after the person has interacted with the field (:invalid alone flags an untouched form) */
.form-control:user-invalid, .form-select:user-invalid { border-color: var(--danger); }
.form-control:user-invalid:focus, .form-select:user-invalid:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 35%, transparent); }

/* ---------- touch devices ---------- */
:where(a, button, summary, label, .btn, .icon-btn, .chip, .nav-link) { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: none) {
  /* :hover sticks after a tap on a touch screen, which left cards and buttons lifted; the pressed state (:active) still animates */
  :is(.course-card, .article-card, .podcast-card, .btn, .chip, .icon-btn):hover:not(:active) { transform: none; }
}
/* iOS zooms the page when a field under 16px gets focus */
@media (max-width: 767.98px) {
  :is(.big-search-input, .episode-search-input, .short-link-row input, input[type="search"]) { font-size: max(1rem, 16px); }
}

/* ---------- scrollbars: thin and tinted, mouse and trackpad only ---------- */
@media (pointer: fine) {
  :root { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 50%, transparent) transparent; }
}

/* ---------- page transitions (cross-document view transitions; browsers without support ignore the at-rule) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(root) { animation-duration: .2s; }
  /* header and bottom bar stay put while the page content cross-fades */
  .site-header { view-transition-name: site-header; }
  .mobile-bottom-nav { view-transition-name: mobile-bottom-nav; }
}


/* ---------- R33.6 accessibility: high-contrast palette, forced-colors and reduced motion ---------- */
html[data-contrast="high"] {
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0a1020;
  --muted: #1e293b;
  --line: #334155;
  --focus: #1237a8;
}
html[data-bs-theme="dark"][data-contrast="high"] {
  --paper: #000000;
  --surface: #050505;
  --surface-2: #111827;
  --text: #ffffff;
  --muted: #f1f5f9;
  --line: #e2e8f0;
  --focus: #ffeb3b;
  --lime: #c7d2fe;
  --lime-600: #c7d2fe;
  --lime-ink: #050505;
}
html[data-contrast="high"] a:not(.btn):not(.brand):not(.nav-link) {
  text-decoration-line: underline;
  text-decoration-thickness: .08em;
}
html[data-contrast="high"] :is(input, select, textarea, button, .btn, .icon-btn):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
html[data-contrast="high"] :is(input, select, textarea) {
  border-width: 2px;
}
html[data-contrast="high"] :is(.card, .panel-card, .compare-modal-card, .cmd-dialog) {
  border-color: var(--line);
}

@media (forced-colors: active) {
  :focus-visible { outline: 2px solid Highlight !important; outline-offset: 3px; }
  :is(button, .btn, .icon-btn, input, select, textarea) { border: 1px solid ButtonText; }
  [aria-current="page"], [aria-pressed="true"], .is-active { outline: 1px solid Highlight; outline-offset: 2px; }
  .skip-link { border: 2px solid LinkText; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
    caret-color: auto !important;
  }
  html { scroll-behavior: auto !important; }
  .hero-slide.is-active .hero-media img { transform: none !important; }
}
