/* ============================================================================
   MrMurse Base Layer
   ----------------------------------------------------------------------------
   Reset + element defaults + layout primitives + global accessibility.
   Loaded AFTER tokens.css, BEFORE components.css.
   This layer styles raw HTML elements and the handful of layout utilities
   every page needs (container, section, grid). Components build on top.
   ========================================================================== */

/* ---- Modern, minimal reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

/* Honor users who ask for less motion — disables smooth scroll + reveals. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--text-body);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
a { color: inherit; text-decoration: none; }

/* ---- Typography defaults -------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
  font-weight: var(--fw-bold);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p  { color: var(--text-body); }

/* Constrain prose line length for readability (accessibility). Opt-in so
   it never fights grid layouts — apply .prose to long-form text blocks. */
.prose { max-width: var(--reading-max); }
.prose p + p { margin-top: var(--space-4); }

/* ---- Accessibility utilities ---------------------------------------------- */

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Skip link — first focusable element on every page. */
.skip-link {
  position: absolute; left: var(--space-4); top: -100px;
  z-index: var(--z-toast);
  background: var(--c-navy); color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm); font-weight: var(--fw-semibold);
  transition: top var(--dur-base) var(--ease-standard);
}
.skip-link:focus { top: var(--space-4); }

/* GLOBAL FOCUS STATE — one consistent, highly visible ring for keyboard users.
   :focus-visible means mouse clicks don't show the ring, only keyboard/AT. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--focus-ring) solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Layout primitives ---------------------------------------------------- */

/* Container: centers content, applies safe gutters, caps width. */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}
.container--narrow { max-width: var(--container-narrow); }

@media (min-width: 920px) {
  .container { padding-inline: var(--container-pad-lg); }
}

/* Section: the vertical rhythm unit. Every page section uses .section. */
.section { padding-block: var(--section-py); }
.section--tight { padding-block: var(--section-py-tight); }
.section--alt { background: var(--bg-alt); }

/* Standard centered section header (eyebrow + title + lead). */
.section-head { max-width: 680px; margin-inline: auto; text-align: center; }
.section-head > * + * { margin-top: var(--space-4); }
.section-head .lead { font-size: var(--fs-body-lg); color: var(--text-body); }
.section-head + .section-body { margin-top: var(--space-7); }

/* ---- Grid system ----------------------------------------------------------
   A simple, predictable auto-fit grid covers most card layouts and collapses
   gracefully without per-breakpoint rules. Fixed-column helpers exist for
   layouts that must hold an exact count.                                    */
.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Auto-fit: cards wrap based on a min width; the most scalable default. */
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

@media (max-width: 920px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* Two-column split (copy + visual). Stacks on tablet. */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-7);
  align-items: center;
}
@media (max-width: 920px) {
  .split { grid-template-columns: 1fr; gap: var(--space-6); }
}

/* ---- Stack utility: consistent vertical spacing between flow children ----- */
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

/* ---- Scroll-reveal (progressive enhancement) ------------------------------
   Hidden state applies ONLY when JS adds .js-ready to <html>, so content is
   always visible if JS fails or is disabled. Reduced-motion users see no
   movement (handled by the media reset above + JS check).                   */
.js-ready .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
}
.js-ready .reveal.is-visible { opacity: 1; transform: none; }

/* Mobile only: tighten the space between the header and the first hero on every
   page by about half. Desktop spacing is unchanged. */
@media (max-width: 768px) {
  .ct-hero, .fr-hero, .wl-hero, .tutors-hero, .plans-hero, .hiw-hero { padding-top: var(--space-7); }
}

/* Small trademark attribution line (kept subtle, separate from the footer). */
.trademark-note {
  font-size: var(--fs-caption); color: var(--text-muted);
  margin-top: var(--space-6); text-align: center; max-width: 640px;
  margin-inline: auto; line-height: var(--lh-snug);
}
