/* ==========================================================================
   Dad's Manual — AI: styles
   Authored by Mark Bunce for BDD, built with Claude.
   Palette and typography from concept.md. Mobile-first.
   ========================================================================== */

/* Fonts */
@font-face {
  font-family: "Bungee";
  src: url("assets/fonts/Bungee-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Regular.ttf") format("truetype-variations"),
       url("assets/fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("assets/fonts/Caveat-Regular.ttf") format("truetype-variations"),
       url("assets/fonts/Caveat-Regular.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

/* Palette and type tokens */
:root {
  --cream: #f6f1e6;
  --plum: #2d1f2e;
  --orange-red: #d84527;     /* BDD primary, human side */
  --teal: #1e6b6b;           /* AI side */
  --muted: #8a7f78;
  --paper: #f6f1e6;          /* unified with cream: cards, heroes, and icon backgrounds share one colour. Cards defined by border, not contrast. */
  --rule: rgba(45, 31, 46, 0.45);   /* fine dark border for cards and heroes */

  --font-display: "Bungee", Impact, "Arial Black", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --font-script: "Caveat", "Brush Script MT", cursive;

  --w-content: 720px;
  --w-wide: 960px;
  --w-cover: 780px;

  --r-small: 6px;
  --r-card: 12px;
}

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;      /* room for sticky nav when anchor-jumping */
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--plum);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p { margin: 0 0 1em; }

h1, h2, h3, h4 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--plum);
  letter-spacing: -0.01em;
}

h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.08em; }

em { font-style: italic; }
strong { font-weight: 700; }

a {
  color: var(--orange-red);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 0.16em; }

ul, ol, dl {
  margin: 0 0 1.2em;
  padding: 0;
}

ul { padding-left: 1.2em; }
ol { padding-left: 1.4em; }

li { margin-bottom: 0.35em; }

blockquote {
  margin: 0 0 1.2em;
  padding: 0;
}

/* Cover banner */
.cover-banner {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem 1rem;
}

.cover-banner img {
  max-width: 100%;
  width: var(--w-cover);
  height: auto;
  box-shadow: 0 20px 60px -30px rgba(45, 31, 46, 0.35);
  border-radius: var(--r-card);
}

.opening-bookend {
  max-width: var(--w-content);
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.25rem;
  font-size: 1.35rem;
  line-height: 1.4;
  text-align: center;
  font-weight: 500;
  color: var(--plum);
}

/* Reading progress bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(45, 31, 46, 0.08);
  z-index: 20;
  pointer-events: none;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--orange-red);
  transition: width 60ms linear;
}

/* Animate-on-scroll base state */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.animate-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Equation staggered reveal */
.equation .eq-term,
.equation .eq-op {
  display: inline-block;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 380ms ease, transform 380ms ease;
  padding: 0 0.12em;
}

.equation.is-visible .eq-term,
.equation.is-visible .eq-op {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger: each subsequent term delayed a little more */
.equation.is-visible .equation-line:nth-child(1) > :nth-child(1)  { transition-delay: 0.00s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(2)  { transition-delay: 0.10s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(3)  { transition-delay: 0.20s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(4)  { transition-delay: 0.30s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(5)  { transition-delay: 0.40s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(6)  { transition-delay: 0.50s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(7)  { transition-delay: 0.60s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(8)  { transition-delay: 0.70s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(9)  { transition-delay: 0.80s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(10) { transition-delay: 0.90s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(11) { transition-delay: 1.00s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(12) { transition-delay: 1.10s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(13) { transition-delay: 1.20s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(14) { transition-delay: 1.30s; }
.equation.is-visible .equation-line:nth-child(1) > :nth-child(15) { transition-delay: 1.40s; }
.equation.is-visible .equation-line:nth-child(2) > :nth-child(1)  { transition-delay: 1.70s; }
.equation.is-visible .equation-line:nth-child(2) > :nth-child(2)  { transition-delay: 1.80s; }
.equation.is-visible .equation-line:nth-child(2) > :nth-child(3)  { transition-delay: 1.90s; }
.equation.is-visible .equation-line:nth-child(2) > :nth-child(4)  { transition-delay: 2.00s; }
.equation.is-visible .equation-line:nth-child(2) > :nth-child(5)  { transition-delay: 2.10s; }

.equation .eq-equals {
  font-weight: 700;
  color: var(--orange-red);
  font-size: 1.15em;
  padding: 0 0.35em;
}

.equation .eq-total,
.equation .eq-result {
  color: var(--orange-red);
  font-weight: 700;
}

.equation-line {
  margin: 0 0 0.6em;
  line-height: 2;
  font-size: 1rem;
}

.equation-line:last-child {
  margin-bottom: 0;
  padding-top: 0.5em;
  border-top: 1px dashed var(--rule);
}

/* Sticky nav */
.sticky-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 241, 230, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

.sticky-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
}

.sticky-nav a {
  color: var(--plum);
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  border-radius: var(--r-small);
}

.sticky-nav a:hover,
.sticky-nav a:focus {
  background: rgba(216, 69, 39, 0.1);
  color: var(--orange-red);
}

/* Main content */
main { padding-bottom: 3rem; }

main > section {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}

section#framework { max-width: var(--w-wide); }

.section-intro {
  color: var(--muted);
  font-size: 1.02rem;
  margin-bottom: 1.75rem;
}

/* Thesis */
.thesis .pull-quote {
  font-size: 1.3rem;
  line-height: 1.45;
  font-weight: 500;
  border-left: 4px solid var(--orange-red);
  padding: 0.25rem 0 0.25rem 1rem;
  margin: 0 0 1.75rem;
  color: var(--plum);
}

.equation {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 1.25rem 1rem;
  margin: 1.75rem 0;
  text-align: center;
  font-size: 0.98rem;
  line-height: 1.45;
}

.equation p {
  margin: 0 0 0.5em;
  letter-spacing: 0.01em;
}

.equation p:last-child { margin-bottom: 0; }

/* Hero pair (Dad + AI labelled) */
.hero-pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin: 0 0 2.5rem;
  align-items: start;
}

@media (min-width: 700px) {
  .hero-pair { grid-template-columns: 1fr 1fr; gap: 2rem; }
}

.hero-figure {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  max-width: 420px;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--cream);
}

.hero-pair figcaption {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Framework grid */
.blocks-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 800px) {
  .blocks-grid { grid-template-columns: 1fr 1fr; }
}

/* Individual block */
.block {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 1.5rem 1.35rem;
  position: relative;
  scroll-margin-top: 80px;
}

.block-icon {
  width: 64px;
  height: 64px;
  display: block;
  margin: 0 0 0.75rem;
  object-fit: contain;
}

.block h3 {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.block .hook {
  color: var(--muted);
  font-size: 1rem;
  margin: 0 0 1rem;
  line-height: 1.45;
}

/* Block bullets (Human / AI / Why) */
.block-bullets {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.75rem;
  margin: 0 0 1rem;
  font-size: 0.98rem;
}

.block-bullets dt {
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--plum);
  padding-top: 0.15rem;
  cursor: default;
  border-radius: var(--r-small);
  padding: 0.15rem 0.4rem;
  margin-left: -0.4rem;
  transition: background 140ms ease, color 140ms ease;
}

.block-bullets dd {
  margin: 0;
  padding: 0.15rem 0.4rem;
  border-radius: var(--r-small);
  transition: background 140ms ease;
}

.block-bullets .human-label { color: var(--orange-red); }
.block-bullets .ai-label    { color: var(--teal); }
.block-bullets .why-label   { color: var(--muted); }

/* Hover-parallel highlight: human hover lights the AI row, and vice versa */
.block-bullets:has(.human-label:hover) .ai-label,
.block-bullets:has(.human-label:hover) .ai,
.block-bullets:has(.human:hover) .ai-label,
.block-bullets:has(.human:hover) .ai {
  background: rgba(30, 107, 107, 0.12);
  color: var(--plum);
}

.block-bullets:has(.ai-label:hover) .human-label,
.block-bullets:has(.ai-label:hover) .human,
.block-bullets:has(.ai:hover) .human-label,
.block-bullets:has(.ai:hover) .human {
  background: rgba(216, 69, 39, 0.12);
  color: var(--plum);
}

/* Touch-device tap-to-highlight fallback (for devices without :hover) */
.block-bullets.force-human-hover .ai-label,
.block-bullets.force-human-hover .ai {
  background: rgba(30, 107, 107, 0.12);
  color: var(--plum);
}

.block-bullets.force-ai-hover .human-label,
.block-bullets.force-ai-hover .human {
  background: rgba(216, 69, 39, 0.12);
  color: var(--plum);
}

/* Extended Intent paragraph and footnote */
.block .extended {
  font-size: 0.98rem;
  margin: 0 0 0.75rem;
}

.block .footnote {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

/* Drill-down */
.drill-down {
  border-top: 1px dashed var(--rule);
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.drill-down summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--orange-red);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0;
  list-style: none;
  user-select: none;
}

.drill-down summary::-webkit-details-marker { display: none; }

.drill-down summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 160ms ease;
}

.drill-down[open] summary::before {
  transform: rotate(90deg);
}

.drill-down > *:not(summary) {
  margin-top: 0.75rem;
  font-size: 0.96rem;
}

.drill-down p:first-of-type { margin-top: 0.75rem; }

/* Dated note under framework */
.dated-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 2rem 0 0;
}

/* Compose section */
.compose p { font-size: 1.05rem; }

.pill-button {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--plum);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.pill-button:hover {
  background: var(--orange-red);
  transform: translateY(-1px);
}

/* Accountability callout: sits between compose and altitudes */
.accountability-callout {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 1.75rem 1.5rem;
  background: var(--cream);
  border: 1px solid var(--plum);
  border-left: 5px solid var(--orange-red);
  border-radius: var(--r-card);
}

.accountability-callout h3 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange-red);
  margin-bottom: 0.75rem;
}

.accountability-callout p {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--plum);
}

.accountability-callout p:last-child {
  margin-bottom: 0;
}

/* Altitudes */
.altitude {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 80px;
}

.altitude h3 {
  font-size: 1.5rem;
  color: var(--orange-red);
  margin-bottom: 0.5rem;
}

.altitude .scenario {
  font-size: 1.15rem;
  color: var(--plum);
  margin-bottom: 1rem;
}

.altitude .credit {
  font-size: 0.88rem;
  color: var(--muted);
  margin: -0.5rem 0 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(216, 69, 39, 0.06);
  border-left: 3px solid var(--orange-red);
  border-radius: 0 var(--r-small) var(--r-small) 0;
}

.altitude .result {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--rule);
}

.altitude .point {
  font-size: 0.98rem;
  color: var(--muted);
}

.altitude-note {
  text-align: center;
  max-width: 600px;
  margin: 2rem auto 0;
  padding: 1rem 1.25rem;
  background: var(--paper);
  border-radius: var(--r-card);
  border: 1px solid var(--rule);
}

/* Altitude picker */
.altitude-picker {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 1.5rem 1.25rem;
  margin-bottom: 2rem;
  text-align: center;
}

.altitude-picker .picker-prompt {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--plum);
}

.picker-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 700px) {
  .picker-buttons { grid-template-columns: 1fr 1fr 1fr; }
}

.picker-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  background: var(--cream);
  border: 2px solid var(--rule);
  border-radius: var(--r-card);
  color: var(--plum);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.picker-btn:hover,
.picker-btn:focus-visible {
  border-color: var(--orange-red);
  transform: translateY(-2px);
  background: var(--paper);
}

.picker-btn .picker-label {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--orange-red);
}

.picker-btn .picker-desc {
  font-size: 0.92rem;
  color: var(--muted);
}

/* Pulse highlight when an altitude is targeted by the picker */
.altitude.is-targeted {
  animation: altitude-pulse 1.6s ease-out;
}

@keyframes altitude-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(216, 69, 39, 0); }
  25%  { box-shadow: 0 0 0 8px rgba(216, 69, 39, 0.22); }
  100% { box-shadow: 0 0 0 0 rgba(216, 69, 39, 0); }
}

/* Closer */
.closer {
  text-align: center;
  padding: 3rem 1.25rem !important;
}

.closing-bookend {
  font-size: 1.35rem;
  line-height: 1.4;
  font-weight: 500;
  max-width: 620px;
  margin: 0 auto;
  color: var(--plum);
}

/* Footer */
footer {
  max-width: var(--w-content);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  border-top: 1px solid var(--rule);
  font-size: 0.92rem;
  color: var(--muted);
}

footer p { margin-bottom: 0.7em; }

footer .meta {
  margin-top: 1.5em;
  font-size: 0.85rem;
  font-style: italic;
}

/* Dialog (six-verbs) */
dialog {
  max-width: 560px;
  width: calc(100% - 2rem);
  padding: 1.75rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  background: var(--paper);
  color: var(--plum);
  box-shadow: 0 30px 80px -20px rgba(45, 31, 46, 0.45);
  font-family: var(--font-body);
}

dialog::backdrop {
  background: rgba(45, 31, 46, 0.55);
  backdrop-filter: blur(2px);
}

dialog h3 {
  font-size: 1.35rem;
  color: var(--orange-red);
  margin-bottom: 0.75rem;
}

dialog .dialog-intro,
dialog .dialog-outro {
  color: var(--muted);
  font-size: 0.96rem;
}

dialog .verbs {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 0.85rem;
  margin: 1rem 0;
  font-size: 0.96rem;
}

dialog .verbs dt {
  font-weight: 700;
  color: var(--plum);
}

dialog .verbs dd {
  margin: 0;
  color: var(--plum);
}

dialog .dialog-close {
  margin-top: 1rem;
  text-align: right;
}

dialog .dialog-close button {
  padding: 0.55rem 1.1rem;
  background: var(--plum);
  color: var(--cream);
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

dialog .dialog-close button:hover {
  background: var(--orange-red);
}

/* Focus styles (accessibility) */
:focus-visible {
  outline: 3px solid var(--orange-red);
  outline-offset: 2px;
  border-radius: var(--r-small);
}

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