/* The shell: the places (Studio, Recordings, Settings) and the page beside them. Prefix pod-.

   Built from the smallest screen up. The shell is always exactly the window: the places hold
   still and the page scrolls on its own, so the studio can always fit the call to what's left,
   and nobody in a podcast is ever scrolled out of sight.
   - A phone, or any narrow window: the places in a bar across the top.
   - A phone on its side, or any short window: the places in a slim rail down the side, so the
     call keeps every bit of height.
   - A window both wide and tall enough: the places named, in a sidebar. */

body {
    background-color: var(--color-page);
}

.pod-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100svh;
}

/* ---------- The places ---------- */

.pod-side {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-8);
    padding: var(--space-4) var(--layout-inset-narrow);
    border-bottom: var(--border-width-hairline) solid var(--color-border-subtle);
}

.pod-nav {
    display: flex;
    gap: var(--space-1);
}

.pod-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-5);
    border: 0;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    text-align: start;
    cursor: pointer;
}

/* Icons only, until there's a sidebar to name them in. The name stays for screen readers. */
.pod-nav-name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.pod-nav-item svg {
    flex: none;
    width: var(--size-icon-md);
    height: var(--size-icon-md);
}

.pod-nav-item:hover {
    background-color: var(--color-surface-muted);
    color: var(--color-text);
}

.pod-nav-item:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: calc(var(--focus-ring-offset) * -1);
}

.pod-nav-item[aria-current="page"] {
    background-color: var(--color-surface);
    box-shadow: var(--shadow-surface);
    color: var(--color-text);
    font-weight: var(--font-weight-semibold);
}

@media (prefers-reduced-motion: no-preference) {
    .pod-nav-item {
        transition: background-color var(--duration-color) var(--ease-standard), color var(--duration-color) var(--ease-standard);
    }
}

/* A count or the recording dot: on the icon's corner, or after the name in a sidebar. */
.pod-count,
.pod-live {
    position: absolute;
    inset: var(--space-2) var(--space-2) auto auto;
}

.pod-count {
    min-width: var(--space-8);
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-primary-text);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
    text-align: center;
}

.pod-count--quiet {
    display: none;
    background-color: transparent;
    color: var(--color-text-muted);
    font-weight: var(--font-weight-medium);
}

.pod-count[hidden],
.pod-live[hidden] {
    display: none;
}

/* Recording: a steady dot. A pulse would run for the whole recording, drawing the page every frame
   while the call needs the computer. */
.pod-live,
.pod-dot {
    flex: none;
    width: var(--space-4);
    height: var(--space-4);
    border-radius: var(--radius-full);
    background-color: var(--color-danger);
}

/* ---------- The page ---------- */

/* Positioned, so hidden labels deep in a long page are measured inside it, not the window. */
.pod-main {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-8) var(--layout-inset-narrow);
}

/* Room under the page for the call when it floats over it. */
.pod-shell:has(~ .pod-float:not([hidden])) .pod-main {
    padding-block-end: calc(var(--space-24) * 4);
}

.pod-page {
    display: grid;
    align-content: start;
    gap: var(--space-8);
    width: 100%;
    max-width: var(--layout-content);
    margin-inline: auto;
}

.pod-page[hidden] {
    display: none;
}

.pod-page--center {
    min-height: 100%;
    align-content: center;
}

.pod-page--wide {
    max-width: calc(var(--layout-content) + var(--space-24) * 2);
}

.pod-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-8);
    padding-bottom: var(--space-8);
    border-bottom: var(--border-width-hairline) solid var(--color-border-subtle);
}

.pod-head-text {
    display: grid;
    gap: var(--space-2);
}

.pod-head-text > * {
    margin: 0;
}

.pod-head h1 {
    display: flex;
    align-items: center;
    gap: var(--space-5);
}

.pod-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
}

.pod-head-actions > [hidden] {
    display: none;
}

/* An action that's only an icon, square, its name in its tooltip and for screen readers. */
.pod-icon-only {
    padding-inline: 0;
    aspect-ratio: 1;
}

/* A back link at the top of a page reached from another. */
.pod-back {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-muted);
    font: inherit;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.pod-back:hover {
    color: var(--color-text);
}

.pod-back:focus-visible {
    outline: var(--focus-ring-width) solid var(--color-focus);
    outline-offset: var(--focus-ring-offset);
}

.pod-back svg {
    width: var(--size-icon-sm);
    height: var(--size-icon-sm);
}

/* A count on a button's corner: notifications in the tray. */
.pod-has-badge {
    position: relative;
}

.pod-badge {
    position: absolute;
    inset: calc(var(--space-2) * -1) calc(var(--space-2) * -1) auto auto;
    min-width: var(--space-10);
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    background-color: var(--color-primary);
    color: var(--color-primary-text);
    font-size: var(--font-size-2xs);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-normal);
    text-align: center;
}

.pod-badge.is-problem {
    background-color: var(--color-danger);
    color: var(--color-on-status);
}

/* A level that fills with --level (0 to 1), set as a voice is heard. */
.pod-level {
    display: block;
    overflow: hidden;
    height: var(--space-2);
    border-radius: var(--radius-full);
    background-color: var(--color-surface-subtle);
}

.pod-level > span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-color: var(--color-success);
    transform-origin: left center;
    scale: var(--level, 0) 1;
}

@media (prefers-reduced-motion: no-preference) {
    .pod-level > span {
        transition: scale var(--duration-fast) linear;
    }
}

/* ---------- The call, small, while you're on another page ---------- */

.pod-float {
    position: fixed;
    inset: auto var(--space-6) var(--space-6) var(--space-6);
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}

.pod-float[hidden] {
    display: none;
}

.pod-float > * {
    width: min(100%, calc(var(--space-24) * 7 + var(--space-12)));
    pointer-events: auto;
}

/* ---------- A phone on its side, or any short window: a rail ---------- */

@media (orientation: landscape) and (max-height: 540px) {
    .pod-shell {
        grid-template-rows: minmax(0, 1fr);
        grid-template-columns: auto minmax(0, 1fr);
    }

    .pod-side {
        flex-direction: column;
        justify-content: flex-start;
        padding: var(--space-6) var(--space-3);
        border-bottom: 0;
        border-inline-end: var(--border-width-hairline) solid var(--color-border-subtle);
    }

    .pod-side .bu-brand {
        display: none;
    }

    .pod-nav {
        flex-direction: column;
    }

    .pod-main {
        padding: var(--space-6) var(--space-8);
    }
}

/* ---------- Wide and tall enough: the places named, in a sidebar ---------- */

@media (min-width: 900px) and (min-height: 541px) {
    .pod-shell {
        grid-template-rows: minmax(0, 1fr);
        grid-template-columns: calc(var(--space-24) * 5) minmax(0, 1fr);
    }

    .pod-side {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: var(--space-16);
        padding: var(--layout-inset) var(--space-8) var(--space-8);
        border-bottom: 0;
        border-inline-end: var(--border-width-hairline) solid var(--color-border-subtle);
    }

    .pod-side .bu-brand {
        padding-inline: var(--space-6);
    }

    .pod-nav {
        flex-direction: column;
    }

    .pod-nav-item {
        width: 100%;
        padding: var(--space-5) var(--space-6);
    }

    .pod-nav-name {
        position: static;
        flex: 1;
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
    }

    .pod-count,
    .pod-live {
        position: static;
    }

    .pod-count {
        min-width: var(--space-10);
        padding: 0 var(--space-3);
        font-size: var(--font-size-xs);
    }

    .pod-count--quiet {
        display: block;
    }

    .pod-main {
        padding: var(--layout-inset) var(--space-16) var(--space-10);
    }

    .pod-shell:has(~ .pod-float:not([hidden])) .pod-main {
        padding-block-end: calc(var(--space-24) * 6);
    }

    .pod-float {
        inset-inline-start: calc(var(--space-24) * 5);
    }
}
