:root {
  /* Colors (tangentialism-inspired) */
  --bg: #fafafa;
  --surface: #fff;
  --fg: #252121;
  --muted: #8a8a92;
  --border: #e5e5e8;
  --accent: #308aa2;
  --accent-soft: rgba(48, 138, 162, 0.12);
  --accent-shadow: rgba(48, 138, 162, 0.25);
  --error: #c0392b;
  --success: #1f7a4d;

  /* Typography */
  --font-serif: 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Consolas, monospace;

  /* Geometry */
  --radius-card: 0.875rem;
  --radius-control: 0.625rem;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fill the viewport so short pages don't reveal the html element's
   (light) background below the body in dark mode. dvh tracks the
   dynamic viewport, accounting for mobile browser chrome. */
body {
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover { text-decoration-thickness: 2px; }

input, textarea, button, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Calm pulse loading affordance (shared) */
.calm-pulse {
  margin: 4rem 0;
  text-align: center;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
}

/* Pulsing dot above the text. */
.calm-pulse::before {
  content: "";
  display: block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 1.6s ease-in-out infinite;
}

/* Closed state: static dot, no animation — signals terminal. */
.calm-pulse.terminal::before {
  animation: none;
  opacity: 0.6;
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.9); }
  50%      { opacity: 1.0;  transform: scale(1.0); }
}

/* Dark palette shared by .theme-dark (manual) and .theme-os under prefers dark. */
body.theme-dark,
body.theme-os {
  /* Light defaults stay until media query / explicit class kicks in below. */
}
body.theme-dark {
  --bg: #0c0c0d;
  --surface: #16161a;
  --fg: #ececef;
  --muted: #8a8a92;
  --border: #2a2a2f;
  --accent: #6db9c8;
  --accent-soft: rgba(109, 185, 200, 0.15);
  --accent-shadow: rgba(109, 185, 200, 0.3);
  --error: #e57373;
  --success: #6abf8e;
}
@media (prefers-color-scheme: dark) {
  body.theme-os {
    --bg: #0c0c0d;
    --surface: #16161a;
    --fg: #ececef;
    --muted: #8a8a92;
    --border: #2a2a2f;
    --accent: #6db9c8;
    --accent-soft: rgba(109, 185, 200, 0.15);
    --accent-shadow: rgba(109, 185, 200, 0.3);
    --error: #e57373;
    --success: #6abf8e;
  }
}
