/* ==========================================================================
   Homepage — hero, stats, path cards, feature banners, popular grid.
   Chrome (header/nav/footer) comes from core.css; this file is only the
   landing-page composition. All colours reference tokens — no hard-coded hex.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
    position: relative;
    z-index: 1;
    max-width: var(--measure);
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-5) var(--sp-6);
    text-align: center;
}
.hero-badge-line {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    background: var(--accent-subtle);
    border: 1px solid var(--border-accent);
    border-radius: var(--r-full);
    padding: 0.35rem 0.9rem;
    margin-bottom: var(--sp-4);
}
/* Editorial display headline — the homepage h1 goes a step larger than the
   shared --fs-3xl used on listing heroes, with tighter tracking and leading so
   the extra size reads as deliberate typography rather than just big text. */
.hero h1 {
    font-size: var(--fs-4xl);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.03;
    color: var(--text);
    margin-bottom: var(--sp-4);
    text-wrap: balance;
}
.hero h1 em {
    font-style: normal;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
/* Typing rotator. The phrase gets its own block so the characters landing and
   erasing can never change the h1's line count — otherwise everything below the
   headline walks up and down as it types. A <br> alone wasn't enough: it was
   hidden under 620px, letting the phrase rejoin the inline flow, and even above
   that the h1's `text-wrap: balance` is free to re-break the earlier lines when
   the last line's width changes. Its own block decouples the two, so the <br>
   is now redundant (kept in the markup as the no-CSS fallback break).

   `nowrap` keeps phrase and caret together on that line — the longest phrase is
   15 characters, which fits the clamped h1 size down to a 320px viewport.

   Not inline-flex: a flex container whose only item is an empty <em> has no text
   baseline to align to, so the browser synthesises one from its bottom edge and
   the line box changes height each time the phrase erases to nothing. */
.hero-type-wrap {
    display: block;
    white-space: nowrap;
}
/* #hero-type is an <em>, so it already picks up the gradient from .hero h1 em. */
.hero-br { display: none; }
/* On the narrowest phones "Data Structures" at the full h1 size only just clears
   the 320px viewport, and `nowrap` would turn a miss into a horizontal
   scrollbar. Ease the phrase line down a touch — it still reads as the headline,
   and the size is stable across phrases so nothing shifts. */
@media (max-width: 360px) {
    .hero-type-wrap { font-size: 0.88em; }
}

.hero-caret {
    display: inline-block;
    width: 3px;
    height: 1em;
    margin-left: 3px;
    background: var(--accent);
    border-radius: 1px;
    transform: translateY(0.1em);
    animation: hero-blink 1s steps(1) infinite;
}
/* Solid while characters are landing — a blinking caret mid-word reads as a
   glitch rather than as typing. */
.hero-caret.typing { animation: none; opacity: 1; }
@keyframes hero-blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .hero-caret { display: none; }
}

.hero p {
    color: var(--text-muted);
    font-size: var(--fs-lg);
    line-height: 1.65;
    max-width: 62ch;
    margin: 0 auto var(--sp-5);
    text-wrap: pretty;
}
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 0.8rem 1.8rem;
    min-height: 48px;
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: var(--fs-md);
    text-decoration: none;
    transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}
/* Resting glow so the primary action reads as the lit element on the page. */
.hero-cta { box-shadow: var(--glow-accent); }
.hero-cta:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--glow-accent-strong);
}
.hero-sub {
    margin-top: var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--text-dim);
}

/* Preview card */
.hero-preview {
    margin-top: var(--sp-6);
    display: flex;
    justify-content: center;
    text-decoration: none;
}
.preview-card {
    background: var(--card-glass);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4) var(--sp-5);
    text-align: left;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: var(--shadow-md);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.preview-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: var(--r-lg);
    right: var(--r-lg);
    height: 1px;
    background: var(--card-sheen);
    opacity: 0.7;
    pointer-events: none;
}
.preview-card:hover {
    background: var(--card-glass-hover);
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--glow-accent);
}
.preview-badge {
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 2px 9px;
    border-radius: var(--r-xs);
}
.preview-card strong { display: block; font-size: var(--fs-base); color: var(--text); margin-top: var(--sp-2); }
.preview-topics { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-2); }

/* --------------------------------------------------------------------------
   Stats strip
   -------------------------------------------------------------------------- */
.stats {
    position: relative;
    z-index: 1;
    max-width: var(--measure);
    margin: 0 auto var(--sp-7);
    padding: var(--sp-5);
    display: flex;
    justify-content: center;
    gap: var(--sp-8);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.stat { text-align: center; }
.stat strong {
    display: block;
    font-size: var(--fs-2xl);
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.02em;
}
.stat span { font-size: var(--fs-sm); color: var(--text-dim); }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section {
    position: relative;
    z-index: 1;
    max-width: var(--measure);
    margin: 0 auto;
    padding: 0 var(--sp-5) var(--sp-7);
}
.section > .section-title { font-size: var(--fs-xl); font-weight: 700; color: var(--text); margin-bottom: var(--sp-1); letter-spacing: -0.02em; }
.section > .section-sub { font-size: var(--fs-base); color: var(--text-muted); margin: 0 0 var(--sp-5); max-width: none; }

/* --------------------------------------------------------------------------
   Path cards — the three interview rounds
   -------------------------------------------------------------------------- */
.paths {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--sp-4);
}
/* Frosted glass over the page mesh — see .surface-card in core.css. */
.path-card {
    position: relative;
    background: var(--card-glass);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-md);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.path-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: var(--r-lg);
    right: var(--r-lg);
    height: 1px;
    background: var(--card-sheen);
    opacity: 0.7;
    pointer-events: none;
}
.path-card:hover {
    background: var(--card-glass-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--glow-accent);
}
.path-card .icon { margin-bottom: var(--sp-3); display: flex; align-items: center; }
.path-card h3 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--sp-2); color: var(--text); }
.path-card p { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-3); line-height: 1.6; }
.path-card .meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Tags
   -------------------------------------------------------------------------- */
.tag {
    background: var(--accent-subtle);
    border: 1px solid var(--border-accent);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: var(--r-xs);
    font-size: var(--fs-xs);
    font-weight: 600;
}
.tag-difficulty-easy { background: color-mix(in srgb, var(--easy) 12%, transparent); border-color: color-mix(in srgb, var(--easy) 30%, transparent); color: var(--easy); }
.tag-difficulty-medium { background: color-mix(in srgb, var(--medium) 12%, transparent); border-color: color-mix(in srgb, var(--medium) 30%, transparent); color: var(--medium); }
.tag-difficulty-hard { background: color-mix(in srgb, var(--hard) 12%, transparent); border-color: color-mix(in srgb, var(--hard) 30%, transparent); color: var(--hard); }

/* --------------------------------------------------------------------------
   Feature banners (concepts / job hunt)
   -------------------------------------------------------------------------- */
.concepts-banner,
.feature-banner {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    border-radius: var(--r-lg);
    padding: var(--sp-5) var(--sp-6);
    text-decoration: none;
    color: var(--accent-contrast);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.concepts-banner { background: linear-gradient(135deg, var(--accent), #a78bfa); }
.feature-banner { background: linear-gradient(135deg, #4f46e5, #3b82f6, #06b6d4); }
.concepts-banner:hover,
.feature-banner:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.concepts-banner-icon { flex-shrink: 0; opacity: 0.92; }
.concepts-banner-text { flex: 1; }
.concepts-banner-text strong { display: block; font-size: var(--fs-md); font-weight: 700; margin-bottom: 0.25rem; }
.concepts-banner-text span { font-size: var(--fs-sm); opacity: 0.92; line-height: 1.55; }
.concepts-banner-arrow {
    flex-shrink: 0;
    font-weight: 600;
    font-size: var(--fs-sm);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.55rem 1.1rem;
    border-radius: var(--r-sm);
}

/* --------------------------------------------------------------------------
   Practice loop — read the design, build it in the simulator, draw it blind.
   Numbered so the three cards read as one sequence rather than three features.
   -------------------------------------------------------------------------- */
.loop-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
    counter-reset: loop;
}
.loop-step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-5);
    background:
        radial-gradient(130% 130% at 0% 0%, var(--accent-subtle), transparent 55%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    text-decoration: none;
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.loop-step:hover { border-color: var(--accent); transform: translateY(-3px); }
.loop-step-num {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--r-full);
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: var(--fs-xs);
    font-weight: 700;
    margin-bottom: var(--sp-1);
}
.loop-step h3 { font-size: var(--fs-md); font-weight: 700; color: var(--text); margin: 0; letter-spacing: -0.015em; }
.loop-step p { color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.6; margin: 0; }
.loop-tag {
    display: inline-block;
    margin-left: 5px;
    padding: 1px 7px;
    border-radius: var(--r-full);
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: 2px;
}
.loop-step-go {
    margin-top: auto;
    padding-top: var(--sp-2);
    color: var(--accent);
    font-size: var(--fs-sm);
    font-weight: 600;
}
/* Connective arrows between the three cards, so the row reads as a loop.
   Decorative only — hidden from assistive tech and dropped when the grid
   collapses to a single column. */
@media (min-width: 861px) {
    .loop-step:not(:last-child)::after {
        content: "→";
        position: absolute;
        right: calc(var(--sp-4) * -0.5);
        top: 50%;
        transform: translate(50%, -50%);
        color: var(--text-dim);
        font-size: var(--fs-md);
        line-height: 1;
        pointer-events: none;
    }
}

/* --------------------------------------------------------------------------
   Popular / feature grid
   -------------------------------------------------------------------------- */
.popular {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sp-4);
}
.pop-card {
    position: relative;
    background: var(--card-glass);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5);
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pop-card:hover {
    background: var(--card-glass-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--glow-accent);
}
.pop-card h4 { font-size: var(--fs-base); font-weight: 650; margin-bottom: 0.3rem; color: var(--text); }
.pop-card p { color: var(--text-muted); font-size: var(--fs-sm); flex-grow: 1; margin-bottom: var(--sp-3); line-height: 1.55; }
.pop-card .meta { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Bento layout
   A modifier on .popular rather than a new class, so the staggered-cascade
   selectors in core.css (which key off .popular > *) keep matching.

   The asymmetry is a 2x2 feature tile in the top-left of a 3-col track. With
   six children that tiles a 3x3 grid exactly — the tile takes 4 cells and the
   five remaining cards take 5 — so there's no hole. That exact fit is why this
   is opted into per-grid rather than applied to every .popular: a grid with a
   different child count would leave a gap.

   The explicit 3-col track (not auto-fill) is what makes the span predictable;
   with auto-fill the column count shifts with the viewport and the tile would
   land unevenly. Only above 860px — below that .popular collapses toward a
   single column and a feature tile stops meaning anything.
   -------------------------------------------------------------------------- */
@media (min-width: 861px) {
    .popular.bento { grid-template-columns: repeat(3, 1fr); }
    .popular.bento > :first-child { grid-column: span 2; grid-row: span 2; }
    /* The tile has ~4x the area, so its type steps up to match. */
    .popular.bento > :first-child { padding: var(--sp-5) var(--sp-6); justify-content: center; }
    .popular.bento > :first-child h4 { font-size: var(--fs-xl); margin-bottom: var(--sp-2); }
    /* .pop-card p flex-grows to push .meta to the card's foot — right for a
       short card, but at double height it opens a dead gap under the text.
       Drop the grow and centre the block instead so the tile reads as composed. */
    .popular.bento > :first-child p { font-size: var(--fs-md); flex-grow: 0; max-width: 46ch; }
}

/* Value-prop cards (non-clickable, coloured top border) */
.pop-card.value-card { cursor: default; border-top-width: 3px; }
.pop-card.value-card.vc-indigo { border-top-color: var(--accent); }
.pop-card.value-card.vc-green { border-top-color: var(--success); }
.pop-card.value-card.vc-amber { border-top-color: var(--warning); }

/* --------------------------------------------------------------------------
   Final CTA block
   -------------------------------------------------------------------------- */
.final-cta { text-align: center; padding-bottom: var(--sp-4); }
.final-cta h2 { font-size: var(--fs-xl); font-weight: 700; color: var(--text); margin-bottom: var(--sp-2); }
.final-cta p { color: var(--text-muted); font-size: var(--fs-md); margin-bottom: var(--sp-4); max-width: 52ch; margin-left: auto; margin-right: auto; }

.section-links { text-align: center; margin-top: var(--sp-4); font-size: var(--fs-sm); }
.section-links a { color: var(--accent); font-weight: 500; text-decoration: none; }
.section-links a:hover { text-decoration: underline; }
.section-links .sep { color: var(--text-dim); margin: 0 var(--sp-2); }

/* --------------------------------------------------------------------------
   Entrance animation (respects prefers-reduced-motion via core.css)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    /* The loop collapses to one column rather than being hidden: only the
       simulator is desktop-only (and says so on arrival), while the designs and
       whiteboard are perfectly usable on a phone. */
    .loop-steps { grid-template-columns: 1fr; }
    .concepts-banner,
    .feature-banner { flex-direction: column; text-align: center; padding: var(--sp-5); }
    .concepts-banner-arrow { width: 100%; text-align: center; }
}
@media (max-width: 640px) {
    .hero { padding: var(--sp-6) var(--sp-5) var(--sp-5); }
    .stats { gap: var(--sp-5); padding: var(--sp-4) var(--sp-4); }
    .paths, .popular { grid-template-columns: 1fr; }
}
