/* ============================================
   SUBJECT PAGES — supplementary styles
   Used by /<level>/<subject>/index.html
   Everything else (hero, topics, materials,
   CTA) reuses classes from courses.css.
   ============================================ */

/* ---------- TOPIC SEARCH ---------- */
.course-section-head.with-search {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.course-section-head-text {
    min-width: 0;
    flex: 1;
}

.topic-search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--divider-color);
    border-radius: 10px;
    min-width: 240px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.topic-search:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.topic-search .material-icons-round {
    font-size: 18px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.topic-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    min-width: 0;
}

.topic-search input::placeholder {
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .course-section-head.with-search {
        flex-direction: column;
        align-items: stretch;
    }
    .topic-search {
        min-width: 0;
        width: 100%;
    }
}

/* ============================================
   SUBJECT HERO — handwriting background
   The background lives on a ::before pseudo
   so we can:
     - clip it to the rounded corners with overflow
     - use background-attachment: fixed (parallax
       on desktop / Android)
     - degrade gracefully on iOS Safari, which
       ignores fixed attachment — the image then
       scrolls with the hero, no jank, no flicker
   ============================================ */

.course-hero {
    position: relative;
    overflow: hidden;
    margin-top: .5rem;
    border-radius: .8rem;
    isolation: isolate; /* scopes the pseudo's z-index to this element */
    /* No background-image here — it lives on ::before */
    clip-path: inset(0 round .8rem);
}
/* Ensure inner content sits above the background layer */
.course-hero > * {
    position: relative;
    z-index: 1;
}

/* Give the description and meta slightly more contrast against the image */
.course-hero .course-description {
    color: var(--text-primary);
    opacity: 0.92;
}


/* Very old browsers without multiple backgrounds — fall back to solid */
@supports not (background-image: linear-gradient(red, red)) {
}
/* iOS Safari parallax */
.course-hero::before {
    content: '';
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100lvh;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--bg-primary-trans), var(--bg-primary-trans)),
        url('/images/hand_writing.png');
    background-size: cover, cover;
    background-position: center, center;
    background-repeat: no-repeat, no-repeat;
}
.course-hero > * {
    position: relative;
    z-index: 1;
}

/* ios-safe fixed parallax */
.course-hero::before {
    height: 100vh;
    height: 100lvh;
    will-change: transform;
}
