.membership-home .hero-grid {
    grid-template-columns: minmax(0, 1.18fr) minmax(320px, .82fr);
}

/* The membership hero reuses the homepage shell, but its cover collage needs
   its own sizing. Without these rules the raw images expand to their natural
   dimensions and push the copy off-screen. */
.membership-home .hero-books {
    position: relative;
    min-height: 520px;
    width: min(100%, 560px);
    margin-inline: auto;
}

.membership-home .hero-cover {
    position: absolute;
    display: block;
    width: clamp(130px, 18vw, 190px);
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border: 8px solid var(--white);
    border-radius: 8px;
    box-shadow: 0 18px 32px rgba(20, 45, 31, .24);
    transform: rotate(var(--cover-rotate, 0deg));
}

.membership-home .hero-cover-0 { --cover-rotate: -8deg; top: 24px; left: 5%; }
.membership-home .hero-cover-1 { --cover-rotate: 7deg; top: 12px; right: 4%; }
.membership-home .hero-cover-2 { --cover-rotate: -3deg; top: 150px; left: 29%; z-index: 2; }
.membership-home .hero-cover-3 { --cover-rotate: 8deg; bottom: 36px; left: 7%; }
.membership-home .hero-cover-4 { --cover-rotate: -7deg; right: 8%; bottom: 20px; }

@media (max-width: 1024px) {
    .membership-home .hero-books { min-height: 430px; }
}

@media (max-width: 640px) {
    .membership-home .hero-books { min-height: 360px; width: min(100%, 390px); }
    .membership-home .hero-cover { width: 126px; border-width: 5px; }
    .membership-home .hero-cover-0 { top: 8px; left: 2%; }
    .membership-home .hero-cover-1 { top: 4px; right: 2%; }
    .membership-home .hero-cover-2 { top: 108px; left: 32%; }
    .membership-home .hero-cover-3 { bottom: 12px; left: 3%; }
    .membership-home .hero-cover-4 { right: 3%; bottom: 6px; }
}

.membership-home .hero-text {
    text-align: left;
}

.membership-home .hero h1 {
    max-width: min(100%, 760px);
    margin-inline: 0;
}

.membership-hero-copy {
    max-width: 54ch;
    margin: -18px 0 34px;
    color: rgba(255, 253, 248, .88);
    font-size: 1.08rem;
    line-height: 1.7;
}

.membership-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.membership-hero-actions .pill-btn {
    min-height: 58px;
    padding-inline: 30px;
    box-shadow: var(--shadow-button);
}

.membership-alert {
    position: relative;
    z-index: 2;
    width: min(100%, 860px);
    margin: 0 auto 34px;
    padding: 16px 20px;
    border: 1px solid rgba(193, 125, 71, .28);
    border-radius: 12px;
    background: var(--white);
    color: #78451c;
    font-weight: 800;
    text-align: center;
}

.membership-home .intro {
    background:
        linear-gradient(174deg, rgba(45, 110, 78, .045) 0 35%, transparent 35.2% 100%),
        var(--cream-soft);
}

.membership-home .intro::after {
    background: var(--cream);
}

.membership-plans {
    position: relative;
    overflow: hidden;
    padding: calc(var(--section-y) + 8px) var(--section-x) calc(var(--section-y) + 42px);
}

.membership-plans::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 18%;
    right: -8%;
    left: -8%;
    height: 250px;
    background:
        repeating-linear-gradient(90deg, rgba(45, 110, 78, .035) 0 1px, transparent 1px 78px),
        rgba(255, 253, 248, .36);
    transform: rotate(-3deg);
}

.membership-plans::after,
.membership-school::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: var(--wave-height);
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80' preserveAspectRatio='none'><path d='M0,80 L0,40 Q70,0 160,30 T400,30 T640,30 T880,30 T1120,30 L1200,40 L1200,80 Z' fill='black'/></svg>") no-repeat bottom / 100% 100%;
    mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 80' preserveAspectRatio='none'><path d='M0,80 L0,40 Q70,0 160,30 T400,30 T640,30 T880,30 T1120,30 L1200,40 L1200,80 Z' fill='black'/></svg>") no-repeat bottom / 100% 100%;
}

.membership-plans::after {
    background: var(--primary);
}

.membership-bg-shape {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.membership-bg-loop {
    top: 72px;
    left: max(34px, calc((100vw - 1220px) / 2 - 105px));
    width: 116px;
    opacity: .16;
    transform: rotate(-14deg);
}

.membership-bg-star {
    right: max(44px, calc((100vw - 1220px) / 2 - 86px));
    bottom: 142px;
    width: 118px;
    opacity: .16;
    transform: rotate(12deg);
}

.membership-shape-1 {
    top: 15%;
    right: max(18%, calc((100vw - 1220px) / 2 + 20px));
    width: 140px;
    opacity: .18;
    transform: rotate(18deg);
}

.membership-shape-2 {
    bottom: 12%;
    left: max(14%, calc((100vw - 1220px) / 2 - 30px));
    width: 110px;
    opacity: .15;
    transform: rotate(-22deg);
}

/* Decorations now handled by shared decorations.css */

.membership-section-title {
    position: relative;
    z-index: 1;
    max-width: 820px;
    margin: 0 auto 54px;
    color: var(--primary);
    font-family: 'Caveat Brush', cursive;
    font-size: 3.35rem;
    line-height: 1.08;
    letter-spacing: 0;
    text-align: center;
    text-wrap: balance;
}

.membership-section-subtitle {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: -32px auto 42px;
    color: var(--muted-green);
    font-size: 1.05rem;
    text-align: center;
}

.membership-plan-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(28px, 4vw, 46px);
    width: min(100%, 1120px);
    margin: 0 auto;
}

.membership-plan-card {
    position: relative;
    display: grid;
    gap: 22px;
    align-content: start;
    min-height: 100%;
    padding: clamp(30px, 4vw, 44px);
    border: 1px solid rgba(45, 110, 78, .09);
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow-card);
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out);
}

.membership-plan-card::before {
    content: "";
    position: absolute;
    top: 18px;
    right: 22px;
    width: 42px;
    height: 42px;
    background: url("/frontend/assets/imgs/shape/shape-star.webp") center / contain no-repeat;
    opacity: .12;
    pointer-events: none;
}

.membership-plan-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-4px);
}

.plan-eyebrow {
    color: var(--secondary);
    font-family: 'Patrick Hand', cursive;
    font-size: 1.22rem;
    font-weight: 700;
}

.membership-plan-card h2 {
    margin: 0;
    color: var(--primary);
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(2.2rem, 4vw, 3.25rem);
    line-height: 1.05;
    letter-spacing: 0;
}

.plan-price-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}

.plan-price-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 10px 24px;
    border-radius: 999px;
    background: var(--secondary);
    box-shadow: 0 5px 0 rgba(95, 47, 24, .16);
    color: var(--white);
    font-family: 'Nunito', sans-serif;
    font-size: clamp(1.8rem, 3.6vw, 2.9rem);
    font-weight: 800;
    line-height: 1;
    transform: rotate(-3deg);
}

.plan-interval {
    color: var(--muted-green);
    font-weight: 800;
}

.plan-copy {
    max-width: 48ch;
    margin: 0;
    color: var(--muted-green);
    font-size: 1.02rem;
    line-height: 1.62;
}

.plan-list {
    display: grid;
    gap: 13px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.plan-list li {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 12px;
    align-items: start;
    color: var(--ink);
    line-height: 1.45;
}

.plan-list li::before {
    content: "✓";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 145, 77, .14);
    color: var(--secondary);
    font-size: .9rem;
    font-weight: 900;
    line-height: 1;
}

.plan-action-form {
    margin-top: 6px;
}

.membership-submit {
    width: 100%;
    max-width: none;
    border: 0;
    cursor: pointer;
}

.membership-school {
    position: relative;
    overflow: hidden;
    background:
        repeating-linear-gradient(90deg, rgba(255, 253, 248, .035) 0 1px, transparent 1px 86px),
        var(--primary);
    padding: calc(var(--section-y) + 6px) var(--section-x) calc(var(--section-y) + 42px);
    color: var(--white);
}

.membership-school::after {
    background: var(--cream-soft);
}

.school-bg-shape {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    user-select: none;
}

.school-shape-1 {
    top: 10%;
    left: 8%;
    width: 100px;
    opacity: .12;
    transform: rotate(-15deg);
}

.school-shape-2 {
    bottom: 15%;
    right: 10%;
    width: 130px;
    opacity: .14;
    transform: rotate(20deg);
}

.school-sparkle {
    position: absolute;
    z-index: 0;
    color: rgba(255, 253, 248, .28);
    font-size: 2.2rem;
    pointer-events: none;
    user-select: none;
}

.school-sparkle-1 {
    top: 22%;
    right: 18%;
}

.school-sparkle-2 {
    bottom: 28%;
    left: 14%;
}

.school-grid {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(320px, .72fr);
    gap: clamp(40px, 6vw, 82px);
    align-items: center;
    width: min(100%, 1280px);
    margin: 0 auto;
}

.school-copy h2 {
    margin: 0 0 22px;
    color: var(--white);
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(2.7rem, 5vw, 4.4rem);
    line-height: 1.05;
    letter-spacing: 0;
    text-wrap: balance;
}

.school-subtitle {
    color: rgba(255, 253, 248, .85);
    font-size: 1.12rem;
    font-weight: 700;
    margin: 0 0 16px;
}

.school-intro {
    max-width: 60ch;
}

.school-copy p {
    max-width: 60ch;
    color: rgba(255, 253, 248, .9);
    font-size: 1.05rem;
    line-height: 1.7;
}

.school-discounts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.school-discount {
    padding: 16px;
    border: 1px solid rgba(255, 253, 248, .22);
    border-radius: 12px;
    background: rgba(255, 253, 248, .08);
    color: var(--white);
    font-weight: 800;
    text-align: center;
}

.school-form-panel {
    padding: clamp(26px, 4vw, 36px);
    border-radius: 14px;
    background: var(--white);
    box-shadow: var(--shadow-card);
    color: var(--ink);
}

.school-form {
    display: grid;
    gap: 16px;
}

.school-form label {
    display: grid;
    gap: 8px;
    color: var(--primary-dark);
    font-weight: 800;
}

.school-form input {
    width: 100%;
    min-height: 50px;
    border: 1px solid rgba(45, 110, 78, .22);
    border-radius: 10px;
    padding: 10px 14px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.school-note {
    margin: 0;
    color: var(--muted-green);
    font-size: .95rem;
    line-height: 1.55;
}

.membership-confidence {
    position: relative;
    overflow: hidden;
    background: var(--cream-soft);
    padding: 62px var(--section-x) 86px;
    text-align: center;
}

.confidence-content p {
    max-width: 820px;
    margin: 0 auto 22px;
    color: var(--primary);
    font-family: 'Caveat Brush', cursive;
    font-size: clamp(1.8rem, 3.6vw, 2.8rem);
    line-height: 1.18;
}

.confidence-content span {
    color: var(--muted-green);
    font-weight: 800;
}

@media (max-width: 1024px) {
    .membership-home .hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .membership-home .hero-text {
        text-align: center;
    }

    .membership-home .hero h1,
    .membership-hero-copy {
        margin-inline: auto;
    }

    .membership-hero-actions {
        justify-content: center;
    }

    .membership-plan-grid,
    .school-grid,
    .school-discounts {
        grid-template-columns: minmax(0, 1fr);
    }

    .membership-shape-1,
    .membership-shape-2,
    .school-sparkle,
    .school-bg-shape {
        display: none;
    }
}

@media (max-width: 767px) {
    .membership-section-title {
        margin-bottom: 34px;
        font-size: 2.55rem;
    }

    .membership-plan-card {
        padding: 28px 24px;
    }

    .plan-price-badge {
        min-height: 50px;
        padding-inline: 20px;
        font-size: 1.72rem;
    }

    .school-form-panel {
        padding: 24px;
    }
}
