/* Main Phase Consulting — shared stylesheet
   Plain CSS, no build step. The complete light palette lives on bare :root;
   the dark blocks redefine tokens only. Every color below references a token. */

:root {
  /* palette — light */
  --ground: #F1F2F0;
  --surface: #FAFAF8;
  --ink: #1A2126;
  --ink-soft: #3E4A52;
  --muted: #66727A;
  --rule: #D3D7D3;
  --accent: #1F5C4A;
  --accent-soft: #DCE8E2;

  /* type */
  --font-sans: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, "Times New Roman", Times, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --text-label: 0.8125rem;
  --text-body: 1.0625rem;
  --text-lead: 1.25rem;
  --text-h2: 1.5rem;
  --text-h1: clamp(1.9rem, 3.4vw, 2.4rem);
  --text-hero: clamp(2.6rem, 5.5vw, 3.6rem);

  --track: 0.08em;
  --measure: 65ch;

  /* layout */
  --width-prose: 760px;
  --width-home: 880px;
  --wrap: var(--width-prose);
  --gutter: clamp(1.25rem, 4vw, 2.5rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 4.5rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #121619;
    --surface: #191F23;
    --ink: #E4E7E5;
    --ink-soft: #B9C1BE;
    --muted: #83908B;
    --rule: #2A3236;
    --accent: #5FB394;
    --accent-soft: #1C2E28;
  }
}

:root[data-theme="dark"] {
  --ground: #121619;
  --surface: #191F23;
  --ink: #E4E7E5;
  --ink-soft: #B9C1BE;
  --muted: #83908B;
  --rule: #2A3236;
  --accent: #5FB394;
  --accent-soft: #1C2E28;
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.home { --wrap: var(--width-home); }

.wrap {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}

main { flex: 1 0 auto; }

::selection { background: var(--accent-soft); color: var(--ink); }

/* ---------- links ---------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  font-family: var(--font-sans);
  text-decoration: none;
}
.skip:focus { top: var(--space-2); }

/* ---------- type ---------- */

h1, h2, h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-lead); line-height: 1.25; }

p {
  margin: 0;
  color: var(--ink-soft);
  max-width: var(--measure);
  text-wrap: pretty;
}

strong { color: var(--ink); font-weight: 600; }

.lead {
  font-size: var(--text-lead);
  line-height: 1.5;
  color: var(--ink);
  max-width: 52ch;
}

.label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--track);
  color: var(--muted);
  margin: 0;
  max-width: none;
}

.meta {
  font-family: var(--font-sans);
  font-size: var(--text-label);
  color: var(--muted);
  max-width: none;
}

address {
  font-style: normal;
  color: var(--ink-soft);
  line-height: 1.6;
}

/* ---------- header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  padding-block: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--ink);
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; }

.wordmark-name {
  font-family: var(--font-sans);
  font-size: var(--text-lead);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--accent);
}

.wordmark-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--track);
  color: var(--muted);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  font-family: var(--font-sans);
  font-weight: 500;
}
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.35em;
  padding-block: 0.2rem;
}
.site-nav a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule);
}
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink);
}

/* ---------- page structure ---------- */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding-block: var(--space-4) var(--space-5);
}

.stack { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-lg { display: flex; flex-direction: column; gap: var(--space-3); }

.page-head { display: flex; flex-direction: column; gap: var(--space-2); }

/* ---------- hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding-top: var(--space-3);
}

.hero h1 {
  font-size: var(--text-hero);
  line-height: 1.04;
  letter-spacing: -0.025em;
  max-width: 16ch;
}

.hero .lead { max-width: 56ch; }

.cta {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0.7rem 1.15rem;
  border: 1.5px solid var(--accent);
}
.cta:hover { background: var(--accent-soft); text-decoration: none; }
.cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- labeled section ---------- */

.section {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr);
  gap: var(--space-2) var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
}
.section > .label { padding-top: 0.4rem; }

.section-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

/* ---------- panel ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------- lists ---------- */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-width: var(--measure);
}
.list li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 5px;
  height: 5px;
  background: var(--muted);
}

.fit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--rule);
}
.fit > div { display: flex; flex-direction: column; gap: var(--space-2); }

/* ---------- case studies ---------- */

.case {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  scroll-margin-top: var(--space-3);
}
.case > h2 { max-width: 28ch; }

/* ---------- footer ---------- */

.site-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2) var(--space-3);
  padding-block: var(--space-3) var(--space-4);
  border-top: 1px solid var(--rule);
  font-family: var(--font-sans);
  font-size: var(--text-label);
  line-height: 1.6;
  color: var(--muted);
}
.site-footer p,
.site-footer address {
  margin: 0;
  color: inherit;
  font-size: inherit;
  font-style: normal;
  max-width: none;
}
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .section { grid-template-columns: 1fr; gap: var(--space-1); }
  .section > .label { padding-top: 0; }
  .fit { grid-template-columns: 1fr; }
  .site-footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
