/* G2.4 Canonical Homepage: visual adapter over the G2.2/G2.3 contracts. */

body.ohda-modal-open {
    overflow: hidden;
    overscroll-behavior: none;
}

.site-header.ohda-site-header {
    position: sticky;
    inset-block-start: 0;
    margin-bottom: -92px;
    padding: max(14px, env(safe-area-inset-top)) 0 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.header-shell.ohda-shell {
    display: flex;
    width: min(calc(100% - 40px), var(--content));
    min-height: 58px;
}

.logo-area.ohda-brand-link {
    margin-inline-end: 0;
}

.logo-img.ohda-logo {
    width: var(--ohda-layout-touch-target);
    height: var(--ohda-layout-touch-target);
}

.primary-nav {
    flex: 1 1 auto;
}

.home-button.ohda-home-link,
.language-switcher.ohda-language-switcher button {
    min-width: var(--ohda-layout-touch-target);
    min-height: var(--ohda-layout-touch-target);
}

.modal-overlay.ohda-modal {
    flex-direction: column;
    background: var(--ohda-color-surface);
}

.modal-overlay.ohda-modal[aria-hidden="false"] {
    display: flex;
    opacity: 1;
}

.modal-content-frame.ohda-modal__frame {
    width: 100%;
    min-height: 0;
    height: 0;
    flex: 1;
}

@media (max-width: 1040px) {
    .header-shell.ohda-shell {
        flex-wrap: wrap;
    }

    .header-shell.ohda-shell .primary-nav {
        order: 3;
        flex: 1 0 100%;
    }
}

@media (max-width: 620px) {
    .header-shell.ohda-shell {
        width: min(calc(100% - 28px), var(--content));
    }

    .logo-img.ohda-logo {
        width: 40px;
        height: 40px;
    }

    .home-button.ohda-home-link,
    .language-switcher.ohda-language-switcher button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Preserve native lesson navigation without changing the card presentation. */
a.lesson-card {
    color: inherit;
    text-decoration: none;
}

.primary-nav a,
.hero-hint,
.category-tab,
.search-submit,
.empty-state-action {
    min-width: 44px;
    min-height: 44px;
}

.load-more[hidden] {
    display: none;
}

/* Keep long topic labels inside their pills; overflow stays in the topic rail. */
.topic-tabs .category-tab {
    flex: 0 0 auto;
}

/* Center both category rails without squeezing the labels or touch targets. */
.category-tabs .category-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-sizing: border-box;
    line-height: 1.4;
    padding: 7px 14px;
}

/* Discovery pass: prominent subject entry and a compact, readable library. */
.hero-subject-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.hero-subject-shortcuts button { min-height: 44px; padding: 9px 13px; border: 1px solid rgba(255,255,255,.35); border-radius: 12px; background: rgba(255,255,255,.08); color: white; font: inherit; font-weight: 700; cursor: pointer; }
.hero-subject-shortcuts span { display: block; font-size: .72rem; font-weight: 400; opacity: .8; }
.hero-subject-shortcuts button:focus-visible, .rail-controls button:focus-visible { outline: 3px solid #68a5ff; outline-offset: 3px; }
.lesson-concept-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.featured-grid .lesson-art:has(.lesson-concept-image)::before, .featured-grid .lesson-art:has(.lesson-concept-image)::after { display: none; }
.lesson-kind { color: var(--text-muted); font-size: .76rem; font-weight: 600; }
.catalog-grid .lesson-art { display: none; }
.catalog-grid .lesson-card { min-height: 0; }
.catalog-grid .lesson-body { padding: 18px; }
.catalog-grid .lesson-body h3 { font-size: 1.08rem; line-height: 1.5; }
.catalog-grid .lesson-body p { margin: 8px 0 14px; font-size: .86rem; }
.catalog-grid .lesson-meta { flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.catalog-grid .lesson-cta { padding-top: 10px; }
.tab-rail { position: relative; min-width: 0; }
.rail-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-bottom: 4px; color: var(--text-muted); font-size: .75rem; }
.rail-controls[hidden] { display: none; }
.rail-controls span { margin-right: auto; }
.rail-controls button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: white; color: var(--text-strong); font-size: 1.4rem; cursor: pointer; }
.rail-controls button:disabled { opacity: .4; cursor: default; }
.tab-rail[data-overflow-right="true"]::after { content: ''; pointer-events: none; position: absolute; right: 0; bottom: 8px; height: 44px; width: 20px; background: linear-gradient(90deg, transparent, var(--surface-muted)); }
@media (max-width: 820px) {
    .hero-inner { padding-bottom: 48px; gap: 24px; }
    .hero-title { font-size: clamp(2rem, 8vw, 3.6rem); }
    .hero-visual { min-height: 210px; }
    .stats-strip { margin-top: 0; }
    .section { padding: 40px 0; }
    .subject-card, .subject-card:nth-child(1), .subject-card:nth-child(4) { grid-column: span 6; min-height: 132px; padding: 16px; }
    .subject-card p, .subject-orbit { display: none; }
    .subject-card h3 { font-size: 1rem; }
    .subject-icon { width: 38px; height: 38px; margin-bottom: 12px; }
}
@media (max-width: 620px) {
    .hero-subject-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero-subject-shortcuts button { padding: 8px; }
    .hero-visual { min-height: 180px; }
    .hero-actions { gap: 8px; }
    .hero-actions .button { width: auto; flex: 1 1 160px; }
    .visual-caption { padding: 9px; }
    .visual-caption span { display: none; }
    .stat { padding: 12px; }
}

.search-suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.search-suggestions .empty-state-action { margin-top: 0; }
.subject-card, .subject-card:nth-child(1), .subject-card:nth-child(4) { grid-column: span 4; }
.featured-grid .lesson-art { background: #edf4f7; }
@media (max-width: 820px) {
    .subject-card, .subject-card:nth-child(1), .subject-card:nth-child(4) { grid-column: span 6; }
    .subject-card h3 { margin-top: 8px; }
    .subject-arrow { top: 12px; right: 12px; width: 28px; height: 28px; }
}

/* Only shown if the lesson's integrated navigation cannot initialize. */
.reader-actions[hidden] { display:none; }
.reader-actions { display:flex; flex:none; padding:8px 12px; background:#fff; }
.reader-actions button { min-width:44px; min-height:44px; padding:7px 12px; border:1px solid #d4deed; border-radius:10px; background:#f5f8ff; color:#23477f; font:inherit; cursor:pointer; }
.reader-actions button:focus-visible { outline:3px solid #2563eb; outline-offset:2px; }

/* Topic counts describe available catalogue entries, not a complete course syllabus. */
.topic-tabs .category-tab { gap: 8px; }
.topic-count { border-radius: 999px; background: rgba(100,116,139,.12); padding: 2px 7px; font-size: .72rem; font-weight: 600; }
.category-tab.active .topic-count { background: rgba(255,255,255,.18); }
.topic-tabs .category-tab:disabled { cursor: not-allowed; color: #64748b; background: #f1f5f9; border-style: dashed; }
.topic-filter-note { margin: 0 0 10px; font-size: .76rem; color: var(--text-muted); line-height: 1.5; }
