/*
  Wine Notes — design tokens + app shell styles (M1-1)

  Token values are documented (with rationale) in docs/design-tokens.md.
  This file is the single implementation of those tokens as CSS custom
  properties — M2 onward should read from these vars rather than
  hardcoding new colors/spacing/radii/shadows.

  No webfont dependency: type is system-stack only, so it renders correctly
  offline on first load (Section 1's local-first guarantee), matching the
  "don't add dependencies unless there's a concrete requirement" rule.
*/

:root {
  /* Color — light (default) */
  --color-bg: #faf4eb;
  --color-surface: #fffdf9;
  --color-primary: #721e2a;
  --color-secondary: #b08947;
  --color-text: #2a201c;
  --color-text-muted: #7a6a63;
  --color-border: #e6dccd;

  /* Typography */
  --font-serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --text-display-size: 1.75rem;
  --text-display-weight: 600;
  --text-display-tracking: -0.01em;
  --text-display-line: 1.15;

  --text-heading-size: 1.25rem;
  --text-heading-weight: 600;
  --text-heading-tracking: 0em;
  --text-heading-line: 1.25;

  --text-body-size: 1rem;
  --text-body-weight: 400;
  --text-body-line: 1.5;

  --text-caption-size: 0.8rem;
  --text-caption-weight: 500;
  --text-caption-tracking: 0.01em;
  --text-caption-line: 1.4;

  /* Spacing — 4px base unit */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows — warm-tinted (mixed from the ink color, not neutral gray) */
  --shadow-sm: 0 1px 2px rgba(42, 32, 28, 0.08), 0 1px 1px rgba(42, 32, 28, 0.04);
  --shadow-md: 0 4px 12px rgba(42, 32, 28, 0.12), 0 2px 4px rgba(42, 32, 28, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1c1512;
    --color-surface: #241b17;
    --color-primary: #c9536a;
    --color-secondary: #d4b673;
    --color-text: #f2e9de;
    --color-text-muted: #b8a99c;
    --color-border: #3a2e28;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-body-size);
  font-weight: var(--text-body-weight);
  line-height: var(--text-body-line);
  -webkit-font-smoothing: antialiased;
}

.app-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.app-header__title {
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 5.5vw, var(--text-display-size));
  font-weight: var(--text-display-weight);
  letter-spacing: var(--text-display-tracking);
  line-height: var(--text-display-line);
  color: var(--color-primary);
  margin: 0;
  white-space: nowrap;
}

.app-header__title-link {
  text-decoration: none;
  display: block;
  min-width: 0;
  flex-shrink: 1;
  overflow: hidden;
}

.app-header__nav {
  margin-left: auto;
}

.app-header__nav-link {
  font-family: var(--font-sans);
  font-size: var(--text-caption-size);
  font-weight: var(--text-caption-weight);
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-header__nav-link:hover {
  color: var(--color-primary);
}

.app-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 var(--space-5) var(--space-6);
  text-align: center;
}

.app-footer__link {
  font-size: var(--text-caption-size);
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-footer__link:hover {
  color: var(--color-primary);
}

.app-main {
  padding: var(--space-5) var(--space-5);
  max-width: 640px;
  margin: 0 auto;
}

.scaffold-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.scaffold-card h2 {
  font-family: var(--font-serif);
  font-size: var(--text-heading-size);
  font-weight: var(--text-heading-weight);
  letter-spacing: var(--text-heading-tracking);
  line-height: var(--text-heading-line);
  margin-top: 0;
}

.scaffold-card ul {
  padding-left: 1.1rem;
  color: var(--color-text-muted);
}

.status-pill {
  font-family: var(--font-sans);
  font-size: var(--text-caption-size);
  font-weight: var(--text-caption-weight);
  letter-spacing: var(--text-caption-tracking);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.status-pill[data-state='ready'] {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
