/* =====================================================
   CorpoCoders — Home  (page-specific)

   REQUIRES site.css → components.css → layout.css loaded first (the shared
   shell: ambient bg, topbar, .st-section scaffolding, footer). This file
   holds ONLY what is unique to the home page: the hero, its CSS code-window
   illustration, the stats band, the tech marquee, the article preview grid
   and the newsletter CTA band. (CLAUDE.md §1)
===================================================== */


/* =========================
   HERO LAYOUT

   Two columns on desktop — copy left, illustration right. Collapses to a
   single centred column below 960px with the illustration underneath.
========================= */

.hm-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    align-items: center;
    gap: 56px;
    padding: 64px 0 88px;
}


/* --- Copy column --- */

.hm-hero-copy {
    max-width: 620px;
}

.hm-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 15px 7px 12px;
    border: 1px solid var(--cc-border-str);
    border-radius: 999px;
    background: var(--cc-grad-soft);
    color: var(--cc-tx-1);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.hm-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cc-brand-2);
    box-shadow: 0 0 0 4px rgba(0, 194, 255, .18);
    animation: hm-pulse 2s ease-in-out infinite;
}

@keyframes hm-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .45;
        transform: scale(.82);
    }
}

.hm-title {
    margin: 22px 0 0;
    font-size: clamp(2.5rem, 5.6vw, 4.1rem);
    line-height: 1.08;
}

/* Animated gradient — composed from the brand tokens (never a raw hex) and
   slowly panned across the text. This is the hero's "animated gradient". */
.hm-title-grad {
    background: linear-gradient(115deg,
            var(--cc-brand-1),
            var(--cc-brand-2),
            var(--cc-secondary),
            var(--cc-brand-2),
            var(--cc-brand-1));
    background-size: 220% 220%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: hm-grad-pan 9s ease-in-out infinite;
}

@keyframes hm-grad-pan {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.hm-sub {
    margin: 22px 0 0;
    max-width: 54ch;
    color: var(--cc-tx-2);
    font-size: clamp(1rem, 1.4vw, 1.12rem);
    line-height: 1.65;
}

.hm-sub strong {
    color: var(--cc-tx-1);
    font-weight: 600;
}

/* CTA row */
.hm-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 34px;
}

/* Trust strip — small proof line under the CTAs */
.hm-trust {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 22px;
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--cc-border);
}

.hm-trust-item {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    color: var(--cc-tx-3);
    font-size: 13px;
    font-weight: 500;
}

.hm-trust-num {
    font-family: var(--cc-mono);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.02em;
    color: var(--cc-tx-1);
    font-variant-numeric: tabular-nums;
}


/* =========================
   CODE-WINDOW ILLUSTRATION

   Built in CSS rather than shipped as an image: it themes with the
   tokens, stays crisp at any size and reads as "engineered" — the same
   reason the launch page uses mono and hairlines. Square-cornered frame,
   rounded controls, brand accents on the syntax. (design.md §7)
========================= */

.hm-art {
    position: relative;
    justify-self: end;
    width: 100%;
    max-width: 520px;
}

.hm-window {
    position: relative;
    z-index: 1;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-r-md);
    background:
        linear-gradient(180deg, var(--cc-surface), transparent 60%),
        var(--cc-bg-2);
    box-shadow: var(--cc-shadow), var(--cc-glow);
    overflow: hidden;
}

.hm-window-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--cc-border);
    background: var(--cc-surface);
}

.hm-dots {
    display: flex;
    gap: 7px;
}

.hm-dots span {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--cc-border-str);
}

.hm-dots span:nth-child(1) {
    background: #FF5F57;
}

.hm-dots span:nth-child(2) {
    background: #FEBC2E;
}

.hm-dots span:nth-child(3) {
    background: #28C840;
}

.hm-window-file {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--cc-tx-3);
    font-family: var(--cc-mono);
    font-size: 12.5px;
}

.hm-window-file i {
    color: var(--cc-brand-2);
    font-size: 14px;
}

:root[data-theme="light"] .hm-window-file i {
    color: var(--cc-brand-1);
}

/* Code body — a <pre> of syntax-coloured lines with a gutter of line
   numbers. Decorative, so it uses aria-hidden in the markup. */
.hm-code {
    margin: 0;
    padding: 20px 22px 24px;
    font-family: var(--cc-mono);
    font-size: 13px;
    line-height: 1.85;
    counter-reset: hm-line;
    overflow-x: auto;
}

.hm-code .ln {
    display: block;
    white-space: pre;
    counter-increment: hm-line;
}

.hm-code .ln::before {
    content: counter(hm-line);
    display: inline-block;
    width: 1.6em;
    margin-right: 18px;
    text-align: right;
    color: var(--cc-tx-3);
    opacity: .6;
}

/* Syntax roles — brand-adjacent, component-scoped (not global tokens) */
.hm-code .k {
    color: var(--cc-brand-2);
}

.hm-code .fn {
    color: var(--cc-secondary);
}

.hm-code .s {
    color: var(--cc-success);
}

.hm-code .n {
    color: var(--cc-warning);
}

.hm-code .c {
    color: var(--cc-tx-3);
    font-style: italic;
}

.hm-code .p {
    color: var(--cc-tx-2);
}

.hm-code .v {
    color: var(--cc-tx-1);
}

/* Light mode: cyan and lighter greens dim on white — deepen them */
:root[data-theme="light"] .hm-code .k {
    color: var(--cc-brand-1);
}

:root[data-theme="light"] .hm-code .s {
    color: #15803D;
}

:root[data-theme="light"] .hm-code .n {
    color: #B45309;
}

/* Blinking caret at the end of the last line */
.hm-caret {
    display: inline-block;
    width: 8px;
    height: 1.05em;
    margin-left: 2px;
    vertical-align: -2px;
    background: var(--cc-brand-2);
    animation: hm-blink 1.1s steps(1) infinite;
}

:root[data-theme="light"] .hm-caret {
    background: var(--cc-brand-1);
}

@keyframes hm-blink {

    0%,
    50% {
        opacity: 1;
    }

    50.01%,
    100% {
        opacity: 0;
    }
}

/* Floating glass stat chip, pinned to the window's lower-left corner */
.hm-chip {
    position: absolute;
    left: -22px;
    bottom: 30px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: var(--cc-r-md);
    box-shadow: var(--cc-shadow);
    animation: hm-bob 6s ease-in-out infinite;
}

.hm-chip-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: var(--cc-r-sm);
    background: var(--cc-grad);
    color: #fff;
    font-size: 19px;
}

.hm-chip-num {
    font-family: var(--cc-mono);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--cc-tx-1);
    font-variant-numeric: tabular-nums;
}

.hm-chip-lbl {
    color: var(--cc-tx-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

@keyframes hm-bob {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}


/* =========================
   COMMUNITY STATISTICS  (Phase 3.2)

   A slab band of animated counters. Reuses .cs-slab / .cs-cell
   (components.css §12) as a 4×2 grid; motion.js counts each value up when
   it scrolls into view via data-cc-counter. Cell anatomy: icon tile →
   number → label. Glow sized to the short cell (~1× its height, §1.5).
========================= */

.hm-stat-grid {
    grid-template-columns: repeat(4, 1fr);
}

.hm-stat {
    --cc-glow-size: 190px;
    --cc-corner-size: 30px;

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 34px 20px 30px;
    text-align: center;
}

.hm-stat-icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: var(--cc-r-md);
    border: 1px solid var(--cc-border);
    background: var(--cc-surface);
    color: var(--cc-tx-3);
    font-size: 21px;
    transition: color var(--cc-t), border-color var(--cc-t), background var(--cc-t), box-shadow var(--cc-t);
}

.hm-stat:hover .hm-stat-icon {
    border-color: rgba(0, 194, 255, .45);
    background: var(--cc-grad-soft);
    color: var(--cc-brand-2);
    box-shadow: 0 0 22px -6px rgba(0, 194, 255, .55);
}

:root[data-theme="light"] .hm-stat:hover .hm-stat-icon {
    border-color: rgba(15, 61, 222, .40);
    color: var(--cc-brand-1);
    box-shadow: 0 0 22px -8px rgba(15, 61, 222, .45);
}

.hm-stat-num {
    font-family: var(--cc-mono);
    font-size: clamp(1.8rem, 3.4vw, 2.5rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    background: var(--cc-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hm-stat-lbl {
    color: var(--cc-tx-3);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    transition: color var(--cc-t);
}

.hm-stat:hover .hm-stat-lbl {
    color: var(--cc-tx-2);
}


/* =========================
   TECHNOLOGY STACK MARQUEE  (Phase 3.3)

   Two rows of tech chips scrolling in opposite directions. The loop,
   track duplication, edge-fade mask and hover-pause all live in the base
   .cc-marquee (site.css) + motion.js; this block only styles the chips
   and the two-row wrapper.
========================= */

.hm-marquee-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Chip — hairline pill, mono label, glyph in brand-cyan */
.hm-tech {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    flex: 0 0 auto;
    padding: 13px 22px;
    border: 1px solid var(--cc-border);
    border-radius: 999px;
    background: var(--cc-surface);
    color: var(--cc-tx-2);
    font-family: var(--cc-mono);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: color var(--cc-t), border-color var(--cc-t), background var(--cc-t);
}

.hm-tech i {
    font-size: 20px;
    color: var(--cc-brand-2);
    transition: transform var(--cc-t);
}

:root[data-theme="light"] .hm-tech i {
    color: var(--cc-brand-1);
}

.hm-tech:hover {
    color: var(--cc-tx-1);
    border-color: var(--cc-border-str);
    background: var(--cc-grad-soft);
}

.hm-tech:hover i {
    transform: scale(1.15);
}


/* =========================
   LATEST ARTICLES  (Phase 3.6)

   A slab grid of post cards — reuses the shared .cs-slab / .cs-cell
   primitive (components.css §12). Cell anatomy: cover strip → category +
   read-time → title → excerpt → author footer pinned to the bottom.
========================= */

.hm-article-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.hm-article {
    --cc-glow-size: 300px;
    --cc-corner-size: 36px;

    display: flex;
    flex-direction: column;
}

/* Cover — a gradient wash with a mono topic glyph. No raster image needed;
   it themes with the tokens and stays crisp. */
.hm-article-cover {
    position: relative;
    aspect-ratio: 16 / 8;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-bottom: 1px solid var(--cc-border);
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(0, 194, 255, .18), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(15, 61, 222, .22), transparent 55%),
        var(--cc-bg-2);
}

.hm-article-cover i {
    font-size: 46px;
    color: var(--cc-tx-1);
    opacity: .9;
    transition: transform var(--cc-t);
}

.hm-article:hover .hm-article-cover i {
    transform: scale(1.08);
}

/* Featured pill, top-left of the cover */
.hm-article-flag {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--cc-grad);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hm-article-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 22px 24px 24px;
}

.hm-article-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    color: var(--cc-tx-3);
    font-size: 12px;
    font-weight: 600;
}

.hm-article-cat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cc-brand-2);
}

:root[data-theme="light"] .hm-article-cat {
    color: var(--cc-brand-1);
}

.hm-article-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--cc-tx-3);
}

.hm-article h3 {
    font-size: 1.18rem;
    line-height: 1.32;
    transition: color var(--cc-t);
}

.hm-article:hover h3 {
    color: var(--cc-brand-2);
}

:root[data-theme="light"] .hm-article:hover h3 {
    color: var(--cc-brand-1);
}

.hm-article-excerpt {
    margin-top: 10px;
    color: var(--cc-tx-2);
    font-size: 14px;
    line-height: 1.6;
    /* Clamp to keep every card footer on a common baseline */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Author footer — pinned to the bottom so footers line up across the row */
.hm-article-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 20px;
}

.hm-article-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cc-grad-soft);
    border: 1px solid var(--cc-border);
    color: var(--cc-tx-1);
    font-size: 12px;
    font-weight: 700;
}

.hm-article-author {
    color: var(--cc-tx-2);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}

.hm-article-date {
    color: var(--cc-tx-3);
    font-size: 11.5px;
}


/* =========================
   NEWSLETTER CTA BAND  (Phase 3.9)

   A framed panel that lifts off the page: near-black fill, brand orb
   glows bleeding in from the corners, a centred pitch, an inline
   email+button form (reuses .cc-input-group / .cc-btn) and a row of
   feature ticks. Square frame, rounded controls (design.md §7).
========================= */

.hm-cta-band {
    position: relative;
    overflow: hidden;
    padding: 64px 40px;
    border: 1px solid var(--cc-border-str);
    border-radius: var(--cc-r-lg);
    background:
        radial-gradient(90% 120% at 0% 0%, rgba(0, 194, 255, .16), transparent 55%),
        radial-gradient(90% 120% at 100% 100%, rgba(15, 61, 222, .22), transparent 55%),
        var(--cc-bg-2);
    text-align: center;
}

/* Faint grid inside the panel, echoing the page backdrop */
.hm-cta-band::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(var(--cc-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--cc-grid-line) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, #000, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 80% at 50% 50%, #000, transparent 75%);
    pointer-events: none;
}

.hm-cta-inner {
    position: relative;
    z-index: 1;
    max-width: 620px;
    margin: 0 auto;
}

.hm-cta-band h2 {
    margin-top: 18px;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.12;
}

.hm-cta-band p {
    margin: 16px auto 0;
    max-width: 48ch;
    color: var(--cc-tx-2);
    font-size: clamp(1rem, 1.4vw, 1.1rem);
    line-height: 1.6;
}

/* Inline form — email field grows, button holds its width */
.hm-cta-form {
    display: flex;
    gap: 12px;
    margin: 30px auto 0;
    max-width: 480px;
}

.hm-cta-form .cc-input-group {
    flex: 1;
}

.hm-cta-form .cc-btn {
    flex: 0 0 auto;
}

/* Feature ticks under the form */
.hm-cta-ticks {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 24px;
    margin-top: 24px;
}

.hm-cta-tick {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--cc-tx-3);
    font-size: 13px;
    font-weight: 500;
}

.hm-cta-tick i {
    color: var(--cc-success);
    font-size: 15px;
}


/* =========================
   RESPONSIVE  (§1.10)

   Only home-specific reflow lives here; the shell's own breakpoints
   (topbar, section padding, footer) are in layout.css.
========================= */

@media (max-width: 960px) {
    .hm-hero {
        grid-template-columns: 1fr;
        gap: 48px;
        padding: 44px 0 64px;
        text-align: center;
    }

    .hm-hero-copy {
        max-width: 640px;
        margin: 0 auto;
    }

    .hm-sub {
        margin-left: auto;
        margin-right: auto;
    }

    .hm-cta,
    .hm-trust {
        justify-content: center;
    }

    .hm-art {
        justify-self: center;
        max-width: 460px;
    }

    /* 4×2 → 2×4 */
    .hm-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .hm-hero {
        padding: 32px 0 52px;
    }

    .hm-cta .cc-btn {
        width: 100%;
    }

    .hm-trust {
        gap: 10px 18px;
    }

    /* The chip overhangs the frame on desktop; tuck it back in on mobile */
    .hm-chip {
        left: 10px;
        bottom: 14px;
        padding: 10px 13px;
    }

    .hm-code {
        font-size: 12px;
        padding: 16px 16px 20px;
    }

    /* One column of article cards on the smallest screens */
    .hm-article-grid {
        grid-template-columns: 1fr;
    }

    /* Stats stay two-up — 8 full-width cells is too long a scroll. Shrink
       the cell and its glow together (§1.10). */
    .hm-stat {
        --cc-glow-size: 150px;
        --cc-corner-size: 24px;

        gap: 10px;
        padding: 24px 12px 22px;
    }

    .hm-stat-icon {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
        font-size: 18px;
    }

    /* CTA band — tighter panel, form stacks to full-width controls */
    .hm-cta-band {
        padding: 44px 22px;
    }

    .hm-cta-form {
        flex-direction: column;
    }

    .hm-cta-form .cc-btn {
        width: 100%;
    }
}


/* =========================
   MOTION PREFERENCE
========================= */

@media (prefers-reduced-motion: reduce) {

    .hm-badge-dot,
    .hm-title-grad,
    .hm-caret,
    .hm-chip {
        animation: none;
    }
}
