/* ==========================================================================
   SUCCESS STORIES (case-studies/index) — framed design system
   Uses home.css tokens (body.home-frame) plus these page rules.
   ========================================================================== */
body.stories-frame { background: var(--page); }

body.stories-frame .sp-hero,
body.stories-frame .sp-logos,
body.stories-frame .sp-stories,
body.stories-frame .sp-voices,
body.stories-frame .sp-backed {
    width: min(var(--frame), calc(100% - 32px));
    margin: 0 auto;
    background: #fff;
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
}
body.stories-frame .sp-eyebrow {
    display: inline-flex;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--deep-purple);
    background: var(--lavender);
    border: 1px solid rgba(70, 46, 125, 0.28);
    border-radius: 2px;
    padding: 7px 14px;
    margin-bottom: 20px;
}
body.stories-frame .sp-label {
    margin: 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
    text-align: center;
}

/* Hero */
body.stories-frame .sp-hero {
    margin-top: var(--nav-h);
    padding: clamp(64px, 10vh, 112px) var(--gutter) clamp(48px, 7vh, 80px);
    text-align: center;
    position: relative;
    background-image: radial-gradient(ellipse 55% 60% at 50% 0%, rgba(70, 138, 247, 0.10), transparent 70%);
}
body.stories-frame .sp-hero::after {
    content: '';
    position: absolute; top: 0; right: 0; width: 64px; height: 64px;
    border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
    background: linear-gradient(to bottom left, var(--page) calc(50% - 0.5px), var(--line-strong) 50%, #fff calc(50% + 0.5px));
}
body.stories-frame .sp-hero-inner { max-width: 820px; margin: 0 auto; }
body.stories-frame .sp-hero h1 {
    font-family: var(--font);
    font-size: clamp(36px, 5vw, 64px);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 1.06;
    color: var(--navy);
    text-wrap: balance;
    margin: 0 0 18px;
}
body.stories-frame .sp-hero-sub { font-size: 18px; line-height: 1.6; color: rgba(1, 28, 64, 0.82); max-width: 58ch; margin: 0 auto 30px; }
body.stories-frame .sp-hero-cta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
body.stories-frame .sp-hero-cta .btn { min-height: 48px; padding: 0 26px; }
body.stories-frame .sp-yc {
    display: inline-flex; align-items: center; gap: 10px;
    margin-top: 28px; padding: 8px 14px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--navy); text-decoration: none;
    border: 1px solid var(--line); border-radius: 2px; background: #fff;
}
body.stories-frame .sp-yc img { height: 22px; width: auto; }
body.stories-frame .sp-yc:hover { border-color: #F26625; }

/* Logo wall */
body.stories-frame .sp-logos { border-top: 1px solid var(--line); padding: 28px 0 0; }
body.stories-frame .sp-logo-wall {
    display: grid; grid-template-columns: repeat(7, 1fr);
    margin-top: 22px; border-top: 1px solid var(--line);
}
body.stories-frame .sp-logo-wall img {
    width: 100%; height: 88px; object-fit: contain; padding: 18px 16px;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    filter: grayscale(100%); opacity: 0.8; transition: filter 0.3s, opacity 0.3s;
}
body.stories-frame .sp-logo-wall img:nth-child(7n) { border-right: 0; }
body.stories-frame .sp-logo-wall img:hover { filter: none; opacity: 1; }

/* Section heads */
body.stories-frame .sp-section-head { text-align: center; max-width: 760px; margin: 0 auto 48px; }
body.stories-frame .sp-section-head h2 {
    font-family: var(--font); font-size: clamp(30px, 3.6vw, 46px); font-weight: 600;
    letter-spacing: -0.025em; line-height: 1.1; color: var(--navy); margin: 0 0 14px; text-wrap: balance;
}
body.stories-frame .sp-section-head p { font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 0 auto; max-width: 60ch; }

/* Story cards */
body.stories-frame .sp-stories { padding: 96px var(--gutter); border-top: 1px solid var(--line); }
body.stories-frame .sp-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
body.stories-frame .sp-card {
    display: flex; flex-direction: column; gap: 14px;
    padding: 28px; text-decoration: none; color: inherit; background: #fff;
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    transition: background 0.2s;
}
body.stories-frame .sp-card:hover { background: var(--page); }
body.stories-frame .sp-card-featured {
    grid-column: span 2; grid-row: span 2;
    background: var(--navy); color: #fff;
    background-image:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 120px),
        repeating-linear-gradient(-45deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 120px);
    padding: 40px;
}
body.stories-frame .sp-card-featured:hover { background-color: #03264f; }
body.stories-frame .sp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.stories-frame .sp-card-logo { height: 40px; width: auto; max-width: 150px; object-fit: contain; }
body.stories-frame .sp-card-featured .sp-card-logo { background: #fff; padding: 6px 10px; border-radius: 2px; height: 52px; }
body.stories-frame .sp-tag {
    font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--deep-purple); background: var(--lavender); border-radius: 2px; padding: 3px 8px; white-space: nowrap;
}
body.stories-frame .sp-metric { display: flex; flex-direction: column; gap: 2px; }
body.stories-frame .sp-metric b { font-size: clamp(36px, 3.6vw, 48px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; color: var(--blue); }
body.stories-frame .sp-metric span { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
body.stories-frame .sp-card-featured .sp-metric b { font-size: clamp(56px, 6vw, 88px); color: #fff; }
body.stories-frame .sp-card-featured .sp-metric span { color: var(--teal); }
body.stories-frame .sp-card h3 { font-family: var(--font); font-size: 18px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--navy); margin: 0; }
body.stories-frame .sp-card-featured h3 { font-size: clamp(22px, 2.2vw, 30px); color: #fff; }
body.stories-frame .sp-card-quote { margin: 4px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--blue); }
body.stories-frame .sp-card-quote p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--ink-2); font-style: normal; }
body.stories-frame .sp-card-featured .sp-card-quote p { font-size: 18px; color: rgba(255,255,255,0.9); }
body.stories-frame .sp-card-quote footer { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
body.stories-frame .sp-card-quote footer img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
body.stories-frame .sp-card-quote footer span { display: flex; flex-direction: column; }
body.stories-frame .sp-card-quote footer strong { color: var(--navy); font-size: 13px; }
body.stories-frame .sp-card-featured .sp-card-quote footer,
body.stories-frame .sp-card-featured .sp-card-quote footer strong { color: rgba(255,255,255,0.85); }
body.stories-frame .sp-card-cta { margin-top: auto; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
body.stories-frame .sp-card-featured .sp-card-cta { color: #fff; }

/* Testimonials */
body.stories-frame .sp-voices { padding: 96px var(--gutter); border-top: 1px solid var(--line); background: var(--page); background-image: repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 7px); }
body.stories-frame .sp-quote-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
body.stories-frame .sp-quote {
    grid-column: span 2; margin: 0; background: #fff; border: 1px solid var(--line);
    padding: 28px; display: flex; flex-direction: column; gap: 18px;
}
body.stories-frame .sp-quote:nth-child(4), body.stories-frame .sp-quote:nth-child(5) { grid-column: span 3; }
body.stories-frame .sp-quote blockquote { margin: 0; font-size: 17px; line-height: 1.55; font-weight: 500; color: var(--navy); }
body.stories-frame .sp-quote figcaption { display: flex; align-items: center; gap: 12px; margin-top: auto; }
body.stories-frame .sp-quote figcaption img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
body.stories-frame .sp-quote figcaption span { display: flex; flex-direction: column; font-size: 13px; color: var(--ink-3); }
body.stories-frame .sp-quote figcaption strong { font-size: 15px; color: var(--navy); }
body.stories-frame .sp-quote-link { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }

/* Investors */
body.stories-frame .sp-backed { padding: 40px var(--gutter); border-top: 1px solid var(--line); }
body.stories-frame .sp-investors { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 18px 44px; margin-top: 20px; }
body.stories-frame .sp-investors img { height: 30px; width: auto; filter: grayscale(100%); opacity: 0.65; }
body.stories-frame .sp-investors img.sp-yc-logo { filter: none; opacity: 1; height: 34px; }

/* Final CTA inline styles cleanup */
body.stories-frame .cta-content h2 { max-width: 20ch; margin-left: auto; margin-right: auto; }

@media (max-width: 1024px) {
    body.stories-frame .sp-logo-wall { grid-template-columns: repeat(4, 1fr); }
    body.stories-frame .sp-logo-wall img:nth-child(7n) { border-right: 1px solid var(--line); }
    body.stories-frame .sp-logo-wall img:nth-child(4n) { border-right: 0; }
    body.stories-frame .sp-grid { grid-template-columns: repeat(2, 1fr); }
    body.stories-frame .sp-card-featured { grid-column: span 2; grid-row: auto; }
    body.stories-frame .sp-quote-grid { grid-template-columns: repeat(2, 1fr); }
    body.stories-frame .sp-quote, body.stories-frame .sp-quote:nth-child(4), body.stories-frame .sp-quote:nth-child(5) { grid-column: span 1; }
}
@media (max-width: 640px) {
    body.stories-frame .sp-hero, body.stories-frame .sp-logos, body.stories-frame .sp-stories,
    body.stories-frame .sp-voices, body.stories-frame .sp-backed { width: calc(100% - 16px); }
    body.stories-frame .sp-hero { padding: 48px 16px 40px; }
    body.stories-frame .sp-hero-sub { font-size: 15px; }
    body.stories-frame .sp-hero-cta .btn { flex: 1 1 100%; }
    body.stories-frame .sp-logo-wall { grid-template-columns: repeat(3, 1fr); }
    body.stories-frame .sp-logo-wall img { height: 70px; padding: 14px 10px; border-right: 1px solid var(--line) !important; }
    body.stories-frame .sp-logo-wall img:nth-child(3n) { border-right: 0 !important; }
    body.stories-frame .sp-stories, body.stories-frame .sp-voices { padding: 64px 16px; }
    body.stories-frame .sp-grid { grid-template-columns: 1fr; }
    body.stories-frame .sp-card-featured { grid-column: auto; padding: 28px; }
    body.stories-frame .sp-card { padding: 22px; }
    body.stories-frame .sp-quote-grid { grid-template-columns: 1fr; }
    body.stories-frame .sp-quote { padding: 22px; }
    body.stories-frame .sp-backed { padding: 32px 16px; }
    body.stories-frame .sp-investors { gap: 16px 28px; }
    body.stories-frame .sp-investors img { height: 24px; }
}
html:has(body.stories-frame), body.stories-frame { overflow-x: clip; }

/* Logo carousel (replaces the static wall): seamless CSS marquee */
body.stories-frame .sp-marquee {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent);
}
body.stories-frame .sp-marquee-track { display: flex; width: max-content; animation: spMarquee 45s linear infinite; }
body.stories-frame .sp-marquee:hover .sp-marquee-track { animation-play-state: paused; }
body.stories-frame .sp-marquee-set { display: flex; align-items: center; gap: 56px; padding: 22px 28px; }
body.stories-frame .sp-marquee-set img {
    height: 52px; width: auto; max-width: 160px; object-fit: contain; flex-shrink: 0;
    filter: grayscale(100%); opacity: 0.8; transition: filter 0.3s, opacity 0.3s;
}
body.stories-frame .sp-marquee-set img:hover { filter: none; opacity: 1; }
@keyframes spMarquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
    body.stories-frame .sp-marquee-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; }
    body.stories-frame .sp-marquee-set[aria-hidden="true"] { display: none; }
    body.stories-frame .sp-marquee-set { flex-wrap: wrap; justify-content: center; }
}
@media (max-width: 640px) {
    body.stories-frame .sp-marquee-set { gap: 36px; padding: 16px 18px; }
    body.stories-frame .sp-marquee-set img { height: 40px; }
    body.stories-frame .sp-marquee-track { animation-duration: 35s; }
}
