/* ==========================================================================
   Customer story — single-story page
   One stylesheet for every story page; the pages differ only in their copy.

   Values come from design-output/story-cal-ai/ (design-tokens.json plus the
   two section captures). Layout: a dark head carrying the title, deck and
   three stat cards, then a two-column body on the page cream — a sticky
   company rail on the left, the article on the right.
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────────────────
   Head — dark band under the floating nav
   ────────────────────────────────────────────────────────────────────────── */

.story-hero {
    position: relative;
    overflow: hidden;
    background: var(--c-ink);
    color: var(--c-text-invert);
    padding-block: 100px var(--s-10);
}

/* The one piece of artwork on the band: a soft lime wash bleeding in from the
   bottom-right corner, the same accent the buttons use. */
.story-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -140px;
    width: 420px;
    height: 420px;
    border-radius: var(--r-round);
    background: rgba(221, 243, 70, 0.3);
    filter: blur(90px);
    pointer-events: none;
}

.story-hero__inner {
    position: relative;   /* above the wash */
    z-index: 1;
}

/* Back to the index. The arrow is lime against the white label, drawn rather
   than loaded so it needs no asset. */
.story-hero__back {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    font-size: var(--t-md);
    font-weight: var(--w-medium);
    line-height: 1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--c-text-invert);
}

.story-hero__back-arrow {
    width: 20px;
    height: 20px;
    flex: none;
    fill: var(--c-lime);
    transition: transform 0.2s ease;
}

.story-hero__back:hover .story-hero__back-arrow {
    transform: translateX(-3px);
}

/* 56/61.6 with -0.56px tracking on the source; clamped down for narrow
   screens but holding the same ratio. */
.story-hero__title {
    margin-block-start: var(--s-9);
    font-family: var(--font-serif);
    font-size: clamp(34px, 3.9vw, 56px);
    font-weight: var(--w-regular);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
}

.story-hero__deck {
    margin-block-start: var(--s-5);
    font-family: var(--font-serif);
    font-size: clamp(20px, 2.2vw, 32px);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    color: var(--c-text-invert);
}

/* ── Stat cards ───────────────────────────────────────────────────────────
   Three cards on a 20px gap, each an olive-black capsule holding a second,
   slightly lighter box inset by 20px. The doubled border is what gives the
   strip its depth on an otherwise flat black band.
   ────────────────────────────────────────────────────────────────────────── */

.story-hero__stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-5);
    margin-block-start: var(--s-10);
}

.story-stat {
    padding: var(--s-5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--r-lg);
    /* --c-ink-warm, the olive-black already in the palette */
    background: var(--c-ink-warm);
}

.story-stat__inner {
    padding: var(--s-5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    /* One step lighter than the card it sits in */
    background: #3b3c2f;
}

.story-stat__figure {
    font-family: var(--font-serif);
    font-size: clamp(34px, 3.4vw, 48px);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
}

.story-stat__label {
    margin-block-start: var(--s-3);
    font-size: var(--t-sm);
    line-height: var(--lh-snug);
    letter-spacing: -0.01em;
    color: var(--c-text-invert-80);
}

/* ──────────────────────────────────────────────────────────────────────────
   Body — company rail + article
   ────────────────────────────────────────────────────────────────────────── */

.story-body {
    background: var(--c-bone);
}

.story-body__grid {
    display: grid;
    grid-template-columns: 319px minmax(0, 1fr);
    align-items: start;
}

/* ── Rail ─────────────────────────────────────────────────────────────── */

.story-rail {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-5);
    padding-block: var(--s-10);
    padding-inline-end: var(--s-7);
    /* Follows the reader down the article, which is long. */
    position: sticky;
    top: var(--s-5);
}

.story-rail__logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    object-position: left center;
}

.story-rail__blurb {
    font-size: var(--t-md);
    line-height: var(--lh-snug);
    letter-spacing: -0.01em;
    color: rgba(90, 90, 90, 0.8);
}

/* Short rule, not a full-width one — it stops well short of the column edge
   on the source, which is what keeps the rail feeling like a margin note. */
.story-rail__rule {
    width: 202px;
    max-width: 100%;
    height: 1px;
    background: var(--border-color);
}

/* Muted card closing the rail — the newsletter prompt. */
.story-rail__card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s-4);
    padding: var(--s-5);
    border-radius: var(--r-sm);
    background: var(--c-bone-deep);
}

.story-rail__card p {
    font-family: var(--font-serif);
    font-size: var(--t-base);
    line-height: var(--lh-snug);
    letter-spacing: -0.01em;
    color: var(--c-text-soft);
}

/* ── Article ──────────────────────────────────────────────────────────── */

.story-article {
    padding-block: var(--s-10);
    padding-inline-start: var(--s-10);
    border-left: 1px solid var(--border-color);
}

/* 40/44 with -1.6px tracking on the source — the tightest setting on the
   page, which is what makes it read as the article's title. */
.story-article__lead {
    font-family: var(--font-serif);
    font-size: clamp(28px, 2.9vw, 40px);
    font-weight: var(--w-regular);
    line-height: var(--lh-tight);
    letter-spacing: -0.04em;
    color: var(--c-text);
}

.story-article__figure {
    margin: var(--s-7) 0 0;
}

.story-article__figure img {
    width: 100%;
    border-radius: 16px;
    background: var(--c-white);
}

.story-article__figure figcaption {
    margin-block-start: var(--s-3);
    font-size: var(--t-sm);
    color: var(--c-text-muted);
}

/* Each block of the story: a heading and its prose. */
.story-section {
    margin-block-start: var(--s-9);
}

.story-section__title {
    font-family: var(--font-serif);
    font-size: clamp(24px, 2.2vw, 30px);
    font-weight: var(--w-regular);
    line-height: 1.4;
    letter-spacing: -0.04em;
    color: var(--c-text-soft);
}

.story-section > p,
.story-section > ul,
.story-section > ol {
    margin-block-start: var(--s-5);
    max-width: 76ch;
    font-size: var(--t-base);
    line-height: 1.6;
    letter-spacing: -0.02em;
    color: var(--c-text-muted);
}

.story-section > p + p {
    margin-block-start: var(--s-4);
}

/* A bold line introducing a list sits tight to it. */
.story-section__lead-in + ul,
.story-section__lead-in + ol {
    margin-block-start: var(--s-2);
}

.story-section__lead-in {
    font-weight: var(--w-medium);
    color: var(--c-text-soft);
}

/* Bulleted and numbered runs, each item a bold lead-in then prose. */
.story-list li,
.story-steps li {
    position: relative;
    padding-inline-start: var(--s-5);
}

.story-list li + li,
.story-steps li + li {
    margin-block-start: var(--s-2);
}

.story-list li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 0.68em;
    width: 4px;
    height: 4px;
    border-radius: var(--r-round);
    background: var(--c-text-muted);
}

/* Numbers are drawn by a counter so the markup stays a plain <ol>. */
.story-steps {
    counter-reset: story-step;
}

.story-steps li {
    counter-increment: story-step;
}

.story-steps li::before {
    content: counter(story-step) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--c-text-muted);
}

.story-list strong,
.story-steps strong {
    font-weight: var(--w-medium);
    color: var(--c-text-soft);
}

/* Pull quote — indented italic serif, set off by white space alone. */
.story-quote {
    max-width: 72ch;
    margin: var(--s-6) 0 0;
    padding-inline-start: var(--s-5);
    font-family: var(--font-serif);
    font-size: var(--t-base);
    font-style: italic;
    line-height: 1.8;
    color: var(--c-text-muted);
}

.story-quote cite {
    display: block;
    margin-block-start: var(--s-2);
    font-family: var(--font-ui);
    font-size: var(--t-sm);
    font-style: normal;
    color: var(--c-text-soft);
}

/* Closing band inside the article: on to the next story, or a call. */
.story-article__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-4);
    margin-block-start: var(--s-10);
    padding-block-start: var(--s-7);
    border-top: 1px solid var(--border-color);
}

.story-article__end p {
    flex: 1 1 260px;
    font-family: var(--font-serif);
    font-size: var(--t-xl);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    color: var(--c-text);
}

/* ──────────────────────────────────────────────────────────────────────────
   Narrow screens — the rail stops being a rail and becomes a header block.
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .story-body__grid {
        grid-template-columns: 1fr;
    }

    .story-rail {
        position: static;
        padding-block: var(--s-9) 0;
        padding-inline-end: 0;
    }

    .story-article {
        padding-block: var(--s-9);
        padding-inline-start: 0;
        border-left: 0;
        border-top: 1px solid var(--border-color);
        margin-block-start: var(--s-9);
    }
}

@media (max-width: 640px) {
    .story-hero {
        padding-block: 88px var(--s-9);
    }

    .story-hero__title {
        margin-block-start: var(--s-7);
    }

    .story-hero__stats {
        grid-template-columns: 1fr;
        gap: var(--s-4);
        margin-block-start: var(--s-9);
    }
}
