/* The Rocket Car Problem — companion site
   Colours and type follow the book's formatting spec (book-formatting-spec.md),
   with web text variants for contrast (design document, Revision 3). */

@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/assets/fonts/lora-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #172126;
  --blue: #23548A;
  --teal: #2E8B7D;        /* rules, icons, large text only */
  --teal-text: #26766A;   /* teal text below 24px */
  --gray-text: #5E6E77;
  --tint-teal: #E8F0F1;
  --tint-blue: #EDF3F8;
  --paper: #FFFFFF;
  --sans: "DejaVu Sans", Verdana, "Segoe UI", system-ui, sans-serif;
  --serif: "Lora", Georgia, "Times New Roman", serif;
  --measure: 38rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;          /* 18px */
  line-height: 1.6;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--blue); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--blue); color: #fff; padding: 0.6rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--tint-teal); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.5rem; position: relative; }
.wordmark {
  font-family: var(--sans); font-weight: 700; font-size: 0.875rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); text-decoration: none;
}

/* Navigation: inline links on wide screens, a <details> menu on phones (no JavaScript) */
.nav-desktop { display: none; }
.nav-desktop ul, .nav-mobile ul, .footer-links { list-style: none; margin: 0; padding: 0; }
.nav-desktop a:not(.button), .nav-mobile a:not(.button) {
  font-family: var(--sans); font-size: 0.9375rem; color: var(--ink); text-decoration: none;
}
.nav-desktop a:not(.button):hover, .nav-mobile a:not(.button):hover { color: var(--blue); text-decoration: underline; }
a[aria-current="page"] { color: var(--blue) !important; font-weight: 700; }

.nav-mobile summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 0.75rem; border: 1px solid var(--tint-teal); border-radius: 6px;
  font-family: var(--sans); font-weight: 700; font-size: 0.9375rem;
}
.nav-mobile summary::-webkit-details-marker { display: none; }
.menu-icon, .menu-icon::before, .menu-icon::after {
  display: block; width: 18px; height: 2px; background: var(--ink); position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.nav-mobile[open] .menu-icon { background: transparent; }
.nav-mobile[open] .menu-icon::before { top: 0; transform: rotate(45deg); }
.nav-mobile[open] .menu-icon::after { top: 0; transform: rotate(-45deg); }
.nav-mobile nav {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 5;
  background: var(--paper); border-bottom: 1px solid var(--tint-teal);
  padding: 0.5rem 1rem 1.25rem; box-shadow: 0 8px 16px rgba(23, 33, 38, 0.08);
}
.nav-mobile li a { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--tint-teal); font-size: 1.0625rem !important; }
.nav-mobile .button { margin-top: 1rem; width: 100%; }

/* Page heads for inner pages */
.page-head { padding: 2rem 0 1.5rem; }
.page-head p { max-width: var(--measure); }
.crumbs { font-family: var(--sans); font-size: 0.875rem; color: var(--gray-text); margin-bottom: 1rem; }
.crumbs a { color: var(--gray-text); }

/* Cards (home page Pivots) */
.cards { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 0.25rem; height: 100%;
  padding: 1rem 1.1rem; border: 1px solid var(--tint-teal); border-top: 3px solid var(--teal);
  border-radius: 6px; text-decoration: none; color: var(--ink);
}
.card:hover { background: var(--tint-teal); }
.card-kicker { font-family: var(--sans); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-text); }
.card-title { font-family: var(--sans); font-size: 1.25rem; font-weight: 700; color: var(--blue); }
.card-meta { font-size: 0.9375rem; color: var(--gray-text); }

/* Chapter lists */
.toc { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: 0; max-width: 44rem; }
.toc a { display: grid; gap: 0.1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--tint-teal); text-decoration: none; color: var(--ink); }
.toc a:hover .toc-title { color: var(--blue); text-decoration: underline; }
.toc-label { font-family: var(--sans); font-size: 0.8125rem; font-weight: 700; color: var(--teal-text); letter-spacing: 0.04em; }
.toc-part { color: var(--gray-text); font-weight: 400; }
.toc-title { font-size: 1.0625rem; }



/* Previous / next */
.pager { display: grid; grid-template-columns: 1fr; gap: 0.75rem; padding-top: 0.5rem; padding-bottom: 2.5rem; }
.pager a { display: block; padding: 0.9rem 1rem; border: 1px solid var(--tint-teal); border-radius: 6px; text-decoration: none; font-family: var(--sans); font-size: 0.9375rem; }
.pager a span { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gray-text); margin-bottom: 0.2rem; }
.pager a:hover { background: var(--tint-blue); }
.pager-next { text-align: right; }

.book-row { display: grid; gap: 1.5rem; }
.book-row .cover { width: min(12rem, 60vw); justify-self: start; }

.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-bottom: 1rem !important; }
.footer-links a { font-family: var(--sans); font-size: 0.875rem; color: var(--ink); }

/* Hero */
.hero { padding: 2.5rem 0 2rem; }
.hero .wrap { display: grid; gap: 2rem; }
.eyebrow {
  font-family: var(--sans); font-weight: 700; font-size: 0.8125rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--teal-text); margin: 0 0 0.75rem;
}
h1, h2, h3 { font-family: var(--sans); font-weight: 700; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -0.01em; }
h1 + .rule, h2 + .rule { width: 48px; height: 3px; background: var(--teal); border: 0; margin: 1rem 0 1.25rem; }
h2 { font-size: 1.5rem; color: var(--blue); }
h3 { font-size: 1.0625rem; }
.lead { font-size: 1.25rem; margin: 0 0 1rem; }
.hero p { max-width: var(--measure); }

.cover {
  justify-self: center; width: min(16rem, 70vw);
  box-shadow: none; border: 1px solid var(--tint-teal);
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 1.5rem; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 2.75rem; padding: 0.65rem 1.25rem; border-radius: 6px;
  font-family: var(--sans); font-weight: 700; font-size: 1rem; text-decoration: none;
  background: var(--blue); color: #fff; border: 2px solid var(--blue);
}
.button:hover { background: #1b4371; border-color: #1b4371; text-decoration: none; }
.button-secondary { background: var(--paper); color: var(--blue); }
.button-secondary:hover { background: var(--tint-blue); color: var(--blue); border-color: var(--blue); }
.note { font-size: 0.9375rem; color: var(--gray-text); }

/* Sections */
section { padding: 2.25rem 0; }
section + section { border-top: 1px solid var(--tint-teal); }
section p { max-width: var(--measure); }

/* Planned items: one status label per section, compact cards (Webpage Review 01) */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 1.25rem; }
.status-text { font-size: 1rem; color: var(--gray-text); }
.badge {
  display: inline-block; white-space: nowrap;
  font-family: var(--sans); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--teal-text);
  background: var(--tint-teal); border-radius: 999px; padding: 0.2rem 0.65rem;
}
.group-label {
  font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-text);
  margin: 1.5rem 0 0.6rem;
}
.status + .group-label { margin-top: 0.5rem; }
.coming { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.coming li { background: var(--tint-blue); border-radius: 8px; padding: 0.9rem 1.1rem; }
.coming h3 { font-size: 1.0625rem; }
.coming h3 a { color: var(--ink); }
.coming p { margin: 0.3rem 0 0; font-size: 1rem; }
.coming.compact li { padding: 0.7rem 1rem; }
.coming.compact p { font-size: 0.9375rem; color: var(--gray-text); }

.status-box {
  margin-top: 1.5rem; max-width: var(--measure);
  background: var(--tint-teal); border-left: 4px solid var(--teal); border-radius: 0 8px 8px 0;
  padding: 1rem 1.25rem;
}
.status-box p { margin: 0.35rem 0 0; font-size: 1rem; }
.h3 { font-size: 1.0625rem; color: var(--ink); }
.intro h1 { max-width: 22ch; }

.quote {
  margin: 1.25rem 0; padding: 0.25rem 0 0.25rem 1.25rem; max-width: var(--measure);
  border-left: 4px solid var(--teal);
}
.quote p { margin: 0; font-size: 1.3125rem; line-height: 1.45; color: var(--blue); font-style: italic; }

.pull {
  font-size: 1.25rem; color: var(--teal-text); text-align: center;
  max-width: 34rem; margin: 1.75rem auto 0; padding: 0 1rem;
}

.callout {
  background: var(--tint-blue); border-left: 4px solid var(--blue);
  padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; max-width: var(--measure);
}
.callout p { margin: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--tint-teal); padding: 1.5rem 0 2.5rem; }
.site-footer p { margin: 0.25rem 0; font-size: 0.9375rem; color: var(--gray-text); }

@media (min-width: 48rem) {
  .pager { grid-template-columns: 1fr 1fr; }
  .hero { padding: 3.5rem 0 3rem; }
  .hero .wrap { grid-template-columns: 1fr 16rem; align-items: center; gap: 3rem; }
  .cover { width: 16rem; grid-column: 2; grid-row: 1; }
  .coming.grid { grid-template-columns: 1fr 1fr; }
  .book-row { grid-template-columns: 1fr 12rem; align-items: start; gap: 3rem; }
}

@media (min-width: 60rem) {
  .nav-mobile { display: none; }
  .nav-desktop { display: flex; align-items: center; gap: 1.5rem; }
  .nav-desktop ul { display: flex; gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Printing or saving as PDF: browsers drop background colours, so make buttons
   print as outlined dark text instead of white text on nothing. */
@media print {
  .nav-desktop, .nav-mobile, .skip, .pager, .footer-links { display: none !important; }
  .button { background: #fff !important; color: var(--blue) !important; border: 2px solid var(--blue) !important; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: var(--gray-text); }
  .button::after { content: none !important; }
  section, .coming li { break-inside: avoid; }
}

/* Footer copyright and disclaimer (every page) */
.site-footer .legal p { max-width: 44rem; font-size: 0.875rem; line-height: 1.55; }
.site-footer .legal p + p { margin-top: 0.5rem; }

/* The one chapter list: grouped like the book, two columns of groups on wide screens */
.chapters { margin-top: 1.25rem; }
.chapter-group { break-inside: avoid; margin-bottom: 1.25rem; }
.chapter-group .group-label { margin: 0 0 0.25rem; }
.chapter-group .group-label a { color: var(--teal-text); text-decoration: none; }
.chapter-group .group-label a:hover { text-decoration: underline; }
.chapters .toc { margin: 0; }
.cards { margin-top: 1.5rem; }
@media (min-width: 48rem) {
  .chapters-all { columns: 2; column-gap: 2.5rem; }
}
