/* =========================================================================
   HabiCode Classroom: public home page
   Concept: habi (Filipino for "weave"). Each language is a thread; woven
   bands mark section seams. Flat fills only: no gradients, glows, or blur.
   Everything is scoped under .hc-home so app-wide styles are unaffected.
   ========================================================================= */

@font-face {
    font-family: 'Lexend';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../../vendor/lexend/lexend-latin.woff2') format('woff2');
}

@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400 500;
    font-display: swap;
    src: url('../../vendor/jetbrains-mono/jetbrains-mono-latin.woff2') format('woff2');
}

/* ── Tokens ── */
.hc-home {
    --hc-paper: #f7f8fc;
    --hc-surface: #ffffff;
    --hc-ink: #161b3d;
    --hc-muted: #565e84;
    --hc-line: #dde1ef;
    --hc-primary: #2b3a8c;
    --hc-primary-fg: #ffffff;
    --hc-teal-ink: #0b7d72;

    /* One thread per language: logo indigo, coral, teal, plus habi gold */
    --hc-t-py: #2b3a8c;
    --hc-t-java: #f0604d;
    --hc-t-cpp: #0f9a8d;
    --hc-t-sql: #e3a21a;

    --hc-code-bg: #121735;
    --hc-code-bar: #1a2048;
    --hc-code-line: #2a3163;
    --hc-code-fg: #e6e8f5;
    --hc-code-muted: #8c93ba;
    --hc-code-k: #ff8a7d;
    --hc-code-s: #f2c45a;
    --hc-code-f: #4fd6d0;

    --hc-band-ground: #161b3d;
    --hc-cta-bg: #2b3a8c;
    --hc-cta-fg: #ffffff;
    --hc-cta-muted: #c9cff0;

    --hc-display: 'Lexend', 'Avenir Next', 'Segoe UI', sans-serif;
    --hc-body: var(--hc-font-sans);
    --hc-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

    --hc-step--1: 0.875rem;
    --hc-step-0: 1rem;
    --hc-step-1: 1.2rem;
    --hc-step-2: 1.6rem;
    --hc-step-3: clamp(1.9rem, 1.4rem + 1.8vw, 2.5rem);
    --hc-step-4: clamp(2.3rem, 1.6rem + 3vw, 3.6rem);
}

[data-bs-theme="dark"] .hc-home {
    --hc-paper: #0e1230;
    --hc-surface: #161b40;
    --hc-ink: #e9ebf7;
    --hc-muted: #a4aacd;
    --hc-line: #2a3163;
    --hc-primary: #8796f2;
    --hc-primary-fg: #0e1230;
    --hc-teal-ink: #3ccfbf;
    --hc-t-py: #8796f2;
    --hc-t-java: #ff7a6b;
    --hc-t-cpp: #2bcbc5;
    --hc-t-sql: #f2b544;
    --hc-code-bg: #0a0d24;
    --hc-code-bar: #11163a;
    --hc-code-line: #262d5c;
    --hc-band-ground: #0a0d24;
    --hc-cta-bg: #1c2563;
    --hc-cta-muted: #b9c0ea;
}

/* ── Base ── */
.hc-home {
    background: var(--hc-paper);
    color: var(--hc-ink);
    font-family: var(--hc-body);
    font-size: var(--hc-step-0);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hc-home h1,
.hc-home h2,
.hc-home h3 {
    font-family: var(--hc-display);
    line-height: 1.12;
    margin: 0;
    color: var(--hc-ink);
    text-wrap: balance;
    letter-spacing: -0.015em;
}

.hc-home p,
.hc-home pre,
.hc-home ul,
.hc-home ol {
    margin: 0;
}

.hc-home a:focus-visible,
.hc-home button:focus-visible {
    outline: 3px solid var(--hc-t-cpp);
    outline-offset: 2px;
    border-radius: 4px;
}

.hc-wrap {
    max-width: 1160px;
    margin-inline: auto;
    padding-inline: 16px;
}

@media (min-width: 720px) {
    .hc-wrap { padding-inline: 32px; }
}

.hc-eyebrow {
    font-family: var(--hc-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--hc-teal-ink);
}

/* ── Buttons ── */
.hc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--hc-display);
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.3;
    padding: 10px 18px;
    border-radius: 8px;
    border: 2px solid transparent;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.hc-btn:hover { transform: translateY(-1px); }
.hc-btn-lg { padding: 13px 22px; font-size: 1rem; }

.hc-btn-primary,
.hc-btn-primary:hover { background: var(--hc-primary); color: var(--hc-primary-fg); }

.hc-btn-outline,
.hc-btn-outline:hover { background: transparent; border-color: var(--hc-line); color: var(--hc-ink); }
.hc-btn-outline:hover { border-color: var(--hc-ink); }

/* ── Nav ── */
.hc-nav .hc-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 18px;
}

.hc-brand { display: flex; text-decoration: none; }

.hc-nav-links { display: flex; align-items: center; gap: 8px; }

@media (max-width: 520px) {
    .hc-nav-links .hc-btn-outline { display: none; }
}

/* ── Hero ── */
.hc-hero .hc-wrap {
    display: grid;
    gap: 40px;
    align-items: center;
    padding-block: 40px 56px;
}

@media (min-width: 960px) {
    .hc-hero .hc-wrap {
        grid-template-columns: 1fr 1.05fr;
        gap: 56px;
        padding-block: 56px 72px;
    }
}

.hc-hero-copy { display: grid; gap: 22px; min-width: 0; }
.hc-hero h1 { font-size: var(--hc-step-4); font-weight: 600; }

.hc-thread {
    text-decoration-line: underline;
    text-decoration-thickness: 0.13em;
    text-underline-offset: 0.14em;
    text-decoration-skip-ink: none;
}

.hc-thread-py { text-decoration-color: var(--hc-t-py); }
.hc-thread-java { text-decoration-color: var(--hc-t-java); }
.hc-thread-cpp { text-decoration-color: var(--hc-t-cpp); }
.hc-thread-sql { text-decoration-color: var(--hc-t-sql); }

.hc-lead { font-size: var(--hc-step-1); color: var(--hc-muted); max-width: 34em; }
.hc-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hc-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    list-style: none;
    padding: 0;
    color: var(--hc-muted);
    font-size: var(--hc-step--1);
}

.hc-facts li { display: inline-flex; align-items: center; gap: 8px; }

/* Cross-stitch bullet */
.hc-stitch {
    position: relative;
    flex: none;
    display: inline-block;
    width: 12px;
    height: 12px;
}

.hc-stitch::before,
.hc-stitch::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 14px;
    height: 3px;
    border-radius: 2px;
}

.hc-stitch::before { background: var(--hc-t-cpp); transform: translate(-50%, -50%) rotate(45deg); }
.hc-stitch::after { background: var(--hc-t-java); transform: translate(-50%, -50%) rotate(-45deg); }

/* ── Sample sandbox ── */
.hc-ide {
    min-width: 0;
    background: var(--hc-code-bg);
    color: var(--hc-code-fg);
    border: 1px solid var(--hc-code-line);
    border-radius: 12px;
    overflow: hidden;
}

.hc-ide-tabs {
    display: flex;
    background: var(--hc-code-bar);
    overflow-x: auto;
    scrollbar-width: none;
}

.hc-ide-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--hc-mono);
    font-size: 0.82rem;
    color: var(--hc-code-muted);
    background: transparent;
    border: 0;
    border-top: 3px solid transparent;
    border-right: 1px solid var(--hc-code-line);
    padding: 11px 16px 12px;
    cursor: pointer;
}

.hc-ide-tab[aria-selected="true"] { color: var(--hc-code-fg); background: var(--hc-code-bg); }
.hc-ide-tab .hc-dot { width: 8px; height: 8px; border-radius: 2px; }

.hc-ide-tab[data-lang="py"] .hc-dot { background: var(--hc-t-py); }
.hc-ide-tab[data-lang="java"] .hc-dot { background: var(--hc-t-java); }
.hc-ide-tab[data-lang="cpp"] .hc-dot { background: var(--hc-t-cpp); }
.hc-ide-tab[data-lang="sql"] .hc-dot { background: var(--hc-t-sql); }
.hc-ide-tab[data-lang="py"][aria-selected="true"] { border-top-color: var(--hc-t-py); }
.hc-ide-tab[data-lang="java"][aria-selected="true"] { border-top-color: var(--hc-t-java); }
.hc-ide-tab[data-lang="cpp"][aria-selected="true"] { border-top-color: var(--hc-t-cpp); }
.hc-ide-tab[data-lang="sql"][aria-selected="true"] { border-top-color: var(--hc-t-sql); }

.hc-ide-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hc-code-line);
    font-family: var(--hc-mono);
    font-size: 0.75rem;
    color: var(--hc-code-muted);
}

.hc-run {
    font-family: var(--hc-display);
    font-weight: 500;
    font-size: 0.82rem;
    background: var(--hc-t-cpp);
    color: #06232a;
    border: 0;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
}

.hc-run:disabled { opacity: 0.7; cursor: progress; }

.hc-code {
    padding: 16px 18px;
    min-height: 200px;
    overflow-x: auto;
    background: transparent;
    color: var(--hc-code-fg);
    font-family: var(--hc-mono);
    font-size: 0.84rem;
    line-height: 1.65;
    tab-size: 4;
}

.hc-code .k { color: var(--hc-code-k); }
.hc-code .s { color: var(--hc-code-s); }
.hc-code .f { color: var(--hc-code-f); }
.hc-code .c { color: var(--hc-code-muted); }

.hc-console { border-top: 1px solid var(--hc-code-line); background: var(--hc-code-bar); }

.hc-console-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    font-family: var(--hc-mono);
    font-size: 0.72rem;
    color: var(--hc-code-muted);
}

.hc-console-out {
    padding: 4px 16px 16px;
    min-height: 104px;
    overflow-x: auto;
    color: var(--hc-code-fg);
    font-family: var(--hc-mono);
    font-size: 0.8rem;
    line-height: 1.55;
    white-space: pre;
}

.hc-console-out .prompt { color: var(--hc-code-muted); }
.hc-console-out .ok { color: var(--hc-code-f); }

/* ── Woven band ── */
.hc-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hc-band { display: block; width: 100%; height: 22px; }
#hcHabi .ground,
#hcHabi .hole { fill: var(--hc-band-ground); }
#hcHabi .w-py { fill: var(--hc-t-py); }
#hcHabi .w-java { fill: var(--hc-t-java); }
#hcHabi .w-cpp { fill: var(--hc-t-cpp); }
#hcHabi .w-sql { fill: var(--hc-t-sql); }

/* ── Sections ── */
.hc-section { padding-block: 72px; }

.hc-section-head {
    display: grid;
    gap: 12px;
    max-width: 40rem;
    margin-bottom: 40px;
}

.hc-section-head h2 { font-size: var(--hc-step-3); font-weight: 600; }
.hc-section-head p { color: var(--hc-muted); font-size: var(--hc-step-1); }

/* Languages: four warp threads */
.hc-langs { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--hc-line); }

.hc-lang {
    display: grid;
    gap: 10px;
    align-content: start;
    min-width: 0;
    padding: 24px 24px 28px 0;
    border-bottom: 1px solid var(--hc-line);
}

@media (min-width: 640px) {
    .hc-langs { grid-template-columns: repeat(2, 1fr); }
    .hc-lang { padding-left: 24px; border-left: 1px solid var(--hc-line); }
    .hc-lang:nth-child(2n + 1) { padding-left: 0; border-left: 0; }
}

@media (min-width: 1000px) {
    .hc-langs { grid-template-columns: repeat(4, 1fr); }
    .hc-lang { border-bottom: 0; }
    .hc-lang:nth-child(2n + 1) { padding-left: 24px; border-left: 1px solid var(--hc-line); }
    .hc-lang:first-child { padding-left: 0; border-left: 0; }
}

.hc-swatch { width: 56px; height: 6px; border-radius: 3px; }
.hc-lang[data-lang="py"] .hc-swatch { background: var(--hc-t-py); }
.hc-lang[data-lang="java"] .hc-swatch { background: var(--hc-t-java); }
.hc-lang[data-lang="cpp"] .hc-swatch { background: var(--hc-t-cpp); }
.hc-lang[data-lang="sql"] .hc-swatch { background: var(--hc-t-sql); }

.hc-lang h3 { margin-top: 8px; font-size: var(--hc-step-2); font-weight: 600; }
.hc-runtime { font-family: var(--hc-mono); font-size: 0.78rem; color: var(--hc-muted); }
.hc-lang p { color: var(--hc-muted); font-size: 0.95rem; }

.hc-new {
    justify-self: start;
    font-family: var(--hc-display);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--hc-ink);
    border: 1.5px solid var(--hc-t-sql);
    border-radius: 4px;
    padding: 1px 7px;
}

/* Capabilities */
.hc-caps-section { background: var(--hc-surface); border-block: 1px solid var(--hc-line); }
.hc-caps { display: grid; gap: 40px; }

@media (min-width: 860px) {
    .hc-caps { grid-template-columns: repeat(3, 1fr); gap: 48px; }
}

.hc-cap h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--hc-ink);
    font-size: var(--hc-step-1);
    font-weight: 600;
}

.hc-cap ul { list-style: none; padding: 0; display: grid; gap: 16px; }
.hc-cap li { display: grid; grid-template-columns: 12px 1fr; gap: 14px; align-items: start; }
.hc-cap li .hc-stitch { margin-top: 7px; }
.hc-cap strong { display: block; font-family: var(--hc-display); font-weight: 500; color: var(--hc-ink); }
.hc-cap-desc { color: var(--hc-muted); font-size: 0.95rem; }

/* Workflow */
.hc-flow-toggle {
    justify-self: start;
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1.5px solid var(--hc-line);
    border-radius: 8px;
}

.hc-flow-toggle button {
    font-family: var(--hc-display);
    font-weight: 500;
    font-size: 0.9rem;
    border: 0;
    background: transparent;
    color: var(--hc-muted);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.hc-flow-toggle button[aria-pressed="true"] { background: var(--hc-ink); color: var(--hc-paper); }

.hc-steps { list-style: none; margin-top: 32px; padding: 0; display: grid; gap: 28px; }
.hc-steps[hidden] { display: none; }

@media (min-width: 860px) {
    .hc-steps { position: relative; grid-template-columns: repeat(3, 1fr); gap: 40px; }
    .hc-steps::before {
        content: "";
        position: absolute;
        left: 22px;
        right: 22px;
        top: 21px;
        height: 2px;
        background: var(--hc-line);
    }
}

.hc-step { position: relative; display: grid; gap: 10px; align-content: start; min-width: 0; }

.hc-step-num {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--hc-paper);
    border: 2px solid var(--hc-ink);
    font-family: var(--hc-display);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.hc-step h3 { margin-top: 6px; font-size: var(--hc-step-1); font-weight: 600; }
.hc-step p { color: var(--hc-muted); max-width: 30em; }

.hc-step code {
    font-family: var(--hc-mono);
    font-size: 0.85em;
    color: var(--hc-ink);
    background: var(--hc-surface);
    border: 1px solid var(--hc-line);
    border-radius: 4px;
    padding: 0 5px;
}

/* Closing call to action */
.hc-cta { background: var(--hc-cta-bg); color: var(--hc-cta-fg); }
.hc-cta .hc-wrap { display: grid; gap: 24px; padding-block: 64px; }

@media (min-width: 860px) {
    .hc-cta .hc-wrap { grid-template-columns: 1.4fr 1fr; align-items: end; }
}

.hc-home .hc-cta h2 { color: var(--hc-cta-fg); font-size: var(--hc-step-3); font-weight: 600; }
.hc-cta p { margin-top: 12px; max-width: 32em; color: var(--hc-cta-muted); font-size: var(--hc-step-1); }
.hc-cta-actions { display: flex; flex-wrap: wrap; gap: 12px; }

@media (min-width: 860px) {
    .hc-cta-actions { justify-content: flex-end; }
}

.hc-btn-light,
.hc-btn-light:hover { background: var(--hc-cta-fg); color: #1c2563; }
.hc-btn-ghost,
.hc-btn-ghost:hover { border-color: var(--hc-cta-muted); color: var(--hc-cta-fg); }

/* Footer: always on the dark band ground, in both themes */
.hc-footer { background: var(--hc-band-ground); color: #b9c0ea; font-size: var(--hc-step--1); }

.hc-footer .hc-wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 22px;
}

.hc-tagline {
    font-family: var(--hc-display);
    font-size: 0.72rem;
    letter-spacing: 0.01em;
}

.hc-tagline b { font-weight: 600; }
.hc-tagline b:nth-child(1) { color: #9aa8f5; }
.hc-tagline b:nth-child(2) { color: #3ccfbf; }
.hc-tagline b:nth-child(3) { color: #f2b544; }
.hc-tagline b:nth-child(4) { color: #ff8a7d; }

@media (prefers-reduced-motion: reduce) {
    .hc-home * { transition: none !important; }
}
