/* ============================================================
   poopy.baby — Warm, 3 AM-Friendly Design System
   Zero external dependencies, mobile-first, high contrast
   ============================================================ */

:root {
  --bg: #faf7f2;
  --bg-tinted: #f2ece2;
  --surface: #ffffff;
  --surface-alt: #f8f4ed;
  --border: #e5dccf;
  --text: #25211e;
  --text-muted: #5f564e;
  --accent: #3d6b59;
  --accent-hover: #2f5546;
  --accent-soft: #e6f0ec;
  --warm: #b56537;
  --warm-soft: #f9ebe2;
  --alert: #b43e3e;
  --alert-soft: #fbeaea;
  --warn: #9a6518;
  --warn-soft: #fdf3dc;
  --ok: #2f6b4f;
  --ok-soft: #e4f3eb;
  --shadow: 0 8px 28px rgba(37, 33, 30, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-rounded, "Hiragino Maru Gothic ProN", Quicksand, Comfortaa, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* 3 AM Nursery Night Mode — low blue light, warm amber/espresso tones */
[data-theme="night"] {
  --bg: #151210;
  --bg-tinted: #1c1815;
  --surface: #221d19;
  --surface-alt: #2a241f;
  --border: #3a312a;
  --text: #eadfd1;
  --text-muted: #b0a191;
  --accent: #74a992;
  --accent-hover: #8bc0a9;
  --accent-soft: #22342c;
  --warm: #de8d5c;
  --warm-soft: #38251a;
  --alert: #e57979;
  --alert-soft: #3a2020;
  --warn: #e0b05c;
  --warn-soft: #362a16;
  --ok: #78b896;
  --ok-soft: #1d3126;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  border-radius: 8px;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 1.1rem;
}

.brand-dot {
  color: var(--accent);
}

.main-nav {
  display: none;
  gap: 1.25rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.94rem;
}

.main-nav a:hover {
  color: var(--accent);
}

.night-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.night-toggle:hover {
  border-color: var(--accent);
}

.night-toggle:active {
  transform: scale(0.97);
}

/* Hero */
.hero {
  padding: 3.5rem 0 2.75rem;
  text-align: center;
}

.hero-inner {
  max-width: 720px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 0.85rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 6vw, 3.25rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
}

.hero-sub {
  margin: 0 auto 1.75rem;
  max-width: 580px;
  color: var(--text-muted);
  font-size: 1.08rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.hero-note {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.78rem 1.35rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.96rem;
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

[data-theme="night"] .btn-primary {
  color: #101915;
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Sections */
.section {
  padding: 3.25rem 0;
}

.section-tinted {
  background: var(--bg-tinted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  margin-bottom: 1.5rem;
}

.section-head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.5vw, 2.1rem);
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--text-muted);
  max-width: 640px;
}

/* Medical Banner */
.medical-banner {
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--warm);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.medical-banner strong {
  color: var(--text);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}

.filter-pill {
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-pill.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

[data-theme="night"] .filter-pill.is-active {
  color: #101915;
}

.filter-pill-alert.is-active {
  background: var(--alert);
  border-color: var(--alert);
  color: #fff;
}

/* Decoder Layout */
.decoder-layout {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
  align-items: start;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 0.85rem;
}

.swatch-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 0.95rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.swatch-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.swatch-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.swatch-blob {
  width: 48px;
  height: 48px;
  border-radius: 50% 46% 52% 48% / 48% 52% 48% 52%;
  margin-bottom: 0.7rem;
  border: 2px solid rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.swatch-blob.texture-seedy::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 25% 35%, rgba(255, 248, 210, 0.85) 2px, transparent 2.5px),
    radial-gradient(circle at 65% 28%, rgba(255, 248, 210, 0.8) 1.8px, transparent 2.3px),
    radial-gradient(circle at 48% 68%, rgba(255, 248, 210, 0.85) 2.2px, transparent 2.8px),
    radial-gradient(circle at 74% 62%, rgba(255, 248, 210, 0.75) 1.7px, transparent 2.2px);
}

.swatch-blob.texture-pebbles::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 30% 35%, rgba(0, 0, 0, 0.28) 5px, transparent 6px),
    radial-gradient(circle at 68% 40%, rgba(0, 0, 0, 0.25) 4.5px, transparent 5.5px),
    radial-gradient(circle at 48% 72%, rgba(0, 0, 0, 0.28) 5px, transparent 6px);
}

.swatch-blob.texture-watery::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.45);
}

.swatch-blob.texture-streaks::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -35deg,
    transparent 0 8px,
    rgba(190, 28, 28, 0.85) 8px 11px
  );
}

.swatch-title {
  font-weight: 700;
  font-size: 0.96rem;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.status-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.status-watch {
  background: var(--warn-soft);
  color: var(--warn);
}

.status-alert {
  background: var(--alert-soft);
  color: var(--alert);
}

/* Detail Panel */
.detail-panel {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 84px;
}

.detail-placeholder {
  text-align: center;
  padding: 2rem 0.5rem;
  color: var(--text-muted);
}

.detail-placeholder-icon {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-header .swatch-blob {
  margin-bottom: 0;
  width: 56px;
  height: 56px;
}

.detail-header h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.detail-block {
  margin-bottom: 1rem;
}

.detail-block h4 {
  margin: 0 0 0.3rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.detail-block p {
  margin: 0;
  font-size: 0.95rem;
}

.detail-call-box {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin: 1rem 0;
  font-size: 0.9rem;
}

.detail-call-box.is-alert {
  background: var(--alert-soft);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--alert) 35%, transparent);
}

.detail-call-box.is-watch {
  background: var(--warn-soft);
  color: var(--text);
}

.detail-call-box.is-ok {
  background: var(--ok-soft);
  color: var(--text);
}

.detail-gear-tip {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.detail-gear-tip span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Calculator */
.calc-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.calc-card {
  padding: 1.5rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.field-group {
  margin-bottom: 1.35rem;
}

.field-group:last-child {
  margin-bottom: 0;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.45rem;
}

.field-label-row label,
.group-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
}

.group-title {
  margin-bottom: 0.55rem;
}

.field-value {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.94rem;
}

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

.range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.tier-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.tier-option {
  cursor: pointer;
}

.tier-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tier-box {
  display: flex;
  flex-direction: column;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  transition: all 0.15s ease;
}

.tier-box strong {
  font-size: 0.9rem;
}

.tier-box small {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.tier-option input:checked + .tier-box {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Calculator Results */
.result-hero {
  text-align: center;
  padding-bottom: 1.15rem;
  margin-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.result-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.result-big {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1.1;
  margin: 0.25rem 0;
}

.result-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.stat-box {
  text-align: center;
  padding: 0.75rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.stat-num {
  display: block;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.fun-fact {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.registry-cta {
  padding: 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}

.cta-pill {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.registry-cta h3 {
  margin: 0 0 0.35rem;
  font-size: 1.08rem;
}

.registry-cta p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.registry-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* Survival Kit */
.affiliate-disclosure {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.kit-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.kit-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.kit-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
}

.kit-cat {
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kit-badge {
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: var(--warm-soft);
  color: var(--warm);
}

.kit-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1.04rem;
  line-height: 1.3;
}

.kit-card p {
  margin: 0 0 1.15rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.kit-card .btn {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

/* FAQ */
.faq-container {
  max-width: 780px;
}

.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-item {
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
}

.faq-item summary {
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* Footer */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner {
  display: grid;
  gap: 1.5rem;
}

.footer-brand strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
}

.footer-brand p,
.footer-legal p {
  margin: 0.35rem 0;
}

.footer-meta {
  margin-top: 0.9rem !important;
  opacity: 0.85;
}

/* Responsive Breakpoints */
@media (min-width: 768px) {
  .main-nav {
    display: flex;
  }

  .decoder-layout {
    grid-template-columns: 1.35fr 1fr;
  }

  .calc-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .footer-inner {
    grid-template-columns: 1fr 2fr;
  }
}
