/* Shared chrome for every surface (hub, /vo, /audio): design tokens, reset,
   header, footer-agnostic bits, and the portrait component. Page-specific
   styles live in each page's own <style> block. Pages stay standalone for the
   visitor; this file just keeps their shared parts from drifting. */

/* ===== Design tokens ===== */
:root {
    /* Dark is the base default, so an unqueryable client lands on dark. Light
       is opted into below via prefers-color-scheme; a saved choice overrides
       both via [data-theme]. */
    --bg: #001021;
    --panel: #13293d;
    --text: #e9f2f6;
    --muted: #9db0ba;
    --faint: #94a7b1;
    --line: #14313c;
    /* Declared per theme, not once: --text flips from near-black to near-white
       between them, so a single ratio moves the frame in opposite directions.
       Dark keeps the heavier 40% mix -- the subject wears black, and a paler
       frame here would cost the silhouette its edge. */
    --photo-bg: color-mix(in srgb, var(--text) 40%, var(--panel));
    --sans:
        "Helvetica Neue", Helvetica, Arial, "Segoe UI", system-ui, sans-serif;
    --fs-label: 0.8rem;
    --fs-sm: 0.92rem;
    --fs-base: 1rem;
    --fs-lead: clamp(1rem, 2.2vw, 1.2rem);
    --fs-h1: clamp(1.7rem, 4.6vw, 3.3rem);
    --fs-h2: clamp(1.5rem, 3vw, 2.1rem);
    --gutter: clamp(1.5rem, 5vw, 5rem);
    --maxw: 1120px;
    /* One curve for every state change on the site. Browser-default `ease`
       front-loads slowly and reads mushy on a 150ms hover; this leaves
       immediately and settles, which is what a response to a pointer should
       feel like. It was already the curve chosen by hand for the reveals and
       the nav underline -- naming it just stops the other 23 transitions
       falling back to the default. */
    --ease-out: cubic-bezier(0.2, 0.6, 0.2, 1);
}
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f4f8fb;
        /* --bg lifted three steps toward white, keeping the ramp's cool cast
           rather than resetting to #fff. Panels are the lightest surface, but
           they belong to the palette; it also tints the top of the body
           gradient, which is the largest area on the page. */
        --panel: #f7fbff;
        --text: #001021;
        --muted: #3d5561;
        --faint: #5c7078;
        --line: #dce6ec;
        --photo-bg: color-mix(in srgb, var(--text) 26%, var(--panel));
    }
}
:root[data-theme="light"] {
    --bg: #f4f8fb;
    --panel: #f7fbff;
    --text: #001021;
    --muted: #3d5561;
    --faint: #5c7078;
    --line: #dce6ec;
    --photo-bg: color-mix(in srgb, var(--text) 26%, var(--panel));
}
:root[data-theme="dark"] {
    --bg: #001021;
    --panel: #13293d;
    --text: #e9f2f6;
    --muted: #9db0ba;
    --faint: #94a7b1;
    --line: #14313c;
    /* Restated because the light @media block above still matches when a
       visitor on a light-preference machine picks dark by hand. */
    --photo-bg: color-mix(in srgb, var(--text) 40%, var(--panel));
}

/* ===== Reset & base ===== */
* {
    box-sizing: border-box;
}
html {
    scroll-behavior: smooth;
    /* Reserve the scrollbar gutter on every page so the gutter-pinned logo +
       toggle sit at the same x whether or not a page scrolls -- no jump. */
    scrollbar-gutter: stable;
    /* Clip horizontal overflow so a full-bleed (100vw) decoration can't add a
       horizontal scrollbar. clip (not hidden) keeps vertical scroll normal and
       doesn't create a scroll container. */
    overflow-x: clip;
}
body {
    margin: 0;
    background-color: var(--bg);
    background-image: linear-gradient(180deg, var(--panel), var(--bg) 900px);
    color: var(--text);
    font-family: var(--sans);
    font-size: clamp(1rem, 0.4vw + 0.94rem, 1.06rem);
    line-height: 1.6;
    letter-spacing: -0.005em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* No overflow-x here on purpose: html's clip (above) already contains the
       full-bleed decorations. hidden on body would make body a scroll
       container, which breaks position: sticky on any descendant and disables
       scroll anchoring. */
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.04;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
::selection {
    background: var(--text);
    color: var(--bg);
}
a {
    color: inherit;
}
.wrap {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
}
:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 3px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
/* Parked 72px above its focused position (12px - 72px = -60px, where it used
   to sit via top). Animating transform rather than top keeps the slide off the
   layout path -- same distance, same duration, no reflow per frame. */
.skip {
    position: fixed;
    left: 12px;
    top: 12px;
    transform: translateY(-72px);
    z-index: 100;
    background: var(--panel);
    color: var(--text);
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 6px 20px -8px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s var(--ease-out);
}
.skip:focus {
    transform: none;
}
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.025em;
    margin: 0;
    text-wrap: balance;
}
p {
    text-wrap: pretty;
}

/* ===== Header (brand + theme toggle) ===== */
header.bar {
    position: relative;
}
.bar-in {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.4rem;
    padding-block: clamp(2rem, 4vw, 3.2rem);
}
.brand {
    justify-self: start;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}
/* Logo is a transparent PNG masked to a flat fill, so it takes one colour
   (nav-link muted, hover text) and follows the theme -- the connectors lose
   their baked gradients and read as solid silhouettes. */
.brand-logo {
    display: block;
    height: clamp(40px, 5vw, 60px);
    aspect-ratio: 810 / 303;
    background-color: var(--muted);
    -webkit-mask: url("/image/emily_audio_logo.png") center / contain no-repeat;
    mask: url("/image/emily_audio_logo.png") center / contain no-repeat;
}
.brand:hover .brand-logo {
    background-color: var(--text);
}
nav.top {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    justify-self: end;
    grid-column: 2;
}
nav.top a {
    text-decoration: none;
    color: var(--muted);
    font-size: var(--fs-sm);
    font-weight: 400;
    letter-spacing: -0.01em;
}
nav.top a:hover {
    color: var(--text);
}
.toggle {
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 0.3rem;
    display: grid;
    place-items: center;
}
.toggle:hover {
    color: var(--text);
}
.toggle svg {
    width: 17px;
    height: 17px;
}
.toggle .ico-sun {
    display: none;
}
@media (prefers-color-scheme: dark) {
    .toggle .ico-moon {
        display: none;
    }
    .toggle .ico-sun {
        display: block;
    }
}
:root[data-theme="light"] .toggle .ico-moon {
    display: block;
}
:root[data-theme="light"] .toggle .ico-sun {
    display: none;
}
:root[data-theme="dark"] .toggle .ico-moon {
    display: none;
}
:root[data-theme="dark"] .toggle .ico-sun {
    display: block;
}

/* ===== Portrait component ===== */
/* Figure sits on a coloured box with negative space around it, echoing the
   framing of image/em1.png. Pages add only the grid placement. */
.hero-photo {
    position: relative;
    min-width: 0;
    width: 100%;
    max-width: 232px;
    /* Pin the frame to the right of its column. The column can be wider than
       the frame's max-width at desktop, so centering would leave a gap on the
       right and the photo drifts left of the content line. */
    justify-self: end;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 8px;
    background: var(--photo-bg);
    /* Shift the frame left by the shadow's x-offset so the offset block's
       right edge -- the outermost visible edge -- lands on the content line
       (theme toggle, route cards), instead of the frame overshooting it. */
    transform: translateX(-14px);
    box-shadow:
        14px 14px 0 -1px color-mix(in srgb, var(--text) 10%, var(--bg)),
        0 12px 34px -16px rgba(0, 0, 0, 0.3);
}
.hero-photo img {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 66%;
    height: auto;
    display: block;
    /* Photo runs warm/saturated against the muted palette; mute it a touch
       rather than casting a colour over it. */
    filter: saturate(0.85);
}

/* Video card player -- shared by /vo and /audio (behaviour in base.js). Colour
   comes from each surface's --accent; page CSS owns card/feature layout. */
.vmedia {
    position: relative;
    line-height: 0;
}
.vplay {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    transition:
        transform 0.15s var(--ease-out),
        opacity 0.2s var(--ease-out);
}
.vplay svg {
    width: 24px;
    height: 24px;
    margin-left: 3px;
}
.vplay:hover {
    transform: scale(1.09);
}
.vmedia.playing .vplay {
    opacity: 0;
    pointer-events: none;
}
.vdur {
    position: absolute;
    bottom: 10px;
    right: 10px;
    /* Fully opaque so the duration reads over any video frame; neutral (not
       accent-tinted) because it overlays both the blue and red surfaces. */
    background: #111;
    color: #fff;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: var(--fs-label);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: opacity 0.2s var(--ease-out);
}
.vmedia.playing .vdur {
    opacity: 0;
}
