/* =========================================================
   Shared design layer: tokens, components, motion utilities
   Linked from every page after Tailwind.
   ========================================================= */

:root {
    --ink: #111111;
    --ink-2: #2a2a2a;
    --text: #3f3f3f;
    --muted: #6b6b6b;
    --subtle: #9a9a9a;
    --line: #e6e6e6;
    --line-hover: #cfcfcf;
    --line-soft: #f1f1f1;
    --surface: #fafafa;
    --surface-2: #f4f4f4;
    --paper: #ffffff;
    --accent: #fca200;
    --accent-hover: #e89400;
    --accent-soft: #fff7ea;
    --accent-line: #f3d08a;
    --accent-ink: #8a5800;
    --success: #187a3e;
    --success-ink: #14532d;
    --success-soft: #f3faf5;
    --success-line: #c6e7d1;
    --danger: #d21f1f;
    --danger-soft: #fff6f6;
    --danger-line: #f3c4c4;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 20px;

    --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.04), 0 1px 1px rgba(17, 17, 17, 0.03);
    --shadow-md: 0 8px 24px -8px rgba(17, 17, 17, 0.12), 0 2px 6px -2px rgba(17, 17, 17, 0.06);
    --shadow-lg: 0 24px 48px -16px rgba(17, 17, 17, 0.16), 0 4px 12px -4px rgba(17, 17, 17, 0.08);

    --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
    --dur-fast: 160ms;
    --dur: 280ms;
    --dur-slow: 700ms;
}

/* ---------- Base ---------- */

html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01", "ss03";
    color: var(--ink);
}

h1, h2, h3, h4 {
    letter-spacing: -0.022em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

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

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

img {
    -webkit-user-drag: none;
}

/* ---------- Typography helpers ---------- */

.display {
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.02;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
}

.measure {
    max-width: 65ch;
}

.text-balance {
    text-wrap: balance;
}

/* ---------- Header ---------- */

#header {
    transition: background-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out);
}

#header.is-scrolled {
    background-color: rgba(255, 255, 255, 0.86);
    box-shadow: 0 1px 0 rgba(10, 10, 10, 0.04), 0 8px 24px -16px rgba(10, 10, 10, 0.12);
}

/* Sliding active pill behind desktop nav items */
#topCard {
    position: relative;
    isolation: isolate;
}

#topCard .nav-pill {
    position: absolute;
    top: 4px;
    left: 0;
    height: calc(100% - 8px);
    width: 0;
    border-radius: 999px;
    background: var(--surface-2);
    z-index: -1;
    opacity: 0;
    transition: transform 420ms var(--ease-spring), width 420ms var(--ease-spring), opacity var(--dur) var(--ease-out);
    pointer-events: none;
}

#topCard.has-pill .nav-item,
#topCard.has-pill .nav-item.active,
#topCard.has-pill .nav-item.bg-gray-500,
#topCard.has-pill .nav-item.bg-white {
    background-color: transparent !important;
}

.nav-item {
    color: var(--ink);
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.nav-item:hover,
#topCard.has-pill .nav-item:hover {
    background-color: var(--surface-2) !important;
}

#hamburger-btn {
    color: var(--ink);
    transition: background-color var(--dur-fast) var(--ease-out);
}

#hamburger-btn:hover {
    background-color: var(--surface-2);
}

.mobile-menu-item:hover,
.mobile-menu-item.active {
    background-color: var(--surface-2);
}

/* ---------- Buttons & links ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    appearance: none;
    background: transparent;
    color: var(--ink);
    transition:
        background-color var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out),
        box-shadow var(--dur) var(--ease-out),
        transform var(--dur-fast) var(--ease-out);
}

.btn-primary {
    background: var(--ink);
    border-color: var(--ink);
    color: var(--paper);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background: var(--ink-2);
    border-color: var(--ink-2);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--paper);
    border-color: var(--line);
    color: var(--ink);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background: var(--surface-2);
    border-color: var(--ink);
}

.btn-ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--muted);
    padding: 0.4rem 0.7rem;
    font-weight: 500;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
    color: var(--ink);
    border-color: var(--ink);
    background: var(--surface);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
}

.btn-arrow .arrow {
    display: inline-block;
    transition: transform var(--dur) var(--ease-spring);
}

.btn-arrow:hover .arrow,
.btn-arrow:focus-visible .arrow,
.lift:hover .btn-arrow .arrow {
    transform: translateX(3px);
}

.press {
    transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.press:active {
    transform: scale(0.97);
}

.hero-scroll {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.hero-scroll:hover,
.hero-scroll:focus-visible {
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
}

.hero-cred {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.35rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--ink);
}

.hero-cred-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.25rem;
}

.hero-cred-list {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0.625rem;
    font-weight: 500;
    line-height: 1.25rem;
}

.hero-cred-list .sep {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: var(--subtle);
    flex: none;
}

.github-star {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.github-star:hover,
.github-star:focus-visible {
    background: var(--ink-2);
}

.link-underline {
    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-out);
    text-decoration: none !important;
}

.link-underline:hover,
.link-underline:focus-visible {
    background-size: 100% 1px;
}

/* ---------- Chips ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
}

.chip-nda {
    border-color: var(--accent-line);
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.chip-live {
    border-color: var(--success-line);
    background: var(--success-soft);
    color: var(--success-ink);
}

.chip-live .live-dot {
    position: relative;
    width: 8px;
    height: 8px;
    flex: none;
}

.chip-live .live-dot::before,
.chip-live .live-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--success);
}

.chip-live .live-dot::after {
    animation: live-ping 1.6s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes live-ping {
    75%, 100% { transform: scale(2.2); opacity: 0; }
}

.nav-item.active {
    background-color: var(--surface-2);
    color: var(--ink);
}

.chip-nda::before {
    content: "\e308";
    display: block;
    font-family: "Phosphor" !important;
    speak: never;
    font-size: 0.875rem;
    line-height: 1;
    font-weight: normal;
    font-style: normal;
    color: currentColor;
}

/* ---------- Cards ---------- */

.lift {
    transition: transform 420ms var(--ease-out), box-shadow 420ms var(--ease-out), border-color var(--dur) var(--ease-out);
    will-change: transform;
    border-color: var(--line);
}

.lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-hover);
}

.lift .lift-media {
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.lift .lift-media img {
    transition: transform 900ms var(--ease-out);
}

.lift:hover .lift-media img {
    transform: scale(1.025);
}

/* ---------- Metrics ---------- */

.metric-value {
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

/* ---------- Scroll reveal ---------- */

.js [data-reveal] {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-visible,
.reveal-fallback [data-reveal] {
    opacity: 1;
    transform: none;
}

.js .lift[data-reveal].is-visible {
    transition: opacity var(--dur-slow) var(--ease-out), transform 420ms var(--ease-out), box-shadow 420ms var(--ease-out), border-color var(--dur) var(--ease-out);
}

.js .lift[data-reveal].is-visible:hover {
    transform: translateY(-4px);
}

/* ---------- Reading progress ---------- */

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 60;
    pointer-events: none;
}

/* ---------- Table of contents rail (case studies) ---------- */

.toc-rail {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: none;
    flex-direction: column;
    gap: 2px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.toc-rail::-webkit-scrollbar {
    display: none;
}

@media (min-width: 1480px) {
    .toc-rail {
        display: flex;
    }
}

.toc-rail a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 8px 5px 4px;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--subtle);
    text-decoration: none;
    border-radius: 6px;
    transition: color var(--dur) var(--ease-out);
    max-width: 150px;
}

.toc-rail a::before {
    content: "";
    flex: none;
    width: 12px;
    height: 1px;
    background: currentColor;
    transition: width var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}

.toc-rail a:hover {
    color: var(--ink-2);
}

.toc-rail a.is-active {
    color: var(--ink);
}

.toc-rail a.is-active::before {
    width: 22px;
    background: var(--accent);
}

/* ---------- Toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 16px);
    opacity: 0;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--paper);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 70;
    pointer-events: none;
    transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

[hidden] {
    display: none !important;
}

/* =========================================================
   Case study components (strategy-first template)
   ========================================================= */

.cs-body {
    font-size: 1.125rem;
    line-height: 1.7;
    font-weight: 300;
    color: var(--ink);
}

@media (min-width: 1024px) {
    .cs-body {
        font-size: 1.25rem;
    }
}

.cs-h2 {
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0;
}

@media (min-width: 640px) {
    .cs-h2 {
        font-size: 1.125rem;
    }
}

@media (min-width: 1024px) {
    .cs-h2 {
        position: sticky;
        top: 88px;
    }
}

.cs-part {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0;
}

.cs-part::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.cs-part-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
}

.cs-part-label b {
    color: var(--accent-ink);
    font-weight: 600;
    margin-right: 6px;
}

/* TL;DR */
.cs-tldr {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper);
}

@media (min-width: 768px) {
    .cs-tldr {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .cs-tldr {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cs-tldr > div {
    padding: 20px 22px;
    border-bottom: 1px solid var(--line);
}

@media (min-width: 768px) {
    .cs-tldr > div:nth-child(odd) {
        border-right: 1px solid var(--line);
    }
    .cs-tldr > div:nth-last-child(-n+2) {
        border-bottom: 0;
    }
}

@media (min-width: 1100px) {
    .cs-tldr > div {
        border-bottom: 0;
        border-right: 1px solid var(--line);
    }
    .cs-tldr > div:last-child {
        border-right: 0;
    }
}

.cs-tldr dt,
.cs-label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.cs-tldr dd {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}

/* Simple key-value grid (context & constraints, segments) */
.cs-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .cs-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cs-grid.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cs-cell {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    background: var(--paper);
    transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}

.cs-cell:hover {
    border-color: var(--line-hover);
    box-shadow: var(--shadow-sm);
}

.cs-cell h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 6px;
}

.cs-cell p,
.cs-cell li {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
}

.cs-cell p + p {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
    color: var(--muted);
}

/* North star */
.cs-northstar {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 28px 28px 28px 30px;
    background:
        radial-gradient(120% 140% at 0% 0%, var(--accent-soft) 0%, rgba(255, 247, 234, 0) 55%),
        var(--surface);
    border: 1px solid var(--line);
}

.cs-northstar blockquote {
    font-size: 1.25rem;
    line-height: 1.4;
    letter-spacing: -0.02em;
    font-weight: 500;
    color: var(--ink);
    margin: 0;
}

@media (min-width: 640px) {
    .cs-northstar blockquote {
        font-size: 1.5rem;
    }
}

.cs-northstar p {
    margin: 1rem 0 0;
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 400;
    color: var(--muted);
}

/* Decisions & tradeoffs table */
.cs-table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
    background: var(--paper);
}

.cs-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
    font-size: 0.95rem;
    line-height: 1.55;
}

.cs-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}

.cs-table td {
    vertical-align: top;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--text);
}

.cs-table tr:last-child td {
    border-bottom: 0;
}

.cs-table td:first-child {
    font-weight: 600;
    color: var(--ink);
    width: 22%;
}

.cs-table .chosen {
    color: var(--ink);
    font-weight: 500;
}

.cs-table .chosen::before,
.cs-table .rejected::before {
    display: inline-block;
    width: 1em;
    font-family: "Phosphor" !important;
    font-size: 1.05em;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    speak: never;
    margin-right: 0.4em;
    vertical-align: -0.18em;
    text-align: center;
}

.cs-table .chosen::before {
    content: "\e184";
    color: var(--success);
}

.cs-table .rejected {
    color: var(--muted);
    text-decoration: line-through;
    text-decoration-color: var(--line-hover);
}

.cs-table .rejected::before {
    content: "\e4f8";
    color: var(--subtle);
    text-decoration: none;
}

/* Not doing list */
.cs-not {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.cs-not li {
    display: grid;
    grid-template-columns: 1.25em 1fr;
    column-gap: 10px;
    align-items: start;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
}

.cs-not li::before {
    content: "\e3de";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25em;
    height: 1.6em;
    font-family: "Phosphor" !important;
    font-size: 1em;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    speak: never;
    color: var(--subtle);
}

.cs-not li strong {
    color: var(--ink);
    font-weight: 600;
}

/* KPIs */
.cs-kpis {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .cs-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .cs-kpis.cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cs-kpi {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    background: var(--paper);
}

.cs-kpi .value {
    font-size: 2rem;
    line-height: 1.05;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.cs-kpi .name {
    margin-top: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink-2);
}

.cs-kpi .name:first-child {
    margin-top: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
}

.cs-kpi .link {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--muted);
}

.cs-kpi .link b {
    color: var(--text);
    font-weight: 500;
}

/* Roadmap (Now / Next / Later) */
.cs-roadmap {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .cs-roadmap {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cs-lane {
    border-radius: var(--radius);
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.cs-lane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cs-lane-head span:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
}

.cs-lane-head span:last-child {
    font-size: 0.75rem;
    color: var(--muted);
}

.cs-lane ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.cs-lane li {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
}

.cs-lane li b {
    display: block;
    color: var(--ink);
    font-weight: 600;
    margin-bottom: 2px;
}

.cs-lane.now {
    background: var(--accent-soft);
    border-color: var(--accent-line);
}

/* =========================================================
   Unified type scale + page rhythm (source of truth: About page)
   ========================================================= */

/* Section title, e.g. "Selected work", "Let's talk" */
.h-section {
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.05;
    font-size: 2rem;
    color: var(--ink);
}

@media (min-width: 640px) {
    .h-section {
        font-size: 3rem;
    }
}

/* Intro paragraph under a page title */
.lead {
    font-size: 1.25rem;
    line-height: 1.45;
    font-weight: 300;
    color: var(--text);
}

@media (min-width: 640px) {
    .lead {
        font-size: 1.5rem;
    }
}

/* Sub-heading inside content, e.g. timeline entries, card groups */
.cs-h3 {
    font-size: 1.125rem;
    line-height: 1.35;
    font-weight: 600;
    color: var(--ink);
}

/* Supporting copy in cards and lists */
.card-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
}

.cs-list {
    margin: 0;
    padding-left: 1.25rem;
    list-style: disc;
    font-size: 1.125rem;
    line-height: 1.7;
    font-weight: 300;
    color: var(--ink);
}

.cs-list > li + li {
    margin-top: 0.35rem;
}

.cs-list strong {
    font-weight: 600;
}

@media (min-width: 1024px) {
    .cs-list {
        font-size: 1.25rem;
    }
}

#tldr {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.cs-page {
    max-width: 72rem;
    margin: 0 auto;
    padding-bottom: 4rem;
}

main .cs-page > * + * {
    margin-top: 3.5rem;
}

.cs-page > .cs-part {
    margin-top: 4.5rem;
}

@media (min-width: 1024px) {
    main .cs-page > * + * {
        margin-top: 4rem;
    }
    .cs-page > .cs-part {
        margin-top: 5.5rem;
    }
}

.cs-page > .cs-part + * {
    margin-top: 2.5rem;
}

/* Shared page chrome: same gutters as About */
.cs-shell {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 7rem;
}

@media (min-width: 640px) {
    .cs-shell {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
        padding-top: 8rem;
    }
}

@media (min-width: 1024px) {
    .cs-shell {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
        padding-top: 10rem;
    }
}

.cs-next {
    max-width: 72rem;
    margin: 0 auto;
    padding: 0 0 4rem;
}

.cs-next-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.lift:hover .btn-primary {
    background: var(--ink-2);
    border-color: var(--ink-2);
}

@media (min-width: 1024px) {
    .cs-next-card {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
        padding: 2rem 2.5rem;
    }
}

.cs-next-copy {
    order: 2;
}

.cs-next-copy .cs-h3 {
    margin: 0.35rem 0 0.75rem;
}

.cs-next-copy .card-text {
    margin: 0 0 1.25rem;
}

@media (min-width: 1024px) {
    .cs-next-copy {
        order: 1;
    }
    .cs-next-card .lift-media {
        order: 2;
    }
}

.cs-footer {
    max-width: 80rem;
    margin: 0 auto;
    padding: 2rem 1rem;
    border-top: 1px solid var(--line);
}

@media (min-width: 640px) {
    .cs-footer {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

.cs-hero > * + * {
    margin-top: 1.5rem;
}

.cs-hero .cs-meta {
    margin-top: 2rem;
}

.cs-title {
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.05;
    font-size: 2.25rem;
    color: var(--ink);
    max-width: 56rem;
    text-wrap: balance;
}

@media (min-width: 640px) {
    .cs-title {
        font-size: 3.75rem;
    }
}

@media (min-width: 1024px) {
    .cs-title {
        font-size: 4.5rem;
    }
}

.cs-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem 3rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .cs-section {
        grid-template-columns: 200px minmax(0, 1fr);
    }
}

@media (min-width: 1280px) {
    .cs-section {
        grid-template-columns: 240px minmax(0, 1fr);
    }
}

.cs-content {
    min-width: 0;
}

main .cs-content > * + * {
    margin-top: 1.25rem;
}

main .cs-content > p.cs-body + p.cs-body {
    margin-top: 1.25rem;
}

.cs-content > .cs-h3 {
    margin-top: 2.5rem;
}

.cs-content > .cs-h3:first-child {
    margin-top: 0;
}

.cs-content > .cs-h3 + * {
    margin-top: 0.75rem;
}

/* Figures (screens, diagrams) */
.cs-figure {
    margin: 0;
}

.cs-figure > img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--line-soft);
    background: var(--surface);
}

.cs-figure > figcaption {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--muted);
}

.cs-figure-row {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .cs-figure-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* =========================================================
   Case study storytelling components
   ========================================================= */

/* At a glance: role, team, timeline, platform */
.cs-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 24px;
    padding: 20px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    margin: 0;
}

@media (min-width: 768px) {
    .cs-meta {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.cs-meta dt {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.cs-meta dd {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
}

/* Impact strip: headline numbers right under the hero */
.cs-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    overflow: hidden;
}

@media (min-width: 900px) {
    .cs-stats {
        grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
    }
}

.cs-stats > div {
    padding: 20px 22px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.cs-stats .n {
    display: block;
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.cs-stats .l {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--muted);
}

@media (max-width: 899px) {
    .cs-stats > div:nth-child(2n) {
        border-right: 0;
    }
    .cs-stats > div:nth-last-child(-n+2):nth-child(odd),
    .cs-stats > div:last-child {
        border-bottom: 0;
    }
}

@media (min-width: 900px) {
    .cs-stats > div {
        border-bottom: 0;
    }
    .cs-stats > div:last-child {
        border-right: 0;
    }
}

/* Pull quote: a real voice from research */
.cs-quote {
    margin: 0;
    padding: 4px 0 4px 22px;
    border-left: 3px solid var(--accent);
}

.cs-quote blockquote {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.45;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-wrap: balance;
}

@media (min-width: 640px) {
    .cs-quote blockquote {
        font-size: 1.5rem;
    }
}

.cs-quote figcaption {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

/* Key insight callout */
.cs-insight {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
}

.cs-insight::before {
    content: "\e2dc";
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.25rem;
    height: 1.55rem;
    font-family: "Phosphor" !important;
    speak: never;
    font-size: 1.15rem;
    line-height: 1;
    font-weight: normal;
    font-style: normal;
    color: var(--accent-ink);
}

.cs-insight p {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ink-2);
}

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

/* Before / after comparison */
.cs-compare {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 768px) {
    .cs-compare {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cs-compare > div {
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--line);
    background: var(--paper);
}

.cs-compare > .after {
    border-color: var(--success-line);
    background: var(--success-soft);
}

.cs-compare .before .cs-label {
    color: var(--danger);
}

.cs-compare .after .cs-label {
    color: var(--success);
}

.cs-compare ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.cs-compare li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.975rem;
    line-height: 1.5;
    color: var(--text);
}

.cs-compare li::before {
    content: "";
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 1.25em;
    height: 1.5em;
    font-family: "Phosphor" !important;
    font-size: 1em;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    speak: never;
}

.cs-compare .before li::before {
    content: "\e4f8";
    color: var(--danger);
}

.cs-compare .after li::before {
    content: "\e184";
    color: var(--success);
}

/* Numbered lessons */
.cs-lessons {
    counter-reset: lesson;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 900px) {
    .cs-lessons {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cs-lessons > li {
    counter-increment: lesson;
    position: relative;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 44px 20px 18px;
    background: var(--paper);
}

.cs-lessons > li::before {
    content: counter(lesson, decimal-leading-zero);
    position: absolute;
    top: 16px;
    left: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent-ink);
}

.cs-lessons h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 6px;
}

.cs-lessons p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}

/* Trip gallery (About) */
.trip-photo {
    position: relative;
    margin: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
}

.trip-photo img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out);
}

.trip-photo figcaption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 28px 12px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--paper);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}

.trip-photo:hover img {
    transform: scale(1.04);
}

/* TO FILL placeholders */
.to-fill {
    display: block;
    border: 1.5px dashed var(--accent-line);
    background: repeating-linear-gradient(-45deg, var(--paper), var(--paper) 10px, var(--accent-soft) 10px, var(--accent-soft) 20px);
    color: var(--accent-ink);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.to-fill::before {
    content: "TO FILL";
    display: inline-block;
    margin-right: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--accent);
    color: var(--ink);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    vertical-align: 1px;
}

span.to-fill {
    display: inline;
    padding: 1px 6px;
}

/* =========================================================
   Diagram primitives (used where screens are under NDA)
   ========================================================= */

.diagram {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle, var(--line) 1px, transparent 1px) 0 0 / 18px 18px,
        var(--surface);
    padding: 24px;
    overflow-x: auto;
}

.diagram-caption {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--muted);
}

/* Horizontal flow */
.flow {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-width: max-content;
}

.flow-step {
    position: relative;
    width: 150px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
}

.flow-step .n {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.flow-step .t {
    margin-top: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.flow-step .d {
    margin-top: 4px;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--muted);
}

.flow-step.pain {
    border-color: var(--danger-line);
    background: var(--danger-soft);
}

.flow-step.pain .n {
    color: var(--danger);
}

.flow-step.good {
    border-color: var(--accent-line);
}

.flow-step.good .n {
    color: var(--accent-ink);
}

.flow-arrow {
    flex: none;
    width: 34px;
    align-self: center;
    height: 1px;
    background: var(--line-hover);
    position: relative;
}

.flow-arrow::after {
    content: "";
    position: absolute;
    right: 0;
    top: -3px;
    border-left: 6px solid var(--line-hover);
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
}

.flow-row-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 10px;
}

/* Animated travelling dot along a flow */
.js .flow.is-visible .flow-arrow::before {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: var(--accent);
    animation: flowDot 2.4s var(--ease-out) infinite;
    animation-delay: var(--i, 0s);
}

@keyframes flowDot {
    0% { transform: translateX(0); opacity: 0; }
    15% { opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateX(26px); opacity: 0; }
}

/* Lifecycle state machine */
.states {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 12px;
    min-width: 680px;
    position: relative;
}

.state {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 14px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.state small {
    display: block;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
}

.state.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(252, 162, 0, 0.14);
}

.states-loop {
    margin-top: 14px;
    min-width: 680px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--muted);
}

.states-loop span {
    flex: 1;
    border-top: 1px dashed var(--line-hover);
    padding-top: 8px;
    text-align: center;
}

/* Low-fidelity abstract wireframe */
.wire {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    min-width: 560px;
}

.wire-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.wire-bar i {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line);
}

.wire-body {
    display: grid;
    grid-template-columns: 170px 1fr 220px;
    min-height: 260px;
}

.wire-col {
    padding: 14px;
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wire-col:last-child {
    border-right: 0;
    background: var(--surface);
}

.wire-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
}

.sk {
    height: 10px;
    border-radius: 4px;
    background: var(--surface-2);
}

.sk.w-40 { width: 40%; }
.sk.w-60 { width: 60%; }
.sk.w-80 { width: 80%; }

.sk-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text);
}

.sk-row .dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line-hover);
    flex: none;
}

.sk-row.add .dot { background: var(--success); }
.sk-row.mod .dot { background: var(--accent); }
.sk-row.del .dot { background: var(--danger); }

.sk-row .tag {
    margin-left: auto;
    font-size: 0.65rem;
    color: var(--muted);
}

.sk-btn {
    margin-top: auto;
    height: 30px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sk-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text);
}

.sk-check::before {
    content: "\e182";
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success);
    font-family: "Phosphor" !important;
    font-size: 11px;
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    speak: never;
}

.sk-check.warn::before {
    content: "\e4e0";
    background: var(--accent-soft);
    color: var(--accent-ink);
}

/* Video slot */
.video-slot {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--ink);
}

.video-slot iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* =========================================================
   Remap Tailwind greys onto the site tokens
   ========================================================= */

.text-gray-400,
.text-gray-500 {
    color: var(--muted) !important;
}

.text-gray-600 {
    color: var(--text) !important;
}

.text-gray-700,
.text-gray-800,
.text-gray-900,
.text-black {
    color: var(--ink) !important;
}

.border-gray-100 {
    border-color: var(--line-soft) !important;
}

.border-gray-200 {
    border-color: var(--line) !important;
}

.border-gray-300 {
    border-color: var(--line) !important;
}

.bg-gray-100 {
    background-color: var(--surface-2) !important;
}

.hover\:bg-gray-100:hover,
.hover\:bg-gray-200:hover {
    background-color: var(--surface-2) !important;
}

.hover\:border-gray-900:hover,
.hover\:border-gray-400:hover {
    border-color: var(--ink) !important;
}

.hover\:text-gray-900:hover {
    color: var(--ink) !important;
}

/* =========================================================
   Reduced motion
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    .js [data-reveal] {
        opacity: 1;
        transform: none;
    }

    .lift:hover,
    .js .lift[data-reveal].is-visible:hover,
    .lift:hover .lift-media img {
        transform: none;
    }
}
