/* Pendi design tokens, reset and base type.
   Brand is violet (committed): #6D28D9 primary, #FBBE3C amber accent.
   Colors in OKLCH. Light and dark via prefers-color-scheme, with a
   data-theme override so a manual toggle can win in either direction. */

:root {
  color-scheme: light dark;

  /* Brand anchors (fixed identity, do not shift per theme) */
  --violet: #6d28d9;
  --violet-600: #7c3aed;
  --violet-500: #8b5cf6;
  --violet-400: #a78bfa;
  --amber: #fbbe3c;

  /* Semantic ramp, light mode */
  --bg: oklch(0.988 0.004 293);
  --bg-tint: oklch(0.966 0.01 293);
  --surface: oklch(1 0 0);
  --ink: oklch(0.24 0.03 293);
  --muted: oklch(0.455 0.03 293);
  --hairline: oklch(0.9 0.012 293);
  --brand: var(--violet);
  --brand-strong: #5b21b6;
  /* Brand used as ink (text, icons, small glyphs) rather than as a fill.
     On light surfaces it is the brand violet itself, so nothing shifts. In
     dark it lifts to violet-400, which is what keeps 4.5:1 on our dark
     backgrounds; --brand stays the fill colour in both themes. */
  --brand-ink: var(--violet);
  --on-brand: #ffffff;
  --accent: var(--amber);
  --accent-ink: oklch(0.32 0.07 74); /* readable text on amber */
  --focus: var(--violet-600);
  /* Form-control edges. Darker than --hairline because a control boundary
     has to clear 3:1 against its own fill, while a decorative card hairline
     does not. */
  --field-border: oklch(0.62 0.02 293);
  /* Status ink, tuned per theme to clear 4.5:1 on bg, bg-tint and surface. */
  --ok: oklch(0.48 0.15 155);
  --danger: oklch(0.52 0.2 27);

  /* Type */
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system,
    BlinkMacSystemFont, "SF Pro Text", Roboto, Ubuntu, Cantarell, "Noto Sans",
    system-ui, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", -apple-system,
    BlinkMacSystemFont, "SF Pro Display", Roboto, system-ui, sans-serif;

  /* Rhythm and shape (one radius scale) */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 34px;
  --shadow: 0 1px 2px oklch(0.4 0.05 293 / 0.06),
    0 12px 34px oklch(0.4 0.08 293 / 0.09);
  --shadow-brand: 0 14px 40px oklch(0.5 0.24 293.5 / 0.28);
  --maxw: 1120px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.175 0.022 293);
    --bg-tint: oklch(0.215 0.028 293);
    --surface: oklch(0.225 0.03 293);
    --ink: oklch(0.955 0.008 293);
    --muted: oklch(0.735 0.028 293);
    --hairline: oklch(0.34 0.03 293);
    --brand: var(--violet-600);
    /* Hover goes one step deeper here. Going lighter would put white label
       text at 4.2:1 on the button, which is under the 4.5:1 line. */
    --brand-strong: var(--violet);
    --brand-ink: var(--violet-400);
    --on-brand: #ffffff;
    --field-border: oklch(0.55 0.03 293);
    --ok: oklch(0.78 0.14 155);
    --danger: oklch(0.72 0.16 27);
    --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 16px 40px oklch(0 0 0 / 0.42);
    --shadow-brand: 0 16px 46px oklch(0.5 0.24 293.5 / 0.5);
    --focus: var(--violet-500);
  }
}

/* Explicit overrides so a toggle can force either theme. */
:root[data-theme="light"] {
  --bg: oklch(0.988 0.004 293);
  --bg-tint: oklch(0.966 0.01 293);
  --surface: oklch(1 0 0);
  --ink: oklch(0.24 0.03 293);
  --muted: oklch(0.455 0.03 293);
  --hairline: oklch(0.9 0.012 293);
  --brand: var(--violet);
  --brand-strong: #5b21b6;
  --brand-ink: var(--violet);
  --field-border: oklch(0.62 0.02 293);
  --ok: oklch(0.48 0.15 155);
  --danger: oklch(0.52 0.2 27);
  --shadow: 0 1px 2px oklch(0.4 0.05 293 / 0.06),
    0 12px 34px oklch(0.4 0.08 293 / 0.09);
  --shadow-brand: 0 14px 40px oklch(0.5 0.24 293.5 / 0.28);
  --focus: var(--violet-600);
}
:root[data-theme="dark"] {
  --bg: oklch(0.175 0.022 293);
  --bg-tint: oklch(0.215 0.028 293);
  --surface: oklch(0.225 0.03 293);
  --ink: oklch(0.955 0.008 293);
  --muted: oklch(0.735 0.028 293);
  --hairline: oklch(0.34 0.03 293);
  --brand: var(--violet-600);
  --brand-strong: var(--violet);
  --brand-ink: var(--violet-400);
  --field-border: oklch(0.55 0.03 293);
  --ok: oklch(0.78 0.14 155);
  --danger: oklch(0.72 0.16 27);
  --shadow: 0 1px 2px oklch(0 0 0 / 0.3), 0 16px 40px oklch(0 0 0 / 0.42);
  --shadow-brand: 0 16px 46px oklch(0.5 0.24 293.5 / 0.5);
  --focus: var(--violet-500);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: clamp(1rem, 0.97rem + 0.2vw, 1.075rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--display);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  font-weight: 680;
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
