/* ============================================================
   The EX Institute — shared stylesheet (v0.2)
   Design tokens + base styles + components.

   Tokens and base styles aligned with the designer's
   `colors_and_type.css` handoff. Component styles
   (site-header, hero, cards, buttons, forms, footer) extend
   the tokens.

   Master copy in /shared; each site has a copy in its root
   (sync via /bin/sync-styles.sh).
   ============================================================ */

/* === WEB FONTS ================================================
   Source Serif 4 + Inter via Google Fonts (Iowan Old Style is
   the Apple-only fallback). For paid production: license
   Tiempos / GT Sectra and ship the cuts; the stack already has
   Iowan as a fallback so swapping is one-line.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,300..900;1,8..60,300..900&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* === DESIGN TOKENS ============================================ */

:root {
  /* Colour — institutional, restrained */
  --c-ink: #15171a;            /* near-black; never pure #000 */
  --c-ground: #fbf8f3;         /* warm off-white page background */
  --c-surface: #ffffff;        /* cards, forms */
  --c-warm-tint: #f4eede;      /* tags, callouts, quiet panels */

  --c-accent: #6b1d2e;         /* oxblood; sparingly */
  --c-accent-hover: #511522;
  --c-accent-soft: #f3e6e9;    /* tints / accent backgrounds */

  --c-text: #1f2226;
  --c-text-muted: #5e6164;
  --c-text-faint: #8a8c8f;

  --c-border: #e8e2d4;
  --c-border-strong: #c9c1ad;

  /* Semantic re-exports for clarity at use sites */
  --fg-1: var(--c-ink);
  --fg-2: var(--c-text);
  --fg-3: var(--c-text-muted);
  --fg-4: var(--c-text-faint);
  --fg-accent: var(--c-accent);
  --bg-page: var(--c-ground);
  --bg-card: var(--c-surface);
  --bg-quiet: var(--c-warm-tint);

  /* Type families. Source Serif 4 is the open-web default;
     Iowan Old Style is the Apple-only fallback. */
  --font-serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Source Serif Pro', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Source Code Pro', monospace;

  /* Type scale */
  --t-display: 3.25rem;     /* 52px — page-opening titles */
  --t-h1: 2.25rem;          /* 36px */
  --t-h2: 1.75rem;          /* 28px */
  --t-h3: 1.375rem;         /* 22px */
  --t-h4: 1.125rem;         /* 18px */
  --t-body: 1.0625rem;      /* 17px */
  --t-small: 0.9375rem;     /* 15px */
  --t-caption: 0.8125rem;   /* 13px — eyebrows / labels */

  /* Line heights */
  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;

  /* Spacing scale (8px base) */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 4rem;
  --s-7: 6rem;
  --s-8: 8rem;

  /* Layout widths */
  --w-narrow: 30rem;
  --w-prose: 38rem;
  --w-content: 56rem;
  --w-page: 72rem;

  /* Border radii (intentionally tiny) */
  --r-sm: 2px;
  --r-md: 4px;
  --r-pill: 999px;

  /* Elevation. The Institute does not use ambient shadows.
     `--shadow-focus` is mandatory on every interactive
     :focus-visible. `--shadow-overlay` is for dropdowns/dialogs
     only. */
  --shadow-focus: 0 0 0 3px rgba(107, 29, 46, 0.2);
  --shadow-overlay: 0 1px 2px rgba(21,23,26,0.06), 0 12px 32px rgba(21,23,26,0.08);

  /* Motion */
  --transition: 150ms ease-out;
  --transition-slow: 280ms ease-out;
}

/* === RESET & BASE ============================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--c-ground);
  color: var(--c-text);
  font-family: var(--font-serif);
  font-size: var(--t-body);
  line-height: var(--lh-relaxed);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: var(--c-accent); color: var(--c-ground); }

/* === TYPOGRAPHY ============================================== */

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--c-ink);
  margin: 0 0 var(--s-3);
  line-height: var(--lh-tight);
}

h1 { font-size: var(--t-h1); letter-spacing: -0.01em; }
h2 { font-size: var(--t-h2); letter-spacing: -0.005em; margin-top: var(--s-5); }
h3 { font-size: var(--t-h3); margin-top: var(--s-4); }
h4 { font-size: var(--t-h4); margin-top: var(--s-3); }

.display {
  font-size: var(--t-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.standfirst {
  font-size: var(--t-h3);
  line-height: var(--lh-snug);
  color: var(--c-text-muted);
  font-style: italic;
  max-width: 32em;
}

p { margin: 0 0 var(--s-3); }
small, .small { font-size: var(--t-small); }

.caption,
.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-accent);
  margin-bottom: var(--s-1);
  display: block;
  font-weight: 500;
}

.caption { color: var(--c-text-faint); letter-spacing: 0.04em; }

a {
  color: var(--c-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(107, 29, 46, 0.4);
  transition: color var(--transition), text-decoration-color var(--transition);
}
a:hover { color: var(--c-accent-hover); text-decoration-color: var(--c-accent-hover); }
a:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
  border-radius: var(--r-sm);
}

ul, ol { margin: 0 0 var(--s-3); padding-left: var(--s-4); }
li { margin: 0 0 var(--s-1); }

blockquote {
  margin: var(--s-4) 0;
  padding: 0 0 0 var(--s-3);
  border-left: 2px solid var(--c-accent);
  color: var(--c-text-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--s-5) 0;
}

.rule--ornament {
  border: none;
  text-align: center;
  margin: var(--s-5) 0;
  color: var(--c-border-strong);
  height: auto;
}
.rule--ornament::before { content: "·   ·   ·"; letter-spacing: 0.5em; }

/* === LAYOUT ================================================== */

.container {
  max-width: var(--w-page);
  margin: 0 auto;
  padding: 0 var(--s-3);
}

@media (min-width: 720px) {
  .container { padding: 0 var(--s-4); }
}

.prose { max-width: var(--w-prose); }
.prose--centred { max-width: var(--w-prose); margin-left: auto; margin-right: auto; }
.content { max-width: var(--w-content); }

main { display: block; }

/* === HEADER ================================================== */

.site-header {
  border-bottom: 1px solid var(--c-border);
  padding: var(--s-3) 0;
  background: var(--c-ground);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.site-mark {
  font-family: var(--font-serif);
  font-size: var(--t-h4);
  font-weight: 600;
  color: var(--c-ink);
  text-decoration: none;
  letter-spacing: -0.005em;
  line-height: var(--lh-tight);
  display: inline-block;
}
.site-mark:hover { color: var(--c-accent); text-decoration: none; }

.site-mark__small {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--c-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  display: block;
  margin-bottom: 0.15em;
  line-height: 1;
}

/* === SVG WORDMARKS ============================================
   Wordmark SVGs are inlined inside `.site-mark` so they inherit
   the CSS below. Width is set per site to render the marks at
   approximately the same visual scale as the prior text-based
   marks (~17px primary text).
   ============================================================ */

.site-mark svg.wordmark {
  display: block;
  height: auto;
  /* Per-site widths set on the svg via class modifier */
}

.site-mark svg.wordmark--primary { width: 240px; }   /* The EX Institute */
.site-mark svg.wordmark--cexp    { width: 165px; }   /* cexp.online */
.site-mark svg.wordmark--expert  { width: 175px; }   /* ex.expert */

/* SVG font sizes are in viewBox units (not CSS pixels). Sizes
   below are tuned so that — at the display widths above —
   the visible text matches the typographic rhythm of the rest
   of the page (~11px caption, ~18px display). */

/* Primary wordmark (The EX Institute): three classes
   viewBox 480 × 88 — at 240px display, 0.5x scale */
.mark-tag {
  font-family: var(--font-sans);
  font-size: 22px;
  fill: var(--c-text-faint);
  font-weight: 500;
  letter-spacing: 2.2;
  text-transform: uppercase;
}
.mark-rule {
  stroke: var(--c-border-strong);
  stroke-width: 1;
}
.mark-name {
  font-family: var(--font-serif);
  font-size: 40px;
  fill: var(--c-ink);
  font-weight: 600;
  letter-spacing: -0.4;
}

/* cexp.online wordmark — viewBox 200 × 56 — at 165px display, 0.83x scale */
.cx-tag {
  font-family: var(--font-sans);
  font-size: 13px;
  fill: var(--c-text-faint);
  font-weight: 500;
  letter-spacing: 1.3;
  text-transform: uppercase;
}
.cx-name {
  font-family: var(--font-serif);
  font-size: 28px;
  fill: var(--c-ink);
  font-weight: 600;
  letter-spacing: -0.4;
}

/* ex.expert wordmark — viewBox 220 × 56 — at 175px display, 0.80x scale */
.xp-tag {
  font-family: var(--font-sans);
  font-size: 13px;
  fill: var(--c-text-faint);
  font-weight: 500;
  letter-spacing: 1.3;
  text-transform: uppercase;
}
.xp-name {
  font-family: var(--font-serif);
  font-size: 28px;
  fill: var(--c-ink);
  font-weight: 600;
  letter-spacing: -0.4;
}

/* Hover tints — applied via the parent .site-mark hover state */
.site-mark:hover .mark-name,
.site-mark:hover .cx-name,
.site-mark:hover .xp-name {
  fill: var(--c-accent);
  transition: fill var(--transition);
}

.site-nav {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  align-items: center;
}

.site-nav a {
  color: var(--c-text);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: var(--t-small);
  padding: 0.3em 0;
}
.site-nav a:hover { color: var(--c-accent); }
.site-nav a.is-current {
  color: var(--c-accent);
  border-bottom: 1px solid var(--c-accent);
}

/* === HERO ==================================================== */

.hero {
  padding: var(--s-7) 0 var(--s-5);
  border-bottom: 1px solid var(--c-border);
}

.hero h1 {
  font-size: var(--t-display);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.05;
  max-width: 18em;
  margin-bottom: var(--s-3);
}

@media (max-width: 640px) {
  .hero { padding: var(--s-5) 0 var(--s-4); }
  .hero h1 { font-size: 2rem; }
}

/* === SECTIONS ================================================ */

.section {
  padding: var(--s-6) 0;
}

.section + .section {
  border-top: 1px solid var(--c-border);
}

.section__head {
  margin-bottom: var(--s-4);
  max-width: 32em;
}

.section__head h2 { margin-top: 0; }

/* === CARDS / GRIDS =========================================== */

.cards {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
  margin-top: var(--s-4);
}

@media (min-width: 720px) {
  .cards { gap: var(--s-4); }
  .cards--3 { grid-template-columns: repeat(3, 1fr); }
  .cards--2 { grid-template-columns: repeat(2, 1fr); }
}

.card {
  padding: var(--s-3) 0;
  border-top: 1px solid var(--c-border);
}

.card__title {
  font-size: var(--t-h4);
  margin: 0 0 var(--s-1);
  font-weight: 600;
}

.card__body {
  font-size: var(--t-small);
  color: var(--c-text);
  margin: 0 0 var(--s-2);
}

.card__cta {
  font-family: var(--font-sans);
  font-size: var(--t-small);
}

/* === BUTTONS ================================================= */

.btn {
  display: inline-block;
  padding: 0.7em 1.5em;
  background: var(--c-ink);
  color: var(--c-ground) !important;
  text-decoration: none !important;
  font-family: var(--font-sans);
  font-size: var(--t-small);
  font-weight: 500;
  border: 1px solid var(--c-ink);
  border-radius: 1px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  letter-spacing: 0.01em;
}

.btn:hover {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-ground) !important;
}

.btn--ghost {
  background: transparent;
  color: var(--c-ink) !important;
}

.btn--ghost:hover {
  background: var(--c-ink);
  color: var(--c-ground) !important;
}

.btn-row {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: var(--s-3);
}

/* === TABLES ================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--s-3) 0;
  font-size: var(--t-small);
  font-family: var(--font-sans);
}

th, td {
  text-align: left;
  padding: var(--s-2);
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

th {
  font-weight: 500;
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-text-muted);
}

/* === DEFINITION LISTS ======================================== */

dl { margin: var(--s-3) 0; }
dt { font-weight: 600; color: var(--c-ink); margin-top: var(--s-3); }
dd { margin: 0 0 var(--s-2); padding: 0; }

/* === FOOTER ================================================== */

.site-footer {
  margin-top: var(--s-7);
  padding: var(--s-5) 0 var(--s-4);
  border-top: 1px solid var(--c-border);
  font-family: var(--font-sans);
  font-size: var(--t-small);
  color: var(--c-text-muted);
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

@media (min-width: 720px) {
  .site-footer__inner { grid-template-columns: 2fr 1fr 1fr 1fr; }
}

.site-footer h4 {
  font-family: var(--font-sans);
  font-size: var(--t-caption);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-faint);
  margin: 0 0 var(--s-2);
  font-weight: 500;
}

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

.site-footer li { margin: 0 0 var(--s-1); }

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

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

.site-footer__bottom {
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-border);
  font-size: var(--t-caption);
  color: var(--c-text-faint);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-2);
}

/* === ACCESSIBILITY =========================================== */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: var(--s-2) var(--s-3);
  background: var(--c-ink);
  color: var(--c-ground);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: var(--t-small);
}

.skip-link:focus {
  left: var(--s-2);
  top: var(--s-2);
}

/* === FORMS =================================================== */

label {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--t-small);
  margin-bottom: var(--s-1);
  color: var(--c-text);
  font-weight: 500;
}

label .label-help {
  display: block;
  font-weight: 400;
  color: var(--c-text-muted);
  font-size: var(--t-caption);
  margin-top: 0.2em;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
  display: block;
  width: 100%;
  padding: 0.7em 0.85em;
  font-family: var(--font-sans);
  font-size: var(--t-body);
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm);
  margin-bottom: var(--s-3);
}

textarea { min-height: 8em; resize: vertical; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: var(--shadow-focus);
}

button {
  cursor: pointer;
  font: inherit;
}

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

/* === BADGES / TAGS =========================================== */

.tag {
  display: inline-block;
  padding: 0.2em 0.6em;
  font-family: var(--font-sans);
  font-size: var(--t-caption);
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--c-warm-tint);
  color: var(--c-text);
  border-radius: var(--r-sm);
  margin-right: 0.3em;
}

.tag--accent {
  background: var(--c-accent);
  color: var(--c-ground);
}

/* === UTILITY ================================================= */

.text-muted { color: var(--c-text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); }
.mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); }

/* === PRINT =================================================== */

@media print {
  body { background: white; color: black; font-size: 11pt; }
  .site-header, .site-footer, .btn, .skip-link { display: none; }
  a { color: black; text-decoration: underline; }
  h1, h2, h3 { page-break-after: avoid; }
}
