/* ============================================================
   CASES — polaroid collage on cream background.
   Each card is a polaroid (white frame, slight rotation, tape
   in the corner), with a handscript handle and a custom SVG
   growth chart that fills with a deep-wine → fire-red gradient.
   ============================================================ */

.cases {
    position: relative;
    background: var(--cream);
    color: var(--ink);
    padding: 30px 48px 160px;
    overflow: hidden;
}

.cases::before {
    /* Subtle grain on cream to match the rest of the site */
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../assets/textures/noise.svg');
    background-size: 256px 256px;
    opacity: 0.05;
    mix-blend-mode: multiply;
    pointer-events: none;
}

.cases__inner {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

.cases__header {
    text-align: center;
    max-width: 880px;
    margin: 0 auto 100px;
    position: relative;
}

.cases__label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--fire-red);
    margin-bottom: 28px;
}

.cases__statement {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.9rem, 4vw, 3.4rem);
    line-height: 1.18;
    letter-spacing: -0.015em;
    color: var(--ink);
    max-width: 900px;
    margin: 0 auto;
}

.cases__statement .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px) rotateX(35deg);
    filter: blur(6px);
    transition:
        opacity 0.55s ease,
        transform 0.55s var(--ease-fade),
        filter 0.55s ease;
}

.cases__statement.is-visible .word {
    opacity: 1;
    transform: translateY(0) rotateX(0deg);
    filter: blur(0);
}

.cases__sub {
    font-family: var(--font-hand);
    font-weight: 500;
    font-size: clamp(1.5rem, 2.5vw, 2.1rem);
    color: var(--fire-red);
    margin-top: 18px;
    transform: rotate(-1.5deg);
    display: inline-block;
}


/* === Collage grid =========================================== */
.cases__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 26px;
    align-items: start;
    padding: 20px 0;
}


/* === Polaroid card ========================================= */
.polaroid {
    background: #FBF8F1;
    padding: 14px 14px 48px;
    box-shadow:
        0 2px 4px rgba(20, 12, 10, 0.08),
        0 18px 40px -12px rgba(20, 12, 10, 0.22),
        0 30px 60px -20px rgba(20, 12, 10, 0.18);
    position: relative;
    transition: transform 0.45s var(--ease-fade), box-shadow 0.45s ease;
    will-change: transform;
}

.polaroid:hover {
    transform: rotate(0deg) translateY(-6px) scale(1.02) !important;
    box-shadow:
        0 4px 8px rgba(20, 12, 10, 0.10),
        0 28px 60px -10px rgba(20, 12, 10, 0.30),
        0 50px 90px -30px rgba(20, 12, 10, 0.22);
    z-index: 5;
}

/* Per-card rotation for organic collage feel */
.polaroid--tilt-1 { transform: rotate(-2.2deg); margin-top: 14px; }
.polaroid--tilt-2 { transform: rotate(1.2deg); margin-top: -6px; }
.polaroid--tilt-3 { transform: rotate(-1.5deg); margin-top: 22px; }
.polaroid--tilt-4 { transform: rotate(1.8deg); margin-top: -2px; }


/* === Tape ================================================== */
.polaroid::before {
    content: '';
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 130px;
    height: 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18) 0%, transparent 35%),
        linear-gradient(90deg, rgba(0,0,0,0.06) 0%, transparent 8%, transparent 92%, rgba(0,0,0,0.06) 100%),
        rgba(232, 198, 96, 0.62);
    box-shadow: 0 2px 6px rgba(60, 30, 0, 0.18);
    z-index: 2;
}

.polaroid--tilt-2::before { transform: translateX(-50%) rotate(2deg); left: 35%; }
.polaroid--tilt-3::before { transform: translateX(-50%) rotate(-5deg); left: 65%; }
.polaroid--tilt-4::before { transform: translateX(-50%) rotate(4deg); left: 42%; }


/* === Photo === */
.polaroid__photo {
    position: relative;
    aspect-ratio: 4 / 5;
    background: var(--burnt-cocoa);
    overflow: hidden;
    margin-bottom: 22px;
}

.polaroid__photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    display: block;
    filter: contrast(1.04) saturate(0.92);
}

.polaroid__photo img[src*="tittogalvez"]  { object-position: 60% 28%; }
.polaroid__photo img[src*="elsensei"]     {
    object-position: center 65%;
    transform: scale(1.2);
    transform-origin: center 75%;
}
.polaroid__photo img[src*="fxalexg"]      { object-position: center 38%; }
.polaroid__photo img[src*="mauristacks"]  { object-position: center 35%; }

.polaroid__photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 55%, rgba(15, 15, 15, 0.55) 100%);
    pointer-events: none;
}


/* === Handscript handle (the polaroid's "caption") === */
.polaroid__handle {
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 1.75rem;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 4px;
    transform: rotate(-1deg);
    display: inline-block;
}

.polaroid__followers {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-bottom: 14px;
}


/* === Stats block under photo === */
.polaroid__stat {
    margin-bottom: 14px;
}

.polaroid__stat-label {
    font-family: var(--font-body);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-dim);
    margin-bottom: 4px;
    line-height: 1.4;
}

.polaroid__stat-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.95rem;
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.02em;
    display: inline-block;
}

.polaroid__stat-value .currency {
    font-size: 0.55em;
    color: var(--fire-red);
    font-weight: 500;
    margin-left: 4px;
    letter-spacing: 0.08em;
}

/* Mauri's "MRR" badge — small filled tag next to the value, sitting
   on the baseline alongside "$1M USD" so the whole line reads as one. */
.polaroid__stat-mrr {
    display: inline-block;
    margin-left: 10px;
    padding: 5px 8px 4px;
    background: var(--fire-red);
    color: #FBF8F1;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.36em;
    letter-spacing: 0.14em;
    border-radius: 3px;
    vertical-align: 0.18em;
    line-height: 1;
}

/* Mauri's recurring-revenue question mark — handscript next to $1M */
.polaroid__stat-q {
    font-family: var(--font-hand);
    color: var(--fire-red);
    font-weight: 700;
    font-size: 1.4em;
    line-height: 0.85;
    margin-left: 6px;
    display: inline-block;
    transform: rotate(-8deg) translateY(-0.05em);
}


/* === Growth chart ==========================================
   SVG viewBox is 220 x 140 with these regions:
     y =  4..24   → value labels above dots
     y = 30..96   → chart plot area
     y =100..118  → x-axis year labels
   Each dot's x is positioned to give breathing room between labels.
   ============================================================ */
.polaroid__chart {
    position: relative;
    width: 100%;
    aspect-ratio: 220 / 140;
    margin-top: 14px;
}

.polaroid__chart svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.polaroid__chart-baseline {
    stroke: var(--ink-faint);
    stroke-width: 1;
    stroke-dasharray: 2 4;
    opacity: 0.5;
}

.polaroid__chart-area {
    fill: url(#chartGradient);
    opacity: 0;
    transition: opacity 0.8s ease 0.4s;
}

.polaroid__chart-line {
    fill: none;
    stroke: var(--fire-red);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.6s var(--ease-fade) 0.3s;
}

.polaroid__chart-dot {
    fill: var(--fire-red);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.polaroid__chart-dot--peak { r: 3.8; }

/* Target dot (Mauri's projection endpoint) — hollow ring style */
.polaroid__chart-dot--target {
    fill: var(--cream);
    stroke: var(--fire-red);
    stroke-width: 2.5;
    r: 4.5;
}

/* Dashed projection line — drawn after the solid actuals */
.polaroid__chart-projection {
    fill: none;
    stroke: var(--fire-red);
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-dasharray: 4 5;
    opacity: 0;
    transition: opacity 0.6s ease 1.5s;
}

.is-visible .polaroid__chart-projection { opacity: 0.7; }

/* Handscript "?" near the target dot */
.polaroid__chart-question {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 19px;
    fill: var(--fire-red);
    opacity: 0;
    transition: opacity 0.4s ease 2.1s;
}

.is-visible .polaroid__chart-question { opacity: 1; }

/* "próximamente" handscript above the projected $1M target */
.polaroid__chart-soon {
    font-family: var(--font-hand);
    font-weight: 600;
    font-size: 11px;
    fill: var(--fire-red);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 0.4s ease 1.9s;
}

.is-visible .polaroid__chart-soon { opacity: 0.95; }

/* Bigger "?" living inside the "próximamente" handscript */
.polaroid__chart-question-inline {
    font-family: var(--font-hand);
    font-weight: 700;
    font-size: 17px;
    fill: var(--fire-red);
}

/* "MRR" tspan inside the chart peak label — smaller weight next to $1M */
.polaroid__chart-mrr {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 8px;
    letter-spacing: 0.12em;
    fill: var(--fire-red);
}

.polaroid__chart-label {
    font-family: var(--font-body);
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.14em;
    fill: var(--ink-dim);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.polaroid__chart-value {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 12px;
    fill: var(--ink);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.polaroid__chart-value--peak { fill: var(--fire-red); font-size: 14px; }

.is-visible .polaroid__chart-line { stroke-dashoffset: 0; }
.is-visible .polaroid__chart-area { opacity: 0.85; }
.is-visible .polaroid__chart-dot { opacity: 1; transition-delay: 1.7s; }
.is-visible .polaroid__chart-label { opacity: 0.55; transition-delay: 1.4s; }
.is-visible .polaroid__chart-value { opacity: 1; transition-delay: 1.8s; }


/* === Annotation (handscript note under polaroid) === */
.cases__note {
    text-align: center;
    margin-top: 56px;
    font-family: var(--font-hand);
    font-weight: 500;
    font-size: clamp(1.3rem, 2vw, 1.7rem);
    color: var(--ink);
    line-height: 1.35;
    transform: rotate(-0.8deg);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.cases__note .hl-red {
    color: var(--fire-red);
}


/* === Responsive ============================================ */

/* Wide desktop — a touch more breathing room */
@media (min-width: 1500px) {
    .cases { padding: 30px 80px 200px; }
    .cases__grid { gap: 36px; }
}

/* Mid desktop — slightly tighter so cards stay readable */
@media (max-width: 1200px) {
    .cases { padding: 30px 36px 150px; }
    .cases__grid { gap: 20px; }
    .polaroid { padding: 12px 12px 44px; }
    .polaroid__handle { font-size: 1.55rem; }
    .polaroid__stat-value { font-size: 1.75rem; }
    .polaroid__followers { font-size: 9.5px; }
}

/* Tablet — 2 × 2 grid */
@media (max-width: 900px) {
    .cases { padding: 30px 28px 120px; }
    .cases__header { margin-bottom: 70px; }
    .cases__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 40px 28px;
        max-width: 720px;
        margin: 0 auto;
        padding-top: 32px;
    }
    .polaroid { padding: 14px 14px 50px; }
    .polaroid__handle { font-size: 1.85rem; }
    .polaroid__stat-value { font-size: 2.1rem; }
    .polaroid__followers { font-size: 10.5px; }
}

/* Phone — single column, level rotations */
@media (max-width: 560px) {
    .cases { padding: 30px 22px 100px; }
    .cases__header { margin-bottom: 50px; }
    .cases__grid {
        grid-template-columns: 1fr;
        gap: 52px;
        max-width: 360px;
    }
    .polaroid--tilt-1,
    .polaroid--tilt-2,
    .polaroid--tilt-3,
    .polaroid--tilt-4 {
        transform: rotate(-1deg);
        margin-top: 0;
    }
    .polaroid--tilt-2 { transform: rotate(1deg); }
    .polaroid--tilt-4 { transform: rotate(1.2deg); }
}
