/* =========================================================
   Orpheus — shared styles
   Warm-modern, off-black canvas, bone/cream panels, terracotta accent
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  /* canvas + surfaces */
  --bg:        #14110E;
  --bg-elev:   #1C1814;
  --bg-card:   #241F19;
  --bg-inset:  #0F0D0B;

  /* text */
  --fg:        #F4EDE0;
  --fg-dim:    #B8ADA0;
  --fg-mute:   #7A7369;
  --fg-faint:  #4A443D;

  /* accents */
  --accent:        oklch(0.68 0.14 40);       /* terracotta */
  --accent-hi:     oklch(0.74 0.14 40);
  --accent-lo:     oklch(0.55 0.12 40);
  --accent-wash:   oklch(0.68 0.14 40 / 0.12);

  --cream:     #E8DFCE;
  --marble:    linear-gradient(135deg, #F4EDE0 0%, #E8DFCE 40%, #D9CDB6 100%);

  /* borders */
  --hair:      rgba(244, 237, 224, 0.08);
  --hair-hi:   rgba(244, 237, 224, 0.14);
  --hair-lo:   rgba(244, 237, 224, 0.04);

  /* radii */
  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;

  /* type */
  --f-display: 'Instrument Serif', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
  --f-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
  overscroll-behavior-y: none;
}

html { overflow-x: clip; }

body {
  min-height: 100vh;
  overflow-x: clip;
  overflow-y: visible;
}

/* subtle warm grain across the whole doc */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.68 0.14 40 / 0.08), transparent 60%),
    radial-gradient(800px 500px at -10% 30%, oklch(0.62 0.08 60 / 0.05), transparent 60%);
}

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

a { color: inherit; text-decoration: none; }

/* ---------- typography ---------- */
.display {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.02;
  text-wrap: balance;
}

.mono { font-family: var(--f-mono); }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.01em; }

/* ---------- layout primitives ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 2; }
.stack-2 > * + * { margin-top: 8px; }
.stack-3 > * + * { margin-top: 16px; }
.stack-4 > * + * { margin-top: 24px; }

.divider {
  height: 1px;
  background: var(--hair);
  border: 0;
  margin: 0;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: transparent;
  color: var(--fg);
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--cream);
  color: #1A1611;
  border-color: var(--cream);
}
.btn-primary:hover:not(:disabled) {
  background: var(--fg);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px oklch(0.68 0.14 40 / 0.5);
}

.btn-accent {
  background: var(--accent);
  color: #1A1611;
  border-color: var(--accent);
}
.btn-accent:hover:not(:disabled) {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  transform: translateY(-1px);
  box-shadow: 0 10px 30px -10px oklch(0.68 0.14 40 / 0.5);
}

.btn-ghost {
  background: transparent;
  border-color: var(--hair-hi);
  color: var(--fg);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-elev);
  border-color: var(--hair-hi);
}

.btn-icon {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--hair);
  background: var(--bg-elev);
  color: var(--fg-dim);
}
.btn-icon:hover:not(:disabled) {
  color: var(--fg);
  border-color: var(--hair-hi);
}

.btn-lg { padding: 15px 26px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 12px;
  color: var(--fg-dim);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.field .hint { font-size: 11px; color: var(--fg-mute); }

.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-inset);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-mute); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23B8ADA0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.select option { background: var(--bg-elev); color: var(--fg); }

/* sliders */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-inset);
  border: 1px solid var(--hair);
  border-radius: 999px;
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: transform 0.15s var(--ease);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--cream);
  border: 2px solid var(--accent);
  cursor: pointer;
}

/* ---------- cards ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-inset {
  background: var(--bg-inset);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--hair);
  color: var(--fg-dim);
}
.badge-accent {
  background: var(--accent-wash);
  border-color: oklch(0.68 0.14 40 / 0.35);
  color: var(--accent-hi);
}
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  border: 1px solid var(--hair-hi);
  color: var(--fg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { border-color: oklch(0.65 0.15 25 / 0.5); }

/* ---------- spinner ---------- */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(26, 22, 17, 0.2);
  border-top-color: #1A1611;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-light {
  border-color: rgba(244, 237, 224, 0.2);
  border-top-color: var(--fg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- util ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; }
.muted { color: var(--fg-mute); }
.dim { color: var(--fg-dim); }
.accent { color: var(--accent-hi); }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
