/* ── Wild Tracks Studio — neumorphic soft-UI theme ──────────────────
   Based on dev_references/neumorphic-DESIGN.md, re-accented with
   soaringwild.org's amber (#D7B864). */

:root {
  --bg: #f4f6f8;
  --surface: #f4f6f8;
  --text: #2c2c2c;
  --text-muted: #8a9bb0;
  --accent: #d7b864;
  --accent-text: #2c2c2c;
  --accent-deep: #b3944a;
  --section-dark: #2e3820;
  --shadow-light: #ffffff;
  --shadow-dark: #d1d9e6;
  --danger: #c0564e;
  --radius: 20px;
  --radius-sm: 10px;
  --space: 0.5rem;
  --nav-h: 60px;
  --z-sticky: 100;
  --z-overlay: 200;
  --z-modal: 300;
  --z-toast: 500;
  --neu-out: -6px -6px 14px var(--shadow-light), 6px 6px 14px var(--shadow-dark);
  --neu-out-sm: -3px -3px 7px var(--shadow-light), 3px 3px 7px var(--shadow-dark);
  --neu-in: inset -3px -3px 7px var(--shadow-light), inset 3px 3px 7px var(--shadow-dark);
}

:root[data-theme="dark"] {
  --bg: #1e2228;
  --surface: #1e2228;
  --text: #e8ecf0;
  --text-muted: #6b7a8d;
  --accent-text: #1e2228;
  --shadow-light: #262d36;
  --shadow-dark: #161c22;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1e2228;
    --surface: #1e2228;
    --text: #e8ecf0;
    --text-muted: #6b7a8d;
    --accent-text: #1e2228;
    --shadow-light: #262d36;
    --shadow-dark: #161c22;
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

h1 { font-size: 2.25rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.15rem; font-weight: 500; }
small, .small { font-size: 0.875rem; }
.muted { color: var(--text-muted); }
.mono { font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace; font-size: 0.85em; }

a { color: inherit; }

.hero-title {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

/* ── Layout ── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: clamp(2.5rem, 6vw, 5rem) 0;
}

/* ── Nav ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--bg);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  box-shadow: 0 4px 10px var(--shadow-dark);
}

.site-nav .container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
}

.nav-brand-group {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.15;
  margin-right: auto;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.nav-brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.nav-brand-sub:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-nav a.nav-link {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.site-nav a.nav-link:hover { color: var(--text); }

.site-nav a.nav-link.active {
  color: var(--text);
  box-shadow: var(--neu-in);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  box-shadow: var(--neu-out-sm);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow 0.2s ease-out, transform 0.2s ease-out, background 0.2s;
  user-select: none;
}

.btn:hover { box-shadow: var(--neu-out); }
.btn:active { transform: translateY(-1px); box-shadow: var(--neu-in); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover { background: var(--accent-deep); }

.btn-ghost {
  background: transparent;
  box-shadow: none;
  border: 1.5px solid var(--text-muted);
}

.btn-ghost:hover { background: color-mix(in srgb, var(--text-muted) 12%, transparent); box-shadow: none; }

.btn-icon {
  padding: 0.55rem;
  border-radius: 50%;
  width: 42px;
  height: 42px;
}

.btn.small { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.danger { color: var(--danger); }

.btn.toggled {
  box-shadow: var(--neu-in);
  color: var(--accent-deep);
}

:root[data-theme="dark"] .btn.toggled { color: var(--accent); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--neu-out);
  padding: 1.25rem;
}

.card-inset {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--neu-in);
  padding: 1rem;
}

/* ── Inputs ── */
label.field {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

input[type="text"],
input[type="number"] {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--neu-in);
  padding: 0.5rem 0.8rem;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
.btn:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Sliders ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--bg);
  box-shadow: var(--neu-in);
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--neu-out-sm);
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--neu-out-sm);
  border: none;
}

/* ── Chips / tags ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  box-shadow: var(--neu-out-sm);
  background: var(--bg);
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.chip.selected {
  box-shadow: var(--neu-in);
  color: var(--accent-deep);
}

:root[data-theme="dark"] .chip.selected { color: var(--accent); }

.chip.static { cursor: default; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(20, 24, 18, 0.45);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--neu-out);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Toast ── */
.toast-wrap {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--section-dark);
  color: #f4f6e8;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem;
  font-size: 0.9rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  animation: fade-up 0.3s ease-out;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.empty-state .icon { font-size: 2.5rem; }

/* ── Motion ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fade-up 0.42s ease-out both; }

.stagger > * { animation: fade-up 0.42s ease-out both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 80ms; }
.stagger > *:nth-child(3) { animation-delay: 160ms; }
.stagger > *:nth-child(4) { animation-delay: 240ms; }
.stagger > *:nth-child(5) { animation-delay: 320ms; }
.stagger > *:nth-child(6) { animation-delay: 400ms; }
.stagger > *:nth-child(n + 7) { animation-delay: 480ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Footer ── */
.site-footer {
  padding: 2rem 0 2.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer a { color: var(--text-muted); }

/* ── Utility ── */
.row { display: flex; align-items: center; gap: 0.75rem; }
.col { display: flex; flex-direction: column; gap: 0.75rem; }
.grow { flex: 1; }
.hidden { display: none !important; }
.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;
}
