/* ============================================================
   Knovli — public page styles
   Loaded by the generated static pages (/flashcards, /study,
   /atlas, /play, /teachers, /creator, /about …) and by the
   "What is Knovli" band in index.html.

   Depends on styles.css for the design tokens and for
   .knovli-logo / .bg-glow. Everything here is additive and
   namespaced kv-page* / kv-hb* / kv-btn*, so it can never
   collide with an app rule.
   ============================================================ */

/* The generated pages have no .shell, which is what gives index.html its
   full-height background. Without this the .bg-glow gradient stops at the end
   of a short page and the rest of the viewport falls back to the UA white —
   very visible in dark mode. */
body.kv-public-page { min-height: 100vh; }

/* ── Shared buttons ─────────────────────────────────────── */
.kv-btn-primary,
.kv-btn-ghost {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.kv-btn-primary { background: var(--brand-gradient); color: #fff; border: 0; }
.kv-btn-ghost   { border: 1px solid var(--border-strong); color: var(--text); }
.kv-btn-primary:hover, .kv-btn-ghost:hover { text-decoration: none; opacity: 0.92; }
.kv-btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ── Page header ────────────────────────────────────────── */
.kv-pagehead {
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 20;
}
/* Full width (owner, 2026-10-07): the bar and the page body both run edge to
   edge, with the same side padding, on every public and landing page. */
.kv-pagehead-inner {
    max-width: none;
    margin: 0 auto;
    padding: 12px clamp(16px, 4vw, 56px);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}
.kv-pagehead .knovli-logo { text-decoration: none; flex-shrink: 0; }

.kv-pagenav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    /* Takes the slack so the CTA pair stays hard right on desktop and wraps
       cleanly underneath on a phone. */
    margin-right: auto;
}
.kv-pagenav-link {
    display: inline-block;
    padding: 7px 11px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}
.kv-pagenav-link:hover { color: var(--text); background: var(--bg-secondary); text-decoration: none; }
.kv-pagenav-link.is-current { color: var(--text); background: var(--bg-secondary); }

.kv-pagehead-cta { display: flex; gap: 8px; flex-shrink: 0; }

/* The menu button. Hidden on a wide screen, where the links sit in the bar. */
.kv-navtoggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.kv-navbtn { display: none; }

/* Below this the eight links no longer fit beside the logo and the buttons. */
@media (max-width: 1000px) {
    .kv-pagehead-inner { gap: 10px; flex-wrap: wrap; }
    .kv-pagehead-cta { margin-left: auto; order: 1; }
    .kv-navbtn {
        order: 2; flex: none; display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
        width: 44px; height: 44px; padding: 0 11px; box-sizing: border-box; cursor: pointer;
        border: 1px solid var(--border-strong); border-radius: 12px;
    }
    .kv-navbtn span { display: block; height: 2px; border-radius: 2px; background: var(--text); transition: transform .15s ease, opacity .15s ease; }
    .kv-navtoggle:checked + .kv-navbtn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .kv-navtoggle:checked + .kv-navbtn span:nth-child(2) { opacity: 0; }
    .kv-navtoggle:checked + .kv-navbtn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    .kv-navtoggle:focus-visible + .kv-navbtn { outline: 2px solid var(--brand-blue); outline-offset: 2px; }
    /* A page rendered before the button existed has no toggle: its links stay
       visible, in one row that scrolls sideways instead of wrapping to three. */
    .kv-pagenav { order: 3; width: 100%; margin-right: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .kv-pagenav::-webkit-scrollbar { display: none; }
    .kv-pagenav-link { white-space: nowrap; }
    /* With the button: folded away until it is pressed, then a list you can tap. */
    .kv-navtoggle ~ .kv-pagenav { display: none; flex-direction: column; gap: 2px; overflow: visible; padding: 6px 0 2px; border-top: 1px solid var(--border); }
    .kv-navtoggle:checked ~ .kv-pagenav { display: flex; }
    .kv-navtoggle ~ .kv-pagenav .kv-pagenav-link { display: block; padding: 13px 12px; font-size: 1rem; border-radius: 10px; }
}
@media (max-width: 700px) {
    .kv-pagehead { position: static; }
}
@media (max-width: 420px) {
    .kv-pagehead-cta { gap: 6px; }
    .kv-pagehead-cta .kv-btn-ghost, .kv-pagehead-cta .kv-btn-primary { padding-left: 11px; padding-right: 11px; font-size: 0.84rem; }
    .kv-pagehead .knovli-word { font-size: 1.25rem; }
}
@media (max-width: 350px) {
    .kv-pagehead-cta .kv-btn-ghost { display: none; }      /* Sign in is one tap away on the sign-up page */
}

/* ── Page body ──────────────────────────────────────────── */
.kv-page-shell { max-width: none; margin: 0 auto; padding: 44px clamp(16px, 4vw, 56px) 8px; }
/* Subject and quiz pages: their intro line runs the full width too. */
.kv-page-main .ks-lead { max-width: none; }
.kv-page-main { font-family: var(--font-body); }

.kv-page-h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 2.9rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.015em;
    margin: 0 0 20px;
    color: var(--text);
}
.kv-page-lead {
    font-size: 1.14rem;
    line-height: 1.65;
    color: var(--text);
    margin: 0 0 28px;
}
/* Flex, not inline flow: /about carries three buttons and inline-blocks give
   them no gap and an inconsistent wrap on a phone. */
.kv-page-cta { margin: 0 0 8px; display: flex; gap: 12px; flex-wrap: wrap; }

.kv-page-section { margin-top: 46px; }
.kv-page-section h2 {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3.6vw, 1.6rem);
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 14px;
    color: var(--text);
}
.kv-page-section p {
    font-size: 1.02rem;
    line-height: 1.72;
    color: var(--text-muted);
    margin: 0 0 16px;
}
.kv-page-section strong { color: var(--text); font-weight: 700; }
.kv-page-section a { color: var(--brand-blue); }
[data-theme="dark"] .kv-page-section a { color: #7FB0FF; }

/* Feature lists — term + explanation. A <dl> rather than a <ul> because the
   term genuinely labels the text, which is also what tells a crawler which
   half is the feature name. */
.kv-deflist { margin: 0; padding: 0; }
.kv-deflist dt {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text);
    margin: 18px 0 4px;
}
.kv-deflist dt:first-child { margin-top: 0; }
.kv-deflist dd {
    margin: 0;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-muted);
    padding-left: 14px;
    border-left: 2px solid var(--border);
}

/* ── FAQ ────────────────────────────────────────────────── */
/* Plain headings and paragraphs, not <details>: collapsed answers are text a
   crawler has to work to value, and there is no reason to hide four short
   answers. The FAQPage JSON-LD in the <head> describes exactly this markup. */
.kv-faq-item { margin: 0 0 22px; }
.kv-faq-item h3 {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
}
.kv-faq-item p { margin: 0; }

/* ── Related pages ──────────────────────────────────────── */
.kv-related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 640px) { .kv-related ul { grid-template-columns: 1fr 1fr; } }
.kv-related a {
    display: block;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
    text-decoration: none;
    height: 100%;
}
.kv-related a:hover { border-color: var(--border-strong); text-decoration: none; }
.kv-related a strong {
    display: block;
    font-family: var(--font-display);
    color: var(--text);
    font-size: 0.98rem;
    margin-bottom: 4px;
}
.kv-related a span {
    display: block;
    /* styles.css sets a global `a { font-weight: 600 }`, which the card's
       description paragraph inherits — semi-bold body text inside a card that
       already has a bold title. Body copy is 400. */
    font-weight: 400;
    font-size: 0.86rem;
    line-height: 1.55;
    color: var(--text-muted);
}

/* ── Page footer ────────────────────────────────────────── */
.kv-pagefoot {
    margin-top: 56px;
    padding: 26px 0 44px;
    border-top: 1px solid var(--border);
}
.kv-pagefoot-links { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.kv-pagefoot-links a { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.kv-pagefoot-links a:hover { color: var(--text); }
/* "Follow us" — filled by kv-social.js; same look as the app footer's row. */
.kv-pagefoot-social { margin: 0 0 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.kv-pagefoot-social[hidden] { display: none; }
.kv-pagefoot-social-label { font-size: 0.8rem; color: var(--text-dim); margin-right: 2px; }
.kv-pagefoot-social-icon { display: inline-flex; border-radius: 9px; line-height: 0; transition: transform 0.12s ease, box-shadow 0.12s ease; }
.kv-pagefoot-social-icon img { width: 34px; height: 34px; display: block; }
.kv-pagefoot-social-icon:hover, .kv-pagefoot-social-icon:focus-visible { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(11, 70, 209, 0.28); }
.kv-pagefoot-social-link { font-size: 0.82rem; color: var(--text-muted); text-decoration: none; border: 1px solid var(--border, rgba(15, 23, 42, 0.14)); border-radius: 999px; padding: 4px 11px; line-height: 1.3; }
.kv-pagefoot-social-link:hover, .kv-pagefoot-social-link:focus-visible { color: var(--text); border-color: currentColor; }
@media (prefers-reduced-motion: reduce) {
    .kv-pagefoot-social-icon { transition: none; }
    .kv-pagefoot-social-icon:hover, .kv-pagefoot-social-icon:focus-visible { transform: none; }
}
.kv-pagefoot-legal { margin: 0; font-size: 0.8rem; color: var(--text-dim); }

/* ============================================================
   The "What is Knovli" band on index.html
   ============================================================ */

/* TWO gates, and they fail in opposite directions on purpose.

   1. `html[data-kv-home]` — set by a synchronous script in index.html's
      <head> when the path is "/" (or "/index.html", the Capacitor boot).
      index.html is what .htaccess answers EVERY client-side route with, so
      without this the homepage pitch would render under /explore and under
      every /decks/<id>. Default here is HIDDEN: a route that somehow never
      ran the script shows the app, not a pitch on the wrong page.

   2. `body.kv-signed-in` — added by app.js on the signed-in mount, removed
      on sign-out. Default here is SHOWN, which is the fail-safe direction
      for the thing the band exists for: if app.js never runs at all (a
      crawler that executes no JavaScript, a failed fetch), the text is
      still in the document and still visible. */
.kv-homeband { display: none; }
html[data-kv-home] .kv-homeband { display: block; }
html[data-kv-home] body.kv-signed-in .kv-homeband { display: none; }

/* FULL WIDTH (owner, 2026-09-17), lined up with the Explore banner above it
   rather than capped at a reading column; the cards grow with it. */
.kv-homeband {
    max-width: none;
    margin: 40px 15px 8px;
    padding: 34px 4px 8px;
    border-top: 1px solid var(--border);
    font-family: var(--font-body);
}
.kv-hb-h1 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 5.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.015em;
    margin: 0 0 16px;
    color: var(--text);
}
.kv-hb-lead {
    font-size: 1.08rem;
    line-height: 1.68;
    color: var(--text);
    margin: 0 0 30px;
    max-width: 68ch;
}
.kv-hb-grid { display: grid; gap: 18px; }
@media (min-width: 760px) { .kv-hb-grid { grid-template-columns: 1fr 1fr; } }

.kv-hb-card {
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
}
.kv-hb-card h2 {
    font-family: var(--font-display);
    font-size: 1.14rem;
    font-weight: 800;
    margin: 0 0 10px;
    color: var(--text);
}
.kv-hb-card h2 a { color: inherit; text-decoration: none; }
.kv-hb-card h2 a:hover { text-decoration: underline; }
.kv-hb-card p {
    font-size: 0.96rem;
    line-height: 1.68;
    color: var(--text-muted);
    margin: 0;
}
/* FEATURED section (Create and share): spans both columns, picture on top, a
   brand-gradient edge so it reads as the lead feature of the band. */
.kv-hb-card--featured {
    grid-column: 1 / -1;
    padding: 0;
    overflow: hidden;
    border: 1px solid transparent;
    background:
        linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
        linear-gradient(135deg, #3B82F6, #8B5CF6) border-box;
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.14);
}
.kv-hb-feature-img { display: block; width: 100%; height: auto; }
.kv-hb-feature-body { padding: 20px 24px 22px; }
/* Wide screens: picture LEFT, text RIGHT (owner, 2026-09-17). The picture keeps
   its own proportions — it carries lettering, so it is never cropped — and the
   text centres against it. Narrower than this it stacks, picture on top. */
@media (min-width: 960px) {
    .kv-hb-card--featured {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        align-items: center;
    }
    .kv-hb-feature-body { padding: 24px 30px; }
}
.kv-hb-card--featured h2 { font-size: 1.4rem; }
.kv-hb-card--featured .kv-hb-feature-body > p:not(.kv-hb-more) { font-size: 1.02rem; color: var(--text); }
/* Bold opening line at the start of a card's text (owner, 2026-09-17). */
.kv-hb-opener {
    color: var(--text);
    font-weight: 800;
}
.kv-hb-more { margin-top: 12px !important; }
.kv-hb-more a { font-weight: 700; font-size: 0.9rem; color: var(--brand-blue); text-decoration: none; }
[data-theme="dark"] .kv-hb-more a { color: #7FB0FF; }
.kv-hb-more a:hover { text-decoration: underline; }

.kv-hb-cta { margin: 28px 0 0; display: flex; gap: 12px; flex-wrap: wrap; }

.kv-hb-foot {
    margin: 26px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.kv-hb-foot a { font-size: 0.86rem; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.kv-hb-foot a:hover { color: var(--text); }

/* ── Pricing, Help, What's new, comparison tables (public-pages-content.js) ── */
.kv-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 6px 0 18px; }
.kv-plan { border: 1px solid var(--border); border-radius: 16px; background: var(--bg-card); padding: 18px; min-width: 0; }
.kv-plan h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.kv-plan-price { margin: 0 0 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.4rem; color: var(--text); }
.kv-plan-desc { font-size: 0.92rem; line-height: 1.6; color: var(--text-muted); overflow-wrap: anywhere; }
.kv-plan-desc ul, .kv-plan-desc ol { margin: 0; padding-left: 18px; }
.kv-plans-sub { margin: 22px 0 8px; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.kv-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 0.94rem; }
.kv-table th, .kv-table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.kv-table thead th, .kv-table th[scope="row"] { color: var(--text); font-weight: 700; }
.kv-compare td, .kv-compare th { width: 38%; }
.kv-compare th[scope="row"], .kv-compare thead th:first-child { width: 24%; }
@media (max-width: 640px) {
    .kv-compare, .kv-compare tbody, .kv-compare tr, .kv-compare td, .kv-compare th { display: block; width: auto; }
    .kv-compare thead { display: none; }
    .kv-compare tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
    .kv-compare td, .kv-compare th { border: 0; padding: 3px 0; }
    .kv-compare td:nth-child(2)::before { content: 'Knovli: '; font-weight: 700; color: var(--text); }
    .kv-compare td:nth-child(3)::before { content: 'The other: '; font-weight: 700; color: var(--text); }
}
.kv-help-toc ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; padding: 0; }
.kv-help-toc a { display: inline-block; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 0.88rem; font-weight: 600; text-decoration: none; color: var(--text); }
.kv-help-cat { margin: 22px 0 8px; font-family: var(--font-display); font-size: 1.1rem; color: var(--text); scroll-margin-top: 80px; }
.kv-help-group { scroll-margin-top: 80px; }
.kv-help-item { border-bottom: 1px solid var(--border); }
.kv-help-item summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--text); }
.kv-help-answer { padding: 0 0 14px; color: var(--text-muted); line-height: 1.65; overflow-wrap: anywhere; }
.kv-help-answer p { margin: 0 0 8px; }
.kv-news { list-style: none; margin: 8px 0 0; padding: 0; }
.kv-news li { padding: 14px 0; border-bottom: 1px solid var(--border); }
.kv-news time { font-size: 0.82rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.kv-news h3 { margin: 4px 0; font-family: var(--font-display); font-size: 1.05rem; color: var(--text); }
.kv-news p { margin: 0; }

/* ── Contact form (kv-contact.js) ── */
.kv-contact { max-width: 560px; margin: 8px 0 6px; }
.kv-contact-form { display: grid; gap: 14px; }
.kv-contact-form[hidden], .kv-contact-done[hidden] { display: none; }
.kv-contact-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.92rem; color: var(--text); }
.kv-contact-form input, .kv-contact-form select, .kv-contact-form textarea {
    font: inherit; font-weight: 400; color: var(--text); background: var(--bg-card);
    border: 1px solid var(--border-strong); border-radius: 12px; padding: 11px 12px; width: 100%; box-sizing: border-box;
}
.kv-contact-form textarea { resize: vertical; min-height: 140px; }
.kv-contact-note { margin: 0; font-size: 0.86rem; color: var(--text-muted); }
.kv-contact-msg { margin: 0; min-height: 1.4em; font-weight: 600; font-size: 0.92rem; color: var(--text-muted); }
.kv-contact-msg.is-error { color: #DC2626; }
.kv-contact-done { border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); padding: 16px 18px; }
