/* =============================================================
   Middle Rock Management - base.css
   Design tokens, reset, and foundational typography.
   Monochrome / neutral editorial system. Edit tokens below to
   tune the whole site from one place.
   ============================================================= */

:root {
  /* --- Brand ink & paper (sampled from the monochrome logo) --- */
  --ink:        #14110f;   /* near-black, warm */
  --ink-soft:   #2b2724;   /* body text */
  --ink-muted:  #6f6862;   /* secondary text, labels */
  --ink-faint:  #a49d96;   /* captions, disabled */
  --rule:       #e2ddd6;   /* hairline rules */
  --rule-strong:#c9c2ba;
  --paper:      #f6f4ef;   /* warm white page background */
  --paper-pure: #ffffff;
  --paper-deep: #efece5;   /* alternating section tint */
  --ink-invert: #f6f4ef;   /* text on dark */
  --panel-dark: #16130f;   /* dark editorial panel */
  --panel-soft: #e4ddd0;   /* soft warm-stone panel (light alt to panel-dark) */

  /* --- Type families ---------------------------------------------
     Ships with a high-quality system stack so the site is fast and
     dependency-free out of the box. To swap in a self-hosted display
     face later (e.g. Fraunces), see README > Typography.            */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Helvetica Neue", sans-serif;

  /* --- Fluid type scale (clamp: min, preferred, max) --------------- */
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0:  clamp(1rem, 0.96rem + 0.22vw, 1.13rem);
  --step-1:  clamp(1.2rem, 1.12rem + 0.4vw, 1.5rem);
  --step-2:  clamp(1.44rem, 1.3rem + 0.7vw, 2rem);
  --step-3:  clamp(1.73rem, 1.5rem + 1.15vw, 2.66rem);
  --step-4:  clamp(2.07rem, 1.7rem + 1.85vw, 3.55rem);
  --step-5:  clamp(2.49rem, 1.9rem + 2.95vw, 4.7rem);
  --step-6:  clamp(2.99rem, 2.05rem + 4.7vw, 6.2rem);

  /* --- Spacing scale --------------------------------------------- */
  --space-2xs: 0.375rem;
  --space-xs:  0.625rem;
  --space-s:   1rem;
  --space-m:   1.75rem;
  --space-l:   3rem;
  --space-xl:  5rem;
  --space-2xl: 8rem;

  /* --- Layout ---------------------------------------------------- */
  --measure: 62ch;
  --container: 76rem;      /* ~1216px */
  --container-wide: 88rem;
  --gutter: clamp(1.25rem, 0.8rem + 2.2vw, 3.25rem);
  --header-h: clamp(74px, 6vw, 96px);   /* masthead: logo + descriptor */

  /* --- Motion ---------------------------------------------------- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur:  0.5s;
  --dur-fast: 0.25s;

  --radius: 2px;           /* restraint - near-square */
  --focus: 2px solid var(--ink);
}

/* ------------------------- Reset ------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }   /* make the hidden attribute reliable (cards/filter use it) */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;       /* guard against any horizontal overflow */
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p { text-wrap: pretty; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* ---------------------- Accessibility -------------------------- */
:focus-visible {
  outline: var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: var(--space-s);
  top: -4rem;
  z-index: 100;
  background: var(--ink);
  color: var(--ink-invert);
  padding: 0.75rem 1.25rem;
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: var(--space-s); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

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

.section { padding-block: clamp(3.5rem, 2rem + 7vw, 7.5rem); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem); }
.section--tint { background: var(--paper-deep); }
.section--stone { background: var(--panel-soft); }
.section--stone .section-label { border-bottom-color: var(--rule-strong); }
.section--dark {
  background: var(--panel-dark);
  color: var(--ink-invert);
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--ink-invert); }

/* --------------------- Reusable atoms -------------------------- */
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--step--1);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 500;
}

.rule {
  border: 0;
  border-top: 1px solid var(--rule);
  margin-block: var(--space-l);
}

.numeral {
  font-family: var(--font-display);
  font-size: var(--step-2);
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* Link with animated underline (respects reduced motion) */
.link-underline {
  position: relative;
  display: inline-block;
  color: var(--ink);
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--dur) var(--ease);
}
.link-underline:hover,
.link-underline:focus-visible { background-size: 100% 1px; }

@media (prefers-reduced-motion: reduce) {
  .link-underline { transition: none; }
  .link-underline:hover, .link-underline:focus-visible { background-size: 100% 1px; }
}

/* Utility */
.text-center { text-align: center; }
.flow > * + * { margin-top: var(--space-s); }
.flow-l > * + * { margin-top: var(--space-m); }
