/* =========================================================
   base.css — design tokens, reset, typography, background.
   Impressionist palette stays; restructured for clarity.
========================================================= */

:root {
  color-scheme: light;
  --hue: 205;
  --sat: 38%;

  /* Surface layers */
  --bg-0: #f3ead7;
  --bg-1: #faf5ea;
  --bg-2: #fffbf2;
  --bg-3: #ebe1cc;

  /* Accent (driven by --hue) */
  --accent:        hsl(var(--hue), var(--sat), 44%);
  --accent-fg:     #fffbf2;
  --accent-soft:   hsl(var(--hue), calc(var(--sat) * 0.55), 92%);
  --accent-glow:   hsl(var(--hue), var(--sat), 60%, 0.18);

  /* Text */
  --text-1: #2c3548;
  --text-2: #4a5468;
  --text-3: #7d8294;
  --text-muted: #95a0b0;

  /* Lines & shadows */
  --border:        rgba(94, 138, 168, 0.18);
  --border-hover:  rgba(94, 138, 168, 0.34);
  --border-accent: hsl(var(--hue), var(--sat), 52%, 0.36);
  --shadow-sm: 0 1px 2px rgba(46, 56, 73, 0.07);
  --shadow:    0 6px 22px rgba(46, 56, 73, 0.08);
  --shadow-lg: 0 18px 44px rgba(46, 56, 73, 0.14);

  /* Painting accents (Giverny) */
  --giverny-pond:  #5e8aa8;
  --giverny-leaf:  #7e9d6c;
  --giverny-wisteria: #a78dbc;
  --giverny-sun:   #f1c25c;
  --giverny-rose:  #e0a8a4;
  --giverny-paper: #faf5ea;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r:    14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* Type */
  --font:        'Manrope', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --font-serif:  'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', serif;
  --font-mono:   ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing */
  --pad-page: clamp(16px, 3vw, 28px);
  --gap: clamp(12px, 1.6vw, 18px);

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   120ms;
  --dur:        220ms;
  --dur-slow:   380ms;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg-0: #0f141c;
  --bg-1: #161d28;
  --bg-2: #1c2533;
  --bg-3: #252f40;

  --accent:      hsl(var(--hue), calc(var(--sat) + 14%), 64%);
  --accent-fg:   #11161e;
  --accent-soft: hsl(var(--hue), calc(var(--sat) * 0.5), 22%);

  --text-1: #e9eef5;
  --text-2: #b6becd;
  --text-3: #7d8694;
  --text-muted: #5a6271;

  --border:       rgba(197, 216, 227, 0.10);
  --border-hover: rgba(197, 216, 227, 0.22);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.30);
  --shadow:    0 8px 26px rgba(0,0,0,0.36);
  --shadow-lg: 0 18px 44px rgba(0,0,0,0.46);
}

*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: hidden; }
html, body { margin: 0; min-height: 100vh; min-height: 100dvh; }

body {
  position: relative;
  overflow-x: hidden;
  color: var(--text-1);
  background-color: var(--bg-0);
  background-image:
    radial-gradient(ellipse 1100px 700px at 12% -8%,  rgba(167, 141, 188, 0.18), transparent 62%),
    radial-gradient(ellipse 900px 560px at 102% 18%, rgba(94, 138, 168, 0.18), transparent 64%),
    radial-gradient(ellipse 1000px 600px at 50% 110%, rgba(126, 157, 108, 0.14), transparent 60%);
  background-attachment: fixed;
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Daily impressionist wallpaper — painted lightly underneath everything.
   Reads from --wallpaper-url set by util/wallpaper.js at boot. */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: var(--wallpaper-url, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.18;
  filter: saturate(1.05);
  mix-blend-mode: multiply;
}
html[data-theme="dark"] body::after {
  opacity: 0.22;
  mix-blend-mode: screen;
}
body::before {
  content: '';
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.18  0 0 0 0 0.22  0 0 0 0 0.28  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 240px 240px;
  mix-blend-mode: multiply;
  opacity: 0.42;
}
html[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.15; }

a { color: var(--accent); text-decoration: none; transition: color var(--dur-fast); }
a:hover { color: color-mix(in srgb, var(--accent) 80%, var(--giverny-wisteria)); }

button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; background: none; padding: 0; }
input, textarea, select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--text-1);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

img { max-width: 100%; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  letter-spacing: -0.005em;
  font-feature-settings: 'liga' on, 'kern' on, 'onum' on;
  margin: 0;
  color: var(--text-1);
}
h1 { font-size: clamp(28px, 3vw, 38px); font-weight: 600; }
h2 { font-size: clamp(22px, 2.2vw, 28px); font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
h4 { font-size: 16px; font-weight: 600; }

.muted { color: var(--text-3); }
.empty {
  color: var(--text-3);
  font-style: italic;
  font-family: var(--font-serif);
  margin: 12px 0;
}
.loading {
  color: var(--text-3);
  font-family: var(--font-serif);
  font-style: italic;
}

::selection {
  background: var(--accent-glow);
  color: var(--text-1);
}
