/* ==========================================================================
   CXD Automation — v2 dark build
   An original dark design system built on the CXD brand tokens
   (Slate Navy #1E2D40 / Ivory #F7F4EF, Cormorant Garamond + Inter).
   All copy in these pages is placeholder. See v2/README.md.
   ========================================================================== */

@layer tokens, base, layout, components, motion;

/* ---------- tokens ------------------------------------------------------ */
@layer tokens {
  :root {
    /* ground: the brand navy taken down into a dark field */
    --ground:      #0C121B;
    --ground-2:    #101825;
    --raise:       #16202F;
    --raise-2:     #1B2838;

    /* ink on dark */
    --ink:         #F7F4EF;
    --ink-2:       #C3CBD6;
    --ink-3:       #9EA9B6;
    --ink-4:       #8593A2;

    /* the brand navy stays the accent, lifted so it reads on dark */
    --accent:      #6E9BD1;
    --accent-2:    #A8C6E8;
    --accent-ink:  #0C121B;

    /* hairlines */
    --hair:        rgba(247, 244, 239, 0.10);
    --hair-2:      rgba(247, 244, 239, 0.06);
    --hair-strong: rgba(247, 244, 239, 0.20);

    /* type */
    --display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --text:    "Inter", "Helvetica Neue", Arial, sans-serif;
    --label:   "Inter", "Helvetica Neue", Arial, sans-serif;

    /* scale */
    --maxw:    78rem;
    --measure: 60ch;
    --gutter:  clamp(1.25rem, 5vw, 5rem);
    --section: clamp(2.75rem, 5.5vw, 5.5rem);

    --track-label: 0.2em;
    --track-tight: -0.02em;

    --r-sm: 2px;
    --r-md: 4px;
    --r-lg: 10px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  }
}

/* ---------- base -------------------------------------------------------- */
@layer base {
  *, *::before, *::after { box-sizing: border-box; }

  html {
    background: var(--ground);
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  /* the masthead is sticky, so anchored sections need to clear it */
  section[id], main[id] { scroll-margin-top: 5.25rem; }

  body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--text);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
  }

  h1, h2, h3, h4 {
    font-family: var(--display);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: var(--track-tight);
    margin: 0;
    text-wrap: balance;
  }

  p { margin: 0 0 1em; max-width: var(--measure); }
  p:last-child { margin-bottom: 0; }

  a { color: inherit; }

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

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

  :focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 3px;
    border-radius: var(--r-sm);
  }

  .skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--ink); color: var(--ground);
    padding: 0.75rem 1rem; z-index: 100; border-radius: 0 0 var(--r-md) 0;
  }
  .skip:focus { left: 0; }

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

/* ---------- layout ------------------------------------------------------ */
@layer layout {
  .wrap {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  .band { padding-block: var(--section); position: relative; }
  .band + .band { border-top: 1px solid var(--hair-2); }
  .band--tint { background: var(--ground-2); }

  .grid { display: grid; gap: clamp(1.5rem, 3vw, 3rem); }
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  @media (max-width: 900px) {
    .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  }
}

/* ---------- components -------------------------------------------------- */
@layer components {

  /* --- labels / eyebrows --- */
  .label {
    font-family: var(--label);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: var(--track-label);
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }
  .label::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--hair);
  }
  .label--bare::after { display: none; }

  /* --- masthead --- */
  .masthead {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--ground) 82%, transparent);
    background: rgba(12, 18, 27, 0.82); /* fallback first for old engines */
    border-bottom: 1px solid var(--hair-2);
  }
  @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .masthead {
      background: color-mix(in srgb, var(--ground) 72%, transparent);
      -webkit-backdrop-filter: saturate(150%) blur(14px);
      backdrop-filter: saturate(150%) blur(14px);
    }
  }
  .masthead__in {
    display: flex; align-items: center; gap: 1.5rem;
    min-height: 64px;
  }
  .wordmark {
    font-family: var(--text);
    font-weight: 600;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--ink);
    white-space: nowrap;
  }
  .wordmark span { color: var(--ink-3); font-weight: 400; }
  .masthead__tag {
    font-size: 0.8125rem; color: var(--ink-3);
    border-left: 1px solid var(--hair);
    padding-left: 1rem;
  }
  @media (max-width: 820px) { .masthead__tag { display: none; } }

  .nav { margin-left: auto; display: flex; align-items: center; gap: 1.5rem; }
  .nav a {
    font-size: 0.875rem; color: var(--ink-2); text-decoration: none;
    transition: color 0.2s var(--ease);
  }
  .nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
  @media (max-width: 760px) { .nav { display: none; } }

  .kbd {
    font-family: var(--label);
    font-size: 0.75rem; color: var(--ink-3);
    border: 1px solid var(--hair); border-radius: var(--r-md);
    padding: 0.3rem 0.55rem; background: transparent; cursor: pointer;
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
  }
  .kbd:hover { color: var(--ink); border-color: var(--hair-strong); }
  .kbd__word { display: none; }
  @media (max-width: 760px) {
    .kbd__key { display: none; }
    .kbd__word { display: inline; }
    .kbd { margin-left: auto; padding: 0.45rem 0.7rem; }
  }

  /* --- hero --- */
  .hero { padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(1.75rem, 3vw, 2.5rem); }
  .hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
  }
  @media (max-width: 1000px) {
    .hero__grid { grid-template-columns: minmax(0, 1fr); }
  }

  .hero__eyebrow {
    font-size: 0.8125rem; color: var(--ink-3);
    margin: 0 0 clamp(1.25rem, 3vw, 2rem);
  }
  .hero h1 {
    font-size: clamp(2.75rem, 8.2vw, 6.5rem);
    line-height: 0.98;
    margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
  }
  .hero__sub {
    font-size: clamp(1rem, 1.4vw, 1.125rem);
    color: var(--ink-2);
    max-width: 34ch;
    margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
  }

  /* the cycling word */
  .cycle { position: relative; display: inline-block; color: var(--ink-3); }
  .cycle__slot { display: inline-block; }

  /* --- buttons --- */
  .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; }
  .btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font-family: var(--text); font-size: 0.9375rem; font-weight: 500;
    padding: 0.8rem 1.35rem;
    border-radius: var(--r-md);
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  }
  .btn--solid { background: var(--ink); color: var(--ground); }
  .btn--solid:hover { background: #fff; }
  .btn--ghost { border-color: var(--hair-strong); color: var(--ink); }
  .btn--ghost:hover { border-color: var(--ink-3); background: var(--raise); }
  .btn--text {
    padding-inline: 0.25rem; color: var(--ink-2);
    text-decoration: underline; text-underline-offset: 4px;
    text-decoration-color: var(--hair-strong);
  }
  .btn--text:hover { color: var(--ink); text-decoration-color: var(--accent); }

  /* --- reader lens (tabbed panel) --- */
  .lens {
    border: 1px solid var(--hair);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--raise), var(--ground-2));
    overflow: hidden;
  }
  .lens__head {
    padding: 1.25rem 1.25rem 0;
    border-bottom: 1px solid var(--hair-2);
  }
  .lens__note { font-size: 0.8125rem; color: var(--ink-3); margin: 0 0 1rem; }
  .lens__tabs { display: flex; gap: 0.25rem; }
  .lens__tab {
    flex: 1 1 0;
    appearance: none; background: none; border: 0;
    border-bottom: 2px solid transparent;
    color: var(--ink-3); cursor: pointer;
    font-family: var(--text); font-size: 0.875rem;
    padding: 0.75rem 0.5rem;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  }
  .lens__tab:hover { color: var(--ink-2); }
  .lens__tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
  .lens__tab svg { width: 15px; height: 15px; flex: none; }

  .lens__body { padding: 1.5rem 1.25rem 1.75rem; min-height: 15rem; }
  .lens__kicker {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-4); margin: 0 0 0.75rem;
  }
  .lens__body h3 { font-size: 1.6rem; margin: 0 0 0.6rem; }
  .lens__body p { font-size: 0.9375rem; color: var(--ink-2); }
  .lens__panel[hidden] { display: none; }

  .code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.78rem;
    line-height: 1.75;
    color: var(--ink-2);
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--hair-2);
    border-radius: var(--r-md);
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
    white-space: pre;
  }
  .code b { color: var(--accent-2); font-weight: 500; }

  /* --- signal strip --- */
  .strip {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.75rem 1.25rem;
    padding-block: 1.5rem;
    border-top: 1px solid var(--hair-2);
    font-size: 0.8125rem; color: var(--ink-3);
  }
  .strip__sep { color: var(--ink-4); }
  .strip__cue { margin-left: auto; display: inline-flex; align-items: center; gap: 0.6rem; }
  @media (max-width: 760px) { .strip__cue { margin-left: 0; } }

  /* --- thesis --- */
  .thesis__lead {
    font-family: var(--display);
    font-size: clamp(1.6rem, 3.4vw, 2.6rem);
    line-height: 1.18;
    max-width: 26ch;
    margin: 0 0 clamp(2.5rem, 5vw, 4rem);
  }
  .thesis__lead em { font-style: italic; color: var(--accent-2); }
  .pillar h3 {
    font-family: var(--label);
    font-size: 0.6875rem; font-weight: 500;
    letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink); margin: 0 0 0.85rem;
  }
  .pillar p { font-size: 0.9375rem; color: var(--ink-3); }

  /* --- doors --- */
  .door {
    display: block; text-decoration: none;
    border: 1px solid var(--hair-2);
    border-radius: var(--r-lg);
    padding: clamp(1.5rem, 2.4vw, 2rem);
    background: var(--ground-2);
    transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
  }
  .door:hover {
    border-color: var(--hair-strong);
    background: var(--raise);
    transform: translateY(-2px);
  }
  @media (prefers-reduced-motion: reduce) { .door:hover { transform: none; } }
  .door__n {
    font-family: var(--label); font-size: 0.75rem;
    letter-spacing: 0.14em; color: var(--ink-4);
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 2.5rem;
  }
  .door h3 { font-size: clamp(1.5rem, 2.4vw, 1.9rem); margin: 0 0 0.7rem; }
  .door p { font-size: 0.9375rem; color: var(--ink-3); margin-bottom: 1.25rem; }
  .door__meta {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }

  /* --- index rows --- */
  .row {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 15rem) minmax(0, 1fr);
    gap: 1.5rem;
    padding-block: clamp(1.5rem, 2.6vw, 2.25rem);
    border-top: 1px solid var(--hair-2);
    align-items: start;
  }
  .row:last-child { border-bottom: 1px solid var(--hair-2); }
  .row__n { font-family: var(--label); font-size: 0.75rem; color: var(--ink-4); letter-spacing: 0.1em; padding-top: 0.35rem; }
  .row__t {
    font-family: var(--label); font-size: 0.8125rem; font-weight: 500;
    letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink);
    padding-top: 0.3rem;
  }
  .row__d { font-size: 0.9375rem; color: var(--ink-3); }
  .row__tags { margin-top: 0.75rem; font-family: var(--label); font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); }
  @media (max-width: 760px) {
    .row { grid-template-columns: 2.5rem minmax(0, 1fr); }
    .row__d { grid-column: 2; }
  }

  /* --- cards (work / writing) --- */
  .card {
    display: flex; flex-direction: column;
    text-decoration: none;
    border: 1px solid var(--hair-2);
    border-radius: var(--r-lg);
    background: var(--ground-2);
    padding: clamp(1.25rem, 2vw, 1.75rem);
    min-height: 100%;
    transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
  }
  .card:hover { border-color: var(--hair-strong); background: var(--raise); }
  .card__k {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-4); margin: 0 0 0.9rem;
  }
  .card h3 { font-size: clamp(1.25rem, 1.9vw, 1.55rem); margin: 0 0 0.6rem; }
  .card p { font-size: 0.9rem; color: var(--ink-3); margin: 0 0 1.25rem; }
  .card__f {
    margin-top: auto; display: flex; gap: 1rem; flex-wrap: wrap;
    border-top: 1px solid var(--hair-2); padding-top: 1rem;
  }
  .stat { display: flex; flex-direction: column; gap: 0.15rem; }
  .stat b {
    font-family: var(--display); font-size: 1.4rem; font-weight: 600;
    color: var(--ink); line-height: 1;
  }
  .stat span {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }

  /* --- article list --- */
  .post {
    display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.5rem;
    padding-block: 1.6rem;
    border-top: 1px solid var(--hair-2);
    text-decoration: none;
    transition: background 0.2s var(--ease);
  }
  .post:last-of-type { border-bottom: 1px solid var(--hair-2); }
  .post:hover h3 { color: var(--accent-2); }
  .post time {
    font-family: var(--label); font-size: 0.75rem;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4);
    padding-top: 0.3rem;
  }
  .post h3 { font-size: 1.4rem; margin: 0 0 0.4rem; transition: color 0.2s var(--ease); }
  .post p { font-size: 0.9rem; color: var(--ink-3); margin: 0; }
  @media (max-width: 700px) {
    .post { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  }

  /* --- closing call --- */
  .call { text-align: center; }
  .call h2 {
    font-size: clamp(2rem, 5.5vw, 4rem);
    margin: 0 auto 1.25rem;
    max-width: 18ch;
  }
  .call p { margin-inline: auto; color: var(--ink-2); }
  .call .actions { justify-content: center; margin-top: 2rem; }

  /* --- footer --- */
  .foot {
    border-top: 1px solid var(--hair-2);
    padding-block: clamp(2.5rem, 5vw, 4rem) 2rem;
    background: var(--ground-2);
  }
  .foot__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
  }
  @media (max-width: 900px) { .foot__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 520px) { .foot__grid { grid-template-columns: minmax(0, 1fr); } }
  .foot h4 {
    font-family: var(--label); font-size: 0.6875rem; font-weight: 500;
    letter-spacing: var(--track-label); text-transform: uppercase;
    color: var(--ink-3); margin: 0 0 1rem;
  }
  .foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
  .foot a { font-size: 0.875rem; color: var(--ink-2); text-decoration: none; }
  .foot ul a { display: inline-block; padding-block: 0.25rem; }
  .foot a:hover { color: var(--ink); }
  .foot__base {
    display: flex; flex-wrap: wrap; gap: 1rem;
    justify-content: space-between; align-items: center;
    border-top: 1px solid var(--hair-2); padding-top: 1.5rem;
    font-size: 0.8125rem; color: var(--ink-4);
  }

  /* --- command palette --- */
  .palette[hidden] { display: none; }
  .palette {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: start center;
    padding: clamp(3rem, 12vh, 9rem) 1rem 1rem;
    background: rgba(4, 7, 11, 0.6);
  }
  @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
    .palette { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
  }
  .palette__box {
    width: min(34rem, 100%);
    background: var(--raise);
    border: 1px solid var(--hair-strong);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  }
  .palette__in {
    width: 100%; border: 0; background: none;
    padding: 1.05rem 1.25rem;
    color: var(--ink); font-family: var(--text); font-size: 1rem;
    border-bottom: 1px solid var(--hair-2);
  }
  .palette__in:focus-visible {
    outline: none; border-bottom-color: var(--accent);
    box-shadow: inset 0 -2px 0 var(--accent);
  }
  .palette__in::placeholder { color: var(--ink-4); }
  .palette__list { list-style: none; margin: 0; padding: 0.4rem; max-height: 20rem; overflow-y: auto; }
  .palette__list a {
    display: flex; justify-content: space-between; gap: 1rem; align-items: center;
    padding: 0.7rem 0.85rem; border-radius: var(--r-md);
    text-decoration: none; color: var(--ink-2); font-size: 0.9375rem;
  }
  .palette__list li[aria-selected="true"] a,
  .palette__list a:hover { background: var(--raise-2); color: var(--ink); }
  .palette__list small {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }
  .palette__empty { padding: 1.25rem; color: var(--ink-4); font-size: 0.9rem; }

  /* --- page header (inner pages) --- */
  .phead { padding-block: clamp(2.75rem, 5.5vw, 5rem) clamp(1.75rem, 3vw, 2.5rem); }
  .phead h1 { font-size: clamp(2.5rem, 6.5vw, 4.5rem); margin: 0 0 1.25rem; }
  .phead p { font-size: clamp(1rem, 1.3vw, 1.125rem); color: var(--ink-2); max-width: 48ch; }

  /* --- long-form prose (articles, case studies) --- */
  .prose { max-width: 68ch; }
  .prose > * + * { margin-top: 1.15em; }
  .prose p { font-size: 1.0625rem; line-height: 1.72; color: var(--ink-2); max-width: none; margin: 0; }
  .prose h2 {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    margin-top: 2.5em; margin-bottom: 0;
    padding-top: 1.75rem; border-top: 1px solid var(--hair-2);
  }
  .prose h3 { font-size: clamp(1.2rem, 1.9vw, 1.45rem); margin-top: 2em; margin-bottom: 0; }
  .prose ul, .prose ol { margin: 0; padding-left: 1.25rem; color: var(--ink-2); font-size: 1.0625rem; line-height: 1.72; }
  .prose li + li { margin-top: 0.5rem; }
  .prose strong { color: var(--ink); font-weight: 600; }
  .prose a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }

  .pull {
    font-family: var(--display);
    font-size: clamp(1.4rem, 2.8vw, 2rem);
    line-height: 1.25;
    color: var(--ink);
    border-left: 2px solid var(--accent);
    padding-left: clamp(1rem, 2vw, 1.75rem);
    margin-block: 2.25em !important;
  }

  .figure {
    border: 1px solid var(--hair-2);
    border-radius: var(--r-md);
    overflow: hidden;
    /* reset the UA default figure margin (1em 40px) which stole 80px on phones */
    margin-inline: 0;
    margin-block: 2em !important;
  }
  .figure__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .figure table { width: 100%; min-width: 22rem; border-collapse: collapse; font-size: 0.9375rem; }
  .figure th, .figure td { text-align: left; padding: 0.7rem 1rem; border-bottom: 1px solid var(--hair-2); }
  .figure th {
    font-family: var(--label); font-size: 0.6875rem; font-weight: 500;
    letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3);
    background: var(--raise);
  }
  .figure td { color: var(--ink-2); }
  .figure tr:last-child td { border-bottom: 0; }
  .figure figcaption {
    padding: 0.7rem 1rem; font-size: 0.8125rem; color: var(--ink-4);
    border-top: 1px solid var(--hair-2); background: var(--ground-2);
  }

  /* article head */
  .ahead { padding-block: clamp(3rem, 6vw, 5rem) clamp(1.5rem, 3vw, 2.5rem); }
  .ahead h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); margin: 0 0 1.25rem; max-width: 20ch; }
  .ahead__stand { font-size: clamp(1.05rem, 1.5vw, 1.25rem); color: var(--ink-2); max-width: 52ch; }
  .ahead__meta {
    display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem;
    margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--hair-2);
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }

  /* facts rail for case studies */
  .facts {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; background: var(--hair-2);
    border: 1px solid var(--hair-2); border-radius: var(--r-md);
    overflow: hidden; margin-bottom: clamp(2rem, 4vw, 3rem);
  }
  .facts > div { background: var(--ground-2); padding: 1.15rem 1.25rem; }
  .facts b {
    display: block; font-family: var(--display);
    font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 600;
    color: var(--ink); line-height: 1;
  }
  .facts span {
    display: block; margin-top: 0.45rem;
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }
  @media (max-width: 760px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

  /* previous / next */
  .pager {
    display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between;
    border-top: 1px solid var(--hair-2); padding-top: 1.5rem; margin-top: clamp(3rem, 6vw, 5rem);
  }
  .pager a { font-size: 0.9375rem; color: var(--ink-2); text-decoration: none; }
  .pager a:hover { color: var(--ink); }

  /* --- card footer line (engagement shapes) --- */
  .card__line {
    font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4);
  }

  /* --- footer legal line --- */
  .foot__legal { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }

  /* --- lead form --- */
  .form { display: grid; gap: 1.1rem; max-width: 40rem; }
  .form__row { display: grid; gap: 1.1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  @media (max-width: 620px) { .form__row { grid-template-columns: minmax(0, 1fr); } }
  .field { display: grid; gap: 0.4rem; }
  .field label {
    font-family: var(--label); font-size: 0.6875rem; font-weight: 500;
    letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-3);
  }
  .field input, .field select, .field textarea {
    width: 100%; font-family: var(--text); font-size: 0.9375rem; color: var(--ink);
    background: var(--ground-2); border: 1px solid var(--hair); border-radius: var(--r-md);
    padding: 0.75rem 0.9rem; transition: border-color 0.2s var(--ease);
  }
  .field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent);
  }
  .field textarea { min-height: 7.5rem; resize: vertical; }
  .field select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238B97A6' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.4rem;
  }
  .field__hint { font-size: 0.8125rem; color: var(--ink-4); }
  .form__foot { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
  .form__foot small { font-size: 0.8125rem; color: var(--ink-4); }
  .form__done {
    border: 1px solid var(--accent); border-radius: var(--r-md);
    padding: 1rem 1.25rem; color: var(--ink-2); background: var(--raise);
  }
  .form__done[hidden] { display: none; }

  /* --- what happens next (contact aside) --- */
  .next { display: grid; gap: 1rem; }
  .next__step {
    display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.75rem;
    padding-block: 0.9rem; border-top: 1px solid var(--hair-2);
  }
  .next__n { font-family: var(--label); font-size: 0.75rem; letter-spacing: 0.1em; color: var(--ink-4); padding-top: 0.2rem; }
  .next__step h3 { font-family: var(--text); font-size: 0.9375rem; font-weight: 600; margin: 0 0 0.25rem; letter-spacing: 0; }
  .next__step p { font-size: 0.875rem; color: var(--ink-3); margin: 0; }

  /* --- principal block (about) --- */
  .who {
    display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3rem); align-items: start;
  }
  @media (max-width: 760px) { .who { grid-template-columns: minmax(0, 1fr); } }
  .who__photo {
    aspect-ratio: 4 / 5; max-width: 100%; border-radius: var(--r-lg);
    background: linear-gradient(160deg, var(--raise-2), var(--ground-2));
    border: 1px solid var(--hair-2); display: grid; place-items: center;
    color: var(--ink-4); font-family: var(--label); font-size: 0.6875rem;
    letter-spacing: 0.14em; text-transform: uppercase; overflow: hidden;
  }
  .who__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .who h2 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); margin: 0 0 0.35rem; }
  .who__role { font-size: 0.9375rem; color: var(--ink-3); margin: 0 0 1.25rem; }
  .who p { font-size: 1rem; color: var(--ink-2); }

  /* --- facts rail (about) --- */
  .facts--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts--3 b { font-size: 1.15rem; font-family: var(--text); font-weight: 600; }

  /* --- commitments (data handling) --- */
  .commit { list-style: none; margin: 0; padding: 0; }
  .commit li {
    display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: 0.85rem;
    padding-block: 1rem; border-top: 1px solid var(--hair-2);
  }
  .commit li:last-child { border-bottom: 1px solid var(--hair-2); }
  .commit svg { width: 18px; height: 18px; color: var(--accent); margin-top: 0.15rem; }
  .commit b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 0.2rem; }
  .commit span { font-size: 0.9375rem; color: var(--ink-3); }

  /* --- placeholder marker --- */
  .ph {
    color: var(--ink-4);
    font-family: var(--label);
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border: 1px dashed var(--hair);
    border-radius: var(--r-sm);
    padding: 0.15rem 0.45rem;
    vertical-align: middle;
    white-space: nowrap;
  }
  .notice {
    background: var(--raise);
    border: 1px dashed var(--hair-strong);
    border-radius: var(--r-md);
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    color: var(--ink-2);
    margin-bottom: 2.5rem;
  }
  .notice strong { color: var(--ink); }
}

/* ---------- motion ------------------------------------------------------ */
@layer motion {
  [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    transition-delay: var(--d, 0ms);
  }
  [data-reveal].is-in { opacity: 1; transform: none; }

  /* if JS never runs, nothing may stay invisible */
  .no-js [data-reveal] { opacity: 1; transform: none; }

  @media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
    .door, .card, .post, .btn, .nav a { transition: none !important; }
  }
}
