/* ---------------------------------------------------------------
   Mac Dev Setup — Zoo Gardens Guide Map
   Design system implementation per DESIGN.md
   --------------------------------------------------------------- */

:root {
  /* Palette */
  --ground: #FAFBFC;
  --primary: #8ED462;
  --ink: #2C2E2A;
  --surface: #FFFFFF;
  --accent-yellow: #F5E211;
  --accent-coral: #FF705D;
  --accent-blue: #0066BB;
  --accent-lilac: #EBC1FF;

  /* Spacing */
  --unit: 1rem;
  --tight: 0.5rem;
  --standard: 1rem;
  --generous: 1.5rem;
  --section: 2rem;
  --extra-generous: 3rem;

  /* Layout */
  --max-width: 1200px;
  --measure: 65ch;
  --inline-padding: 1rem;
  --progress-rail-offset: 1.5rem;

  /* Motion */
  --ease-overshoot: cubic-bezier(0.19, 1, 0.22, 1);

  scrollbar-color: var(--ink) transparent;
  caret-color: var(--accent-yellow);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1E1F1C;
    --primary: #6BA045;
    --ink: #E8E9E4;
    --surface: #F5F1E4;
  }
}

@media (min-width: 769px) {
  :root {
    --inline-padding: 2rem;
    --section: 3rem;
    --extra-generous: 4rem;
  }
}

@media (max-width: 768px) {
  :root {
    --progress-rail-offset: 0.75rem;
  }
}

@media (max-width: 480px) {
  :root {
    --progress-rail-offset: 0.5rem;
  }
}

/* ---------------------------------------------------------------
   Base reset and craft floor
   --------------------------------------------------------------- */

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

html {
  overflow-x: clip;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }
}

p {
  text-wrap: pretty;
  margin: 0 0 var(--standard);
  max-width: var(--measure);
}

h1,
h2,
h3 {
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 700;
  margin-bottom: var(--standard);
  max-width: var(--measure);
}

h2 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 700;
  margin-bottom: var(--generous);
  max-width: var(--measure);
}

h3 {
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
  margin-top: var(--extra-generous);
  margin-bottom: var(--standard);
  max-width: var(--measure);
}

code {
  font-family: ui-monospace, "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
}

kbd {
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  background: var(--ink);
  color: var(--ground);
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

ul {
  max-width: var(--measure);
}

li {
  margin-bottom: var(--tight);
}

a {
  color: var(--accent-blue);
  text-underline-offset: 0.18em;
}

.lobe a {
  color: #003d7a;
}

::selection {
  background: var(--primary);
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid var(--accent-yellow);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------
   Lobes — organic sections with coastline edges
   --------------------------------------------------------------- */

.lobe {
  background: var(--primary);
  padding: var(--section) var(--inline-padding);
  max-width: var(--max-width);
  margin: 0 auto;
}

.lobe-header {
  border-radius: 0 0 48% 52% / 0 0 40px 60px;
  padding-top: var(--extra-generous);
  padding-bottom: var(--extra-generous);
}

.lobe-content {
  margin-top: 2rem;
  padding-top: var(--extra-generous);
  padding-bottom: var(--extra-generous);
}

.lobe-odd {
  border-radius: 52% 48% 48% 52% / 60px 40px 60px 40px;
}

.lobe-even {
  border-radius: 48% 52% 52% 48% / 40px 60px 40px 60px;
}

.lobe-footer {
  border-radius: 48% 52% 0 0 / 60px 40px 0 0;
  margin-top: 2rem;
  padding-top: var(--extra-generous);
  padding-bottom: var(--extra-generous);
}

.intro {
  font-size: 1.125rem;
  max-width: var(--measure);
  margin-bottom: 0;
}

/* Lobe entrance animation */
@media (prefers-reduced-motion: no-preference) {
  .lobe {
    animation: lobeEnter 0.6s var(--ease-overshoot) backwards;
  }

  .lobe-header {
    animation-delay: 0s;
  }

  .lobe-content:nth-of-type(1) {
    animation-delay: 0.1s;
  }

  .lobe-content:nth-of-type(2) {
    animation-delay: 0.2s;
  }

  .lobe-content:nth-of-type(3) {
    animation-delay: 0.3s;
  }

  .lobe-content:nth-of-type(4) {
    animation-delay: 0.4s;
  }

  .lobe-content:nth-of-type(5) {
    animation-delay: 0.5s;
  }

  .lobe-footer {
    animation-delay: 0.6s;
  }

  @keyframes lobeEnter {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* ---------------------------------------------------------------
   Progress rail and capsules
   --------------------------------------------------------------- */

.progress-rail {
  position: fixed;
  left: var(--progress-rail-offset);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 100;
}

.progress-capsule {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--ground);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s var(--ease-overshoot);
  font-family: inherit;
  padding: 0;
}

@media (max-width: 768px) {
  .progress-capsule {
    width: 40px;
    height: 40px;
  }
}

.progress-capsule:hover {
  transform: scale(1.08);
}

.progress-capsule.active {
  background: var(--accent-yellow);
}

.capsule-label {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
}

@media (max-width: 768px) {
  .capsule-label {
    font-size: 14px;
  }
}

.capsule-chip {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0;
  transition: opacity 0.4s var(--ease-overshoot);
}

.progress-capsule.active .capsule-chip {
  opacity: 1;
}

/* ---------------------------------------------------------------
   Section headers and step badges
   --------------------------------------------------------------- */

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--generous);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--accent-yellow);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .step-badge {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
}

.section-header h2 {
  margin: 0;
}

/* ---------------------------------------------------------------
   Command windows — punched white rectangles
   --------------------------------------------------------------- */

.command-window {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin: var(--generous) 0;
  box-shadow: 0 4px 12px rgba(44, 46, 42, 0.12);
  max-width: var(--measure);
}

.command-window pre {
  margin: 0;
  overflow-x: auto;
}

.command-window code {
  display: block;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .command-window code {
    color: var(--ground);
  }
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--ground);
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
  min-height: 32px;
  min-width: 60px;
}

.copy-btn:hover {
  transform: scale(1.05);
}

.copy-btn:active {
  transform: scale(0.95);
}

/* ---------------------------------------------------------------
   Checklists
   --------------------------------------------------------------- */

.checklist {
  display: flex;
  flex-direction: column;
  gap: var(--tight);
  margin-top: var(--generous);
  max-width: var(--measure);
}

.checklist label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 16px;
  cursor: pointer;
}

.checklist input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  min-height: 20px;
  accent-color: var(--accent-yellow);
}

/* ---------------------------------------------------------------
   Smooth scroll
   --------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ---------------------------------------------------------------
   Print stylesheet
   --------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    padding: 0;
  }

  .progress-rail {
    display: none;
  }

  .lobe {
    background: transparent;
    border-radius: 0;
    page-break-inside: avoid;
    padding: 1rem 0;
  }

  .lobe-header {
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
  }

  .command-window {
    background: #f5f5f5;
    border: 1px solid #ccc;
    page-break-inside: avoid;
    padding: 0.75rem;
  }

  .copy-btn {
    display: none;
  }

  h1 {
    font-size: 24pt;
  }

  h2 {
    font-size: 18pt;
  }

  h3 {
    font-size: 14pt;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
  }
}
@media (max-width: 480px) {
  /* --impeccable-mobile-pad */
  body { padding-inline: max(1rem, 16px); }
  .container, [class*="container"], section, header, footer, nav, main, article {
    padding-inline: max(1rem, 16px);
  }
}
/* --impeccable-measure */
p, li, dt, dd, blockquote, figcaption, td, th { max-width: min(var(--measure), 100%); }
