/* ============================================================
   The Wyrd — Shared Design Tokens & Utilities
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400&family=Inter:wght@300;400;500;600&display=swap');

/* ── Tokens ── */
:root {
  /* Dark mode (default) */
  --bg:         #0B0D0C;
  --bg-2:       #111413;
  --bg-3:       #161A18;
  --ink:        #E8E4DB;
  --ink-dim:    #9A958A;
  --rule:       #26201A;
  --accent:     #A68A4E;
  --accent-dim: #6E5A33;
  --moss:       #2E3A2B;
  --blood:      #5B2A23;
  --surface:    #141816;
  --surface-2:  #1C201E;
  --danger:     #8B3A35;
  --success:    #3A6B3A;
}

[data-theme="light"] {
  --bg:         #F5F0E8;
  --bg-2:       #EDE8DF;
  --bg-3:       #E5DFD4;
  --ink:        #1A1612;
  --ink-dim:    #6B6358;
  --rule:       #D4CCC0;
  --accent:     #8B6E30;
  --accent-dim: #A68A4E;
  --moss:       #4A6B45;
  --blood:      #7A3B32;
  --surface:    #EDE8DF;
  --surface-2:  #E5DFD4;
  --danger:     #8B3A35;
  --success:    #3A6B3A;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 300;
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* Grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ── Typography ── */
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent-dim); transition: color .2s, border-color .2s; }
a:hover { color: var(--accent); border-color: var(--accent); }

.serif { font-family: 'Cormorant Garamond', serif; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
}
.label {
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent-dim);
}

/* ── Layout ── */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 2; }
.wrap-narrow { max-width: 560px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 2; }

/* ── Nav ── */
.wyrd-nav {
  padding: 20px 0 28px;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0;
  z-index: 100;
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; }
.brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  color: var(--ink);
}
.brand em { font-style: italic; color: var(--accent); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-links { display: flex; gap: 24px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.nav-links a { border: none; color: var(--ink-dim); }
.nav-links a:hover, .nav-links a.active { color: var(--accent); }

/* ── Theme toggle ── */
.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 13px;
  transition: all .2s;
  border-radius: 2px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all .2s;
  border-bottom: 1px solid var(--accent);
}
.btn:hover { background: var(--accent); color: var(--bg); }
.btn.primary { background: var(--accent); color: var(--bg); }
.btn.primary:hover { background: transparent; color: var(--accent); }
.btn.ghost { border-color: var(--rule); color: var(--ink-dim); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--ink); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 8px 16px; font-size: 11px; }

/* ── Form elements ── */
.field { margin-bottom: 24px; }
.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 8px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 300;
  outline: none;
  transition: border-color .2s;
  border-radius: 2px;
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--accent); }
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-dim); opacity: 0.6; }
.field textarea { resize: vertical; min-height: 120px; }
.field-hint { font-size: 13px; color: var(--ink-dim); margin-top: 6px; }
.field-error { font-size: 13px; color: var(--danger); margin-top: 6px; }

/* ── Cards / Surfaces ── */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 28px;
}
.card-sm { padding: 20px; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--rule); margin: 32px 0; }

/* ── Status / Alerts ── */
.alert {
  padding: 14px 18px;
  border-left: 2px solid var(--accent);
  background: var(--surface);
  font-size: 14px;
  color: var(--ink-dim);
  margin-bottom: 24px;
}
.alert.error { border-color: var(--danger); color: var(--danger); }
.alert.success { border-color: var(--success); color: var(--ink); }

/* ── Footer ── */
.wyrd-footer {
  padding: 40px 0;
  border-top: 1px solid var(--rule);
  text-align: center;
}
.wyrd-footer .meta {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-dim);
}
.rune { color: var(--accent); margin: 0 10px; }

::selection { background: var(--accent); color: var(--bg); }
