/* ==========================================================================
   40 Spaces — site stylesheet
   Design tokens live at the top so the whole site can be restyled from here.
   Palette is carried over from the existing 40spaces.com brand kit.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand palette */
  --ink:        #0E1C2A;  /* deep navy — primary text and dark surfaces      */
  --ink-soft:   #1B2E42;  /* raised surface on navy                          */
  --signal:     #00D4A6;  /* mint — accent, only on dark or as a rule        */
  --deep:       #05604A;  /* darkened mint — accent text/marks on light      */
  --deep-mid:   #35907B;  /* mid step of the same hue (chart ramp)           */
  --sand:       #E8E3D8;  /* warm neutral                                    */
  --paper:      #F7F5EF;  /* page background                                 */
  --white:      #FFFFFF;
  --muted:      #4B5563;  /* secondary text on light                         */
  --muted-dark: #A9B6C4;  /* secondary text on navy                          */
  --line:       #DAD5C7;  /* hairline on light                               */
  --line-dark:  rgba(255, 255, 255, .16);

  /* Type */
  --font: "akzidenz-grotesk-next-pro", "Helvetica Neue", Helvetica, Arial,
          system-ui, sans-serif;

  --step--1: clamp(.8125rem, .78rem + .16vw, .875rem);
  --step-0:  clamp(1rem, .96rem + .2vw, 1.125rem);
  --step-1:  clamp(1.2rem, 1.12rem + .4vw, 1.4rem);
  --step-2:  clamp(1.45rem, 1.3rem + .75vw, 1.95rem);
  --step-3:  clamp(1.55rem, 1.25rem + 1.6vw, 2.75rem);
  --step-4:  clamp(1.8rem, 1.2rem + 3vw, 3.9rem);
  --step-5:  clamp(2.1rem, 1.1rem + 4.6vw, 5.25rem);

  /* Space + shape */
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 68ch;
  --wide: 1440px;
  --mid: 1120px;
  --radius: 4px;
  --radius-lg: 14px;
  --pill: 100px;

  --shadow-sm: 0 1px 2px rgba(14, 28, 42, .06), 0 6px 20px rgba(14, 28, 42, .05);
  --shadow-md: 0 2px 4px rgba(14, 28, 42, .07), 0 18px 44px rgba(14, 28, 42, .11);

  --header-h: 76px;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .5em;
  overflow-wrap: break-word;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -.022em;
  text-wrap: balance;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); letter-spacing: -.014em; }
h4 { font-size: var(--step-1); letter-spacing: -.01em; line-height: 1.25; }
h5, h6 { font-size: var(--step-0); letter-spacing: 0; line-height: 1.35; }

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a { color: var(--deep); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }

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

ul, ol { margin: 0 0 1.15em; padding-left: 1.35em; }
li { margin-bottom: .4em; }

strong { font-weight: 700; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 3rem 0;
}

figure { margin: 0; }

/* Visible keyboard focus everywhere. */
:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
  border-radius: 2px;
}
.on-dark :focus-visible,
.site-header :focus-visible,
.site-footer :focus-visible,
.band :focus-visible { outline-color: var(--signal); }

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 999;
  background: var(--signal);
  color: var(--ink);
  padding: .75rem 1.25rem;
  border-radius: var(--pill);
  font-weight: 700;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 1rem; }

/* --------------------------------------------------------------------------
   3. Layout primitives
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--mid { max-width: var(--mid); }
/* Long-form articles run as one centered column rather than a left-hung
   block with half the screen empty beside it. */
.wrap--narrow { max-width: 800px; }
.wrap--narrow .prose { max-width: none; }

.section { padding-block: clamp(3.5rem, 8vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--flush-top { padding-block-start: 0; }

.stack > * + * { margin-top: 1.15em; }

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--muted);
  max-width: 46ch;
}
.on-dark .lede { color: var(--muted-dark); }

/* Two-column reading layout: a narrow rail (heading or contents) beside the
   main column. Used on long pages so the page fills its measure at desktop
   widths instead of stranding half the screen. */
.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.split__aside { position: sticky; top: calc(var(--header-h) + 2rem); }
.split__main > *:first-child { margin-top: 0; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; gap: 2rem; }
  .split__aside { position: static; }
}

/* On-page contents */
.toc h2 {
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-top: 0;
  border-top: 0;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--line);
}
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: .55rem 0 .55rem 1.1rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  font-size: var(--step--1);
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  color: var(--ink);
}
.toc a:hover,
.toc a:focus-visible { color: var(--deep); border-left-color: var(--signal); }

/* --------------------------------------------------------------------------
   4. Signature: the measure rail
   A ruler-tick rule and a ticked eyebrow. The brand's whole argument is that a
   website is a measurable asset, so section markers are drawn as measurements.
   -------------------------------------------------------------------------- */
.measure {
  height: 9px;
  background-image: repeating-linear-gradient(
    to right,
    var(--signal) 0 1px,
    transparent 1px 11px
  );
}
.measure--light { opacity: .55; }

.rail {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
  margin: 0 0 1.4rem;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--deep);
}
.rail::before {
  content: "";
  flex: 0 0 auto;
  margin-top: .5em;
  width: 2.75rem;
  height: 7px;
  background-image: repeating-linear-gradient(
    to right,
    currentColor 0 1px,
    transparent 1px 7px
  );
}
.on-dark .rail, .band .rail { color: var(--signal); }

/* --------------------------------------------------------------------------
   5. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .95rem 2rem;
  border: 2px solid var(--signal);
  border-radius: var(--pill);
  background: var(--signal);
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease,
              transform .18s ease;
}
.btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--ink); color: var(--white); }

.on-dark .btn--ghost, .band .btn--ghost {
  border-color: rgba(255, 255, 255, .55);
  color: var(--white);
}
.on-dark .btn--ghost:hover, .band .btn--ghost:hover {
  background: var(--white);
  border-color: var(--white);
  color: var(--ink);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 2rem;
}

/* Text link with an arrow. */
.link-more {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid var(--signal);
  padding-bottom: .25rem;
}
.link-more::after { content: "\2192"; transition: transform .18s ease; }
.link-more:hover::after { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   6. Header + navigation (global part)
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink);
  border-bottom: 1px solid var(--line-dark);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-h);
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header__logo { display: flex; align-items: center; flex: 0 0 auto; }
.site-header__logo img { width: 168px; height: auto; }

.nav { margin-left: auto; }
.nav ul {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 2.2vw, 2.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav li { margin: 0; }
.nav a {
  display: block;
  padding: .4rem 0;
  color: var(--white);
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color .16s ease, border-color .16s ease;
}
.nav a:hover { color: var(--signal); }
/* Applied at runtime by Modo to the current page's link. */
.nav a.active { color: var(--signal); border-bottom-color: var(--signal); }

.site-header .btn { padding: .7rem 1.4rem; }

.nav-toggle {
  display: none;
  margin-left: auto;
  align-items: center;
  gap: .55rem;
  padding: .6rem .9rem;
  background: transparent;
  border: 1px solid var(--line-dark);
  border-radius: var(--pill);
  color: var(--white);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}
.nav-toggle__bars {
  position: relative;
  width: 18px;
  height: 2px;
  background: currentColor;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
}
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

/* Below 900px the nav collapses behind a toggle — but only once JS is running.
   Without JS there is no toggle, and the nav and CTA stay open and usable. */
@media (max-width: 900px) {
  .site-header__inner { flex-wrap: wrap; row-gap: 0; }
  .nav {
    flex-basis: 100%;
    margin-left: 0;
    border-top: 1px solid var(--line-dark);
  }
  .nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-block: .5rem 1.25rem;
  }
  .nav a { padding: .85rem 0; border-bottom: 1px solid var(--line-dark); }
  .nav a.active { border-bottom-color: var(--signal); }
  .site-header .btn { width: 100%; margin-block: 0 1.25rem; }

  .js-nav .nav-toggle { display: inline-flex; }
  .js-nav .nav { display: none; }
  .js-nav .nav[data-open="true"] { display: block; }
  .js-nav .site-header .btn { display: none; }
  .js-nav .nav[data-open="true"] ~ .btn { display: inline-flex; }
}

/* --------------------------------------------------------------------------
   7. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: clamp(460px, 74vh, 780px);
  padding-block: clamp(4rem, 12vw, 8rem) clamp(3rem, 7vw, 5rem);
  background: var(--ink);
  color: var(--white);
  overflow: hidden;
}
.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, rgba(14, 28, 42, .92) 0%, rgba(14, 28, 42, .3) 62%),
    linear-gradient(105deg, rgba(14, 28, 42, .94) 0%, rgba(14, 28, 42, .8) 48%,
                    rgba(14, 28, 42, .55) 100%);
}
.hero__inner { width: 100%; max-width: var(--wide); margin-inline: auto; padding-inline: var(--gutter); }
.hero h1 { max-width: 16ch; margin-bottom: .35em; }
.hero .lede { color: rgba(255, 255, 255, .84); max-width: 42ch; }
.hero .rail { color: var(--signal); }

/* Over photography, a hairline ghost button can wash out — give it a scrim. */
.hero .btn--ghost {
  background: rgba(14, 28, 42, .5);
  border-color: var(--white);
  color: var(--white);
}
.hero .btn--ghost:hover { background: var(--white); color: var(--ink); }

.hero--compact {
  min-height: clamp(320px, 46vh, 460px);
  align-items: center;
}
.hero--compact h1 { max-width: 20ch; font-size: var(--step-4); }
.hero--compact .lede { max-width: 58ch; }

/* --------------------------------------------------------------------------
   8. Chapters — the alternating story blocks on the home page
   -------------------------------------------------------------------------- */
.chapter {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
  border-top: 1px solid var(--line);
}
/* Both children are pinned to row 1. The text comes first in the source, so
   without this the flipped media — which wants an earlier column — falls past
   the auto-placement cursor and drops to a second row. */
.chapter__text { grid-column: 1 / span 6; grid-row: 1; max-width: 58ch; }
.chapter__media { grid-column: 8 / span 5; grid-row: 1; }
.chapter--flip .chapter__text { grid-column: 7 / span 6; }
.chapter--flip .chapter__media { grid-column: 1 / span 5; }

.chapter h2 { font-size: var(--step-3); }
.chapter__kicker {
  display: block;
  font-size: var(--step-1);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--muted);
  margin-bottom: .6rem;
}

.chapter__media img {
  width: 100%;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Full-page site screenshots are extremely tall (500 x 2560 and similar).
   Frame them as previews cropped from the top rather than letting one image
   set the height of a whole section. */
.shot {
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  background: var(--sand);
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
  box-shadow: none;
}
.chapter__media .shot { aspect-ratio: 4 / 5; }
.prose .shot { aspect-ratio: 16 / 11; margin-bottom: .75rem; }

@media (max-width: 860px) {
  .chapter__media .shot { aspect-ratio: 3 / 2; }
  .chapter { grid-template-columns: 1fr; }
  .chapter__text,
  .chapter__media,
  .chapter--flip .chapter__text,
  .chapter--flip .chapter__media { grid-column: 1 / -1; grid-row: auto; }
  .chapter--flip .chapter__media { order: -1; }
}

/* --------------------------------------------------------------------------
   9. Dark band (CTA, stats, feature sections)
   -------------------------------------------------------------------------- */
.band {
  background: var(--ink);
  color: var(--white);
}
.band h1, .band h2, .band h3, .band h4 { color: var(--white); }
.band a:not(.btn) { color: var(--signal); }
.band a:not(.btn):hover { color: var(--white); }
.band--sand { background: var(--sand); color: var(--ink); }
.band--sand h2 { color: var(--ink); }

/* Site-wide closing call to action (global part). */
.cta-band .wrap { text-align: center; }
.cta-band h2 { font-size: var(--step-3); margin-bottom: .5rem; }
.cta-band p { max-width: 60ch; margin-inline: auto; color: var(--muted-dark); }
.cta-band .btn-row { justify-content: center; }

/* --------------------------------------------------------------------------
   10. Card grids
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.card-grid > li { margin: 0; }
/* Post cards carry longer titles, so they get a wider minimum. */
.card-grid--posts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--deep-mid);
}
.card__media {
  aspect-ratio: 16 / 10;
  background: var(--sand);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding: 1.5rem 1.5rem 1.75rem;
  flex: 1 1 auto;
}
.card__body h3 { margin: 0; font-size: var(--step-1); }
.card__body p { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.6; }
/* Pin the card's action to the bottom so a row of cards lines up. */
.card__body .btn,
.card__body .link-more { margin-top: auto; padding-top: .5rem; align-self: flex-start; }
.card__body .btn { padding-block: .95rem; margin-block-start: auto; }

/* Card on a navy band. */
.card--dark {
  background: var(--ink-soft);
  border-color: var(--line-dark);
}
.card--dark:hover { border-color: var(--signal); }
.card--dark .card__body h3 { color: var(--white); }
.card--dark .card__body p { color: var(--muted-dark); font-size: var(--step-0); }

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  font-size: var(--step--1);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--deep);
}
.card__meta time { color: var(--muted); font-weight: 400; letter-spacing: .06em; }

/* Whole-card link: the heading anchor covers the card. */
.card--linked { position: relative; }
.card--linked a.card__link { text-decoration: none; color: inherit; }
.card--linked a.card__link::after { content: ""; position: absolute; inset: 0; }
.card--linked:focus-within { outline: 3px solid var(--signal); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   11. Charts — the PLG results. One hue, light-to-dark: before is the lighter
   step, after the darker. Every bar is direct-labeled, so the reading never
   depends on color alone.
   -------------------------------------------------------------------------- */
.chart { margin: 0 0 2.5rem; }
.chart__title { font-size: var(--step-2); margin-bottom: .35rem; }
.chart__note { font-size: var(--step--1); color: var(--muted); margin-bottom: 1.5rem; max-width: 62ch; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0 0 1.75rem;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.legend li { display: flex; align-items: center; gap: .5rem; margin: 0; }
.legend__swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.legend__swatch--before { background: var(--deep-mid); }
.legend__swatch--after { background: var(--deep); }

.deltas { margin: 0; padding: 0; list-style: none; }
.delta {
  margin: 0;
  padding: 1.15rem 0;
  border-top: 1px solid var(--line);
}
.delta:last-child { border-bottom: 1px solid var(--line); }

.delta__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1rem;
  margin-bottom: .7rem;
}
.delta__label { font-weight: 700; font-size: var(--step-0); }
.delta__change {
  margin-left: auto;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--deep);
}

.delta__bars { display: grid; gap: 2px; }
.delta__row { display: flex; align-items: center; gap: .75rem; }
.delta__bar {
  height: 16px;
  min-width: 3px;
  border-radius: 0 var(--radius) var(--radius) 0;
  width: var(--w, 0%);
}
.delta__bar--before { background: var(--deep-mid); }
.delta__bar--after { background: var(--deep); }
.delta__value {
  flex: 0 0 auto;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}
.delta__value b { color: var(--ink); font-weight: 700; }

/* Ranked single-series bars — interior page views after launch. */
.ranked { margin: 0; padding: 0; list-style: none; }
.ranked li {
  display: grid;
  grid-template-columns: minmax(7.5rem, 10rem) 1fr auto;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: .55rem 0;
}
.ranked__label { font-weight: 700; font-size: var(--step--1); }
.ranked__bar {
  height: 16px;
  min-width: 3px;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--deep);
  width: var(--w, 0%);
}
.ranked__value { font-variant-numeric: tabular-nums; font-size: var(--step--1); color: var(--muted); }

@media (max-width: 560px) {
  .ranked li { grid-template-columns: 1fr auto; }
  .ranked__bar { grid-column: 1 / -1; order: 3; }
}

/* Data table alternative to the charts. */
.data-table-wrap { overflow-x: auto; margin-top: 1.5rem; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
.data-table caption {
  text-align: left;
  font-weight: 700;
  padding-bottom: .75rem;
  color: var(--muted);
}
.data-table th, .data-table td {
  text-align: left;
  padding: .65rem .9rem .65rem 0;
  border-bottom: 1px solid var(--line);
}
.data-table th { font-weight: 700; }
.data-table td + td, .data-table th + th { text-align: right; padding-right: 0; }

details.data-toggle { margin-top: 1.5rem; }
details.data-toggle > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--deep);
  padding: .5rem 0;
}

/* --------------------------------------------------------------------------
   12. Stat tiles
   -------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--line-dark);
  border: 1px solid var(--line-dark);
}
.stats li {
  margin: 0;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: var(--ink);
}
.stat__value {
  display: block;
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--signal);
  font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block;
  margin-top: .75rem;
  font-size: var(--step--1);
  line-height: 1.45;
  color: var(--muted-dark);
}

/* --------------------------------------------------------------------------
   13. FAQ accordion — native details/summary, keyboard accessible by default
   -------------------------------------------------------------------------- */
.faq-group { margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.faq-group > h2 { font-size: var(--step-3); }
.faq-group > h3 { font-size: var(--step-2); margin-top: 0; }

.faq { border-top: 1px solid var(--line); }
.faq > details { border-bottom: 1px solid var(--line); }
.faq > details > summary {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.35rem .25rem;
  cursor: pointer;
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.01em;
  list-style: none;
}
.faq > details > summary::-webkit-details-marker { display: none; }
.faq > details > summary::after {
  content: "";
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-left: auto;
  margin-top: .4em;
  border-right: 2px solid var(--deep);
  border-bottom: 2px solid var(--deep);
  transform: rotate(45deg);
  transition: transform .2s ease;
}
.faq > details[open] > summary::after { transform: rotate(-135deg); }
.faq > details > summary:hover { color: var(--deep); }
.faq__answer { padding: 0 3rem 1.6rem .25rem; max-width: var(--measure); }
.faq__answer > *:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   14. Prose — legal pages, blog posts, case study bodies
   -------------------------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose h2 {
  font-size: var(--step-2);
  margin-top: 2.5em;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { font-size: var(--step-1); margin-top: 2em; }
.prose h4 { font-size: var(--step-0); margin-top: 1.8em; text-transform: none; }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li { margin-bottom: .5em; }
.prose figure { margin: 2.5rem 0; }
.prose figure img { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
figcaption {
  margin-top: .75rem;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--muted);
}
.prose blockquote {
  margin: 2rem 0;
  padding: .25rem 0 .25rem 1.5rem;
  border-left: 3px solid var(--signal);
  font-size: var(--step-1);
  line-height: 1.45;
}

/* Wider container for the case-study body so charts get room, centred under
   the full-width hero and stats band. */
.prose--wide { max-width: 880px; margin-inline: auto; }

/* --------------------------------------------------------------------------
   15. Article header + post lists
   -------------------------------------------------------------------------- */
.post-header { border-bottom: 1px solid var(--line); }
.post-header h1 { font-size: var(--step-4); max-width: 22ch; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.25rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
  color: var(--muted);
}
.post-meta li { margin: 0; }
.post-meta .post-meta__cat {
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--deep);
}

.post-hero { margin-block: 2.5rem 3rem; }
.post-hero img { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* Category filter bar generated by Modo on listing pages. */
.modo-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: 2rem;
}
.modo-filterbar [data-modo-cat] {
  padding: .5rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--step--1);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
}
.modo-filterbar [data-modo-cat].is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

/* --------------------------------------------------------------------------
   16. Notice — flags content the 40 Spaces team still needs to review
   -------------------------------------------------------------------------- */
.review-note {
  margin: 2rem 0;
  padding: 1.1rem 1.35rem;
  background: #FFF6D6;
  border: 1px solid #E0C86A;
  border-left: 5px solid #B8901A;
  border-radius: var(--radius);
  color: #4A3A05;
  font-size: var(--step--1);
  line-height: 1.55;
}
.review-note strong { color: #3A2D04; }
.review-note p:last-child { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   17. Footer (global part)
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--ink);
  color: var(--muted-dark);
  padding-block: clamp(3rem, 6vw, 4.5rem) 2rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (min-width: 901px) {
  .site-footer__grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}
.site-footer h2 {
  font-size: var(--step--1);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 1.15rem;
}
.site-footer__logo img { width: 180px; margin-bottom: 1.25rem; }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { color: var(--signal); text-decoration: underline; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: .65rem; font-size: var(--step--1); }
.site-footer address { font-style: normal; font-size: var(--step--1); line-height: 1.8; }

.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.5rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line-dark);
  font-size: var(--step--1);
}
.site-footer__base ul { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-left: auto; }
.site-footer__base li { margin: 0; }

/* --------------------------------------------------------------------------
   18. Motion — opt-in, and always disabled when the visitor asks
   -------------------------------------------------------------------------- */
/* The hidden state is only applied once JS has taken over, so content is
   never invisible to a visitor without JavaScript. */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .55s ease, transform .55s ease;
}
.js-reveal [data-reveal].is-visible { opacity: 1; transform: none; }

.js-bar { transition: width .8s cubic-bezier(.22, .8, .3, 1); }

@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;
  }
  .js-reveal [data-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   19. Print
   -------------------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .cta-band, .btn-row, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .hero { min-height: auto; background: none; color: #000; }
  .hero::after, .hero__media { display: none; }
}
