/* Glass belongs to floating controls. Reading surfaces remain quiet and legible.
   Brand geometry, typography and colours are exclusively owned by brand.css. */
:root {
  --glass-fill: #f4f8fc;
  --glass-border: rgba(255, 255, 255, .92);
  --glass-shadow: 0 12px 36px rgba(22, 62, 91, .08),
    0 1px 3px rgba(22, 62, 91, .05), inset 0 1px 0 #fff;
  --glass-blur: none;
  --glass-surface: linear-gradient(145deg, #ffffffed, #f2f8fcdf);
  --glass-deep: radial-gradient(ellipse at 95% 0%, #356e91 0%, transparent 65%),
    linear-gradient(145deg, #1b4968, #163e5b 75%);
  --glass-canvas: radial-gradient(ellipse 65% 700px at 100% 0%, #cfe9f5a6, transparent),
    radial-gradient(ellipse 60% 800px at 0% 550px, #dfedf8b0, transparent),
    #f3f7fb;
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root {
    --glass-fill: rgba(247, 251, 255, .78);
    --glass-blur: blur(22px) saturate(145%);
  }
}

body, .editorial-site, .onboarding-shell, .first-run-shell, .app-shell {
  background: var(--glass-canvas);
}
html { scroll-padding-top: 130px; }
.editorial-site .reading-layout > nav,
.reading-layout > :is(.why-index, .glossary-index, .legal-nav),
.race-reading-index { top: 150px; }

/* One floating navigation treatment across the app and public pages. */
.brand-bar, .app-header, .editorial-site .site-header {
  position: sticky;
  top: 14px;
  z-index: 30;
  width: calc(100% - 40px);
  max-width: 1480px;
  min-height: 76px;
  height: auto;
  margin: 14px auto 0;
  padding: 14px clamp(18px, 2.4vw, 36px);
  gap: 16px;
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  background: var(--glass-fill);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.brand-navigation { gap: 6px; }
.brand-navigation a { padding: 12px 16px; border-radius: 999px; }
.brand-navigation a:hover { background: #ffffffb8; text-decoration: none; }
.language-switcher { padding: 3px; border-radius: 999px; background: #163e5b08; }
.language-switcher button { min-height: 34px; border-radius: 999px; }
.language-switcher button[aria-pressed="true"] {
  background: #fff;
  color: var(--navy);
  text-decoration: none;
  box-shadow: 0 2px 8px #163e5b10;
}
.onboarding-account-actions > button {
  min-height: 44px;
  border: 1px solid #163e5b28;
  border-radius: 999px;
  background: #ffffff80;
  box-shadow: inset 0 1px 0 #fff;
}
.onboarding-account-actions > button:hover { background: var(--navy); color: #fff; }
.menu-toggle { border-radius: 50%; box-shadow: inset 0 1px 0 #ffffff40, 0 4px 12px #163e5b24; }
/* Keep the fixed menu relative to the viewport, not a filtered header. */
.app-header { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
}
.menu-backdrop { inset: 0; }
.app-menu { top: 110px; right: 20px; width: min(430px, calc(100vw - 40px)); height: calc(100dvh - 130px); border: 1px solid var(--glass-border); border-radius: 24px; }

/* Visitor home page */
.landing-hero { gap: clamp(32px, 5vw, 80px); padding-block: 64px 72px; }
.landing-photo {
  position: relative;
  padding: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 34px;
  background: #ffffff70;
  box-shadow: 0 24px 64px #163e5b16, inset 0 1px 0 #fff;
}
.landing-photo img { aspect-ratio: 5 / 4; border-radius: 26px; }
.landing-actions { gap: 14px; }
.landing-actions .editorial-text-link {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding-inline: 6px;
  color: var(--navy);
  text-decoration: underline;
}
.landing-footer { background: #e9f1f8; color: var(--ink); border-top-color: #ffffff; }
.landing-footer .public-guides a { color: var(--navy); }
.landing-footer-legal { border-top-color: var(--rule); }
.landing-footer-legal a { color: var(--muted); }
.landing-footer-account { grid-template-columns: 1fr; }
.landing-footer-account .public-guides { max-width: 700px; }
.editorial-site .site-footer { background: var(--glass-deep); border-top-color: #ffffff30; }

/* Tinted controls carry emphasis; no blur is needed on every individual button. */
.primary-button, .review-button, .editorial-site .cta {
  border: 1px solid #163e5b;
  border-radius: 999px;
  background: linear-gradient(165deg, #2c6488, #163e5b 85%);
  color: #fff;
  box-shadow: inset 0 1px 0 #ffffff45, 0 6px 16px #163e5b21;
}
.primary-button:not(:disabled):hover, .review-button:hover, .editorial-site .cta:hover {
  background: linear-gradient(165deg, #347596, #1d4d70 85%);
  box-shadow: inset 0 1px 0 #ffffff55, 0 8px 22px #163e5b2c;
}
.secondary-button, .complete-button, .instruction-button, .move-session-button {
  border-radius: 999px;
  min-height: 44px;
}

/* Light cards are translucent without stacking expensive backdrop filters. */
.weekly-log-summary, .current-race-estimate, .readiness-details,
.plan-review-card, .billing-panel, .profile-identity, .feedback-form,
.auth-view > form, .auth-confirmation, .overview-next-session .session-card,
.editorial-site .distance-card, .editorial-site .directory-bottom {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background: var(--glass-surface);
  box-shadow: var(--shadow-card);
}
.editorial-site .directory-card { container-type: inline-size; padding: 20px; border: 1px solid var(--glass-border); border-radius: var(--radius-card); background: var(--glass-surface); box-shadow: var(--shadow-card); }
.editorial-site .directory-card h2 { font-size: 24px; font-size: clamp(22px, 9.5cqi, 32px); }
.editorial-site .directory-card .course-graph { border-radius: 16px; }
.current-training, .distance-hero, .landing-example .plan-journey,
.plan-review-hero, .editorial-site .race-card {
  background: var(--glass-deep);
  box-shadow: inset 0 1px 0 #ffffff35, 0 12px 32px #163e5b14;
}
.onboarding-focused .setup-trial, .race-preset-note { border: 1px solid #fff; border-radius: 18px; background: var(--glass-surface); box-shadow: var(--shadow-card); }
.onboarding-focused .onboarding-form { padding: 8px 32px 32px; border: 1px solid #fff; border-radius: 28px; background: var(--glass-surface); box-shadow: var(--glass-shadow); }
.form-section input, .form-section select, .profile-identity input, .action-dialog input, .feedback-form select, textarea {
  background: #ffffffeb;
  border-color: #b8cbd9;
  box-shadow: inset 0 2px 4px #163e5b04;
}
.form-section :is(input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.workspace-sidebar { border-right: 0; background: transparent; }
.workspace-nav { top: 110px; max-height: calc(100dvh - 110px); background: transparent; }
.workspace-nav > button { border-left: 0; border-radius: 14px; }
.workspace-nav > button.active { background: #ffffffd9; box-shadow: var(--glass-shadow); }
.app-menu { background: var(--glass-fill); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }

/* Dialog surfaces are nearly opaque to retain contrast over a busy dashboard. */
.modal-backdrop { background: #102b4559; }
.session-modal, .review-modal, .shared-baseline-modal, .phase-detail-modal, .action-dialog {
  border: 1px solid #ffffff;
  border-radius: 28px;
  background: #f7fbfe;
  box-shadow: inset 0 1px 0 #fff, 0 32px 100px #102b4538;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .brand-navigation a, .landing-actions > a, .editorial-site .cta, .language-switcher button {
    transition: background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
  }
  .landing-actions > a:hover, .editorial-site .cta:hover { transform: translateY(-2px); }
  .landing-actions > a:active, .editorial-site .cta:active { transform: translateY(0); }
}

@media (max-width: 850px) {
  .landing-hero { gap: 26px; padding-block: 44px 48px; }
}
@media (max-width: 600px) {
  html { scroll-padding-top: 24px; }
  .brand-bar, .app-header, .editorial-site .site-header {
    position: relative;
    top: auto;
    width: calc(100% - 24px);
    margin-top: 12px;
    padding: 14px 16px;
    border-radius: 22px;
    gap: 12px;
  }
  .landing-hero { padding-block: 36px 44px; gap: 28px; }
  .landing-photo { border-radius: 28px; padding: 6px; }
  .landing-photo img { aspect-ratio: 6 / 5; border-radius: 22px; }
  .onboarding-focused .onboarding-form { padding: 0 18px 24px; border-radius: 24px; }
  .editorial-site .directory-card { padding: 18px; }
}
@media (max-width: 380px) {
  .onboarding-shell .brand-bar { padding: 14px 16px; }
  .onboarding-shell .onboarding-account-actions { flex-basis: 100%; max-width: none; justify-content: space-between; }
}

/* Preferences and fallbacks affect materials, without hiding any content. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root {
    --glass-fill: #f7fbff;
    --glass-blur: none;
    --glass-surface: #f8fbfe;
    --glass-border: #99b1c4;
    --glass-canvas: #eef4f8;
  }
  .landing-photo { background: #f8fbfe; }
}
@media (prefers-reduced-motion: reduce) {
  .landing-actions > a, .editorial-site .cta, .brand-navigation a { transition: none; transform: none; }
}
@media print {
  body, .editorial-site, .onboarding-shell, .first-run-shell, .app-shell { background: #fff; }
  .brand-bar, .app-header, .editorial-site .site-header { position: static; box-shadow: none; }
  .landing-photo { background: #fff; box-shadow: none; }
}
