/* ============================================================
   Case Study Pages — Listing + Detail
   Design reference: Figma node 12911:14941 (desktop 1440px)
                     Figma node 12958:15863 (mobile 390px)
   Dark-themed, matching Teachmint X brand.
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
    --cs-surface:        #1a1a1a;
    --cs-surface-2:      #2a2a2a;
    --cs-border:         rgba(255, 255, 255, 0.08);
    --cs-border-light:   rgba(255, 255, 255, 0.12);
    --cs-accent:         #1DA1F2;
    --cs-text-primary:   #ffffff;
    --cs-text-secondary: rgba(255, 255, 255, 0.72);
    --cs-text-muted:     rgba(255, 255, 255, 0.45);
    --cs-stat-bg:        #ffffff;
    --cs-stat-value:     #1F3965;
    --cs-stat-label:     #374151;
    --cs-stat-border:    #e5e7eb;
    --cs-badge-bg:       rgba(255, 255, 255, 0.1);
    --cs-max-w:          1280px;
    --cs-px:             80px;
    --cs-py:             64px;
}

/* ── Page text color (bg comes from bg-black Tailwind class on <body>) ── */
body.cs-page {
    color: var(--cs-text-primary);
}

/* ── Shared inner container ─────────────────────────────────── */
.cs-inner {
    max-width: var(--cs-max-w);
    margin: 0 auto;
    padding-left: var(--cs-px);
    padding-right: var(--cs-px);
}

/* ============================================================
   HERO — Two-column: title left, image right
   ============================================================ */
.cs-hero {
    background-color: black;
    padding: 40px var(--cs-px) 32px;
    max-width: var(--cs-max-w);
    margin: 0 auto;
}

.cs-hero__inner {
    display: flex;
    align-items: center;
    gap: 48px;
}

.cs-hero__left {
    flex: 1;
    min-width: 0;
}

.cs-hero__title {
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--cs-text-primary);
    margin: 0 0 20px;
}

.cs-hero__subtitle {
    font-size: 16px;
    font-weight: 400;
    color: var(--cs-text-secondary);
    line-height: 1.65;
    margin: 0;
}

.cs-hero__right {
    width: 440px;
    min-width: 440px;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    border: 1px solid var(--cs-border-light);
    overflow: hidden;
    background-color: black;
    flex-shrink: 0;
}

.cs-hero__right img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cs-hero__video {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
}

/* ============================================================
   SUMMARY + ABOUT — Dark, two-column with blue vertical rule
   ============================================================ */
.cs-summary-section {
    background-color: black;
    border-top: 1px solid var(--cs-border);
    border-bottom: 1px solid var(--cs-border);
}

.cs-summary-section__inner {
    display: grid;
    grid-template-columns: 1fr 2px 1fr;
    gap: 0;
    max-width: var(--cs-max-w);
    margin: 0 auto;
    padding: var(--cs-py) var(--cs-px);
}

.cs-summary-col {
    padding: 0 48px;
}

.cs-summary-col:first-child {
    padding-left: 0;
}

.cs-summary-col:last-child {
    padding-right: 0;
}

.cs-summary-divider {
    width: 2px;
    height: 224px;
    background-color: #1DA1F2;
    align-self: center;
}

.cs-summary-col__heading {
    font-size: 28px;
    font-weight: 700;
    color: var(--cs-text-primary);
    margin: 0 0 16px;
}

.cs-summary-col__text {
    font-size: 15px;
    color: var(--cs-text-secondary);
    line-height: 1.75;
    margin: 0 0 20px;
}

.cs-summary-col__text:last-child {
    margin-bottom: 0;
}

.cs-school-badge {
    display: inline-flex;
    align-items: center;
    background: var(--cs-badge-bg);
    border: 1px solid var(--cs-border-light);
    border-radius: 100px;
    padding: 6px 16px;
    font-size: 13px;
    color: var(--cs-text-secondary);
    margin-top: 8px;
}

/* ============================================================
   STATS BAR — White section, blue numbers
   ============================================================ */
.cs-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background-color: var(--cs-stat-bg);
    border-top: 1px solid var(--cs-stat-border);
    border-bottom: 1px solid var(--cs-stat-border);
}

.cs-stat {
    padding: 36px 24px;
    text-align: center;
    border-right: 1px solid var(--cs-stat-border);
}

.cs-stat:last-child {
    border-right: none;
}

.cs-stat__value {
    display: block;
    font-size: 44px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--cs-stat-value);
    margin-bottom: 10px;
}

.cs-stat__label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: var(--cs-stat-label);
    line-height: 1.4;
}

/* ============================================================
   BODY SECTIONS — Dark background
   ============================================================ */
.cs-body {
    background-color: black;
    max-width: var(--cs-max-w);
    margin: 0 auto;
    padding: 0 var(--cs-px);
}

.cs-section {
    padding: 32px 0;
    border-bottom: 1px solid var(--cs-border);
}

.cs-section:last-child {
    border-bottom: none;
}

.cs-section:first-child {
    padding-top: var(--cs-py);
}

.cs-section:first-child::before {
    top: var(--cs-py);
}

/* Section heading */
.cs-section__heading {
    font-size: 30px;
    font-weight: 700;
    color: var(--cs-text-primary);
    margin: 0 0 28px;
    line-height: 1.25;
}

/* 32 × 84 px accent block — Figma spec: width 32, height 84 */
.cs-section {
    position: relative;
}

.cs-section::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--cs-px));   /* escapes the cs-body padding */
    top: 32px;                        /* matches .cs-section padding-top */
    width: 32px;
    height: 84px;
    background-color: var(--cs-accent);
    border-radius: 0 4px 4px 0;
}

.cs-section__subheading {
    font-size: 18px;
    font-weight: 600;
    color: var(--cs-text-primary);
    margin: 28px 0 10px;
    line-height: 1.4;
}

.cs-section__subheading:first-child {
    margin-top: 0;
}

.cs-section__paragraph {
    font-size: 17px;
    color: var(--cs-text-secondary);
    line-height: 1.8;
    margin: 0 0 16px;
}

.cs-section__paragraph:last-child {
    margin-bottom: 0;
}

.cs-section__bullets {
    list-style: disc;
    padding-left: 20px;
    margin: 0 0 16px;
}

.cs-section__bullets li {
    font-size: 15px;
    color: var(--cs-text-secondary);
    line-height: 1.75;
    margin-bottom: 6px;
}

/* ============================================================
   TESTIMONIAL CARD — Slightly lighter dark surface
   ============================================================ */
.cs-testimonial {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border-light);
    border-radius: 12px;
    padding: 36px 40px;
    margin: 28px auto;
    text-align: center;
    max-width: 680px;
}

.cs-testimonial__quote {
    font-size: 17px;
    font-weight: 400;
    color: var(--cs-text-primary);
    line-height: 1.75;
    margin: 0 0 28px;
}

.cs-testimonial__attribution {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.cs-testimonial__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--cs-surface-2);
}

.cs-testimonial__meta {
    text-align: left;
}

.cs-testimonial__school {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--cs-text-primary);
    line-height: 1.4;
}

.cs-testimonial__author {
    display: block;
    font-size: 13px;
    color: var(--cs-text-muted);
    margin-top: 2px;
}

/* ============================================================
   CTA SECTION — Split layout: text left, image right
   ============================================================ */
.cs-cta-section {
    background-color: black;
    border-top: 1px solid var(--cs-border);
}

.cs-cta-section__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    align-items: center;
    max-width: var(--cs-max-w);
    margin: 0 auto;
    padding: 60px var(--cs-px);
}

.cs-cta-section__heading {
    font-size: 36px;
    font-weight: 700;
    color: var(--cs-text-primary);
    margin: 0 0 16px;
    line-height: 1.25;
}

.cs-cta-section__text {
    font-size: 16px;
    color: var(--cs-text-secondary);
    margin: 0 0 36px;
    line-height: 1.7;
}

.cs-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--cs-stat-bg);
    color: black;
    font-size: 15px;
    font-weight: 600;
    padding: 13px 28px;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity 0.18s ease;
    border: none;
    cursor: pointer;
}

.cs-cta-btn:hover {
    opacity: 0.88;
    color: black;
    text-decoration: none;
}

.cs-cta-section__image-wrap {
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background-color: var(--cs-surface);
}

.cs-cta-section__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   LISTING PAGE — Hero (centred dark)
   ============================================================ */
.cs-listing-hero {
    background-color: black;
    text-align: center;
    padding: 16px var(--cs-px);
}

.cs-listing-hero__eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cs-text-muted);
    margin-bottom: 14px;
}

.cs-listing-hero__title {
    font-size: 46px;
    font-weight: 700;
    color: var(--cs-text-primary);
    margin: 0 0 8px;
    line-height: 1.15;
}

.cs-listing-hero__subtitle {
    font-size: 17px;
    color: var(--cs-text-secondary);
    margin: 0 auto;
    max-width: 560px;
    line-height: 1.65;
}

/* ============================================================
   LISTING CARD GRID
   ============================================================ */
.cs-listing-section {
    background-color: black;
    padding: 24px;
    max-width: var(--cs-max-w);
    margin: 0 auto;
}

.cs-listing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}

.cs-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-border-light);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.cs-card:hover {
    border-color: rgba(37, 99, 235, 0.45);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.cs-card__image-wrap {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #2a2a2a;
}

.cs-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.cs-card:hover .cs-card__image {
    transform: scale(1.03);
}

.cs-card__body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cs-card__badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--cs-text-muted);
    align-self: flex-start;
}

.cs-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--cs-text-primary);
    line-height: 1.45;
    margin: 0;
}

.cs-card__excerpt {
    font-size: 13px;
    color: var(--cs-text-secondary);
    line-height: 1.65;
    margin: 0;
    flex: 1;
}

.cs-card__stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.cs-card__stat-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--cs-text-muted);
    background: var(--cs-surface-2);
    border-radius: 4px;
    padding: 4px 8px;
}

.cs-card__stat-chip strong {
    color: var(--cs-text-primary);
    font-weight: 700;
}

.cs-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--cs-accent);
    text-decoration: none;
    margin-top: 6px;
    transition: gap 0.15s ease;
}

.cs-card__link:hover {
    gap: 10px;
    color: var(--cs-accent);
    text-decoration: none;
}

/* ── Pinned / featured case study card ─────────────────────── */
.cs-pinned-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
    background: var(--cs-surface);
    border: 3px solid var(--tm-color-bl-2);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease;
    margin-bottom: 48px;
    isolation: isolate;
    position: relative;
    z-index: 0;
}

.cs-pinned-card:hover {
    border-color: var(--tm-color-bl-1);
    text-decoration: none;
    color: inherit;
}

.cs-pinned-card__image {
    overflow: hidden;
    position: relative;
    min-height: 280px;
}

.cs-pinned-card__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    display: block;
    transition: transform 0.4s ease;
}

.cs-pinned-card:hover .cs-pinned-card__image img {
    transform: scale(1.05);
}

.cs-pinned-card__body {
    padding: 48px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    justify-content: center;
    background: #222121;
}

.cs-pinned-card__label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tm-color-bl-2);
    background: var(--tm-color-bl-4);
    padding: 4px 10px;
    border-radius: 4px;
    align-self: flex-start;
}

.cs-pinned-card__badge {
    font-size: 12px;
    color: var(--cs-text-muted);
    font-weight: 500;
}

.cs-pinned-card__title {
    font-size: 24px;
    font-weight: 700;
    color: var(--cs-text-primary);
    line-height: 1.35;
    margin: 0;
}

.cs-pinned-card__excerpt {
    font-size: 15px;
    color: var(--cs-text-secondary);
    line-height: 1.7;
    margin: 0;
}

.cs-pinned-card__stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 4px 0;
}

.cs-pinned-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cs-pinned-card__stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--tm-color-wh-1);
    line-height: 1.1;
}

.cs-pinned-card__stat-label {
    font-size: 12px;
    color: var(--cs-text-secondary);
    line-height: 1.4;
}

/* "All Case Studies" section heading */
.cs-listing-section--grid {
    padding-top: 0;
}

.cs-listing-all-heading {
    font-size: 20px;
    font-weight: 600;
    color: var(--cs-text-muted);
    margin: 0 0 24px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
}

/* ── Placeholder card ───────────────────────────────────────── */
.cs-card--placeholder {
    pointer-events: none;
    opacity: 0.55;
}

.cs-card__image-wrap--empty {
    aspect-ratio: 16 / 9;
    background: var(--cs-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cs-card__coming-soon {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tm-color-bl-2);
    background: var(--tm-color-bl-4);
    padding: 5px 14px;
    border-radius: 100px;
}

/* CTA for listing page */
.cs-listing-cta {
    background-color: black;
    border-top: 1px solid var(--cs-border);
    text-align: center;
    padding: 30px var(--cs-px);
}

.cs-listing-cta__heading {
    font-size: 32px;
    font-weight: 700;
    color: var(--cs-text-primary);
    margin: 0 0 14px;
}

.cs-listing-cta__text {
    font-size: 16px;
    color: var(--cs-text-secondary);
    margin: 0 0 32px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.65;
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
    :root {
        --cs-px: 20px;
        --cs-py: 40px;
    }

    /* Hero stacks */
    .cs-hero {
        padding: 48px 20px 40px;
    }

    .cs-hero__inner {
        flex-direction: column;
        gap: 28px;
    }

    .cs-hero__right {
        width: 100%;
        min-width: 0;
        aspect-ratio: 16 / 9;
    }

    .cs-hero__title {
        font-size: 26px;
    }

    /* Summary stacks */
    .cs-summary-section__inner {
        grid-template-columns: 1fr;
        padding: 40px 20px;
        gap: 0;
    }

    .cs-summary-divider {
        width: 100%;
        height: 1px;
        margin: 28px 0;
    }

    .cs-summary-col {
        padding: 0;
    }

    .cs-summary-col__heading {
        font-size: 22px;
    }

    /* Stats bar 2x2 on mobile */
    .cs-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .cs-stat {
        border-bottom: 1px solid var(--cs-stat-border);
        padding: 24px 16px;
    }

    .cs-stats-bar .cs-stat:nth-child(2n) {
        border-right: none;
    }

    .cs-stats-bar .cs-stat:nth-last-child(-n+2) {
        border-bottom: none;
    }

    .cs-stat__value {
        font-size: 30px;
    }

    /* Section headings */
    .cs-section__heading {
        font-size: 22px;
    }

    /* Scale down the accent block on mobile */
    .cs-section::before {
        width: 4px;
        height: 48px;
        border-radius: 0 2px 2px 0;
    }

    /* Testimonial card */
    .cs-testimonial {
        padding: 24px 20px;
        text-align: left;
        max-width: 100%;
    }

    .cs-testimonial__attribution {
        justify-content: flex-start;
    }

    /* CTA split → stacked */
    .cs-cta-section__inner {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 56px 20px;
    }

    .cs-cta-section__image-wrap {
        order: -1;
    }

    .cs-cta-section__heading {
        font-size: 26px;
    }

    /* Pinned card stacks on mobile */
    .cs-pinned-card {
        grid-template-columns: 1fr;
    }

    .cs-pinned-card__image {
        aspect-ratio: 16 / 9;
        min-height: unset;
    }

    .cs-pinned-card__body {
        padding: 24px;
    }

    .cs-pinned-card__title {
        font-size: 18px;
    }

    .cs-pinned-card__stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Listing grid single column */
    .cs-listing-grid {
        grid-template-columns: 1fr;
    }

    .cs-listing-hero {
        padding: 24px 16px;
    }

    .cs-listing-hero__title {
        font-size: 30px;
    }
}


@media (min-width: 769px) and (max-width: 1149px) {
    :root {
        --cs-px: 40px;
    }

    /* Hero */
    .cs-hero__title {
        font-size: 32px;
    }

    .cs-hero__right {
        width: 340px;
        min-width: 340px;
        aspect-ratio: 16 / 9;
    }

    /* Pinned card: stack at this range */
    .cs-pinned-card {
        grid-template-columns: 1fr;
    }

    .cs-pinned-card__image {
        aspect-ratio: 16 / 9;
        min-height: unset;
    }

    .cs-pinned-card__body {
        padding: 32px;
    }

    .cs-pinned-card__stats {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Summary divider: shorten */
    .cs-summary-divider {
        height: 180px;
    }

    /* Stats bar: 2x2 grid */
    .cs-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .cs-stats-bar .cs-stat:nth-child(2n) {
        border-right: none;
    }

    .cs-stats-bar .cs-stat:nth-child(-n+2) {
        border-bottom: 1px solid var(--cs-stat-border);
    }

    .cs-stat__value {
        font-size: 36px;
    }

    /* Listing grid: 2 columns */
    .cs-listing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
