/* ==========================================================================
   The Educated Meathead — site stylesheet

   Hand-written, no build step, no framework. Every value comes from
   tokens.css; there are no raw colours or sizes in this file.

   Mobile is the baseline, not an afterthought. Layouts are fluid, grids use
   min() guards so a track can never be wider than its container, and nothing
   is given a fixed width. The result should never scroll sideways.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. The display face

   Fjalla One, SIL Open Font License 1.1, © Sorkin Type Co. Served from this
   origin — no font CDN in the critical path, no third-party request.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Fjalla One";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/fjalla-one-latin.1b492d988a78.woff2") format("woff2");
}

/* --------------------------------------------------------------------------
   1. Reset
   -------------------------------------------------------------------------- */

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

* {
  margin: 0;
}

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

body {
  min-height: 100vh;
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* A long unbroken string — a pasted URL, say — breaks instead of forcing
     the page wider than the screen. */
  overflow-wrap: break-word;
}

img,
picture,
video,
canvas,
svg,
iframe {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
}

/* The two display levels speak in the old site's voice: condensed caps. The
   face has no bold, so the weight is 400 and the size does the emphasis. */
h1,
h2 {
  font-family: var(--font-display);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  text-transform: uppercase;
}

ul,
ol {
  padding-left: var(--space-md);
}

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

/* --------------------------------------------------------------------------
   2. Links, buttons, focus
   -------------------------------------------------------------------------- */

a {
  color: var(--color-accent);
  text-decoration-thickness: var(--border-hairline);
  text-underline-offset: 0.18em;
  transition: color var(--transition-fast);
}

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

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

.button {
  display: inline-block;
  padding: 0.85rem 1.75rem 0.75rem;
  border: none;
  /* The darker base edge is lifted from the old site's buttons. */
  border-bottom: 3px solid var(--color-accent-hover);
  border-radius: var(--radius-sm);
  background-color: var(--color-accent);
  /* Black on orange, as the old site set it — white on this orange fails
     contrast; ink clears it comfortably. */
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color var(--transition-base),
    border-color var(--transition-base);
}

.button:hover {
  background-color: var(--color-accent-bright);
  border-bottom-color: var(--color-accent-hover);
  color: var(--color-ink);
}

.button--quiet {
  background-color: transparent;
  border: var(--border-hairline) solid var(--color-rule-strong);
  color: var(--color-ink);
}

.button--quiet:hover {
  background-color: transparent;
  border-color: var(--color-ink);
  color: var(--color-ink);
}

/* Keyboard users land here first and can jump past the nav. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--space-2xs) var(--space-sm);
  background-color: var(--color-ink);
  color: var(--color-on-accent);
  text-decoration: none;
}

.skip-link:focus {
  left: var(--space-2xs);
  top: var(--space-2xs);
  color: var(--color-on-accent);
}

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.page-main {
  display: block;
}

.section {
  padding-block: var(--space-section);
}

/* --------------------------------------------------------------------------
   4. Header and primary navigation

   The header is a wrapping flex row. Below the nav breakpoint the menu
   becomes a full-width third row that pushes the page down when opened —
   deliberately in normal flow rather than an overlay, because an overlay is
   the usual cause of a phone scrolling sideways.
   -------------------------------------------------------------------------- */

.site-header {
  background-color: var(--color-accent);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  min-height: 4.5rem;
}

.site-wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  /* Lets the wordmark shrink rather than push the menu button off-screen. */
  min-width: 0;
}

.site-wordmark:hover {
  color: var(--color-on-accent);
}

.site-wordmark__mark {
  /* Arm and cap only, hard-cut alpha — the art's own sticker outline is
     what separates it from the band, so it needs no plate. Landscape, so
     sized by height. */
  height: 2.4rem;
  width: auto;
  flex: none;
}

.site-header__cta { margin-left: var(--space-md); white-space: nowrap; }

.site-header .button {
  border: none;
  border-bottom: 3px solid var(--color-ink);
  background-color: var(--color-ink);
  color: var(--color-on-accent);
}

.site-header .button:hover {
  background-color: var(--color-ink);
  color: var(--color-on-accent);
  opacity: .88;
}

/* The global focus ring is accent-on-white; on the accent it vanishes. */
.site-header :focus-visible { outline-color: var(--color-ink); }

/* On narrow screens the mark alone is the identity — the old site's own
   header did the same — which makes room for the consult button. */
@media (max-width: 480px) {
  .site-wordmark__text { display: none; }
  .site-header__cta { margin-left: auto; }
}

.site-nav__toggle {
  display: none;
  padding: var(--space-2xs) var(--space-xs);
  border: var(--border-hairline) solid var(--color-accent-hover);
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  cursor: pointer;
}

.site-nav__toggle:hover {
  border-color: var(--color-ink);
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-block;
  padding-block: var(--space-2xs);
  border-bottom: var(--border-thick) solid transparent;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.site-nav__link:hover {
  color: var(--color-on-accent);
  border-bottom-color: var(--color-ink);
}

.site-nav__link[aria-current="page"] {
  color: var(--color-ink);
  border-bottom-color: var(--color-ink);
  font-weight: var(--weight-medium);
}

@media (max-width: 61.9375em) {
  .site-nav__toggle {
    display: inline-block;
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
  }

  /* Collapsed only when JavaScript is available to reopen it. Without JS the
     menu simply stays visible, stacked. */
  .js .site-nav__list {
    display: none;
  }

  .js .site-nav[data-open="true"] .site-nav__list {
    display: block;
  }

  .site-nav__list {
    padding-bottom: var(--space-sm);
    border-top: var(--border-hairline) solid var(--color-accent-hover);
    padding-top: var(--space-2xs);
  }

  .site-nav__link {
    display: block;
    padding-block: var(--space-xs);
    border-bottom: none;
    border-left: var(--border-thick) solid transparent;
    padding-left: var(--space-xs);
    margin-left: calc(var(--space-xs) * -1);
    font-size: var(--text-base);
  }

  .site-nav__link:hover,
  .site-nav__link[aria-current="page"] {
    border-bottom-color: transparent;
    border-left-color: var(--color-ink);
  }
}

/* --------------------------------------------------------------------------
   5. Page hero and prose
   -------------------------------------------------------------------------- */

.page-hero {
  padding-block: var(--space-section);
}

.eyebrow {
  margin-bottom: var(--space-md);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* Marv's name and license, above every page title. Carries his credential
   rather than a section label, so it reads in the brand accent and sits
   tighter to the title it belongs to. */
.eyebrow--credential {
  margin-bottom: var(--space-2xs);
  color: var(--color-accent-hover);
  letter-spacing: 0.08em;
}

.page-hero__eyebrow {
  margin-bottom: var(--space-md);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.page-hero__title {
  max-width: 20ch;
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

.page-hero__standfirst {
  max-width: 48ch;
  margin-top: var(--space-md);
  color: var(--color-ink-secondary);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

.page-hero__price {
  margin-top: var(--space-md);
  color: var(--color-ink-secondary);
  font-size: var(--text-base);
}

.page-hero__price strong {
  color: var(--color-ink);
  font-weight: var(--weight-semibold);
}

.page-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xl);
}

/* Rich text from the Wagtail editor. Spacing is applied between siblings
   rather than below every element, so there is never a trailing gap. */
.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: var(--space-sm);
}

.prose h2 {
  margin-top: var(--space-xl);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-tight);
}

.prose h3 {
  margin-top: var(--space-lg);
  font-size: var(--text-md);
}

.prose ul,
.prose ol {
  padding-left: var(--space-md);
}

.prose li + li {
  margin-top: var(--space-3xs);
}

.prose a {
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   6. Footer

   auto-fit with a min() guard: each column wants at least 13rem, but never
   more than the container, so on a narrow phone the tracks collapse to one
   column instead of overflowing.
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: var(--space-section);
  padding-block: var(--space-2xl) var(--space-xl);
  border-top: var(--border-hairline) solid var(--color-rule);
  color: var(--color-ink-secondary);
  font-size: var(--text-sm);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: var(--space-xl) var(--space-lg);
}

.site-footer__tagline {
  margin-bottom: var(--space-3xs);
  color: var(--color-ink-secondary);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.site-footer__heading {
  margin-bottom: var(--space-sm);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.site-footer__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__list li + li {
  margin-top: var(--space-2xs);
}

.site-footer a {
  color: var(--color-ink-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-accent);
}

.site-footer__address {
  font-style: normal;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-md);
  justify-content: space-between;
  margin-top: var(--space-2xl);
  padding-top: var(--space-md);
  border-top: var(--border-hairline) solid var(--color-rule);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

/* --- footer newsletter ---------------------------------------------------
   Sitewide: this used to live in home.css and so was unstyled on every other
   page. Text on the left, the form on the right; stacked on narrow screens. */

.site-footer__newsletter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-lg) var(--space-2xl);
  align-items: start;
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: var(--border-hairline) solid var(--color-rule);
}

@media (min-width: 62rem) {
  .site-footer__newsletter { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
}

.site-footer__newsletter-text { max-width: 30rem; }

.site-footer__note {
  margin: var(--space-2xs) 0 0;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.site-footer__note--ok { color: var(--color-ink); font-weight: var(--weight-semibold); }
.site-footer__note--error { margin-bottom: var(--space-sm); color: var(--color-ink); font-weight: var(--weight-semibold); }

.newsletter-form { min-width: 0; }

.newsletter-form__interests {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3xs) var(--space-2xs);
  margin: 0 0 var(--space-sm);
  padding: 0;
  border: 0;
  min-width: 0;
}

.newsletter-form__legend {
  float: left;               /* keeps the legend on the chips' line */
  margin-right: var(--space-2xs);
  padding: 0;
  color: var(--color-ink-faint);
  font-size: var(--text-2xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: 2;
}

/* Email and button: one row, identical height, the field takes the slack. */
.newsletter-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-2xs);
}

.newsletter-form__row input[type="email"] {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.55rem 0.8rem;
  border: var(--border-hairline) solid var(--color-rule-strong);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1.3;
}

.newsletter-form__row input[type="email"]:focus-visible {
  outline: var(--border-thick) solid var(--color-accent);
  outline-offset: 1px;
  border-color: var(--color-accent);
}

.newsletter-form__row .button { flex: 0 0 auto; white-space: nowrap; }

/* Phones: the button wraps under the field, so let it span the same width. */
@media (max-width: 30rem) {
  .newsletter-form__row .button { flex: 1 1 100%; text-align: center; }
}

.vh-label {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. Error pages
   -------------------------------------------------------------------------- */

.error-page {
  padding-block: var(--space-section);
}

.error-page__code {
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.error-page__title {
  max-width: 20ch;
  margin-top: var(--space-sm);
  font-size: var(--text-2xl);
}

.error-page__body {
  max-width: 46ch;
  margin-top: var(--space-md);
  color: var(--color-ink-secondary);
}

/* --------------------------------------------------------------------------
   8. Preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* --------------------------------------------------------------------------
   Rich text inline styles

   The editor's size and color controls write these classes. Values come from
   the tokens, so editorial "orange" can never drift from the brand orange.
   -------------------------------------------------------------------------- */

.rt-accent { color: var(--color-accent-hover); font-weight: var(--weight-semibold); }
.rt-muted { color: var(--color-ink-muted); }
.rt-large { font-size: 1.25em; }
.rt-small { font-size: 0.85em; }

/* --------------------------------------------------------------------------
   Testimonials — shared by every placement, so they live here, not in a
   page stylesheet. The programs page found that out the hard way: bullets.
   -------------------------------------------------------------------------- */

.testimonials { padding-block: var(--space-section); }

.testimonials .section__title { margin-inline: auto; text-align: center; }

/* Each testimonial is a card: sunken ground, hairline frame, a display-face
   quote mark, and the attribution anchored to the card's foot so a short
   quote and a long one still read as siblings. */
.testimonial-list {
  list-style: none;
  margin: var(--space-xl) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: var(--space-md);
  align-items: stretch;
}

.testimonial {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) var(--space-md) var(--space-md);
  background: var(--color-surface-sunken);
  border: var(--border-hairline) solid var(--color-rule);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
}

.testimonial::before {
  content: "\201C";
  display: block;
  height: 0.55em;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--color-accent);
}

.testimonial__quote {
  margin: var(--space-2xs) 0 0;
  padding: 0;
  border: 0;
  font-size: var(--text-sm);
  font-style: normal;
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-snug);
}

.testimonial__by {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  margin-top: auto;
  padding-top: var(--space-md);
}

.testimonial__photo img { border-radius: 50%; width: 44px; height: 44px; }

.testimonial__name {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

.testimonial__detail {
  display: block;
  color: var(--color-ink-muted);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
}

/* Carousel mode, applied by JavaScript when there are more than three
   quotes: one snapping row instead of a grid, rotated automatically until
   the visitor takes over. */
.testimonial-list--carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.testimonial-list--carousel::-webkit-scrollbar { display: none; }

.testimonial-list--carousel .testimonial {
  flex: 0 0 min(100%, 21rem);
  scroll-snap-align: start;
}

.testimonial-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2xs);
  margin-top: var(--space-md);
}

.testimonial-dots__dot {
  width: 0.6rem;
  height: 0.6rem;
  padding: 0;
  border: var(--border-hairline) solid var(--color-rule-strong);
  border-radius: 50%;
  background: var(--color-surface);
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.testimonial-dots__dot.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent-hover);
}

