/* site.css — full-width standalone page shell (replaces the design-canvas wrapper).
   Each Manuscript page renders as one continuous, full-width scrolling document. */

html { scroll-behavior: smooth; }

body.site {
  margin: 0;
  min-height: 100%;
  background: #F5F0E8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html { background: #F5F0E8; }

/* The page article fills the viewport width; inner sections keep their own
   max-widths and gutters, so content stays measured while the page is fluid. */
body.site > #root > .manuscript {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Tweak-driven helpers carried over from the canvas build */
body.hide-marginalia .m-marginalia { display: none; }
body.no-italic em { font-style: normal !important; }
body.no-italic .serif-italic { font-style: normal !important; }

/* ─────────────────────────────────────────────────────────
   Mobile navigation — hamburger + drawer (hidden on desktop)
   ───────────────────────────────────────────────────────── */
.m-header__burger { display: none; }
.m-header__drawer { display: none; }

@media (max-width: 1040px) {
  .m-header {
    padding: 20px 28px;
    grid-template-columns: 1fr auto;
    column-gap: 16px;
  }
  .m-header__brand { font-size: 22px; letter-spacing: 0.24em; }
  .m-header__brand-mark { width: 24px; height: 24px; margin-right: 10px; }
  .m-header__nav { display: none; }
  .m-header__apply { display: none; }
  .m-header__end { display: none; }

  .m-header__burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px; height: 40px;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    justify-self: end;
  }
  .m-header__burger span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: var(--burgundy);
    transition: transform .25s ease, opacity .2s ease;
  }
  .m-header.is-open .m-header__burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .m-header.is-open .m-header__burger span:nth-child(2) { opacity: 0; }
  .m-header.is-open .m-header__burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

  .m-header__drawer {
    display: block;
    position: fixed;
    inset: 64px 0 0 0;
    background: var(--burgundy);
    z-index: 500;
    padding: 32px 28px 48px;
    overflow-y: auto;
  }
  .m-header__drawer[hidden] { display: none; }
  .m-header__drawer-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .m-header__drawer-nav a {
    font-family: var(--serif);
    font-size: 30px;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--pulp);
    text-decoration: none;
    padding: 16px 0;
    border-bottom: 1px solid rgba(201,168,76,0.25);
  }
  .m-header__drawer-nav a.is-active { color: var(--gold); font-style: italic; }
  .m-header__drawer-apply {
    margin-top: 28px;
    background: var(--gold);
    color: var(--burgundy-ink) !important;
    text-align: center;
    border-bottom: none !important;
    font-family: var(--sans) !important;
    font-size: 13px !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase;
    font-weight: 500;
    padding: 18px 0 !important;
  }
  .m-header__drawer-portal {
    margin-top: 20px;
    text-align: center;
    color: rgba(245,240,232,0.7) !important;
    border-bottom: none !important;
    font-family: var(--sans) !important;
    font-size: 12px !important;
    letter-spacing: 0.2em !important;
    text-transform: uppercase;
    font-weight: 400;
  }
}

/* ─────────────────────────────────────────────────────────
   Ultra-wide — hold the page to a civilised measure
   ───────────────────────────────────────────────────────── */
@media (min-width: 1680px) {
  body.site > #root > .manuscript {
    max-width: 1680px;
    margin: 0 auto;
    box-shadow: 0 0 120px rgba(26,20,16,0.06);
  }
}

/* ═════════════════════════════════════════════════════════
   GLOBAL RESPONSIVE BASE  (loaded last — overrides components)
   Step 2: reduce gutters, cap display type, single-column grids
   ═════════════════════════════════════════════════════════ */

/* Section gutters — tablet/large-phone */
@media (max-width: 768px) {
  .m-hero, .m-hero.m-hero--split,
  .m-section, .m-pullquote, .m-act-card, .m-cta,
  .m-popener, .m-disc, .m-bigo, .m-pfacts, .m-five-intro,
  .m-manifest, .m-gain, .m-specs,
  .m-story, .m-founders, .m-testimonials, .m-about-close,
  .m-faq, .m-portal, .m-footer {
    padding-left: 28px;
    padding-right: 28px;
  }
  .m-plate { padding-left: 32px; padding-right: 32px; }
  .m-manifest__doc { padding-left: 28px; padding-right: 28px; }

  /* Cap oversized display type so nothing overflows the viewport */
  .m-hero__head, .m-popener__head, .m-about-hero__head,
  .m-situation__title, .m-diagnosis__title, .m-h2 {
    font-size: clamp(30px, 8.5vw, 52px) !important;
    line-height: 1.08 !important;
  }
  .m-plate__quote { font-size: clamp(20px, 5.5vw, 30px) !important; }

  /* Situation/insight plate quotes must fit their frame on phones */
  .m-situation__plate .m-plate__quote,
  .m-insight__plate .m-plate__quote {
    font-size: clamp(19px, 5vw, 26px) !important;
    line-height: 1.35 !important;
    overflow-wrap: break-word;
    hyphens: none;
  }
  .m-situation__plate .m-plate,
  .m-insight__plate .m-plate { max-width: 100% !important; }

  /* Any lingering two-column grids collapse to one */
  .m-situation__grid,
  .m-hero.m-hero--split .m-hero__top,
  .m-hero.m-hero--split .m-hero__below {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
}

/* Phone */
@media (max-width: 480px) {
  .m-hero, .m-hero.m-hero--split,
  .m-section, .m-pullquote, .m-act-card, .m-cta,
  .m-popener, .m-disc, .m-bigo, .m-pfacts, .m-five-intro,
  .m-manifest, .m-gain, .m-specs,
  .m-story, .m-founders, .m-testimonials, .m-about-close,
  .m-faq, .m-portal, .m-footer {
    padding-left: 20px;
    padding-right: 20px;
  }
  .m-plate { padding-left: 22px; padding-right: 22px; }
  .m-manifest__doc { padding-left: 18px; padding-right: 18px; }

  /* Vertical rhythm — pull big top/bottom paddings in on phones */
  .m-section { padding-top: 56px; padding-bottom: 56px; }
  .m-popener, .m-pfacts, .m-five-intro, .m-gain, .m-specs,
  .m-manifest, .m-story, .m-founders, .m-testimonials { padding-top: 48px; padding-bottom: 48px; }
}

/* iOS: inputs ≥16px to prevent auto-zoom; tap targets ≥44px */
@media (max-width: 768px) {
  input, textarea, select { font-size: 16px !important; }
  .btn { min-height: 44px; }

  /* Hero photo — restore a real aspect ratio when stacked (else it collapses) */
  .m-hero.m-hero--split .m-hero__photo {
    aspect-ratio: 4 / 3;
    align-self: center;
    width: 100%;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
  }
  .m-hero.m-hero--split .m-hero__top { align-items: start; }

  /* Text-then-centered-plate: every text+plate split stacks the same way */
  .m-situation__grid,
  .m-insight__grid {
    grid-template-columns: 1fr !important;
    gap: 36px !important;
  }
  .m-situation__grid .m-prose,
  .m-insight__grid .m-prose { order: 1; }
  .m-situation__plate,
  .m-insight__plate {
    order: 2;
    justify-content: center;
    display: flex;
  }
  .m-situation__plate .m-plate,
  .m-insight__plate .m-plate { margin-left: auto; margin-right: auto; }

  /* Section label — keep it left-aligned and consistent */
  .m-situation__label { display: inline-block; }

  /* Programme opener: stack deck then centered plate */
  .m-popener__split { grid-template-columns: 1fr !important; gap: 32px !important; }
  .m-popener__plate { display: flex; justify-content: center; }
  .m-popener__plate .m-plate { margin-left: auto; margin-right: auto; }
}

/* ── Page pager — "next chapter" nav above the footer ── */
.m-pagenav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 64px;
  border-top: 1px solid var(--rule);
}
.m-pagenav__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-decoration: none;
  min-width: 0;
}
.m-pagenav__link--next { align-items: flex-end; text-align: right; margin-left: auto; }
.m-pagenav__link--empty { visibility: hidden; }
.m-pagenav__dir {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.m-pagenav__name {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 3vw, 32px);
  color: var(--burgundy);
  transition: color .2s ease;
}
.m-pagenav__link:hover .m-pagenav__name { color: var(--gold-deep); }

@media (max-width: 768px) {
  .m-pagenav { padding: 32px 28px; }
}
@media (max-width: 480px) {
  .m-pagenav { padding: 28px 20px; gap: 16px; }
  .m-pagenav__name { font-size: 18px; }
}
