:root {
  --bg: #fff8ef;
  --bg-alt: #fbeedd;
  --card: #ffffff;
  --ink: #2e1d16;
  --ink-soft: #6b5247;
  --accent: #c2502a;
  --accent-ink: #ffffff;
  --line: #ecd9c3;
  --dog: #b9542b;
  --dog-shade: #8e3b1c;
  --dog-ink: #5a2412;
  --nose: #24150f;
  --shadow: 0 6px 20px rgba(110, 50, 20, 0.08);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1411;
    --bg-alt: #261a16;
    --card: #2d201b;
    --ink: #f6e9df;
    --ink-soft: #c9b2a5;
    --accent: #e8774d;
    --accent-ink: #1d1411;
    --line: #42302a;
    --dog: #cf6a3e;
    --dog-shade: #9d4524;
    --dog-ink: #3b170a;
    --nose: #120a07;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1d1411;
  --bg-alt: #261a16;
  --card: #2d201b;
  --ink: #f6e9df;
  --ink-soft: #c9b2a5;
  --accent: #e8774d;
  --accent-ink: #1d1411;
  --line: #42302a;
  --dog: #cf6a3e;
  --dog-shade: #9d4524;
  --dog-ink: #3b170a;
  --nose: #120a07;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 0.8em; }

a { color: var(--accent); }

button {
  font: inherit;
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 0.7em 1.5em;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease;
}
button:hover { transform: translateY(-2px); }
button:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Hero ---------- */

/* The hero is taller than the screen; its content stays pinned
   (sticky) while you scroll through it, so the dog stretches in view. */
.hero {
  height: 200vh;
  background:
    radial-gradient(circle at 20% 8%, var(--bg-alt) 0 9%, transparent 9.5%),
    radial-gradient(circle at 85% 15%, var(--bg-alt) 0 6%, transparent 6.5%),
    var(--bg);
}

.hero-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 560px;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.nav {
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding: 0 16px;
  font-weight: 700;
}
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover { color: var(--accent); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 48px 0 8px;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  font-weight: 700;
}
h1 span { color: var(--accent); }

.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 34ch;
}

.hero-dog {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 24px 0 12px;
  cursor: pointer;
}

.speech {
  min-height: 1.6em;
  font-family: "Fredoka", sans-serif;
  font-size: 1.3rem;
  color: var(--accent);
  margin-top: 12px;
}

/* ---------- The dog ---------- */

.doxie {
  display: flex;
  align-items: stretch;
  height: 140px;
  max-width: 100%;
  filter: drop-shadow(0 8px 6px rgba(80, 30, 10, 0.18));
}
.doxie svg { height: 100%; flex: none; display: block; }
.doxie-rear { width: 90px; }
.doxie-front { width: 150px; }

.doxie-middle {
  position: relative;
  width: var(--length, 60px);
  flex: none;
  transition: width 0.08s linear;
}
.doxie-middle span {
  position: absolute;
  left: -1px;
  right: -1px;
  top: 50px;
  height: 50px;
  background: var(--dog);
}

.tail {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  animation: wag 0.9s ease-in-out infinite;
}
.doxie.excited .tail { animation-duration: 0.25s; }
.ear {
  transform-box: fill-box;
  transform-origin: 50% 0;
}
.doxie.excited .ear { animation: flop 0.25s ease-in-out infinite; }

@keyframes wag {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(10deg); }
}
@keyframes flop {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-8deg); }
}

/* ---------- Sections ---------- */

.section {
  max-width: 1040px;
  margin: 0 auto;
  padding: 72px 16px;
}
.section:nth-of-type(even) {
  max-width: none;
  background: var(--bg-alt);
}
.section:nth-of-type(even) > * {
  max-width: 1008px;
  margin-left: auto;
  margin-right: auto;
}

.intro { color: var(--ink-soft); max-width: 60ch; }
.note { color: var(--ink-soft); font-size: 0.9rem; margin-top: 20px; }

.grid { display: grid; gap: 18px; margin-top: 24px; }
.grid.two { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .grid.two { grid-template-columns: 1fr; } }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.card, .swatch {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card p, .swatch p { color: var(--ink-soft); margin: 0; }

.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
.sizes div {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 2px dashed var(--line);
}
.sizes strong { font-family: "Fredoka", sans-serif; color: var(--accent); }
.sizes span { color: var(--ink-soft); }

.chip {
  height: 90px;
  border-radius: 12px;
  margin-bottom: 14px;
  background: var(--chip);
}
.chip.shaded {
  background:
    linear-gradient(180deg, rgba(40, 18, 8, 0.55) 0%, rgba(40, 18, 8, 0) 55%),
    repeating-linear-gradient(100deg, rgba(30, 12, 6, 0.25) 0 2px, transparent 2px 7px),
    var(--chip);
}

/* ---------- Doxie-meter ---------- */

#meter { text-align: center; }
#meter .intro { margin: 0 auto; }
.meter-dog {
  display: flex;
  justify-content: center;
  margin: 32px 0 16px;
  overflow: hidden;
}
.meter-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
}
.meter-control input { width: min(420px, 70vw); accent-color: var(--accent); }
.meter-readout {
  font-family: "Fredoka", sans-serif;
  font-size: 1.3rem;
  margin-top: 12px;
  min-height: 1.6em;
}

/* ---------- Facts ---------- */

.facts { text-align: center; }
.fact {
  max-width: 46ch;
  margin: 16px auto 24px;
  font-size: 1.2rem;
  min-height: 3.4em;
}

/* ---------- Quiz ---------- */

.quiz-box {
  max-width: 640px;
  margin-top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.quiz-progress { color: var(--ink-soft); font-weight: 700; margin-bottom: 4px; }
.quiz-question { font-family: "Fredoka", sans-serif; font-size: 1.3rem; margin-bottom: 16px; }
.quiz-options { display: grid; gap: 10px; }
.quiz-options button {
  text-align: left;
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  border: 2px solid var(--line);
  box-shadow: none;
  font-family: "Nunito", sans-serif;
  font-weight: 700;
}
.quiz-options button:hover:not(:disabled) { border-color: var(--accent); }
.quiz-options button:disabled { cursor: default; transform: none; }
.quiz-options button.right { border-color: #3b9b5a; background: rgba(59, 155, 90, 0.15); }
.quiz-options button.wrong { border-color: #c0392b; background: rgba(192, 57, 43, 0.12); }
.quiz-feedback { margin: 16px 0 0; min-height: 1.6em; color: var(--ink-soft); }
.quiz-next { margin-top: 12px; }

/* ---------- Footer ---------- */

.footer {
  text-align: center;
  padding: 48px 16px 40px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}
.footer-dog { display: flex; justify-content: center; transform: scale(0.6); margin: -20px 0 -20px; }

/* ---------- Small screens ---------- */

@media (max-width: 520px) {
  .doxie { height: 112px; }
  .doxie-rear { width: 72px; }
  .doxie-front { width: 120px; }
  .doxie-middle span { top: 40px; height: 40px; }
  .section { padding: 56px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero { height: auto; }
  .hero-inner { position: static; }
  .tail, .doxie.excited .tail, .doxie.excited .ear { animation: none; }
  .doxie-middle { transition: none; }
  button { transition: none; }
}
