/* ============================================================
   Case-study system — shared foundation for project pages.

   Extracted from insign.css so Borgo (and later case studies) inherit
   the same skin instead of forking it. Insign still ships its own copy;
   migrating it onto this file is a safe follow-up, not a prerequisite.

   Load order:  main.css → project.css → case-system.css → <page>.css
   ============================================================ */

:root {
    /* one vertical rhythm AND one content rail for every section —
       the eyebrows are left-aligned, so they only line up with each
       other if every section's content box is the same width */
    --sec-y: clamp(6rem, 14vh, 10rem);
    --sec-max: 1200px;
}

/* ------------------------------------------------------------------
   Background: ONE base layer. Sections add decorations on top of it,
   they never repaint it.
   ------------------------------------------------------------------ */
body {
    /* deepest navy so a fast-scroll repaint gap never flashes bright blue */
    background: var(--navy-950);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        linear-gradient(rgba(5, 7, 15, 0.65), rgba(5, 7, 15, 0.65)),
        var(--navy-900) url('../assets/images/background.webp') center / cover no-repeat;
}

.case {
    position: static;
    /* the hero owns the space under the fixed nav so its media can start
       at y=0 — otherwise main's padding leaves a bare strip above it */
    padding-top: 0;
}

/* nothing on a case page is allowed to open a sideways scroll */
html,
body {
    overflow-x: clip;
}

/* ------------------------------------------------------------------
   Reveal-on-scroll — IntersectionObserver, not scroll position.
   A "top passes 84%" trigger can never fire for elements in the
   document's last viewport; they would stay invisible forever.
   ------------------------------------------------------------------ */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}

.reveal.is-in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {

    .reveal,
    .reveal.is-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ------------------------------------------------------------------
   Hero — full viewport, media inside it, fading out at the bottom
   ------------------------------------------------------------------ */
.hero-viewport {
    position: relative;
    z-index: 1;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: none;
    margin-inline: 0;
    padding: calc(var(--nav-h) + var(--space-4)) var(--gutter) clamp(4rem, 12vh, 7rem);
}

.hero-viewport__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: var(--sec-max);
    margin-inline: auto;
}

.hero-video {
    position: absolute;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 52%, rgba(0, 0, 0, .55) 78%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0%, #000 52%, rgba(0, 0, 0, .55) 78%, transparent 100%);
}

.hero-video video,
.hero-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .8;
}

/* left scrim so the hero text stays readable over the video —
   only reaches ~60% across, the rest of the frame stays clean */
.hero-video::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right,
            rgba(0, 0, 0, .72) 0%,
            rgba(0, 0, 0, .42) 32%,
            transparent 60%);
}

/* On small screens the cover-crop would cut the media to a vertical
   sliver — show it whole instead: uncropped 16:9 block up top, text
   below it. Applies to video AND image heroes (SeniorTech ships a
   still), so no case page ever paints its text over the media. */
@media (max-width: 768px) {
    .hero-viewport:has(.hero-video :is(video, img)) {
        min-height: 0;
        justify-content: flex-start;
        padding: 0 0 clamp(3rem, 8vh, 5rem);
    }

    .hero-viewport:has(.hero-video :is(video, img)) .hero-video {
        position: relative;
        inset: auto;
        z-index: 0;
        margin-top: var(--nav-h);
        aspect-ratio: 16 / 9;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .hero-viewport:has(.hero-video :is(video, img)) .hero-video :is(video, img) {
        opacity: 1;
    }

    /* text sits below the media now — no scrim needed */
    .hero-viewport:has(.hero-video :is(video, img)) .hero-video::after {
        content: none;
    }

    .hero-viewport:has(.hero-video :is(video, img)) .hero-viewport__inner {
        padding: var(--space-4) var(--gutter) 0;
    }

    /* pin the mute toggle to the video's bottom-right corner
       (video height = 100vw * 9/16) */
    .hero-viewport:has(.hero-video video) .hero-mute-btn {
        bottom: auto;
        top: calc(var(--nav-h) + 56.25vw - 60px);
    }
}

/* hero fact list — lives here, not in a page file, so every case study
   renders it identically */
.case__facts--left {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.case__facts--left dt {
    font-family: var(--font-display);
    font-size: .95rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--steel-500);
}

.case__facts--left dd {
    margin-top: .3rem;
    font-size: 1rem;
    color: var(--white);
}

@media (max-width: 768px) {
    .case__facts--left {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--space-4);
    }
}

/* hero mute toggle */
.hero-mute-btn {
    position: absolute;
    bottom: clamp(2rem, 5vh, 4rem);
    right: var(--gutter);
    z-index: 20;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color .3s ease, transform .3s var(--ease-out);
}

.hero-mute-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.hero-mute-btn:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 3px;
}

.hero-mute-btn.is-muted {
    opacity: 0.7;
}

/* ------------------------------------------------------------------
   Shared typography
   ------------------------------------------------------------------ */
.section-eyebrow {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--yellow);
    margin-bottom: 1.2rem;
    text-align: left;
}

.section-eyebrow::after {
    content: '';
    display: block;
    width: 34px;
    height: 2px;
    background: var(--yellow);
    margin: .7rem 0 0;
    opacity: .7;
}

.opener-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.6rem, 6.5vw, 4.6rem);
    line-height: 1.04;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--white);
}

.opener-title em {
    font-style: normal;
    color: var(--yellow);
}

.lead {
    font-family: var(--font-body);
    font-size: clamp(1.02rem, 1.4vw, 1.25rem);
    line-height: 1.75;
    color: var(--steel-300);
    max-width: 58ch;
    margin: 1.6rem auto 0;
}

.lead strong {
    color: var(--white);
}

/* closing links: no underline — hover paints the highlight instead */
.end-links a {
    text-decoration: none;
}

.end-links a:hover {
    color: var(--navy-950, #05070F);
    background: var(--yellow);
}

/* emphasis reads as a highlight, never an underline (underline = link) */
.hl {
    color: var(--navy-950, #05070F);
    /* gradient image, not a flat background-color: Android "force dark"
       browsers dim bright fills but leave image layers alone, so the
       highlight stays true yellow instead of going muddy olive */
    background: linear-gradient(var(--yellow), var(--yellow));
    padding: .04em .22em;
    border-bottom: none;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.intro-large {
    font-family: var(--font-body);
    font-size: clamp(1.7rem, 3.2vw, 2.5rem);
    font-weight: 400;
    line-height: 1.5;
    color: var(--white);
    max-width: 40ch;
    margin: 0 auto;
}

.intro-large strong {
    color: var(--yellow);
    font-weight: 500;
}

/* ------------------------------------------------------------------
   Ambient bubbles (populated by JS)
   ------------------------------------------------------------------ */
.css-bubbles {
    position: absolute;
    inset: 0;
    min-height: 150vh;
    z-index: 1;
    pointer-events: none;
    /* fade at both edges so the field never ends on a hard line where
       its section stops */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 88%, transparent 100%);
}

.css-bubbles span {
    position: absolute;
    bottom: -100px;
    border-radius: 50%;
    animation: floatUp 12s infinite linear;
    will-change: transform, opacity;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }

    10%,
    90% {
        opacity: var(--max-opacity, 0.8);
    }

    100% {
        transform: translateY(-120vh) translateX(var(--drift, 30px));
        opacity: 0;
    }
}

/* ============================================================
   .picker — the page's workhorse.

   "A set of options; picking one swaps the media." Borgo uses it four
   times (website, app, hubs, activities); Insign's glasses showcase is
   the same pattern and can migrate onto it later.

   Implemented as an ARIA tablist so it is keyboard-operable.
   ============================================================ */
.picker {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: clamp(1.5rem, 4vw, 4rem);
    align-items: center;
    width: 100%;
}

.picker__options {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.picker__option {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    text-align: left;
    color: var(--steel-300);
    background: transparent;
    /* visible pill outline so the options read as buttons, not loose text */
    border: 1px solid rgba(169, 188, 212, .3);
    border-radius: 999px;
    padding: .7rem 1.1rem;
    cursor: pointer;
    transition: color .3s var(--ease-out), background-color .3s var(--ease-out),
        border-color .3s var(--ease-out), transform .3s var(--ease-out);
}

.picker__option:hover {
    color: var(--white);
    background: rgba(255, 255, 255, .05);
    transform: translateX(3px);
}

.picker__option:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
}

.picker__option[aria-selected="true"] {
    color: var(--navy-900);
    background: var(--yellow);
    border-color: var(--yellow);
}

/* views stack in one grid cell: the stage keeps a stable height and the
   media never loses its box when switching */
.picker__stage {
    position: relative;
    display: grid;
    width: 100%;
}

.picker__view {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .7s ease-out, visibility .7s;
}

.picker__view.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.picker__caption {
    font-family: var(--font-body);
    font-size: .95rem;
    line-height: 1.6;
    color: var(--steel-300);
    margin-top: 1.2rem;
    max-width: 60ch;
}

@media (max-width: 900px) {
    .picker {
        grid-template-columns: 1fr;
    }

    .picker__options {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        order: 2;
        gap: .5rem;
        /* breathing room between the media/cards above and the tab row */
        margin-top: clamp(1.4rem, 4vw, 2.4rem);
    }

    .picker__option {
        font-size: .8rem;
        padding: .55rem .85rem;
        letter-spacing: .1em;
    }

    .picker__option:hover {
        transform: none;
    }
}

/* grid items must always be allowed to shrink below their media's
   intrinsic width — this is what keeps videos from cutting off screen */
.picker__stage,
.picker__view,
.picker__main {
    min-width: 0;
    max-width: 100%;
}

/* ------------------------------------------------------------------
   Hero intro — one short line under the title on every case page
   ------------------------------------------------------------------ */
.hero-intro {
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.6vw, 1.35rem);
    line-height: 1.7;
    color: var(--steel-300);
    max-width: 46ch;
    margin-top: var(--space-3);
}

.hero-intro strong,
.hero-intro em {
    font-style: normal;
    color: var(--yellow);
    font-weight: 500;
}

/* ------------------------------------------------------------------
   Glass glare — one sheen for every screen (laptop, phone, demo clip).
   Apply .glass-glare to the frame that clips its media.
   ------------------------------------------------------------------ */
.glass-glare {
    position: relative;
}

.glass-glare::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    border-radius: inherit;
    background:
        linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .14) 44%, rgba(255, 255, 255, .05) 52%, transparent 62%),
        radial-gradient(120% 60% at 8% 0%, rgba(255, 255, 255, .12), transparent 55%);
    background-size: 220% 100%, 100% 100%;
    background-position: 0% 0, 0 0;
}

@media (prefers-reduced-motion: no-preference) {
    .glass-glare::after {
        animation: glareSweep 9s ease-in-out infinite alternate;
    }
}

@keyframes glareSweep {
    from { background-position: 0% 0, 0 0; }
    to   { background-position: 100% 0, 0 0; }
}

/* ------------------------------------------------------------------
   Team credits — who else built this, right before the sign-off
   ------------------------------------------------------------------ */
.team-credits {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: clamp(3rem, 8vh, 5rem) var(--gutter) 0;
}

.team-credits__eyebrow {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--yellow);
}

.team-credits__list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(2rem, 6vw, 3.5rem);
    list-style: none;
    margin: 1.6rem 0 0;
    padding: 0;
}

.team-credits__name {
    display: block;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: .03em;
    color: var(--white);
}

.team-credits__link {
    display: inline-block;
    margin-top: .3rem;
    font-family: var(--font-display);
    font-size: .85rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--steel-300);
    text-decoration: none;
    transition: color .3s;
}

.team-credits__link:hover {
    color: var(--yellow);
}

/* hero "Teamwork" fact doubles as a jump link to #team */
.case__facts--left a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--steel-500);
    transition: color .3s, border-color .3s;
}

.case__facts--left a:hover {
    color: var(--yellow);
    border-color: var(--yellow);
}
