/* ============================================================
   Flickwick Design System — Gallery-White Tokens
   ============================================================
   Applies to app chrome only.
   Reading view (read.html) and shared view (shared.html) are EXEMPT.
   ============================================================ */

/* ── FONTS ─────────────────────────────────────────────────── */
/* Lora — body (warm readable serif, storybook feel) */
/* Crimson Pro — display/hero (softer serif, storybook chapter-title feel) */
/* DM Mono — utility text (timestamps, metadata only) */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
  /* Force dark mode regardless of system preference */
  color-scheme: dark;

  /* Typography */
  --font-sans: "Lora", Georgia, serif;
  --font-serif: "Crimson Pro", Georgia, serif;
  --font-mono: "DM Mono", "JetBrains Mono", ui-monospace, monospace;
  --font-utility: "Lora", Georgia, serif;

  /* Colors — Dark (only mode) — warm brown-charcoal, old leather book */
  --color-background: #1A1614;
  --color-background-muted: #211E1A;
  --color-foreground: #F5F0E6;
  --color-foreground-muted: rgba(245,240,230,0.65);
  --color-foreground-subtle: rgba(245,240,230,0.45);
  --color-border: rgba(245,240,230,0.08);

  /* Accent palette */
  --color-forest: #A3C4A9;
  --color-dijon: #E0B96A;
  --color-walnut: #B08868;

  /* Accent tints (8–14% opacity for pill backgrounds) */
  --color-forest-tint: rgba(163,196,169,0.12);
  --color-dijon-tint: rgba(224,185,106,0.12);
  --color-walnut-tint: rgba(176,136,104,0.12);

  /* Radii — softer edges */
  --radius-sm: 0.5rem;    /* 8px */
  --radius-md: 0.625rem;  /* 10px */
  --radius-lg: 0.75rem;   /* 12px */
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.75;
  background: var(--color-background);
  color: var(--color-foreground);
}

/* ── TYPOGRAPHY UTILITIES ──────────────────────────────────── */

/* Signature section eyebrow: utility Lora, 12px, uppercase, tracked */
.eyebrow {
  font-family: var(--font-utility);
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-foreground-subtle);
  line-height: 1.4;
}

/* Mono utility text — for numbers, dates, status, metadata, table headers */
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Body muted text */
.text-muted {
  color: var(--color-foreground-muted);
}

.text-subtle {
  color: var(--color-foreground-subtle);
}

/* ── BUTTONS ───────────────────────────────────────────────── */

/* Primary: bg-foreground text-background, 36px tall, rounded-sm */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  height: 36px;
  padding: 0 1.25rem;
  background: var(--color-foreground);
  color: var(--color-background);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

/* Ghost / outline button */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  height: 36px;
  padding: 0 1.25rem;
  background: transparent;
  color: var(--color-foreground-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}
.btn-ghost:hover {
  color: var(--color-foreground);
  border-color: var(--color-border);
}
.btn-ghost:active { transform: scale(0.98); }

/* Small button (inline actions) */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  height: 30px;
  padding: 0 0.85rem;
  background: transparent;
  color: var(--color-foreground-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.btn-sm:hover {
  color: var(--color-foreground);
  border-color: var(--color-border);
}
.btn-sm.active {
  background: var(--color-foreground);
  color: var(--color-background);
  border-color: var(--color-foreground);
}

/* ── STATUS PILLS ──────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 9999px;
  white-space: nowrap;
}
.pill-forest {
  color: var(--color-forest);
  background: var(--color-forest-tint);
}
.pill-dijon {
  color: var(--color-dijon);
  background: var(--color-dijon-tint);
}
.pill-walnut {
  color: var(--color-walnut);
  background: var(--color-walnut-tint);
}

/* ── CARDS ─────────────────────────────────────────────────── */
/* Default: no border, no shadow, no fill. Whitespace separates. */
/* If grouping is ambiguous: hairline OR muted bg — never both. */
.card {
  border-radius: var(--radius-lg);
}
.card-hairline {
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
}
.card-muted {
  background: var(--color-background-muted);
  border-radius: var(--radius-lg);
}

/* ── INPUTS ────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  background: var(--color-background);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus {
  border-color: var(--color-forest);
}
.input::placeholder {
  color: var(--color-foreground-subtle);
}

/* Textarea */
.textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--color-background);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  resize: vertical;
  line-height: 1.55;
  transition: border-color 0.15s;
}
.textarea:focus {
  border-color: var(--color-forest);
}
.textarea::placeholder {
  color: var(--color-foreground-subtle);
}

/* ── NAV ───────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  border-bottom: 0.5px solid var(--color-border);
}
.nav-logo {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 15px;
  color: var(--color-foreground);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── HAIRLINE DIVIDER ──────────────────────────────────────── */
.divider {
  height: 0.5px;
  background: var(--color-border);
}

/* ── LOADING SPINNER ───────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--color-border);
  border-top-color: var(--color-forest);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL / OVERLAY ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-sheet {
  background: var(--color-background);
  border: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
}

/* ── BOTTOM SHEET ──────────────────────────────────────────── */
.bottom-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 50;
  align-items: flex-end;
  justify-content: center;
}
.bottom-sheet-overlay.active { display: flex; }

.bottom-sheet {
  background: var(--color-background);
  border-top: 0.5px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  padding: 1.25rem 1.5rem 2rem;
  max-height: 90vh;
  overflow-y: auto;
  animation: sheetUp 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes sheetUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.sheet-handle {
  width: 32px;
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto 1.25rem;
}

/* ── LINK STYLE ────────────────────────────────────────────── */
a {
  color: inherit;
  text-decoration-color: var(--color-border);
  text-underline-offset: 3px;
}

/* ── PAPER GRAIN NOISE OVERLAY ─────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}
