/* ============================================================
   Bedtime Stories by Nana — shared design tokens & base styles
   Palette: night sky + lamplight, not a generic SaaS theme.
   ============================================================ */

:root {
  /* Color */
  --navy-deep: #0f1228;      /* darkest background, page edges */
  --navy: #171b3a;           /* primary background */
  --navy-soft: #222753;      /* raised surfaces: cards, inputs */
  --navy-line: #34386a;      /* hairline borders on dark surfaces */
  --amber: #f0a860;          /* lamplight accent — primary action */
  --amber-bright: #f6c98d;   /* hover state for amber */
  --amber-dim: #4a3a26;      /* amber used as a subtle wash/border on dark */
  --lavender: #a7a1d9;       /* secondary accent — links, quiet UI */
  --rose: #e39a93;           /* tertiary accent — used sparingly for warmth */
  --cream: #f6f0e4;          /* primary text on dark backgrounds */
  --cream-dim: #c9c3ae;      /* secondary text on dark backgrounds */
  --ink: #21243f;            /* primary text on light/cream surfaces */
  --ink-dim: #585c7c;        /* secondary text on light/cream surfaces */
  --danger: #e08e7d;

  /* Type */
  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-body: "Figtree", -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --content-max: 40rem;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 15% 0%, rgba(167, 161, 217, 0.10), transparent 60%),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(240, 168, 96, 0.08), transparent 60%),
    var(--navy);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  color: var(--cream);
}

p { margin: 0; line-height: 1.55; }

a { color: var(--lavender); text-decoration: none; }
a:hover { color: var(--amber-bright); }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--amber-bright);
  outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Shared layout shell ---------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.25rem 1.5rem 3.5rem;
}

.page-header {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream-dim);
  letter-spacing: 0.01em;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  color: var(--cream-dim);
}
.back-link:hover { color: var(--amber-bright); }
.back-link svg { width: 1em; height: 1em; }

.content {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---------- Stars background (decorative) ---------- */

.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--amber);
  color: #221708;
}
.btn-primary:hover { background: var(--amber-bright); }
.btn-primary:disabled {
  background: var(--navy-line);
  color: var(--cream-dim);
  cursor: not-allowed;
  transform: none;
}

.btn-quiet {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--navy-line);
}
.btn-quiet:hover { border-color: var(--lavender); color: var(--lavender); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(224, 142, 125, 0.4);
}
.btn-danger:hover { background: rgba(224, 142, 125, 0.12); }

.btn-block { width: 100%; }

/* ---------- Form fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field label {
  font-size: 0.9rem;
  color: var(--cream-dim);
}

.field input[type="text"],
.field input[type="email"] {
  background: var(--navy-soft);
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  color: var(--cream);
  font-size: 1rem;
  font-family: var(--font-body);
}
.field input::placeholder { color: var(--cream-dim); opacity: 0.7; }
.field input:focus { border-color: var(--amber); outline: none; }

input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
}

/* ---------- Cards / surfaces ---------- */

.card {
  background: var(--navy-soft);
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.hint {
  font-size: 0.88rem;
  color: var(--cream-dim);
}

.status-message {
  font-size: 0.92rem;
  color: var(--lavender);
}

.status-message.error { color: var(--danger); }

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--cream-dim);
  border: 1px dashed var(--navy-line);
  border-radius: var(--radius-lg);
}
.empty-state p:first-child {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--cream);
  margin-bottom: 0.5rem;
}

/* ---------- Utility ---------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon-btn {
  background: var(--navy-soft);
  border: 1px solid var(--navy-line);
  border-radius: 999px;
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
}
.icon-btn:hover { border-color: var(--amber); color: var(--amber-bright); }
.icon-btn svg { width: 1.3rem; height: 1.3rem; }
