/**
 * Mapidu marketing site — design tokens aligned with app theme.
 */
:root {
  --app-text-scale: 1;
  --font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI",
    Roboto, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  --border-hairline: 1px;
  --accent-stripe: 2px;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  --container-max: 72rem;
  --header-height: 4rem;

  --color-primary: #a88200;
  /* Text-on-Canvas color: #a88200 is only 3.3-3.6:1 against white/#f5f5f7,
     below WCAG AA's 4.5:1 for text. --color-primary itself stays unchanged
     (used for backgrounds/borders/icons, which only need 3:1) — this darker
     variant is for actual foreground text (links, price, headings). */
  --color-primary-text: #8a6b00;
  /* Text-on-primary-background (buttons): white fails at 3.58:1 on this
     gold; dark text passes at 5.02:1 — same technique the dark theme
     already uses (dark text on its own, lighter gold). */
  --color-primary-contrast: #1a1612;
  /** Brand gold gradient — derived from palette (matches logo.svg) */
  --brand-gold-start: var(--color-primary);
  --brand-gold-end: var(--color-warning);
  --app-primary-gradient-angle: 135deg;
  --app-primary-gradient: linear-gradient(
    var(--app-primary-gradient-angle),
    var(--brand-gold-start) 0%,
    var(--brand-gold-end) 100%
  );
  --color-secondary: #4688c7;
  --color-tertiary: #6f8f7a;
  --color-success: #4ecf88;
  /* Text-safe variant: #4ecf88 as foreground (the pricing checkmark) is
     only 1.98:1 on white, far below WCAG AA's 3:1 for graphical objects —
     same background-vs-text split as --color-primary/--color-primary-text
     above. --color-success itself stays unchanged. */
  --color-success-text: #1e7e4d;
  --color-warning: #f2a93b;
  --color-danger: #e8697a;

  --color-bg: #ffffff;
  --color-bg-elevated: #f5f5f7;
  --color-surface: #ffffff;
  --color-border: #e8e8ed;
  --color-border-strong: #d1d1d6;

  --color-text: #1a1612;
  --color-text-muted: #5f5145;
  --color-text-subtle: #8d8880;

  --color-brand-subtle: rgba(168, 130, 0, 0.08);
  --shadow-elevated: 0 4px 16px rgba(15, 23, 42, 0.06);

  --focus-ring: 0 0 0 3px rgba(168, 130, 0, 0.35);
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  /* Strong ease-out for UI enter/exit + press feedback (Emil Kowalski's
     design-engineering curve — the built-in CSS easings are too weak). */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
  font-size: calc(100% * var(--app-text-scale));
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:not([data-motion-override]) {
    scroll-behavior: auto;
  }

  :root:not([data-motion-override]) *,
  :root:not([data-motion-override]) *::before,
  :root:not([data-motion-override]) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Manual override (settings dialog) — takes effect regardless of OS setting. */
html[data-motion-override="reduce"] {
  scroll-behavior: auto;
}

:root[data-motion-override="reduce"] *,
:root[data-motion-override="reduce"] *::before,
:root[data-motion-override="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* Manual high-contrast override / prefers-contrast: high — strengthens
   borders, muted text, and the focus ring using existing theme tokens. */
@media (prefers-contrast: high) {
  :root:not([data-contrast-override]) {
    --color-border: var(--color-border-strong);
    --color-text-muted: var(--color-text);
    --color-text-subtle: var(--color-text);
    --focus-ring: 0 0 0 3px var(--color-primary);
  }
}

:root[data-contrast-override="high"] {
  --color-border: var(--color-border-strong);
  --color-text-muted: var(--color-text);
  --color-text-subtle: var(--color-text);
  --focus-ring: 0 0 0 3px var(--color-primary);
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Windows High Contrast Mode (forced-colors): box-shadow-based focus rings
   and color-only selection state are stripped, so reinforce both with
   `outline` + System Color keywords, which forced-colors preserves. Must
   come after the base :focus-visible rule above to win the cascade at
   equal specificity. */
@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
  }

  .pref-tile.is-selected,
  .pref-tile[aria-checked="true"] {
    outline: 3px solid Highlight;
    outline-offset: 1px;
  }
}

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

.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 1000;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--transition-fast);
}

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

.container {
  width: min(100% - 2rem, var(--container-max));
  margin-inline: auto;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  min-height: 50vh;
  color: var(--color-text-muted);
}

.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion-override]) .loading-spinner {
    animation: none;
    border-top-color: var(--color-primary);
  }
}

:root[data-motion-override="reduce"] .loading-spinner {
  animation: none;
  border-top-color: var(--color-primary);
}

.section {
  padding-block: var(--space-3xl);
  scroll-margin-top: calc(var(--header-height) + var(--space-md));
}

.section-header {
  max-width: 42rem;
  margin-bottom: var(--space-2xl);
}

.section-header.centered {
  margin-inline: auto;
  text-align: center;
}

.section-eyebrow {
  display: inline-block;
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-primary-text);
}

.section-title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-subtitle {
  margin: 0;
  font-size: 1.125rem;
  color: var(--color-text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  min-height: max(2.75rem, 44px);
  padding: 0.625rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  border: var(--border-hairline) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast) var(--ease-out);
}

/* Press feedback: the interface confirms it heard the press. */
.btn:active {
  transform: scale(0.97);
}

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

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border-strong);
}

/* Hover states gated so a tap on a touch device doesn't leave them stuck. */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    filter: brightness(1.08);
    text-decoration: none;
  }

  .btn-secondary:hover {
    background: var(--color-bg-elevated);
    text-decoration: none;
  }
}

.accent-primary,
.accent-secondary,
.accent-tertiary {
  position: relative;
  border-left: none;
  overflow: hidden;
}

.accent-primary::after,
.accent-secondary::after,
.accent-tertiary::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--accent-stripe);
  pointer-events: none;
}

.accent-primary::after {
  background: var(--color-primary);
}

.accent-secondary::after {
  background: var(--color-secondary);
}

.accent-tertiary::after {
  background: var(--color-tertiary);
}
