/* The picture behind a hero's headline - js/shared/hero-photos.js.
   Used by index.html (.hero-left) and branch/find-tutors.html (.hero-section);
   each page's own hero stylesheet turns its words light while a picture shows
   (.has-hero-photo, set halfway through the fade by the script). */

:root {
    /* Darkens a picture enough for light words on it, whatever the picture. */
    --hero-photo-shade: linear-gradient(180deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.45) 100%);
}

.hero-photos-host {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* The page's content sits above the pictures. */
.hero-photos-host > :not(.hero-photos) {
    position: relative;
    z-index: 1;
}

.hero-photos {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Under index.html's fixed navbar nothing can be seen: the picture starts below it
   (--hero-nav-overlap, hero-section.js). */
.hero-left .hero-photos {
    top: var(--hero-nav-overlap, 0px);
}

.hero-photo-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    opacity: 0;
    /* The picture going stays whole until the new one has covered it: faded together,
       the hero's own background would show through at every turn. */
    transition: opacity 0s linear 0.8s;
}

.hero-photo-layer.is-on {
    opacity: 1;
    z-index: 1;
    transition: opacity 0.8s ease;
}

/* No picture next: this one fades away. */
.hero-photos.is-clearing .hero-photo-layer {
    transition: opacity 0.8s ease;
}

/* The whole picture, always: never cropped or stretched */
.hero-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
}

/* What the picture leaves beside it, when the hero is another shape */
.hero-photo-fill {
    position: absolute;
    top: -40px;
    left: -40px;
    width: calc(100% + 80px);
    height: calc(100% + 80px);
    max-width: none;
    object-fit: cover;
    filter: blur(28px) brightness(0.8);
}

.hero-photo-fill[hidden] {
    display: none;
}

.hero-photos::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--hero-photo-shade);
    opacity: 0;
    z-index: 2;
    transition: opacity 0.8s ease;
}

.hero-photos.is-shaded::after {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .hero-photo-layer,
    .hero-photo-layer.is-on,
    .hero-photos.is-clearing .hero-photo-layer,
    .hero-photos::after {
        transition: none;
    }
}

/* Site Content can hide the headline and the subtitle (meta.hidden). The headline
   stays for screen readers and search engines. */
.hero-no-headline .hero-text {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.hero-no-subtitle .hero-left-inner .hero-subtitle {
    display: none;
}

/* branch/find-tutors.html: the words go and their room stays. The hero's height is its
   content's, so without it the hero would shrink, and the picture with it. */
.hero-section.hero-no-headline > .hero-title,
.hero-section.hero-no-headline > .hero-title * {
    color: transparent;
    text-shadow: none;
    -webkit-user-select: none;
    user-select: none;
}

/* theme.css colours a selection, which would paint the hidden words. */
.hero-section.hero-no-headline > .hero-title::selection,
.hero-section.hero-no-headline > .hero-title *::selection {
    color: transparent;
    background: transparent;
}

.hero-section.hero-no-headline > .hero-title {
    white-space: nowrap;
    overflow: hidden;
}

.hero-section.hero-no-headline > .hero-title .cursor-blink,
.hero-section.hero-no-subtitle > .hero-subtitle {
    visibility: hidden;
}

/* index.html with the headline hidden and a picture to show: nothing on the picture. The
   hero takes the picture's shape, as far as the window allows (--hero-photo-height,
   hero-section.js), with the subtitle and the buttons under it - over it they would hide
   part of it. */
.hero-section.hero-picture-mode {
    min-height: 0;
    padding: var(--hero-nav-height, 95px) 0 0;
}

.hero-picture-mode .hero-left {
    min-height: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
}

.hero-picture-mode .hero-photos {
    position: relative;
    inset: auto;
    top: 0;
    flex: none;
    width: 100%;
    height: var(--hero-photo-height, 60vh);
}

/* The first button's pulsing glow needs the room under it, or the hero cuts it off. */
.hero-picture-mode .hero-left-inner {
    max-width: none;
    padding: 1.25rem 1rem 2.5rem;
}

.hero-picture-mode .hero-subtitle {
    margin-bottom: 1rem;
}

.hero-picture-mode .hero-buttons {
    margin-bottom: 0;
}

.hero-picture-mode .hero-particles,
.hero-picture-mode .scroll-indicator {
    display: none;
}
