/* ============================================================
   SBN Home Page
   Scoped to .home-page — does not bleed into admin or other
   public pages. Grain + blob + reveal defined here only.
   All colour values use --clr-* design tokens.
   ============================================================ */

/* ── Grain overlay (scoped to home layout) ─────────────────── */
.home-page ~ .home-grain,
.home-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: .035;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Shared layout ─────────────────────────────────────────── */
.home-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.home-page .btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .92rem;
    padding: 10px 20px;
    border-radius: 11px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: .18s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.home-page .btn-ghost {
    color: var(--clr-text);
    border-color: var(--clr-line);
}
.home-page .btn-ghost:hover { background: var(--clr-bg-card); }
.home-page .btn-solid {
    background: var(--clr-gradient);
    color: #fff;
}
.home-page .btn-solid:hover {
    transform: translateY(-1px);
    background: var(--clr-gradient-hover);
    box-shadow: 0 8px 24px -8px #e74c3c;
}
.home-page .btn-lg { padding: 14px 26px; font-size: 1rem; }

/* ── Eyebrow label ─────────────────────────────────────────── */
.home-page .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--clr-accent);
    margin-bottom: 20px;
}
.home-page .eyebrow::before {
    content: "";
    width: 24px;
    height: 2px;
    background: var(--clr-gradient);
}

/* ── Reveal animation ──────────────────────────────────────── */
.home-page .reveal {
    opacity: 0;
    transform: translateY(22px);
    animation: home-rise .8s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes home-rise { to { opacity: 1; transform: none; } }
.home-page .d1 { animation-delay: .05s; }
.home-page .d2 { animation-delay: .18s; }
.home-page .d3 { animation-delay: .32s; }
.home-page .d4 { animation-delay: .46s; }
.home-page .d5 { animation-delay: .6s; }

/* ── Hero ──────────────────────────────────────────────────── */
.home-hero {
    position: relative;
    padding: 88px 24px 72px;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 0 0 24px 24px;
}

/* Blob background */
.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: .4;
}
.hero-bg .blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: .4;
    animation: blob-float 18s ease-in-out infinite;
}
.blob.b1 { width: 480px; height: 480px; background: var(--clr-accent);   top: -160px; right: -80px; }
.blob.b2 { width: 420px; height: 420px; background: var(--clr-accent-2, var(--clr-fifth)); bottom: -200px; left: -100px; animation-delay: -6s; }
.blob.b3 { width: 300px; height: 300px; background: #7c3aed;  top: 40%; left: 40%; animation-delay: -11s; opacity: .3; }
@keyframes blob-float {
    0%,100% { transform: translate(0,0) scale(1); }
    33%      { transform: translate(40px,-30px) scale(1.08); }
    66%      { transform: translate(-30px,20px) scale(.95); }
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    gap: 48px;
    align-items: center;
}

.home-hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.6rem, 5.2vw, 4.1rem);
    line-height: 1.02;
    letter-spacing: -.025em;
    margin-bottom: 22px;
}
.home-hero h1 em {
    font-style: italic;
    background: var(--clr-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-right: .08em;
    margin-right: -.08em;
}
.hero-lead {
    font-size: 1.12rem;
    color: var(--clr-text-dim);
    max-width: 520px;
    margin-bottom: 32px;
}
.hero-cta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 40px;
}
.stat-n {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.7rem;
}
.stat-l {
    font-size: .82rem;
    color: var(--clr-text-dim);
}

/* ── Sections ──────────────────────────────────────────────── */
.home-section {
    padding: 84px 0;
}
.section-head {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 48px;
}
.section-head .eyebrow { justify-content: center; }
.section-head h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 3.6vw, 2.8rem);
    letter-spacing: -.02em;
    margin-bottom: 14px;
}
.section-head p {
    color: var(--clr-text-dim);
    font-size: 1.05rem;
}

/* ── Rhythm card ───────────────────────────────────────────── */
.rhythm-card {
    background: var(--clr-bg-elev);
    border: 1px solid var(--clr-line);
    border-radius: 22px;
    padding: 34px;
}
.rhythm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}
.rhythm-card-header h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.3rem;
}
.tempo-badge {
    font-size: .82rem;
    color: var(--clr-text-dim);
    font-variant-numeric: tabular-nums;
}
.rhythm-card-footer {
    margin-top: 20px;
    text-align: right;
}
.rhythm-explore-link {
    font-size: .85rem;
    font-weight: 600;
    color: var(--clr-accent);
    text-decoration: none;
    transition: opacity .15s;
}
.rhythm-explore-link:hover { opacity: .75; }

/* ── Chord rain ────────────────────────────────────────────── */
.chord-rain-section {
    position: relative;
    height: 680px;
    padding-bottom: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Brand gradient blob — sits behind the rain */
.chord-rain-section::before {
    content: "";
    position: absolute;
    width: 680px;
    height: 680px;
    border-radius: 50%;
    background: radial-gradient(circle, #888 0%, #444 50%, transparent 75%);
    opacity: .11;
    filter: blur(90px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
    animation: blob-float 18s ease-in-out infinite;
    animation-delay: -4s;
}

/* Vignette that keeps copy legible over the rain */
.chord-rain-section::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse 60% 55% at 50% 50%,
        rgba(255,255,255,1) 0%,
        rgba(255,255,255,.7) 45%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 2;
}

.chord-rain-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: visible;
}

.chord-rain-copy {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 560px;
    padding: 0 24px;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.chord-rain-copy .eyebrow {
    justify-content: center;
    pointer-events: auto;
}

.chord-rain-copy h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.4rem, 5vw, 4rem);
    letter-spacing: -.025em;
    line-height: 1.05;
    margin-bottom: 16px;
}

.chord-rain-copy h2 em {
    font-style: italic;
    background: var(--clr-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding-right: .08em;
    margin-right: -.08em;
}

.chord-rain-copy p {
    color: var(--clr-text-dim);
    font-size: 1.05rem;
    margin-bottom: 28px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.chord-rain-copy .btn {
    pointer-events: auto;
}

.rain-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 28px;
    pointer-events: none;
}

.rain-stat-n {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    display: block;
}

.rain-stat-l {
    font-size: .78rem;
    color: var(--clr-text-dim);
    display: block;
}

@media (prefers-reduced-motion: reduce) {
    .chord-rain-section .chord-rain-card {
        /* Cards rendered static — rAF loop is halted by the component */
        opacity: 0.35 !important;
    }
}

/* ── Grades standalone page hero ──────────────────────────── */
.grades-hero {
    padding: 88px 0 56px;
    background: #fff;
}
.grades-hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.6rem, 5.2vw, 4.1rem);
    line-height: 1.05;
    letter-spacing: -.025em;
    margin-bottom: 20px;
}
.grades-hero h1 em {
    font-style: italic;
    color: var(--clr-accent);
}
.grades-hero-lead {
    font-size: 1.12rem;
    color: var(--clr-text-dim);
    max-width: 520px;
}

/* Remove top padding from grades-section on the standalone page */
.grades-page .grades-section {
    padding-top: 0;
}

/* ── Difficulty grades ─────────────────────────────────────── */
.grades-section {
    padding: 84px 0 100px;
    background: #fff;
}

.grades-intro {
    text-align: center;
    max-width: 620px;
    margin: 0 auto 48px;
}
.grades-intro h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 3.6vw, 2.8rem);
    letter-spacing: -.02em;
    margin-bottom: 14px;
}
.grades-intro p {
    color: var(--clr-text-dim);
    font-size: 1.05rem;
}

/* Sticky stepper */
.stepper-wrap {
    position: sticky;
    top: var(--header-height, 64px);
    z-index: 100;
    background: color-mix(in srgb, var(--clr-bg) 80%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--clr-line);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 72px;
    overflow: hidden;
}

.stepper-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: var(--current-grade-clr, var(--clr-accent));
    transition: background-color .3s;
}

/* Native scroll-driven progress (Chrome 115+) */
@supports (animation-timeline: scroll()) {
    .stepper-progress {
        animation: grades-progress-fill linear both;
        animation-timeline: scroll(root);
    }
    @keyframes grades-progress-fill {
        from { width: 0% }
        to   { width: 100% }
    }
}

.stepper-steps {
    display: flex;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.stepper-steps .step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    font-size: .83rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--clr-text-dim);
    border-bottom: 2px solid transparent;
    transition: color .2s, border-color .2s;
    height: 100%;
}
.stepper-steps .step:hover {
    color: var(--current-grade-clr);
}
.stepper-steps .step.active {
    color: var(--current-grade-clr);
    border-bottom-color: var(--current-grade-clr);
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--clr-bg-elev);
    border: 1.5px solid var(--clr-line);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
    transition: background .2s, border-color .2s, color .2s;
    color: var(--clr-text-dim);
    flex-shrink: 0;
}
.stepper-steps .step.active .step-num {
    background: var(--current-grade-clr);
    border-color: var(--current-grade-clr);
    color: #fff;
}

.step-label { white-space: nowrap; }

/* Grade blocks */
.grades-body { display: flex; flex-direction: column; gap: 96px; }

.grade-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px 56px;
    align-items: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity .7s, transform .7s;
}
.grade-block.visible {
    opacity: 1;
    transform: none;
}

/* Native scroll-driven block reveal (Chrome 115+) */
@supports (animation-timeline: scroll()) {
    .grade-block {
        opacity: 1;
        transform: none;
        animation: grades-block-reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 35%;
    }
    @keyframes grades-block-reveal {
        from { opacity: 0; transform: translateY(40px); }
        to   { opacity: 1; transform: none; }
    }
}

/* Alternating sides: even blocks flip order */
.grade-block:nth-child(even) { direction: rtl; }
.grade-block:nth-child(even) > * { direction: ltr; }

/* Grade image */
.grade-img {
    border-radius: 18px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    position: relative;
    background: color-mix(in srgb, var(--grade-clr) 20%, var(--clr-bg-elev));
}
.grade-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Colour overlay ties photo to grade colour */
.grade-img::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        color-mix(in srgb, var(--grade-clr) 40%, transparent),
        transparent 60%
    );
    pointer-events: none;
}
/* Placeholder when image is missing */
.grade-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 3rem;
    color: color-mix(in srgb, var(--grade-clr) 70%, var(--clr-text));
    background: color-mix(in srgb, var(--grade-clr) 12%, var(--clr-bg-elev));
}
.grade-img-placeholder span {
    font-family: var(--font-display);
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    opacity: .7;
}

/* Grade text */
.grade-text {}

.grade-pip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--grade-clr);
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
}

.grade-badge {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--grade-clr);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}

.grade-text h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.7rem, 2.6vw, 2.3rem);
    letter-spacing: -.02em;
    line-height: 1.1;
    margin-bottom: 6px;
}
.grade-text h3 em {
    font-style: italic;
    color: var(--grade-clr);
}

.grade-text p {
    color: var(--clr-text-dim);
    font-size: 1rem;
    line-height: 1.65;
    margin: 16px 0 20px;
    max-width: 460px;
}

/* Chord chips */
.chord-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}
.chord-chip {
    font-family: var(--font-display);
    font-size: .82rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--clr-line);
    color: var(--clr-text-dim);
    background: var(--clr-bg-elev);
    transition: border-color .15s, color .15s;
    cursor: default;
}
.chord-chip:hover {
    border-color: var(--grade-clr);
    color: var(--grade-clr);
}

/* CTA link */
.grade-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: .9rem;
    color: var(--grade-clr);
    text-decoration: none;
    transition: opacity .15s;
}
.grade-cta:hover { opacity: .75; }

/* ── Feature cards ─────────────────────────────────────────── */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.feature-card {
    background: var(--clr-bg-card);
    border: 1px solid var(--clr-line);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: .2s;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: var(--clr-text);
    display: block;
}
.feature-card:hover {
    transform: translateY(-4px);
    border-color: var(--clr-accent);
}
.feature-card::after {
    content: "";
    position: absolute;
    top: 0; right: 0;
    width: 120px; height: 120px;
    background: radial-gradient(circle at top right, var(--clr-accent), transparent 70%);
    opacity: 0;
    transition: .3s;
}
.feature-card:hover::after { opacity: .12; }
.card-icon { font-size: 1.7rem; margin-bottom: 16px; }
.feature-card h3 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 8px;
}
.feature-card p { color: var(--clr-text-dim); font-size: .93rem; }
.card-more {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    margin-top: 16px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--clr-accent);
}


/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero-inner > div:last-child { order: -1; }
    .feature-cards { grid-template-columns: 1fr; }
    .home-foot { grid-template-columns: 1fr 1fr; }
    .foot-brand { grid-column: 1 / -1; }
    .grade-block { grid-template-columns: 1fr; }
    .grade-block:nth-child(even) { direction: ltr; }
    .step-label { display: none; }
    .stepper-steps .step { padding: 0 14px; }
}
@media (max-width: 720px) {
    .grade-block { grid-template-columns: 1fr; }
    .grade-img { order: -1 !important; }
}
@media (max-width: 600px) {
    .hero-stats { flex-wrap: wrap; gap: 20px; }
    .hero-cta { flex-direction: column; }
    .home-foot { grid-template-columns: 1fr; }
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .home-page .reveal { opacity: 1; transform: none; animation: none; }
    .hero-bg .blob { animation: none; }
    .rhythm-playhead { display: none; }
    .grade-block { opacity: 1 !important; transform: none !important; animation: none !important; }
    .stepper-progress { animation: none !important; }
}
