/* ==========================================================
   APERTURE — tokens
========================================================== */
:root {
    --bg: #0d0c0a;
    --bg-2: #161512;
    --paper: #ece7dc;
    --ink: #ece7dc;
    --muted: #8a857a;
    --line: rgba(236, 231, 220, 0.14);
    --accent: #ff5b2e;

    --sans: "Inter Tight", system-ui, sans-serif;
    --serif: "Instrument Serif", Georgia, serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;

    --gutter: clamp(16px, 2.6vw, 40px);
    --gap: clamp(8px, 1.2vw, 18px);
    --ease: cubic-bezier(0.76, 0, 0.24, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    background: var(--bg);
}

html.lenis,
html.lenis body {
    height: auto;
}

.lenis.lenis-smooth {
    scroll-behavior: auto !important;
}

.lenis.lenis-stopped {
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.is-loading {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
}

.mono {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

:focus-visible {
    outline: 1px solid var(--accent);
    outline-offset: 3px;
}

/* ==========================================================
   Preloader
========================================================== */
/* The loader has no background of its own: the iris blades are one huge
   SVG path with a hexagonal hole, so opening the iris reveals the page. */
#loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--gutter);
    pointer-events: auto;
}

.loader-lens {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 45%, #2a2621 0%, var(--bg) 60%);
}

.loader-lens img {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(70vmin, 520px);
    height: min(70vmin, 520px);
    object-fit: cover;
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0;
    filter: blur(14px) grayscale(1) contrast(1.4);
    transition: opacity 0.9s var(--ease-out), filter 1.6s var(--ease-out), transform 2.4s var(--ease-out);
}

.loader-lens img.is-developed {
    opacity: 1;
    filter: none;
    transform: translate(-50%, -50%) scale(1);
}

.loader-iris {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.iris-blades {
    fill: var(--bg);
}

.iris-seams {
    fill: none;
    stroke: rgba(236, 231, 220, 0.22);
    stroke-width: 0.35;
}

.iris-rim {
    fill: none;
    stroke: rgba(236, 231, 220, 0.3);
    stroke-width: 0.35;
}

#iris-ticks line {
    stroke: rgba(236, 231, 220, 0.18);
    stroke-width: 0.6;
    transition: stroke 0.25s;
}

#iris-ticks line.on {
    stroke: var(--accent);
}

.loader-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
}

.loader-fstop {
    font-family: var(--serif);
    font-size: clamp(56px, 11vw, 150px);
    line-height: 0.8;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.loader-fstop {
    display: inline-flex;
    align-items: baseline;
}

/* the italic ƒ and slash lean right into the digits: give them room */
.loader-fstop em {
    color: var(--muted);
    letter-spacing: 0.02em;
    padding-left: 0.12em;
    margin-right: 0.22em;
}

.loader-exif {
    text-align: right;
    color: var(--muted);
    line-height: 1.7;
}

#loader-status {
    color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
    .loader-lens img { transition: none; }
}

/* ==========================================================
   Grain + cursor
========================================================== */
.grain {
    position: fixed;
    inset: -50%;
    z-index: 90;
    pointer-events: none;
    opacity: 0.07;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation: grain 1s steps(6) infinite;
}

@keyframes grain {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-3%, 2%); }
    40% { transform: translate(2%, -4%); }
    60% { transform: translate(-4%, -1%); }
    80% { transform: translate(3%, 3%); }
    100% { transform: translate(0, 0); }
}

#cursor {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 95;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    background: var(--paper);
    pointer-events: none;
    mix-blend-mode: difference;
    display: grid;
    place-items: center;
    transition: width 0.45s var(--ease-out), height 0.45s var(--ease-out), margin 0.45s var(--ease-out), background 0.3s;
}

#cursor.is-label {
    width: 84px;
    height: 84px;
    margin: -42px 0 0 -42px;
    mix-blend-mode: normal;
    background: var(--accent);
}

#cursor.is-down {
    transform: scale(0.8);
}

.cursor-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bg);
    opacity: 0;
    transition: opacity 0.2s;
}

#cursor.is-label .cursor-label {
    opacity: 1;
}

@media (hover: none), (pointer: coarse) {
    #cursor {
        display: none;
    }
}

/* ==========================================================
   Nav
========================================================== */
#nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    padding: 18px var(--gutter);
    mix-blend-mode: difference;
    color: #fff;
}

.logo {
    font-family: var(--serif);
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.logo sup {
    font-family: var(--sans);
    font-size: 10px;
    vertical-align: top;
    margin-left: 2px;
}

.nav-hud {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.nav-hud b {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.hud-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: blink 1.6s infinite;
}

.hud-sep {
    opacity: 0.4;
}

.hud-rate-wrap[hidden] {
    display: none;
}

@keyframes blink {
    50% { opacity: 0.15; }
}

.nav-credit {
    justify-self: end;
    display: inline-block;
    padding: 9px 14px;
    border: 1px solid currentColor;
    border-radius: 100px;
}

@media (max-width: 760px) {
    #nav {
        grid-template-columns: 1fr auto;
    }

    .nav-hud {
        display: none;
    }
}

/* ==========================================================
   Hero
========================================================== */
.hero {
    position: relative;
    min-height: 100svh;
    padding: calc(90px + 4vh) var(--gutter) var(--gutter);
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    overflow: hidden;
    isolation: isolate;
}

.hero-meta {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    color: var(--muted);
    position: relative;
    z-index: 2;
}

.hero-meta span:last-child {
    text-align: right;
}

.hero-title {
    position: relative;
    z-index: 2;
    align-self: center;
    font-family: var(--sans);
    font-weight: 500;
    font-size: clamp(56px, 11.5vw, 210px);
    line-height: 0.88;
    letter-spacing: -0.055em;
    margin: 6vh 0 5vh;
    pointer-events: none;
    mix-blend-mode: difference;
}

.hero-title .line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.06em;
}

.hero-title .line > span {
    display: inline-block;
}

.hero-title .line:nth-child(2) {
    padding-left: 12vw;
}

.hero-title .line:nth-child(3) {
    text-align: right;
}

.hero-title em {
    letter-spacing: -0.03em;
}

/* floating photographs */
.hero-float {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.float {
    position: absolute;
    overflow: hidden;
    background: var(--bg-2);
    clip-path: inset(100% 0 0 0);
}

.float img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.3);
}

.f1 { width: clamp(120px, 15vw, 260px); aspect-ratio: 3 / 4; top: 16%; right: 7%; }
.f2 { width: clamp(90px, 10vw, 180px); aspect-ratio: 1; top: 44%; left: 4%; }
.f3 { width: clamp(110px, 13vw, 230px); aspect-ratio: 4 / 5; bottom: 20%; right: 30%; }
.f4 { width: clamp(80px, 8vw, 150px); aspect-ratio: 3 / 4; top: 13%; left: 40%; }
.f5 { width: clamp(100px, 11vw, 200px); aspect-ratio: 4 / 3; bottom: 30%; left: 20%; }

@media (max-width: 760px) {
    .f4, .f5 { display: none; }
    .f1 { top: 12%; right: 4%; }
    .f2 { top: 52%; left: auto; right: 6%; }
    /* up beside the title: lower down it sat behind the search field */
    .f3 { top: 24%; bottom: auto; right: auto; left: 6%; width: 92px; }
}

/* search */
.search--hero {
    position: relative;
    z-index: 3;
    max-width: 760px;
}

.search-label {
    display: block;
    color: var(--muted);
    margin-bottom: 12px;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    position: relative;
}

.search-field::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--paper);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.9s var(--ease);
}

.search-field:focus-within::after {
    transform: scaleX(1);
}

.search-field input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    font-family: var(--serif);
    font-size: clamp(28px, 3.4vw, 48px);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.search-field input::placeholder {
    color: var(--muted);
    opacity: 0.55;
}

input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.search-field kbd {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px 7px;
    color: var(--muted);
}

.search-go {
    flex: none;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--bg);
    display: grid;
    place-items: center;
    transition: background 0.3s;
}

.search-go:hover {
    background: var(--accent);
}

.search-go svg,
.dock svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

.chips-label {
    color: var(--muted);
    margin-right: 4px;
}

.chip {
    font-size: 14px;
    padding: 7px 14px;
    border: 1px solid var(--line);
    border-radius: 100px;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.chip:hover {
    background: var(--paper);
    color: var(--bg);
    border-color: var(--paper);
}

.hero-foot {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6vh;
    color: var(--muted);
}

.hero-foot-line {
    flex: 1;
    height: 1px;
    background: var(--line);
    overflow: hidden;
}

.hero-foot-line i {
    display: block;
    width: 30%;
    height: 100%;
    background: var(--paper);
    animation: scan 2.4s var(--ease) infinite;
}

@keyframes scan {
    from { transform: translateX(-100%); }
    to { transform: translateX(340%); }
}

#hero-credit a {
    color: var(--ink);
}

@media (max-width: 760px) {
    .hero-meta {
        grid-template-columns: 1fr 1fr;
    }

    .hero-meta span:nth-child(2) {
        display: none;
    }

    .search-field kbd {
        display: none;
    }

    .search-go {
        width: 48px;
        height: 48px;
    }

    #hero-credit {
        display: none;
    }
}

/* ==========================================================
   Marquee
========================================================== */
.marquee {
    border-block: 1px solid var(--line);
    overflow: hidden;
    padding: 18px 0;
}

.marquee-track {
    display: flex;
    width: max-content;
    animation: marquee 38s linear infinite;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

.marquee-group {
    display: flex;
    align-items: center;
    flex: none;
}

.marquee button {
    font-size: clamp(34px, 5vw, 76px);
    letter-spacing: -0.04em;
    line-height: 1.05;
    padding: 0 0.3em;
    transition: color 0.3s;
}

.marquee button:hover {
    color: var(--accent);
}

.marquee i {
    font-style: normal;
    font-size: clamp(16px, 2vw, 28px);
    color: var(--muted);
}

@keyframes marquee {
    to { transform: translateX(-50%); }
}

/* ==========================================================
   Results
========================================================== */
.results {
    padding: clamp(60px, 10vw, 140px) var(--gutter) 60px;
}

.results-head {
    margin-bottom: clamp(32px, 5vw, 64px);
}

.results-kicker {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    margin-bottom: 8px;
}

.results-title {
    font-weight: 500;
    font-size: clamp(56px, 13vw, 240px);
    line-height: 0.86;
    letter-spacing: -0.06em;
    overflow: hidden;
    padding-bottom: 0.08em;
    text-transform: capitalize;
    overflow-wrap: anywhere;
}

.results-title > span {
    display: inline-block;
}

.results-title em {
    letter-spacing: -0.02em;
}

/* an Aperture creator's profile header (creator.js, launch panel L5) */
.creator-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 20px clamp(16px, 2.4vw, 32px);
    margin-top: clamp(20px, 3vw, 36px);
    padding-top: clamp(20px, 3vw, 32px);
    border-top: 1px solid var(--line);
}

.creator-head[hidden] {
    display: none;
}

.ch-avatar {
    position: relative;
    width: clamp(64px, 7vw, 96px);
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    background: var(--line);
    display: grid;
    place-items: center;
}

.ch-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ch-initial {
    font-size: clamp(26px, 3vw, 40px);
    font-weight: 500;
}

.ch-handle {
    color: var(--muted);
    margin-bottom: 8px;
}

.ch-bio {
    max-width: 58ch;
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.45;
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.creator-head.is-missing .ch-bio {
    color: var(--muted);
}

.ch-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 20px;
    list-style: none;
    padding: 0;
    color: var(--muted);
}

.ch-facts li[hidden] {
    display: none;
}

.ch-facts a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ch-facts a:hover {
    color: var(--accent);
}

.ch-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.ch-actions .btn {
    padding: 10px 18px;
    font-size: 14px;
}

.ch-actions [hidden] {
    display: none;
}

@media (max-width: 700px) {
    .creator-head {
        grid-template-columns: auto 1fr;
    }

    .ch-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}

@media (pointer: coarse) {
    .ch-actions .btn {
        min-height: 44px;
    }

    .ch-facts a {
        display: inline-block;
        min-height: 44px;
        line-height: 44px;
    }
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 32px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.filters[hidden] {
    display: none;
}

.filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.filter-label {
    color: var(--muted);
    margin-right: 6px;
}

.toggle {
    font-size: 14px;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid var(--line);
    transition: background 0.3s, color 0.3s;
}

.toggle.is-active {
    background: var(--paper);
    color: var(--bg);
    border-color: var(--paper);
}

.swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--s, conic-gradient(#c7372f, #e8c53a, #3f8a4f, #2a8c8c, #2f5fc7, #7a45c2, #c7372f));
    box-shadow: 0 0 0 1px var(--line);
    transition: transform 0.4s var(--ease-out), box-shadow 0.3s;
}

.swatch:hover {
    transform: scale(1.15);
}

.swatch.is-active {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--paper);
}

/* ---------- masonry ---------- */
.grid {
    display: flex;
    align-items: flex-start;
    gap: var(--gap);
}

.grid-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    will-change: transform;
}

.card {
    position: relative;
    --c: #222;
}

.card-media {
    position: relative;
    display: block;
    width: 100%;
    overflow: hidden;
    background: var(--c);
    clip-path: inset(100% 0 0 0);
    transition: clip-path 1.2s var(--ease);
    transition-delay: var(--d, 0s);
    cursor: pointer;
}

.card.is-in .card-media {
    clip-path: inset(0 0 0 0);
}

.card-media::before {
    /* blurred low-res preview */
    content: "";
    position: absolute;
    inset: -10%;
    background: var(--lqip) center / cover;
    filter: blur(18px);
}

.card-media img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.25);
    transition: opacity 0.8s ease, transform 1.6s var(--ease-out);
}

.card.is-in.is-loaded .card-media img {
    opacity: 1;
    transform: scale(1);
}

.card.is-in.is-loaded .card-media:hover img {
    transform: scale(1.06);
    transition: opacity 0.8s ease, transform 1.2s var(--ease-out);
}

.card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 45%);
    opacity: 0;
    transition: opacity 0.5s;
}

.card-media:hover::after,
.card-media:focus-visible::after {
    opacity: 1;
}

.card-cap {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #fff;
    z-index: 2;
    pointer-events: none;
}

.card-author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
}

.card-author img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex: none;
}

.card-author span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-cap > *,
.card-idx {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s, transform 0.6s var(--ease-out);
}

.card-media:hover .card-cap > *,
.card-media:focus-visible .card-cap > *,
.card-media:hover + .card-idx {
    opacity: 1;
    transform: none;
}

.card-cap > *:nth-child(2) {
    transition-delay: 0.05s;
}

.card-hex {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.card-hex::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.card-idx {
    position: absolute;
    top: 12px;
    left: 14px;
    color: #fff;
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: difference;
}

@media (hover: none) {
    .card-cap > * {
        opacity: 1;
        transform: none;
    }

    .card-media::after {
        opacity: 0.8;
    }

    .card-hex {
        display: none;
    }
}

.grid-state {
    text-align: center;
    padding: 12vh 0;
}

.grid-state h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(36px, 5vw, 72px);
    line-height: 1;
    margin-bottom: 14px;
}

.grid-state p {
    color: var(--muted);
    max-width: 44ch;
    margin: 0 auto 22px;
}

.grid-state .chips {
    justify-content: center;
}

.grid-foot {
    display: grid;
    place-items: center;
    padding-top: 60px;
}

#sentinel {
    width: 100%;
    height: 1px;
}

.more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 30px 46px;
    border-radius: 200px;
    border: 1px solid var(--line);
    transition: background 0.4s, color 0.4s;
}

.more[hidden] {
    display: none;
}

.more:hover {
    background: var(--paper);
    color: var(--bg);
}

.more-label {
    font-family: var(--serif);
    font-size: 28px;
    line-height: 1;
}

.more-count {
    color: var(--muted);
}

.more.is-busy .more-label::after {
    content: "…";
}

/* skeleton pulse while fetching */
.grid.is-busy {
    opacity: 0.35;
    transition: opacity 0.4s;
}

/* ==========================================================
   Dock
========================================================== */
.dock {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.72);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
    transform: translate(-50%, 160%);
    transition: transform 0.9s var(--ease);
    max-width: calc(100vw - 32px);
}

.dock.is-visible {
    transform: translate(-50%, 0);
}

.search--dock {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px 0 14px;
    min-width: 0;
}

.dock-icon {
    flex: none;
    color: var(--muted);
    width: 18px !important;
    height: 18px !important;
}

.search--dock input {
    width: 220px;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    font-size: 15px;
    padding: 10px 0;
}

.search--dock input::placeholder {
    color: var(--muted);
}

.dock-density {
    display: flex;
    gap: 2px;
    padding-left: 6px;
    border-left: 1px solid var(--line);
}

.dock button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--muted);
    transition: background 0.3s, color 0.3s;
}

.dock button:hover {
    color: var(--ink);
}

.dock button.is-active {
    background: var(--paper);
    color: var(--bg);
}

.dock-density svg {
    width: 16px !important;
    height: 16px !important;
    fill: currentColor;
    stroke: none !important;
}

.dock-top {
    background: var(--accent) !important;
    color: var(--bg) !important;
}

.dock-top svg {
    width: 18px !important;
    height: 18px !important;
}

@media (max-width: 600px) {
    .search--dock input {
        width: 100%;
    }

    .search--dock {
        flex: 1;
    }

    .dock {
        left: 16px;
        right: 16px;
        transform: translateY(160%);
    }

    .dock.is-visible {
        transform: none;
    }

    .dock-density button[data-density="4"] {
        display: none;
    }
}

/* ==========================================================
   Lightbox
========================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 1fr minmax(320px, 400px);
    --c: #222;
}

.lightbox[hidden] {
    display: none;
}

.lb-bg {
    position: absolute;
    inset: 0;
    background: var(--bg);
    background-image: radial-gradient(ellipse at 35% 50%, color-mix(in srgb, var(--c) 34%, transparent), transparent 70%);
    transition: background-image 0.8s;
}

.lb-stage {
    position: relative;
    height: 100svh;
}

.lb-img {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2;
    object-fit: cover;
    background: var(--c);
    will-change: transform, width, height;
}

.lb-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 3;
}

.lb-prev { left: 0; }
.lb-next { right: 0; }

.lb-panel {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 22px var(--gutter) var(--gutter);
    border-left: 1px solid var(--line);
    background: rgba(13, 12, 10, 0.55);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    height: 100svh;
    /* only the details scroll; the Close bar and the actions stay put */
    overflow: hidden;
}

.lb-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--muted);
}

.lb-close {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink);
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 100px;
    transition: background 0.3s, color 0.3s;
}

.lb-close:hover {
    background: var(--paper);
    color: var(--bg);
}

.lb-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    gap: 28px;
    padding-block: 14px;
    /* soft edges where the details scroll under the bar and the actions */
    -webkit-mask-image: linear-gradient(transparent, #000 14px, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(transparent, #000 14px, #000 calc(100% - 14px), transparent);
}

.lb-top,
.lb-actions,
.lb-hint {
    flex: none;
}

.lb-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(32px, 3vw, 46px);
    line-height: 1.02;
    letter-spacing: -0.01em;
}

.lb-title::first-letter {
    text-transform: uppercase;
}

.lb-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lb-author img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-2);
}

.lb-author b {
    display: block;
    font-weight: 500;
}

.lb-author small {
    color: var(--muted);
}

.lb-author:hover b {
    color: var(--accent);
}

.lb-meta div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
}

.lb-meta dt {
    color: var(--muted);
    white-space: nowrap;
}

.lb-meta dd {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: right;
}

.lb-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 1px var(--line);
}

/* Download across the top, the two quieter actions side by side below */
.lb-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
}

#lb-download {
    grid-column: 1 / -1;
}

.lb-actions .btn {
    min-height: 48px;
    padding: 12px 20px;
    gap: 12px;
    font-size: 14px;
    white-space: nowrap;
}

/* long board names give way before the button does */
.lb-actions .btn > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "Unsplash ↗" is enough on screen; screen readers still hear "View on Unsplash" */
#lb-open .lb-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

#lb-download.btn {
    min-height: 56px;
    font-size: 15px;
}

.btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    border-radius: 100px;
    border: 1px solid var(--line);
    font-size: 15px;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.btn:hover {
    border-color: var(--paper);
}

.btn--solid {
    background: var(--paper);
    color: var(--bg);
    border-color: var(--paper);
}

.btn--solid:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.lb-hint {
    color: var(--muted);
    text-align: center;
}

.lb-fade {
    will-change: transform, opacity;
}

/* Small screens (phones either way up, short windows): the panel scrolls,
   so its top bar (counter + Close) and the actions stay pinned to its
   edges instead of scrolling out of reach. Breakpoints are mirrored by
   lbStacked() / lbCompact() in api.js. */
@media (max-width: 860px), (max-height: 640px) {
    .lb-panel {
        --pad: var(--gutter);
        gap: 18px;
        padding: 0 var(--pad);
        background: var(--bg-2);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .lb-top {
        position: sticky;
        top: 0;
        z-index: 2;
        margin: 0 calc(var(--pad) * -1);
        padding: 10px var(--pad);
        background: var(--bg-2);
        border-bottom: 1px solid var(--line);
    }

    .lb-close {
        min-height: 44px;
        padding: 0 18px;
    }

    .lb-body {
        flex: none;
        overflow: visible;
        padding-block: 0;
        -webkit-mask-image: none;
        mask-image: none;
        justify-content: flex-start;
        gap: 18px;
    }

    .lb-title {
        font-size: clamp(26px, 7vw, 34px);
    }

    .lb-more {
        margin-top: 4px;
    }

    .lb-actions {
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin: auto calc(var(--pad) * -1) 0;
        padding: 10px var(--pad) max(10px, env(safe-area-inset-bottom));
        background: var(--bg-2);
        border-top: 1px solid var(--line);
        grid-template-columns: 1fr 1fr;
    }

    #lb-download {
        grid-column: 1 / -1;
    }

    .lb-actions .btn,
    #lb-download.btn {
        min-height: 44px;
        padding: 10px 18px;
        font-size: 14px;
    }

    .lb-long {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .lb-hint {
        display: none;
    }
}

/* Phones held upright: photo on top, panel below. One row of actions. */
@media (max-width: 860px) and (min-height: 521px), (max-width: 560px) {
    .lightbox {
        grid-template-columns: 1fr;
        grid-template-rows: 54svh minmax(0, 1fr);
    }

    .lb-stage {
        height: 54svh;
    }

    .lb-panel {
        height: auto;
        min-height: 0;
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .lb-actions {
        grid-template-columns: 1.2fr 1fr 1fr;
        gap: 6px;
    }

    #lb-download {
        grid-column: auto;
    }

    .lb-actions .btn {
        justify-content: center;
        gap: 8px;
        padding: 10px 12px;
        white-space: nowrap;
    }
}

/* Phones on their side: keep photo and panel side by side. */
@media (max-width: 860px) and (max-height: 520px) and (min-width: 561px) {
    .lightbox {
        grid-template-columns: 1fr minmax(280px, 42vw);
    }
}

/* ==========================================================
   Footer
========================================================== */
.footer {
    padding: clamp(80px, 12vw, 180px) var(--gutter) calc(var(--gutter) + 70px);
    border-top: 1px solid var(--line);
    overflow: hidden;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 40px;
    flex-wrap: wrap;
}

.footer-lede {
    font-size: clamp(26px, 3.2vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.03em;
    max-width: 18ch;
}

.footer-links {
    list-style: none;
    display: grid;
    gap: 10px;
    text-align: right;
}

.footer-links a,
.linklike {
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    transition: color 0.3s;
}

.footer-links a:hover,
.linklike:hover {
    color: var(--accent);
}

.footer-mark {
    font-family: var(--serif);
    font-size: 27vw;
    line-height: 0.8;
    letter-spacing: -0.05em;
    text-align: center;
    /* the "p" hangs ~6vw below the line box: leave room so it never touches the small print */
    margin: 8vw 0 7vw;
    white-space: nowrap;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
}

@media (max-width: 760px) {
    .footer-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 32px;
    }

    .footer-links {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 22px;
        padding: 0;
        margin: 0;
        text-align: left;
    }

    .footer-links a,
    .footer-links .linklike {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    .footer-mark {
        margin: 14vw 0 9vw;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 6px;
    }
}

/* ==========================================================
   Reduced motion
========================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
    }

    .float,
    .card-media {
        clip-path: none !important;
    }

    .marquee-track {
        animation: none;
    }
}

/* ==========================================================
   Infinite canvas
========================================================== */
.results-kicker-r {
    display: inline-flex;
    align-items: center;
    gap: 18px;
}

.cv-enter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 12px;
    border-radius: 100px;
    border: 1px solid var(--line);
    color: var(--ink);
    font: inherit;
    transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.cv-enter:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.cv-enter svg,
.dock-canvas svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.dock-canvas svg {
    width: 16px !important;
    height: 16px !important;
    stroke: none !important;
}

.dock.is-hidden {
    transform: translate(-50%, 160%) !important;
}

.cv {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: transparent;
    overflow: hidden;
    color: var(--ink);
}

.cv[hidden] {
    display: none;
}

#cv-gl {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: grab;
    touch-action: none;
}

.cv.is-dragging #cv-gl {
    cursor: grabbing;
}

@media (hover: hover) and (pointer: fine) {
    #cv-gl,
    .cv.is-dragging #cv-gl {
        cursor: none;
    }
}

.cv-bar,
.cv-foot {
    position: absolute;
    left: var(--gutter);
    right: var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    pointer-events: none;
}

.cv-bar {
    top: 18px;
}

.cv-foot {
    bottom: 20px;
    color: var(--muted);
}

.cv-bar > *,
.cv-foot > * {
    pointer-events: auto;
}

.cv-brand {
    font-weight: 500;
    font-size: 20px;
    letter-spacing: -0.03em;
}

.cv-brand em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
}

.cv-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.66);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
}

.cv-search svg {
    width: 16px;
    height: 16px;
    flex: none;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.6;
}

.cv-search input {
    width: min(300px, 36vw);
    background: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    padding: 11px 0;
}

.cv-search input::placeholder {
    color: var(--muted);
}

.cv-close {
    padding: 11px 18px;
    border-radius: 100px;
    background: var(--paper);
    color: var(--bg);
    transition: background 0.3s;
}

.cv-close:hover {
    background: var(--accent);
}

.cv-title {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    text-align: center;
    overflow: hidden;
    pointer-events: none;
    font-family: var(--serif);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(64px, 14vw, 260px);
    line-height: 0.95;
    letter-spacing: -0.03em;
    text-transform: capitalize;
    color: var(--paper);
    mix-blend-mode: difference;
    padding: 0 var(--gutter) 0.06em;
}

.cv-title > span {
    display: inline-block;
}

.cv-cap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv-cap b {
    color: var(--accent);
    font-weight: 500;
}

.cv-cap i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 1px var(--line);
}

.cv-xy {
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .cv-brand,
    .cv-hint {
        display: none;
    }

    .cv-search {
        flex: 1;
    }

    .cv-search input {
        width: 100%;
    }

    .results-kicker {
        flex-wrap: wrap;
    }
}

/* scrims keep the bar and footer legible over bright photos */
.cv::before,
.cv::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 140px;
    pointer-events: none;
}

.cv::before {
    top: 0;
    background: linear-gradient(rgba(13, 12, 10, 0.7), transparent);
}

.cv::after {
    bottom: 0;
    background: linear-gradient(transparent, rgba(13, 12, 10, 0.8));
}

.cv-bar,
.cv-foot,
.cv-title {
    z-index: 1;
}

/* Unsplash attribution line: "Photo by <name> on Unsplash" */
.lb-credit {
    font-size: 14px;
    color: var(--muted);
    margin: -6px 0 22px;
}

.lb-credit a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--line);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.3s;
}

.lb-credit a:hover {
    text-decoration-color: var(--accent);
}

/* ==========================================================
   PIN BOARD
========================================================== */
.cv-actions {
    display: flex;
    gap: 8px;
}

.cv-board {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px 11px 18px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.66);
    border: 1px solid var(--line);
    color: var(--ink);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    transition: border-color 0.3s;
}

.cv-board:hover,
.cv-board[aria-expanded="true"] {
    border-color: var(--accent);
}

.cv-board b {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 100px;
    background: var(--line);
    color: var(--ink);
    font-weight: 500;
    font-size: 12px;
    transition: background 0.3s, color 0.3s;
}

.cv-board.has-pins b {
    background: var(--accent);
    color: var(--bg);
}

.cv-hint kbd,
.pb-empty kbd {
    font: inherit;
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
}

.cv-pinned {
    font-style: normal;
    color: var(--accent);
}

.pb-fly {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 70;
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.pb {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    background-color: rgba(13, 12, 10, 0.84);
}

.pb[hidden] {
    display: none;
}

.pb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px var(--gutter) 10px;
}

.pb-title {
    font-weight: 500;
    font-size: clamp(32px, 4.4vw, 60px);
    letter-spacing: -0.04em;
    line-height: 1;
}

.pb-title em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    color: var(--accent);
}

.pb-title sup {
    font-size: 13px;
    letter-spacing: 0;
    color: var(--muted);
    vertical-align: super;
}

.pb-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pb-acts button,
.pb-tools > button,
.cv-board {
    text-transform: uppercase;
}

.pb-tools > button,
.pb-import {
    padding: 11px 16px;
    border-radius: 100px;
    border: 1px solid var(--line);
    color: var(--ink);
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}

.pb-tools > button:hover,
.pb-import:hover,
.pb-import:focus-within {
    border-color: var(--paper);
}

.pb-tools > .pb-close {
    background: var(--paper);
    border-color: var(--paper);
    color: var(--bg);
}

.pb-tools > .pb-close:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.pb-area {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: none;
    cursor: grab;
    background-image: radial-gradient(rgba(236, 231, 220, 0.09) 1px, transparent 1.4px);
    background-size: 26px 26px;
}

.pb-area.is-panning {
    cursor: grabbing;
}

.pb-area.is-threading,
.pb-area.is-threading .pb-card {
    cursor: crosshair;
}

.pb-world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
}

.pb-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 14px;
    text-align: center;
    padding: var(--gutter);
    font-family: var(--serif);
    font-style: italic;
    font-size: clamp(36px, 5vw, 72px);
    line-height: 1;
    color: var(--paper);
    pointer-events: none;
}

.pb-empty[hidden] {
    display: none;
}

.pb-empty .mono {
    font-style: normal;
    font-size: 13px;
    color: var(--muted);
}

.pb-card {
    position: absolute;
    padding: 10px 10px 8px;
    background: var(--paper);
    color: var(--bg);
    border-radius: 3px;
    rotate: var(--r, 0deg);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15), 0 18px 40px -12px rgba(0, 0, 0, 0.7);
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: rotate 0.4s var(--ease-out), box-shadow 0.4s, scale 0.4s var(--ease-out);
}

.pb-card:hover {
    z-index: 999;
}

.pb-card.is-held {
    cursor: grabbing;
    rotate: var(--tilt, 0deg);
    scale: 1.04;
    z-index: 1000;
    will-change: transform;
    transition: scale 0.3s var(--ease-out), box-shadow 0.3s;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15), 0 40px 70px -16px rgba(0, 0, 0, 0.85);
}

.pb-pin {
    position: absolute;
    left: 50%;
    top: -7px;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffb299, var(--accent) 45%, #b8340f);
    box-shadow: 0 3px 4px rgba(0, 0, 0, 0.45);
    z-index: 1;
}

.pb-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    background: var(--c);
    pointer-events: none;
}

.pb-card figcaption {
    display: grid;
    /* the column never grows past the card: long names get an ellipsis instead */
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
    padding-top: 8px;
}

.pb-note {
    width: 100%;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--bg);
    font-family: var(--serif);
    font-style: italic;
    font-size: 19px;
    line-height: 1.05;
    cursor: text;
}

.pb-note::placeholder {
    color: rgba(13, 12, 10, 0.35);
}

.pb-note:focus {
    background: rgba(255, 91, 46, 0.08);
}

.pb-meta,
.pb-acts {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.pb-meta {
    color: rgba(13, 12, 10, 0.55);
}

.pb-meta > * {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pb-meta a:hover {
    color: var(--accent);
}

.pb-acts {
    border-top: 1px dashed rgba(13, 12, 10, 0.2);
    padding-top: 6px;
}

.pb-acts button,
.pb-acts a {
    color: var(--bg);
    transition: color 0.2s;
}

.pb-acts button:hover:not(:disabled),
.pb-acts a:hover {
    color: var(--accent);
}

.pb-acts button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lb-pin {
    cursor: pointer;
    color: var(--ink);
    text-align: left;
}

.lb-pin [aria-hidden] {
    display: inline-block;
    color: var(--accent);
}

.lb-pin.is-on {
    border-color: var(--accent);
    color: var(--accent);
}

@media (max-width: 760px) {
    .cv-board {
        padding: 11px 12px;
    }

    .pb-title {
        width: 100%;
    }
}

/* canvas zoom controls */
.cv-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cv-zoom {
    display: inline-flex;
    align-items: center;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.66);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
}

.cv-zoom button {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 100px;
    color: var(--ink);
    font-size: 16px;
    line-height: 1;
    transition: color 0.3s, opacity 0.3s;
}

.cv-zoom .cv-zoom-lvl {
    min-width: 58px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.cv-zoom button:hover:not(:disabled) {
    color: var(--accent);
}

.cv-zoom button:disabled {
    opacity: 0.3;
    cursor: default;
}

.cv-hint kbd + kbd {
    margin-left: 2px;
}

@media (max-width: 760px) {
    .cv-xy {
        display: none;
    }
}

/* board: threads between pins */
.pb-strings {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 1px;
    overflow: visible;
    z-index: 100000;
    pointer-events: none;
}

.pb-thread-line,
.pb-thread-temp {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.2;
    stroke-linecap: round;
}

.pb-thread-line {
    transition: stroke 0.2s;
}

.pb-thread-temp {
    stroke-dasharray: 6 6;
    pointer-events: none;
}

.pb-thread-hit {
    fill: none;
    stroke: transparent;
    stroke-width: 16;
    pointer-events: stroke;
    cursor: pointer;
}

.pb-thread:hover .pb-thread-line {
    stroke: var(--paper);
    stroke-dasharray: 7 5;
}

.pb-area.is-threading .pb-thread-hit {
    pointer-events: none;
}

.pb-pin {
    cursor: crosshair;
    transition: scale 0.25s var(--ease-out);
}

.pb-pin::before {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
}

.pb-pin:hover,
.pb-area.is-threading .pb-card.is-target .pb-pin {
    scale: 1.35;
}

.pb-card.is-target {
    outline: 2px solid var(--accent);
    outline-offset: 5px;
}

.pb-hint {
    flex-basis: 100%;
    font-size: 11px;
    color: var(--muted);
}

.pb-hint kbd {
    font: inherit;
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
}

.pb-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    vertical-align: -1px;
    background: var(--accent);
}

.pb-tools {
    align-items: center;
}

/* thin rules between the toolbar's groups: view · edit · look · send · leave */
.pb-sep {
    flex: none;
    align-self: center;
    width: 1px;
    height: 22px;
    margin: 0 4px;
    background: var(--line);
}

.pb-tools > .pb-more {
    display: none;
}

/* view-only boards lose the edit tools, which would leave rules side by side */
.pb.is-readonly .pb-sep {
    display: none;
}

/* the shortcut line is for keyboards; it only crowds tablets and phones */
@media (max-width: 1100px), (pointer: coarse) {
    .pb-hint {
        display: none;
    }
}

/* Below 1180px the full toolbar no longer fits on one line. Rather than wrap
   or scroll sideways, the everyday tools stay in one row and the rest fold
   behind ⋯. Phones keep .pb-main (Add, Undo, Find, ⋯, Wall); tablets also
   keep .pb-wide (Group, Tidy, Palette, Share). */
@media (max-width: 1180px) {
    .pb-tools {
        width: 100%;
        flex-wrap: wrap;
    }

    .pb-tools > .pb-more {
        display: grid;
        place-items: center;
        min-width: 44px;
        align-self: stretch;
        min-height: 40px;
        padding: 0;
        margin-left: auto;
        font-size: 18px;
        line-height: 1;
    }

    .pb-tools.is-more > .pb-more {
        background: var(--paper);
        border-color: var(--paper);
        color: var(--bg);
    }

    .pb-sep,
    .pb-tools:not(.is-more) > :not(.pb-main):not(.pb-wide) {
        display: none;
    }

    /* the folded tools come in below a rule, after the everyday row */
    .pb-tools > :not(.pb-main):not(.pb-wide) {
        order: 2;
    }

    .pb-tools.is-more::after {
        content: "";
        order: 1;
        flex-basis: 100%;
        height: 1px;
        margin: 2px 0;
        background: var(--line);
    }
}

@media (max-width: 760px) {
    .pb-head {
        gap: 12px;
        padding-bottom: 8px;
    }

    .pb-tools {
        gap: 6px;
    }

    .pb-tools:not(.is-more) > .pb-wide {
        display: none;
    }

    .pb-tools > .pb-wide {
        order: 2;
    }

    .pb-tools > button {
        min-height: 44px;
        padding: 0 14px;
    }

    .pb-tools .cv-zoom button {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ==========================================================
   boards: switcher, groups, thread knots, sharing, keyboard
========================================================== */
.pb-titlebar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 20px;
    min-width: 0;
}

.pb-title {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.pb-name {
    font: inherit;
    letter-spacing: inherit;
    color: var(--paper);
    background: none;
    border: 0;
    outline: 0;
    padding: 0 4px;
    margin-left: -4px;
    border-radius: 8px;
    width: 9ch;
    min-width: 3ch;
    max-width: min(64vw, 22ch);
    field-sizing: content;
    text-overflow: ellipsis;
}

.pb-name:hover:not([readonly]),
.pb-name:focus {
    background: rgba(236, 231, 220, 0.07);
}

.pb-switch {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pb-switch > button {
    font: inherit;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 100px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--ink);
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.3s;
}

.pb-switch > button:hover:not(:disabled) {
    border-color: var(--paper);
}

.pb-switch > button:disabled,
.pb-tools > button:disabled {
    opacity: 0.35;
    cursor: default;
}

.pb-hint kbd + kbd {
    margin-left: 2px;
}

/* shared (view-only) boards */
.pb-shared {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 10px 10px 16px;
    border-radius: 14px;
    border: 1px solid var(--accent);
    font-size: 12px;
    color: var(--ink);
}

.pb-shared[hidden] {
    display: none;
}

.pb-shared b {
    color: var(--accent);
    font-weight: 500;
}

.pb-shared button {
    padding: 9px 16px;
    border-radius: 100px;
    background: var(--accent);
    color: var(--bg);
    text-transform: uppercase;
    font-size: 11px;
}

.pb-shared #pb-shared-signin {
    margin-left: auto;
    background: transparent;
    color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

@media (pointer: coarse) {
    .pb-shared button {
        min-height: 44px;
    }
}

/* ---------- editing together (#21) ---------- */
/* an editor on someone else's board: their boards, Share and Delete aren't theirs to use here */
.pb.is-guest .pb-switch,
.pb.is-guest #pb-share {
    display: none !important;
}

.pb-people {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0 4px;
    list-style: none;
}

.pb-people[hidden] {
    display: none;
}

/* phones: who's here leads the everyday row (it's .pb-main, so it never folds behind ⋯) */
@media (max-width: 760px) {
    .pb-people {
        order: -1;
        flex: none;
    }
}

.pb-person {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: -6px;
    border-radius: 50%;
    background: var(--c, var(--accent));
    box-shadow: 0 0 0 2px var(--bg);
    color: var(--bg);
    font-size: 12px;
    font-weight: 600;
    cursor: default;
}

.pb-person:first-child {
    margin-left: 0;
}

.pb-person.is-more {
    background: var(--paper);
    font-size: 10px;
}

.pb-cursors {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 30;
}

.pb-cursor {
    position: absolute;
    left: 0;
    top: 0;
    transition: transform 0.08s linear, opacity 0.4s ease;
    will-change: transform;
}

.pb-cursor svg {
    display: block;
    fill: var(--c, var(--accent));
    stroke: var(--bg);
    stroke-width: 1.2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.pb-cursor span {
    position: absolute;
    left: 14px;
    top: 16px;
    max-width: 160px;
    overflow: hidden;
    padding: 3px 8px;
    border-radius: 100px;
    background: var(--c, var(--accent));
    color: var(--bg);
    font: 500 11px/1.3 var(--sans);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pb-cursor.is-idle {
    opacity: 0.25;
}

@media (prefers-reduced-motion: reduce) {
    .pb-cursor {
        transition: none;
    }
}

.pb.is-readonly .pb-edit,
.pb.is-readonly .pb-acts [data-act="remove"],
.pb.is-readonly .pb-frame-grip,
.pb.is-readonly .pb-frame-del,
.pb.is-readonly .pb-frame-handle {
    display: none !important;
}

.pb.is-readonly .pb-card,
.pb.is-readonly .pb-pin,
.pb.is-readonly .pb-frame-bar {
    cursor: inherit;
}

.pb.is-readonly .pb-knot {
    pointer-events: none;
}

.pb.is-readonly .pb-knot:not(.has-label) {
    display: none;
}

/* keyboard */
.pb-area:focus {
    outline: 0;
}

.pb-card:focus-visible {
    outline: 2px solid var(--paper);
    outline-offset: 5px;
}

.pb-card.is-source {
    outline: 2px dashed var(--accent);
    outline-offset: 5px;
}

/* groups */
.pb-frames {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 0;
}

.pb-frame {
    position: absolute;
    border: 1.5px dashed rgba(236, 231, 220, 0.35);
    border-radius: 14px;
    background: rgba(236, 231, 220, 0.04);
    pointer-events: none;
    transition: border-color 0.3s;
}

.pb-frame.is-held,
.pb-frame:focus-within {
    border-color: var(--accent);
}

.pb-frame-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 10px;
    pointer-events: auto;
    cursor: grab;
}

.pb-frame.is-held .pb-frame-bar {
    cursor: grabbing;
}

.pb-frame-grip {
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
    cursor: grab;
}

.pb-frame-grip:hover,
.pb-frame-grip:focus-visible {
    color: var(--paper);
}

.pb-frame-title {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--paper);
    font: 500 20px/1.2 var(--sans);
    letter-spacing: -0.02em;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: text;
}

.pb-frame-title:focus {
    background: rgba(236, 231, 220, 0.08);
}

.pb-frame-title::placeholder {
    color: var(--muted);
}

.pb-frame-del {
    color: var(--muted);
    padding: 4px 8px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.pb-frame:hover .pb-frame-del,
.pb-frame-del:focus-visible {
    opacity: 1;
}

.pb-frame-del:hover {
    color: var(--accent);
}

.pb-frame-handle {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 24px;
    height: 24px;
    pointer-events: auto;
    cursor: nwse-resize;
    border-bottom-right-radius: 14px;
    background: linear-gradient(135deg, transparent 52%, rgba(236, 231, 220, 0.45) 52%);
}

/* thread knots + labels */
.pb-knots {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 100001;
}

.pb-knot {
    position: absolute;
    translate: -50% -50%;
    min-width: 12px;
    height: 12px;
    padding: 0;
    border-radius: 100px;
    background: var(--accent);
    border: 2px solid var(--bg);
    color: var(--bg);
    font: 500 11px/1 var(--mono);
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: scale 0.2s var(--ease-out);
}

.pb-knot.has-label {
    height: auto;
    padding: 5px 10px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pb-knot:hover,
.pb-knot:focus-visible,
.pb-knot.is-open {
    scale: 1.15;
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

.pb-pop {
    position: absolute;
    z-index: 10;
    transform: translate(-50%, 22px);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.94);
    border: 1px solid var(--line);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.pb-pop[hidden] {
    display: none;
}

.pb-pop input {
    width: min(220px, 50vw);
    background: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    padding: 6px 10px;
}

.pb-pop input::placeholder {
    color: var(--muted);
}

.pb-pop button {
    padding: 7px 12px;
    border-radius: 100px;
    border: 1px solid var(--line);
    color: var(--ink);
    font-size: 11px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: border-color 0.2s, color 0.2s;
}

.pb-pop button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* canvas: tone filter */
.cv-tones {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.66);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
}

.cv-tones[hidden] {
    display: none;
}

.cv-tones .swatch {
    width: 16px;
    height: 16px;
}

@media (max-width: 1100px) {
    .cv-tones {
        display: none !important;
    }
}

/* lightbox: more like this */
.lb-more {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
    font-size: 12px;
}

.lb-more-label {
    color: var(--muted);
    margin-right: 4px;
    text-transform: uppercase;
}

.lb-chip {
    max-width: 100%;
    padding: 7px 14px;
    border-radius: 100px;
    border: 1px solid var(--line);
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: border-color 0.3s, color 0.3s;
}

.lb-chip:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.lb-chip:disabled {
    opacity: 0.35;
    cursor: default;
}

/* board picker (replaces the native <select>) */
.pb-head {
    position: relative;
    z-index: 20;
}

.pb-picker {
    position: relative;
}

/* the header rows get transforms from the entrance animation, which makes each
   its own stacking context; lift the title row so its popover covers the tools */
.pb-titlebar {
    position: relative;
    z-index: 2;
}

.pb-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 240px;
    padding: 8px 12px 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--line);
    background: rgba(22, 21, 18, 0.66);
    color: var(--ink);
    font: inherit;
    font-size: 12px;
    text-transform: uppercase;
    transition: border-color 0.3s;
}

.pb-picker-btn #pb-picker-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pb-picker-btn svg {
    flex: none;
    width: 12px;
    height: 12px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: rotate 0.35s var(--ease-out);
}

.pb-picker-btn:hover,
.pb-picker-btn[aria-expanded="true"] {
    border-color: var(--paper);
}

.pb-picker-btn[aria-expanded="true"] svg {
    rotate: 180deg;
}

.pb-picker-pop {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 30;
    width: 320px;
    max-width: calc(100vw - 32px);
    padding: 6px;
    border-radius: 20px;
    background: rgba(22, 21, 18, 0.96);
    border: 1px solid var(--line);
    box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
}

.pb-picker-pop[hidden] {
    display: none;
}

.pb-picker-label {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px 8px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.pb-opts {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: min(340px, 50vh);
    overflow-y: auto;
    outline: 0;
    overscroll-behavior: contain;
}

.pb-opt {
    display: grid;
    grid-template-columns: 48px 1fr auto 14px;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 8px;
    border-radius: 14px;
    color: var(--ink);
    text-transform: none;
    cursor: pointer;
    transition: background 0.2s;
}

.pb-opt.is-active {
    background: rgba(236, 231, 220, 0.07);
}

.pb-opts:focus-visible .pb-opt.is-active {
    box-shadow: inset 0 0 0 1px rgba(236, 231, 220, 0.3);
}

/* a little stack of polaroids from the board */
.pb-opt-stack {
    position: relative;
    width: 48px;
    height: 40px;
}

.pb-opt-stack img,
.pb-opt-stack i {
    position: absolute;
    top: 3px;
    width: 26px;
    height: 33px;
    object-fit: cover;
    border-radius: 2px;
    border: 2px solid var(--paper);
    background: var(--bg-2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.55);
    transition: rotate 0.35s var(--ease-out), translate 0.35s var(--ease-out);
}

.pb-opt-stack img:nth-child(1) {
    left: 2px;
    rotate: -9deg;
}

.pb-opt-stack img:nth-child(2) {
    left: 11px;
    top: 1px;
    rotate: 2deg;
}

.pb-opt-stack img:nth-child(3) {
    left: 20px;
    rotate: 10deg;
}

.pb-opt.is-active .pb-opt-stack img:nth-child(1) {
    rotate: -15deg;
    translate: -2px 0;
}

.pb-opt.is-active .pb-opt-stack img:nth-child(3) {
    rotate: 16deg;
    translate: 2px 0;
}

.pb-opt-stack i {
    left: 11px;
    border: 1.5px dashed rgba(236, 231, 220, 0.3);
    background: none;
    box-shadow: none;
}

.pb-opt-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 500 16px/1.2 var(--sans);
    letter-spacing: -0.02em;
}

.pb-opt-count {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.pb-opt-check {
    color: var(--accent);
    font-size: 13px;
    opacity: 0;
}

.pb-opt[aria-selected="true"] .pb-opt-check {
    opacity: 1;
}

.pb-opt[aria-selected="true"] .pb-opt-name {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    letter-spacing: -0.01em;
}

.pb-picker-new {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-top: 6px;
    padding: 12px 12px 10px 8px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 12px;
    text-transform: uppercase;
    text-align: left;
    border-radius: 0 0 14px 14px;
    transition: color 0.2s, background 0.2s;
}

.pb-picker-new b {
    display: grid;
    place-items: center;
    width: 48px;
    height: 28px;
    font-weight: 400;
    font-size: 20px;
    color: var(--accent);
}

.pb-picker-new:hover,
.pb-picker-new:focus-visible {
    background: rgba(236, 231, 220, 0.05);
    color: var(--accent);
    outline: 0;
}

/* ==========================================================
   smoothness
========================================================== */
/* the board used to blur the live WebGL wall every frame (backdrop-filter).
   Now the wall stops redrawing under the board and is blurred once. */
#cv-gl {
    transition: filter 0.45s var(--ease-out), scale 0.45s var(--ease-out);
}

.cv.is-board #cv-gl {
    filter: blur(14px) saturate(1.2) brightness(0.9);
    scale: 1.04;
}

/* behind the blurred wall: never let the page under the canvas show through */
.cv.is-board {
    background: var(--bg);
}

.cv.is-board .cv-bar,
.cv.is-board .cv-foot,
.cv.is-board .cv-title {
    visibility: hidden;
}

/* own compositor layer only while the board moves, so it re-rasterises
   crisply at rest instead of staying a scaled bitmap */
.pb-world.is-moving {
    will-change: transform;
}

.pb-card {
    contain: layout style;
}

/* thread shadow is a plain offset path, not a per-frame filter */
.pb-thread-shadow {
    fill: none;
    stroke: rgba(0, 0, 0, 0.38);
    stroke-width: 3;
    stroke-linecap: round;
    transform: translate(0, 3px);
}

.pb-knot {
    left: 0;
    top: 0;
}

@media (prefers-reduced-motion: reduce) {
    #cv-gl {
        transition: none;
    }
}

/* ==========================================================
   phase 1: item kinds, selection, snapping, find, minimap,
   tray, menus, palette, toasts, touch
========================================================== */

/* ---------- item kinds ---------- */
.pb-card.is-note {
    background: var(--tint, #f3dc8c);
    padding: 22px 14px 10px;
    min-height: 190px;
}

.pb-sticky {
    font-size: 23px;
    line-height: 1.08;
    min-height: 140px;
}

.pb-card.is-note .pb-acts {
    border-top-color: rgba(13, 12, 10, 0.15);
}

.pb-bookmark {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    aspect-ratio: 4 / 3;
    padding: 14px 12px 12px;
    background: #1d1b18;
    color: var(--paper);
    overflow: hidden;
}

.pb-bookmark-host {
    font-family: var(--serif);
    font-style: italic;
    font-size: 26px;
    line-height: 1;
    overflow-wrap: anywhere;
}

.pb-bookmark-path {
    font-size: 10px;
    line-height: 1.3;
    color: rgba(236, 231, 220, 0.6);
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pb-bookmark:hover .pb-bookmark-host {
    color: var(--accent);
}

.pb-card.is-missing img {
    opacity: 0;
}

.pb-card.is-missing::before {
    content: "Image unavailable";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 10px;
    aspect-ratio: 4 / 5;
    display: grid;
    place-items: center;
    font: 11px var(--mono);
    text-transform: uppercase;
    color: rgba(236, 231, 220, 0.6);
    background: #1d1b18;
}

/* ---------- selection, matches, snapping ---------- */
.pb-card.is-selected {
    outline: 2px solid var(--accent);
    outline-offset: 5px;
}

.pb-card.is-carried {
    will-change: transform;
    transition: none;
}

.pb-card.is-match,
.pb-frame.is-match {
    outline: 2px dashed rgba(236, 231, 220, 0.55);
    outline-offset: 6px;
}

.pb-card.is-hit,
.pb-frame.is-hit {
    outline: 3px solid var(--paper);
    outline-offset: 6px;
}

.pb-knot.is-match {
    outline: 2px dashed var(--paper);
}

.pb-knot.is-hit {
    outline: 3px solid var(--paper);
    scale: 1.25;
}

.pb-guides {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1;
    stroke-dasharray: 4 4;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.pb-marquee {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 6;
    border: 1px solid var(--accent);
    background: rgba(255, 91, 46, 0.08);
    pointer-events: none;
}

.pb-marquee[hidden],
.pb-drop[hidden],
.pb-find[hidden],
.pb-linkbox[hidden],
.pb-selbar[hidden],
.pb-minimap[hidden],
.pb-tray[hidden],
.pb-menu[hidden],
.pb-palette[hidden] {
    display: none;
}

/* ---------- drop hint ---------- */
.pb-drop {
    position: absolute;
    inset: 12px;
    z-index: 7;
    display: grid;
    place-items: center;
    border: 2px dashed var(--accent);
    border-radius: 20px;
    background: rgba(255, 91, 46, 0.06);
    color: var(--ink);
    font-size: 13px;
    text-transform: uppercase;
    pointer-events: none;
}

.pb-area.is-dropping {
    box-shadow: inset 0 0 0 2px var(--accent);
}

/* ---------- floating bars: find, link box, selection ---------- */
.pb-find,
.pb-linkbox,
.pb-selbar {
    position: absolute;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    border-radius: 100px;
    background: rgba(22, 21, 18, 0.94);
    border: 1px solid var(--line);
    box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.85);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.pb-find,
.pb-linkbox {
    top: 14px;
    left: 50%;
    translate: -50% 0;
    width: min(460px, calc(100% - 32px));
}

.pb-find svg {
    flex: none;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.6;
}

.pb-find input,
.pb-linkbox input {
    flex: 1;
    min-width: 0;
    background: none;
    border: 0;
    outline: 0;
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    padding: 8px 10px;
}

.pb-find input::placeholder,
.pb-linkbox input::placeholder {
    color: var(--muted);
}

.pb-find #pb-find-n {
    font-size: 11px;
    color: var(--muted);
    padding: 0 6px;
    font-variant-numeric: tabular-nums;
}

.pb-find button,
.pb-linkbox button,
.pb-selbar button {
    flex: none;
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border-radius: 100px;
    color: var(--ink);
    font-size: 12px;
    transition: background 0.2s, color 0.2s;
}

.pb-find button:hover,
.pb-linkbox button:hover,
.pb-selbar button:hover:not(:disabled) {
    background: rgba(236, 231, 220, 0.08);
    color: var(--accent);
}

#pb-link-add {
    background: var(--accent);
    color: var(--bg);
    text-transform: uppercase;
}

#pb-link-add:hover {
    background: var(--paper);
    color: var(--bg);
}

.pb-selbar {
    bottom: 18px;
    left: 50%;
    translate: -50% 0;
    max-width: calc(100% - 32px);
    overflow-x: auto;
    font-size: 11px;
}

#pb-sel-n {
    padding: 0 10px;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
}

.pb-selbar-group {
    display: flex;
    gap: 2px;
    padding: 0 4px;
    border-left: 1px solid var(--line);
}

.pb-selbar svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
}

.pb-selbar button:disabled {
    opacity: 0.3;
    cursor: default;
}

.pb-selbar-text {
    text-transform: uppercase;
}

.pb-selbar .is-danger:hover {
    color: #ff7a59;
}

/* ---------- minimap ---------- */
.pb-minimap {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 6;
    width: 200px;
    height: 128px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(13, 12, 10, 0.82);
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
    cursor: crosshair;
    touch-action: none;
}

/* ---------- tray: photos from the wall ---------- */
.pb-tray {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 7;
    padding: 10px 12px 12px;
    border-radius: 18px;
    background: rgba(22, 21, 18, 0.95);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.pb-tray-head {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 10px;
}

.pb-tray-hint {
    flex: 1;
    color: var(--muted);
}

.pb-tray-head button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: var(--ink);
}

.pb-tray-head button:hover {
    background: rgba(236, 231, 220, 0.08);
}

.pb-tray-list {
    display: flex;
    gap: 10px;
    margin: 0;
    padding: 2px 2px 6px;
    list-style: none;
    overflow-x: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.pb-tray-item {
    position: relative;
    display: block;
    width: 72px;
    height: 90px;
    flex: none;
    padding: 0;
    border-radius: 4px;
    overflow: hidden;
    background: var(--c);
    cursor: grab;
    touch-action: none;
    transition: transform 0.25s var(--ease-out), opacity 0.25s;
}

.pb-tray-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.pb-tray-item:hover,
.pb-tray-item:focus-visible {
    transform: translateY(-3px);
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

.pb-tray-item.is-pinned {
    opacity: 0.4;
}

.pb-tray-item.is-pinned::after {
    content: "✓";
    position: absolute;
    right: 4px;
    top: 4px;
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-size: 11px;
}

.pb-tray-empty {
    padding: 18px 4px;
    color: var(--muted);
    font-size: 13px;
}

.pb-ghost {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 80;
    width: 80px;
    height: 100px;
    border: 4px solid var(--paper);
    border-radius: 3px;
    background-size: cover;
    background-position: center;
    box-shadow: 0 24px 50px -12px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

/* ---------- menus ---------- */
.pb-menu {
    position: fixed;
    z-index: 60;
    min-width: 240px;
    padding: 6px;
    border-radius: 16px;
    background: rgba(22, 21, 18, 0.97);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
}

.pb-menu [role="menuitem"] {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--ink);
    font-size: 12px;
    text-transform: uppercase;
    text-align: left;
    cursor: pointer;
}

.pb-menu [role="menuitem"]:hover,
.pb-menu [role="menuitem"]:focus-visible,
.pb-menu [role="menuitem"]:focus {
    background: rgba(236, 231, 220, 0.08);
    outline: 0;
}

.pb-menu [role="menuitem"].is-danger {
    color: #ff7a59;
}

.pb-menu kbd {
    font: inherit;
    font-size: 11px;
    padding: 1px 6px;
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--muted);
}

/* on touch, the long-press menu is a bottom sheet */
.pb-menu.is-sheet {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    top: auto;
    min-width: 0;
    padding: 10px;
    border-radius: 22px;
}

.pb-menu.is-sheet [role="menuitem"] {
    padding: 16px 14px;
    font-size: 13px;
}

/* ---------- palette ---------- */
.pb-palette {
    position: fixed;
    z-index: 60;
    width: 280px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(22, 21, 18, 0.97);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
}

.pb-palette-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 10px;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.pb-palette-head button {
    color: var(--ink);
    font-size: 10px;
    text-transform: uppercase;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 100px;
}

.pb-palette-head button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pb-swatches {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.pb-swatch {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 6px 8px 6px 6px;
    border-radius: 10px;
    color: var(--ink);
    text-align: left;
}

.pb-swatch:hover,
.pb-swatch:focus-visible {
    background: rgba(236, 231, 220, 0.07);
    outline: 0;
}

.pb-swatch i {
    width: 36px;
    height: 28px;
    border-radius: 6px;
    background: var(--sw);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.pb-swatch span {
    font-size: 13px;
}

.pb-swatch small {
    font-size: 10px;
    color: var(--muted);
}

.pb-swatch-note {
    padding: 14px 10px;
    color: var(--muted);
    font-size: 13px;
}

/* ---------- toolbar ---------- */
.pb-tools > .pb-add {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.pb-tools > .pb-add:hover,
.pb-tools > .pb-add[aria-expanded="true"] {
    background: var(--paper);
    border-color: var(--paper);
}

.pb-tools > button[aria-expanded="true"] {
    border-color: var(--paper);
}

/* ---------- toast ---------- */
.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 90;
    max-width: min(560px, calc(100vw - 32px));
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--paper);
    color: var(--bg);
    font-size: 12px;
    line-height: 1.45;
    box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.8);
    translate: -50% 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, translate 0.4s var(--ease-out);
}

.toast.is-on {
    opacity: 1;
    translate: -50% 0;
}

.toast[data-tone="warn"] {
    background: #ffd2c4;
    box-shadow: 0 24px 50px -16px rgba(0, 0, 0, 0.8), inset 4px 0 0 var(--accent);
}

/* ---------- touch ---------- */
@media (pointer: coarse) {
    .pb-pin::before {
        inset: -16px;
    }

    .pb-frame-handle {
        width: 36px;
        height: 36px;
    }

    .pb-knot:not(.has-label) {
        min-width: 18px;
        height: 18px;
    }

    .pb-frame-del {
        opacity: 1;
    }
}

@media (max-width: 760px) {
    .pb-minimap {
        width: 140px;
        height: 90px;
        right: 10px;
        bottom: 10px;
    }

    .pb-tray-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        transition: none;
    }
}

/* ---------- first-run walkthrough (tour.js) ---------- */
.tour-ring {
    position: fixed;
    z-index: 70;
    border-radius: 14px;
    border: 1.5px solid var(--accent);
    box-shadow: 0 0 0 9999px rgba(8, 7, 6, 0.55);
    pointer-events: none;
    transition: left 0.45s var(--ease-out), top 0.45s var(--ease-out), width 0.45s var(--ease-out), height 0.45s var(--ease-out);
}

.tour {
    position: fixed;
    z-index: 71;
    width: min(340px, calc(100vw - 32px));
    padding: 18px 18px 14px;
    border-radius: 18px;
    background: rgba(22, 21, 18, 0.98);
    border: 1px solid var(--line);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.9);
    color: var(--paper);
    transition: left 0.45s var(--ease-out), top 0.45s var(--ease-out);
}

.tour-step {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 11px;
}

.tour-title {
    margin: 0 0 6px;
    font: italic 400 28px/1.05 var(--serif);
    letter-spacing: -0.01em;
}

.tour-text {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(236, 231, 220, 0.82);
}

.tour-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tour-gap {
    flex: 1;
}

.tour-actions button {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--paper);
    font: inherit;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.tour-actions .tour-skip {
    border-color: transparent;
    color: var(--muted);
    padding: 0 8px;
}

.tour-actions .tour-next {
    background: var(--accent);
    border-color: var(--accent);
    color: #120f0c;
}

.tour-actions button:hover {
    border-color: var(--paper);
}

.tour-actions .tour-skip:hover {
    color: var(--paper);
    border-color: transparent;
}

.tour-actions button:focus-visible {
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .tour-actions button {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tour,
    .tour-ring {
        transition: none;
    }
}

/* pin heads drawn above the threads (see placeHead in pins.js) */
.pb-pinhead {
    fill: url(#pb-pinhead-fill);
    filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.45));
    transform-box: fill-box;
    transform-origin: center;
    /* reappearing after a drop waits for the card's 0.4s settle */
    transition: scale 0.25s var(--ease-out), opacity 0.15s 0.4s;
}

.pb-pinhead.is-lifted {
    opacity: 0;
    transition: scale 0.25s var(--ease-out), opacity 0s;
}

.pb-pinhead.is-hover,
.pb-pinhead.is-target {
    scale: 1.35;
}

/* ---------- account and sync (cloud.js) ---------- */
.pb-tools > .pb-account {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pb-tools > .pb-account[hidden] {
    display: none;
}

.pb-account-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    transition: background 0.3s;
}

.pb-account[data-state="synced"] .pb-account-dot {
    background: #5fbf7a;
}

.pb-account[data-state="syncing"] .pb-account-dot {
    background: var(--paper);
    animation: acct-pulse 1s ease-in-out infinite;
}

.pb-account[data-state="error"] .pb-account-dot,
.pb-account[data-state="offline"] .pb-account-dot {
    background: var(--accent);
}

@keyframes acct-pulse {
    50% {
        opacity: 0.25;
    }
}

.acct {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(8, 7, 6, 0.6);
}

.acct[hidden] {
    display: none;
}

.acct-card {
    position: relative;
    width: min(420px, 100%);
    padding: 28px 24px 22px;
    border-radius: 22px;
    background: rgba(22, 21, 18, 0.98);
    border: 1px solid var(--line);
    box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.9);
    color: var(--paper);
}

.acct-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
}

.acct-close:hover {
    color: var(--paper);
}

.acct-kicker {
    margin: 0 0 8px;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
}

.acct-title {
    margin: 0 0 10px;
    font: italic 400 34px/1.02 var(--serif);
    letter-spacing: -0.01em;
}

.acct-who {
    font: 500 20px/1.3 var(--sans);
    font-style: normal;
    overflow-wrap: anywhere;
}

.acct-text {
    margin: 0 0 20px;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(236, 231, 220, 0.82);
}

.acct-form {
    display: grid;
    gap: 10px;
}

.acct-form input {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(236, 231, 220, 0.05);
    color: var(--paper);
    font: 15px var(--sans);
}

.acct-form input:focus {
    outline: none;
    border-color: var(--paper);
}

.acct-primary,
.acct-google,
.acct-quiet {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.acct-primary {
    background: var(--accent);
    color: #120f0c;
    border: 1px solid var(--accent);
}

.acct-primary:hover {
    background: var(--paper);
    border-color: var(--paper);
}

.acct-primary:disabled {
    opacity: 0.6;
    cursor: progress;
}

.acct-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: var(--paper);
    color: #1d1b18;
    border: 1px solid var(--paper);
}

.acct-google svg {
    width: 18px;
    height: 18px;
}

.acct-google:hover {
    background: #fff;
}

.acct-quiet {
    background: transparent;
    color: var(--paper);
    border: 1px solid var(--line);
}

.acct-quiet:hover {
    border-color: var(--paper);
}

.acct-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
}

.acct-or::before,
.acct-or::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.acct-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.acct-fine {
    margin: 18px 0 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.acct-fine a {
    color: var(--paper);
}

.acct-danger {
    display: inline;
    padding: 0;
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font: inherit;
}

.acct-error {
    margin: 12px 0 0;
    font-size: 13px;
    color: var(--accent);
}

.acct-error:empty {
    display: none;
}

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

/* ---------- comments panel (#20) ---------- */
.pb-ccount:not(:empty) {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: #120f0c;
    font-size: 10px;
}

.pbc {
    position: absolute;
    top: var(--pbc-top, 16px);
    right: 16px;
    bottom: 16px;
    z-index: 65;
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100% - 32px));
    border-radius: 20px;
    background: rgba(22, 21, 18, 0.98);
    border: 1px solid var(--line);
    box-shadow: 0 40px 80px -24px rgba(0, 0, 0, 0.9);
    color: var(--paper);
}

.pbc[hidden] {
    display: none;
}

.pbc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px 6px 18px;
}

.pbc-title {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.pbc-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
}

.pbc-close:hover {
    color: var(--paper);
}

.pbc-status {
    margin: 0 18px;
    font-size: 11px;
    color: var(--muted);
}

.pbc-status:empty {
    display: none;
}

.pbc-list {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 4px 10px 10px;
    overflow-y: auto;
    list-style: none;
    overscroll-behavior: contain;
}

.pbc-empty {
    padding: 10px 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.pbc-item {
    padding: 10px 8px;
    border-radius: 12px;
    border-bottom: 1px solid var(--line);
}

.pbc-item.is-focus {
    background: rgba(236, 231, 220, 0.06);
}

.pbc-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 2px;
    margin: 0 0 4px;
    font-size: 11px;
    color: var(--muted);
}

.pbc-meta b {
    color: var(--paper);
    font-weight: 500;
    overflow-wrap: anywhere;
}

.pbc-del {
    margin-left: auto;
    padding: 4px 6px;
    font: inherit;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.pbc-del:hover {
    color: var(--accent);
}

.pbc-chip {
    display: inline-block;
    max-width: 100%;
    margin: 0 0 6px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-size: 10px;
    color: var(--paper);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.pbc-chip:hover:not(:disabled) {
    border-color: var(--paper);
}

.pbc-chip:disabled {
    color: var(--muted);
    cursor: default;
}

.pbc-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.pbc-form,
.pbc-signin {
    padding: 10px 12px 12px;
    border-top: 1px solid var(--line);
}

.pbc-form[hidden],
.pbc-signin[hidden] {
    display: none;
}

.pbc-on {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 10px;
    color: var(--accent);
}

.pbc-on[hidden] {
    display: none;
}

.pbc-on span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pbc-on button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: var(--muted);
    cursor: pointer;
}

.pbc-form textarea {
    display: block;
    width: 100%;
    min-height: 72px;
    max-height: 30vh;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(236, 231, 220, 0.05);
    color: var(--paper);
    font: 14px/1.45 var(--sans);
    resize: vertical;
}

.pbc-form textarea:focus,
.pbc-row input:focus {
    outline: none;
    border-color: var(--paper);
}

.pbc-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.pbc-as {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
}

.pbc-row input {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(236, 231, 220, 0.05);
    color: var(--paper);
    font: 13px var(--sans);
}

.pbc-post {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--accent);
    color: #120f0c;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.pbc-post:hover {
    background: var(--paper);
}

.pbc-post:disabled {
    opacity: 0.6;
    cursor: progress;
}

.pbc-error {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--accent);
}

.pbc-error:empty {
    display: none;
}

.pbc-signin p {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.5;
    color: rgba(236, 231, 220, 0.82);
}

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

/* the count on a card with comments; opens them */
.pb-cbadge {
    position: absolute;
    top: -10px;
    left: -10px;
    z-index: 3;
    display: grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    padding: 0 7px;
    border-radius: 13px 13px 13px 3px;
    background: var(--accent);
    color: #120f0c;
    font: 500 11px var(--mono);
    box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.pb-cbadge[hidden] {
    display: none;
}

/* phones: a sheet from the bottom */
@media (max-width: 600px) {
    .pbc {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: min(72%, calc(100% - var(--pbc-top, 16px) - 8px));
    }
}

@media (pointer: coarse) {
    .pbc-close,
    .pbc-post,
    .pbc-row input {
        min-height: 44px;
    }

    .pbc-close {
        width: 44px;
    }

    .pbc-del,
    .pbc-chip {
        min-height: 44px;
    }

    .pbc-on button {
        width: 44px;
        height: 44px;
    }

    /* a bigger invisible hit area around the small badge */
    .pb-cbadge::after {
        content: "";
        position: absolute;
        inset: -9px;
    }
}

/* ---------- share panel (reuses the account dialog's look) ---------- */
.share {
    z-index: 85;
    /* short screens: the panel scrolls instead of being cut off at the top */
    place-items: start center;
    overflow-y: auto;
}

.share .acct-card {
    margin-block: auto;
}

.share-link {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}

.share-link input {
    flex: 1;
    min-width: 0;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(236, 231, 220, 0.05);
    color: var(--paper);
    font: 13px var(--mono);
    text-overflow: ellipsis;
}

.share-link input:focus {
    outline: none;
    border-color: var(--paper);
}

.share-access {
    display: grid;
    gap: 2px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.share-access legend {
    padding: 0;
    margin-bottom: 6px;
}

.share-choice {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    font-size: 14px;
    cursor: pointer;
}

.share-choice input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

.share-pass {
    grid-template-columns: 1fr auto;
    margin-bottom: 14px;
}

.share-pass[hidden] {
    display: none;
}

.share-actions {
    margin-top: 4px;
}

@media (pointer: coarse) {
    .share-choice {
        min-height: 44px;
    }

    .acct-close {
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 420px) {
    .share-pass {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================
   Aperture library (#33): source switch, creators, Studio
========================================================== */
.nav-end {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-end .nav-credit {
    justify-self: auto;
}

.nav-studio {
    cursor: pointer;
    color: inherit;
}

.nav-studio[hidden] {
    display: none;
}

@media (max-width: 520px) {
    .nav-long {
        display: none;
    }
}

.source {
    margin-top: 22px;
}

.source[hidden] {
    display: none;
}

/* a creator without a picture: their initial in a circle */
.avatar-initial {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--paper);
    color: var(--bg);
    font: 600 11px/1 var(--sans);
    font-style: normal;
}

.avatar-initial[hidden] {
    display: none;
}

.lb-author .avatar-initial {
    width: 44px;
    height: 44px;
    font-size: 18px;
}

.lb-author img[hidden] {
    display: none;
}

.lb-license {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

.lb-license[hidden],
#lb-download[hidden],
#lb-open[hidden] {
    display: none;
}

/* Aperture photos have no likes */
.lb-panel dl > div[hidden] {
    display: none;
}

#lb-open[hidden] + .lb-pin {
    grid-column: 1 / -1;
}

/* ---------- Studio ---------- */
/* a full-screen workspace: a sticky top bar, then either a "gate" (sign in,
   apply, in review) with the steps beside it, or the desk (stats, queue,
   filters, a grid of photos and an inspector) */
.studio {
    --s-panel: #12110f;
    --s-raise: rgba(236, 231, 220, 0.04);
    --s-raise-2: rgba(236, 231, 220, 0.07);
    --s-line: rgba(236, 231, 220, 0.1);
    --s-line-2: rgba(236, 231, 220, 0.2);
    --s-soft: rgba(236, 231, 220, 0.72);
    --s-ok: #8fc79a;
    --s-top: 64px;
    position: fixed;
    inset: 0;
    z-index: 85;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    color: var(--paper);
}

.studio[hidden] {
    display: none;
}

body.studio-open {
    overflow: hidden;
}

.studio-sheet {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* the top bar */
.studio-top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--s-top);
    padding: 0 var(--gutter);
    background: rgba(13, 12, 10, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--s-line);
}

.studio-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    font: 500 15px/1 var(--sans);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.studio-brand em {
    font: italic 400 21px/1 var(--serif);
    color: var(--accent);
}

.studio-brand-mark {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--paper);
    box-shadow: inset 0 0 0 4px var(--bg), inset 0 0 0 9px var(--accent);
}

.studio-tabs {
    display: flex;
    align-self: stretch;
    gap: 4px;
}

.studio-tabs[hidden] {
    display: none;
}

.studio-tab {
    position: relative;
    min-height: 44px;
    padding: 0 14px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s;
}

.studio-tab:hover,
.studio-tab[aria-current] {
    color: var(--paper);
}

.studio-tab[aria-current]::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
}

.studio-top-end {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    margin-left: auto;
}

.studio-account {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
}

.studio-account[hidden] {
    display: none;
}

.studio-account-who {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-link-btn {
    min-height: 44px;
    padding: 0 4px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--paper);
    text-decoration: underline;
    text-decoration-color: var(--s-line-2);
    text-underline-offset: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.studio-link-btn:hover {
    text-decoration-color: currentColor;
}

.studio-link-btn[hidden] {
    display: none;
}

.studio-close {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
}

.studio-close:hover {
    border-color: var(--paper);
}

/* the stage: content, and the steps beside a gate */
.studio-stage {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: clamp(32px, 6vw, 96px);
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: clamp(32px, 7vh, 88px) var(--gutter) 64px;
}

.studio[data-mode="app"] .studio-stage {
    grid-template-columns: minmax(0, 1fr);
    width: min(1480px, 100%);
    padding-top: 28px;
}

.studio[data-mode="app"] .studio-how,
.studio[data-view="loading"] .studio-how {
    display: none;
}

.studio-main {
    min-width: 0;
}

.studio-gate {
    max-width: 520px;
}

.studio-gate[hidden],
.studio-desk[hidden],
.studio-form[hidden] {
    display: none;
}

.studio-loading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.studio-loading .studio-text {
    margin: 0;
}

.studio-spinner {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--s-line-2);
    border-top-color: var(--accent);
    animation: studio-spin 0.8s linear infinite;
}

@keyframes studio-spin {
    to {
        transform: rotate(360deg);
    }
}

.studio-eyebrow {
    margin: 0 0 14px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.studio-h {
    margin: 0 0 18px;
    font: 400 clamp(38px, 5.4vw, 64px) / 0.98 var(--serif);
    letter-spacing: -0.02em;
}

.studio-h em {
    color: var(--accent);
}

.studio-text {
    max-width: 62ch;
    margin: 0 0 20px;
    font-size: 15px;
    line-height: 1.6;
    color: rgba(236, 231, 220, 0.82);
}

.studio-text a {
    color: var(--paper);
}

.studio-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--s-raise-2);
    border: 1px solid var(--line);
}

.studio-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #e7b04a;
}

.studio-badge[data-status="declined"] .studio-dot {
    background: var(--accent);
}

.studio-note {
    max-width: 62ch;
    margin: -6px 0 20px;
    padding: 12px 16px;
    border-left: 2px solid var(--accent);
    background: rgba(236, 231, 220, 0.04);
    font: italic 400 20px / 1.35 var(--serif);
    overflow-wrap: anywhere;
}

.studio-note[hidden] {
    display: none;
}

.studio-gate .acct-form,
.studio-gate .acct-google {
    max-width: 420px;
}

/* how it works: three steps, lit by how far the person has got */
.studio-how {
    align-self: start;
    position: sticky;
    top: calc(var(--s-top) + 32px);
    padding: 28px;
    border: 1px solid var(--s-line);
    border-radius: 16px;
    background: var(--s-raise);
}

.studio-how .studio-eyebrow {
    color: var(--muted);
}

.studio-steps {
    list-style: none;
    display: grid;
    gap: 0;
    counter-reset: step;
}

.studio-steps li {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 0 0 22px 44px;
    counter-increment: step;
    color: var(--muted);
}

.studio-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -2px;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--s-line-2);
    font: 500 12px/1 var(--mono);
    background: var(--bg);
}

.studio-steps li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 14px;
    top: 30px;
    bottom: 2px;
    width: 1px;
    background: var(--s-line);
}

.studio-steps b {
    font-size: 15px;
    font-weight: 500;
    color: var(--paper);
}

.studio-steps span {
    font-size: 13px;
    line-height: 1.5;
}

/* the current step */
.studio[data-stage="apply"] [data-step="apply"]::before,
.studio[data-stage="review"] [data-step="review"]::before {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 91, 46, 0.14);
}

.studio[data-stage="declined"] [data-step="review"]::before {
    content: "!";
    border-color: var(--accent);
    background: var(--accent);
    color: #120f0c;
}

/* finished steps */
.studio:is([data-stage="review"], [data-stage="declined"]) [data-step="apply"]::before {
    content: "✓";
    border-color: var(--paper);
    background: var(--paper);
    color: var(--bg);
}

.studio-how-note {
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--s-line);
    font-size: 12px;
    line-height: 1.55;
    color: var(--muted);
}

/* fields (the report dialog uses these too) */
.studio-field {
    display: grid;
    gap: 6px;
    align-content: start;
    min-width: 0;
}

.studio-field > span,
.studio-field > label {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-transform: uppercase;
}

.studio-field small {
    font-size: 12px;
    color: var(--muted);
}

.studio-chars {
    font: 400 11px/1 var(--mono);
    text-transform: none;
    letter-spacing: 0;
}

.studio-field input,
.studio-field textarea,
.studio-sort select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--s-line, var(--line));
    background: rgba(236, 231, 220, 0.05);
    color: var(--paper);
    font: 15px/1.4 var(--sans);
    transition: border-color 0.2s, background 0.2s;
}

.studio-field textarea {
    resize: vertical;
}

.studio-field input:hover,
.studio-field textarea:hover {
    border-color: var(--s-line-2, var(--line));
}

.studio-field input:focus,
.studio-field textarea:focus,
.studio-sort select:focus {
    outline: none;
    border-color: var(--paper);
    background: rgba(236, 231, 220, 0.07);
}

.studio-field input[readonly],
.studio-field textarea[readonly] {
    opacity: 0.6;
}

.studio-prefixed {
    position: relative;
    display: block;
}

.studio-prefix {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 15px;
    pointer-events: none;
}

.studio .studio-prefixed input {
    padding-left: 29px;
}

/* the profile form: an application (in the gate) or the Profile tab */
.studio-form {
    max-width: 760px;
}

.studio[data-mode="app"] .studio-form {
    max-width: 880px;
    margin: 0 auto;
    padding-top: 12px;
}

.studio-form-head {
    margin-bottom: 8px;
}

.studio-section {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: 16px 40px;
    padding: 28px 0;
    border-top: 1px solid var(--s-line);
}

.studio-form.is-applying .studio-section {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 20px;
}

.studio-form.is-applying .studio-section-info {
    display: none;
}

.studio-section-h {
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 500;
}

.studio-section-info p {
    font-size: 13px;
    line-height: 1.55;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.studio-section-info b {
    color: var(--paper);
    font-weight: 500;
}

.studio-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.studio-wide {
    grid-column: 1 / -1;
}

.studio-check {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin: 0 0 24px;
    padding: 16px;
    border: 1px solid var(--s-line);
    border-radius: 12px;
    background: var(--s-raise);
    font-size: 14px;
    line-height: 1.5;
    color: rgba(236, 231, 220, 0.82);
    cursor: pointer;
}

.studio-check input {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--accent);
}

.studio-form:not(.is-applying) .studio-apply-only,
.studio-form.is-applying .studio-edit-only {
    display: none;
}

.studio-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 24px;
    border-top: 1px solid var(--s-line);
}

.studio-form.is-applying .studio-form-actions {
    padding-top: 0;
    border-top: 0;
}

.studio-avatar-row {
    display: flex;
    align-items: center;
    gap: 18px;
}

.studio-file-btn {
    display: inline-flex;
    align-items: center;
}

.studio-file-btn:focus-within,
.studio-upload-btn:focus-within {
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

.studio-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paper);
    color: var(--bg);
    font: 600 20px/1 var(--sans);
}

.studio-avatar--lg {
    width: 80px;
    height: 80px;
    font-size: 30px;
}

.studio-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- the desk ---------- */
.studio-desk {
    position: relative;
}

.studio-banner {
    margin-bottom: 24px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 91, 46, 0.45);
    border-radius: 12px;
    background: rgba(255, 91, 46, 0.07);
    font-size: 14px;
    line-height: 1.55;
}

.studio-banner a {
    color: var(--paper);
}

.studio-banner .studio-note {
    margin: 12px 0 0;
}

.studio-banner[hidden] {
    display: none;
}

.studio-pagehead {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.studio-me {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 4px;
}

.studio-me b {
    font: 400 clamp(28px, 3.2vw, 40px) / 1 var(--serif);
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.studio-me-link {
    justify-self: start;
    font-size: 12px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.studio-me-link:hover {
    color: var(--paper);
}

.studio-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.studio-upload-btn svg {
    width: 16px;
    height: 16px;
}

.studio[data-status="blocked"] .studio-upload-btn {
    display: none;
}

/* stats */
.studio-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 24px;
    border: 1px solid var(--s-line);
    border-radius: 14px;
    background: var(--s-raise);
}

.studio-stats > div {
    display: grid;
    gap: 6px;
    padding: 16px 20px;
    min-width: 0;
}

.studio-stats > div + div {
    border-left: 1px solid var(--s-line);
}

.studio-stats dt {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-stats dd {
    font: 400 32px/1 var(--serif);
    font-variant-numeric: tabular-nums;
}

.studio-stats dd small {
    font: 400 13px/1 var(--sans);
    color: var(--muted);
}

.studio-stats .is-alert dd {
    color: var(--accent);
}

/* the upload queue */
.studio-queue {
    margin-bottom: 24px;
    padding: 6px 16px 10px;
    border: 1px solid var(--s-line);
    border-radius: 14px;
    background: var(--s-raise);
}

.studio-queue[hidden] {
    display: none;
}

.studio-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 44px;
}

.studio-queue-head p {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-queue-list {
    list-style: none;
    display: grid;
    gap: 2px;
}

.studio-q {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--s-line);
}

.studio-q-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--s-raise-2);
}

.studio-q-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.studio-q[data-state="waiting"] .studio-q-thumb {
    opacity: 0.5;
}

.studio-q-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 16px;
    align-items: center;
    min-width: 0;
}

.studio-q-name {
    font-size: 14px;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-q-note {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
}

.studio-q[data-state="done"] .studio-q-note {
    color: var(--s-ok);
}

.studio-q[data-state="error"] .studio-q-note {
    grid-column: 1 / -1;
    text-align: left;
    color: var(--accent);
}

.studio-q-bar {
    grid-column: 1 / -1;
    height: 3px;
    border-radius: 3px;
    background: var(--s-line);
    overflow: hidden;
}

.studio-q-bar i {
    display: block;
    width: 0;
    height: 100%;
    background: var(--paper);
    transition: width 0.4s var(--ease-out);
}

.studio-q[data-state="done"] .studio-q-bar i {
    background: var(--s-ok);
}

.studio-q[data-state="error"] .studio-q-bar {
    display: none;
}

/* empty: one big drop zone */
.studio-empty[hidden] {
    display: none;
}

.studio-empty .studio-text {
    margin: 14px auto 0;
    text-align: center;
    color: var(--muted);
}

.studio-drop {
    display: grid;
    gap: 10px;
    place-items: center;
    text-align: center;
    padding: clamp(48px, 10vh, 96px) 20px;
    border: 1px dashed var(--s-line-2);
    border-radius: 18px;
    background: var(--s-raise);
    cursor: pointer;
    transition: border-color 0.25s, background 0.25s;
}

.studio-drop:hover {
    border-color: var(--accent);
    background: rgba(255, 91, 46, 0.05);
}

.studio-drop-icon {
    width: 48px;
    height: 48px;
    color: var(--muted);
}

.studio-drop-title {
    font: italic 400 clamp(26px, 3.4vw, 36px) / 1.1 var(--serif);
}

.studio-drop-note {
    max-width: 52ch;
    font-size: 11px;
    line-height: 1.6;
    color: var(--muted);
}

/* dragging files over the desk */
.studio-desk.is-dragging::after {
    content: "Drop to upload";
    position: fixed;
    inset: calc(var(--s-top) + 12px) 12px 12px;
    z-index: 6;
    display: grid;
    place-items: center;
    border: 2px dashed var(--accent);
    border-radius: 20px;
    background: rgba(13, 12, 10, 0.86);
    font: italic 400 40px/1 var(--serif);
    pointer-events: none;
}

/* filters, search, sort */
.studio-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.studio-toolbar[hidden] {
    display: none;
}

.studio-filters {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--s-line);
    border-radius: 999px;
}

.studio-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.studio-filter span {
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.studio-filter:hover {
    color: var(--paper);
}

.studio-filter[aria-pressed="true"] {
    background: var(--paper);
    color: var(--bg);
}

.studio-filter[hidden] {
    display: none;
}

.studio-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.studio-pick-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
}

.studio-pick-all input,
.studio-pick input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.studio-search {
    position: relative;
    display: block;
}

.studio-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.studio-search input {
    width: 240px;
    min-height: 42px;
    padding: 0 14px 0 36px;
    border-radius: 999px;
    border: 1px solid var(--s-line);
    background: transparent;
    color: var(--paper);
    font: 14px var(--sans);
}

.studio-search input:focus {
    outline: none;
    border-color: var(--paper);
}

.studio-sort select {
    min-height: 42px;
    padding: 0 34px 0 14px;
    border-radius: 999px;
    font-size: 13px;
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.studio-sort option {
    background: var(--bg-2);
}

/* the grid and the inspector beside it */
.studio-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 24px;
    align-items: start;
}

.studio-workspace[hidden] {
    display: none;
}

.studio-library {
    min-width: 0;
}

.studio-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.studio-item {
    position: relative;
    min-width: 0;
}

.studio-card {
    display: grid;
    width: 100%;
    padding: 0;
    text-align: left;
    border-radius: 12px;
    cursor: pointer;
    color: inherit;
}

.studio-thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 5;
    border-radius: 12px;
    overflow: hidden;
    background: var(--c, #222);
    outline: 1px solid var(--s-line);
    outline-offset: -1px;
    transition: outline-color 0.2s;
}

.studio-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease-out);
}

.studio-card:hover .studio-thumb img {
    transform: scale(1.03);
}

.studio-item.is-current .studio-thumb {
    outline: 2px solid var(--paper);
    outline-offset: 3px;
}

.studio-item.is-picked .studio-thumb {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.studio-item[data-state="hidden"] .studio-thumb img {
    opacity: 0.45;
}

.studio-card-body {
    display: grid;
    gap: 3px;
    padding: 10px 2px 0;
    min-width: 0;
}

.studio-card-title {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-card-meta {
    font-size: 11px;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.studio-card-warn {
    color: var(--accent);
}

.studio-state {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: rgba(13, 12, 10, 0.78);
    color: var(--paper);
    white-space: nowrap;
}

.studio-state::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted);
}

.studio-item[data-state="live"] .studio-state::before,
.studio-inspector[data-state="live"] .studio-state::before {
    background: var(--s-ok);
}

.studio-item[data-state="hidden"] .studio-state::before,
.studio-inspector[data-state="hidden"] .studio-state::before {
    background: var(--accent);
}

.studio-thumb .studio-state {
    position: absolute;
    left: 10px;
    bottom: 10px;
    pointer-events: none;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* a tick box in the corner: on hover, when ticked, and always on touch screens */
.studio-pick {
    position: absolute;
    top: 8px;
    left: 8px;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(13, 12, 10, 0.7);
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.studio-item:hover .studio-pick,
.studio-pick:focus-within,
.studio-item.is-picked .studio-pick,
.studio-desk.has-picked .studio-pick {
    opacity: 1;
}

.studio-none {
    padding: 40px 0;
    text-align: center;
    color: var(--muted);
}

.studio-none[hidden] {
    display: none;
}

/* the inspector */
.studio-inspector {
    position: sticky;
    top: calc(var(--s-top) + 16px);
    max-height: calc(100vh - var(--s-top) - 32px);
    max-height: calc(100dvh - var(--s-top) - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--s-line);
    border-radius: 16px;
    background: var(--s-panel);
}

.studio-insp-blank {
    display: none;
    gap: 14px;
    place-items: center;
    padding: 56px 32px;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    color: var(--muted);
}

.studio-insp-blank svg {
    width: 44px;
    height: 44px;
}

.studio-inspector.is-empty .studio-insp-blank {
    display: grid;
}

.studio-inspector.is-empty .studio-insp-body {
    display: none;
}

.studio-insp-body {
    display: grid;
    gap: 18px;
    padding: 16px 20px 20px;
}

.studio-insp-head {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
}

.studio-insp-h {
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-saved {
    margin-left: auto;
    font-size: 11px;
    color: var(--muted);
}

.studio-saved:empty + .studio-state {
    margin-left: auto;
}

.studio-insp-close {
    display: none;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
}

.studio-insp-preview {
    position: relative;
    display: block;
    aspect-ratio: var(--ar, 3 / 2);
    max-height: 300px;
    margin: 0 auto;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: var(--c, #222);
}

.studio-insp-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.studio-insp-open {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 10px;
    text-transform: uppercase;
    background: rgba(13, 12, 10, 0.78);
    opacity: 0;
    transition: opacity 0.2s;
}

.studio-insp-preview:hover .studio-insp-open,
.studio-insp-preview:focus-visible .studio-insp-open {
    opacity: 1;
}

/* tags as chips */
.studio-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid var(--s-line);
    background: rgba(236, 231, 220, 0.05);
    cursor: text;
}

.studio-tags:focus-within {
    border-color: var(--paper);
}

.studio-tag-list {
    display: contents;
    list-style: none;
}

.studio-tag {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0 2px 0 10px;
    border-radius: 999px;
    background: var(--s-raise-2);
    border: 1px solid var(--s-line);
    font-size: 13px;
    line-height: 28px;
}

.studio-tag-x {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 15px;
    color: var(--muted);
    cursor: pointer;
}

.studio-tag-x:hover {
    color: var(--paper);
    background: var(--s-raise-2);
}

.studio .studio-tags input {
    flex: 1 1 100px;
    min-width: 100px;
    min-height: 30px;
    padding: 0 4px;
    border: 0;
    background: none;
}

.studio .studio-tags input:focus {
    background: none;
}

/* licence: two cards */
.studio-license {
    display: grid;
    gap: 8px;
    border: 0;
    min-width: 0;
}

.studio-license legend {
    margin-bottom: 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-license label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--s-line);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.studio-license label:has(:checked) {
    border-color: var(--paper);
    background: var(--s-raise);
}

.studio-license label:has(:focus-visible) {
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

.studio-license input {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    accent-color: var(--accent);
}

.studio-license span {
    display: grid;
    gap: 2px;
}

.studio-license b {
    font-size: 14px;
    font-weight: 500;
}

.studio-license small {
    font-size: 12px;
    color: var(--muted);
}

/* the checklist before publishing */
.studio-ready {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--s-raise);
}

.studio-ready[hidden] {
    display: none;
}

.studio-ready > p {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-ready ul {
    list-style: none;
    display: grid;
    gap: 6px;
}

.studio-ready li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.studio-ready li::before {
    content: "";
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid var(--s-line-2);
}

.studio-ready li[data-ok="true"] {
    color: var(--paper);
}

.studio-ready li[data-ok="true"]::before {
    content: "✓";
    display: grid;
    place-items: center;
    border-color: var(--s-ok);
    background: var(--s-ok);
    color: #0d0c0a;
    font-size: 10px;
    font-weight: 700;
}

.studio-ready small {
    font-size: 12px;
    line-height: 1.5;
    color: var(--muted);
}

/* details */
.studio-meta {
    display: grid;
    gap: 0;
    border-top: 1px solid var(--s-line);
}

.studio-meta > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--s-line);
    font-size: 13px;
}

.studio-meta dt {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-meta dd {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
}

.studio-meta code {
    font: 12px var(--mono);
    text-transform: none;
}

.studio-tone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.studio-tone i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    outline: 1px solid var(--s-line-2);
}

.studio-insp-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.studio-insp-actions .acct-primary,
.studio-insp-actions .acct-quiet {
    flex: 1;
}

.studio-insp-actions [hidden] {
    display: none;
}

.studio-delete {
    min-height: 46px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.studio-delete:hover {
    border-color: rgba(255, 91, 46, 0.5);
    background: rgba(255, 91, 46, 0.08);
}

/* the bulk bar: floats at the bottom while photos are ticked */
.studio-bulk {
    position: sticky;
    bottom: 20px;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: max-content;
    max-width: 100%;
    margin: 24px auto 0;
    padding: 8px 8px 8px 20px;
    border: 1px solid var(--s-line-2);
    border-radius: 999px;
    background: rgba(22, 21, 18, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.studio-bulk[hidden],
.studio-bulk [hidden] {
    display: none;
}

.studio-bulk > span {
    margin-right: 8px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.studio-error {
    margin-top: 16px;
}

/* the confirm dialog */
.studio-confirm {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(8, 7, 6, 0.72);
}

.studio-confirm[hidden] {
    display: none;
}

.studio-confirm-box {
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid var(--s-line-2);
    border-radius: 18px;
    background: var(--bg-2);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.studio-confirm-h {
    margin-bottom: 10px;
    font: 400 30px/1.05 var(--serif);
    overflow-wrap: anywhere;
}

.studio-confirm .acct-row {
    justify-content: flex-end;
}

.studio-danger-btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--accent);
    color: #120f0c;
    cursor: pointer;
}

.studio-danger-btn:hover {
    background: #ff7a55;
}

/* ---------- Studio: narrower screens ---------- */
@media (max-width: 1180px) {
    .studio-workspace {
        grid-template-columns: minmax(0, 1fr) 340px;
    }

    .studio-search input {
        width: 200px;
    }
}

@media (max-width: 899px) {
    .studio-stage,
    .studio[data-mode="app"] .studio-stage {
        grid-template-columns: minmax(0, 1fr);
    }

    .studio-how {
        position: static;
    }

    .studio-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    /* the inspector is a full-screen sheet while a photo is open */
    .studio-inspector {
        display: none;
    }

    .studio.is-inspecting {
        overflow: hidden;
    }

    .studio.is-inspecting .studio-inspector {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 8;
        max-height: none;
        border: 0;
        border-radius: 0;
        background: var(--bg);
    }

    .studio.is-inspecting .studio-insp-body {
        width: min(560px, 100%);
        margin: 0 auto;
        padding: 0 16px 32px;
    }

    .studio-insp-head {
        position: sticky;
        top: 0;
        z-index: 1;
        margin: 0 -16px;
        padding: 0 16px;
        min-height: 56px;
        background: var(--bg);
        border-bottom: 1px solid var(--s-line);
    }

    .studio-insp-close {
        display: inline-flex;
    }

    .studio-insp-h {
        display: none;
    }

    .studio-insp-open {
        opacity: 1;
    }

    .studio-insp-actions {
        position: sticky;
        bottom: 0;
        margin: 0 -16px -32px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        background: var(--bg);
        border-top: 1px solid var(--s-line);
    }

    .studio-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .studio-stats > div:nth-child(3) {
        border-left: 0;
    }

    .studio-stats > div:nth-child(n + 3) {
        border-top: 1px solid var(--s-line);
    }

    .studio-section {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
    }
}

@media (max-width: 640px) {
    .studio {
        --s-top: 56px;
    }

    .studio-top {
        gap: 8px;
        padding: 0 8px 0 16px;
    }

    .studio-brand {
        font-size: 0;
        gap: 0;
    }

    .studio-brand em {
        font-size: 22px;
    }

    .studio-brand-mark {
        margin-right: 8px;
    }

    .studio-tab {
        padding: 0 10px;
    }

    .studio-tab[aria-current]::after {
        left: 10px;
        right: 10px;
    }

    .studio-account-who,
    .studio-close-label {
        display: none;
    }

    .studio-top-end {
        gap: 4px;
    }

    .studio-close {
        width: 44px;
        padding: 0;
    }

    .studio-stage {
        padding: 28px 16px 48px;
        gap: 28px;
    }

    .studio[data-mode="app"] .studio-stage {
        padding-top: 20px;
    }

    .studio-pagehead {
        flex-wrap: wrap;
    }

    .studio-upload-btn {
        width: 100%;
        justify-content: center;
    }

    .studio-stats > div {
        padding: 12px 14px;
    }

    .studio-stats dd {
        font-size: 26px;
    }

    .studio-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .studio-toolbar {
        align-items: stretch;
    }

    .studio-filters {
        overflow-x: auto;
        scrollbar-width: none;
        max-width: 100%;
    }

    .studio-tools {
        width: 100%;
        justify-content: space-between;
    }

    .studio-search {
        order: -1;
        flex: 1 1 100%;
    }

    .studio-search input {
        width: 100%;
    }

    .studio-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .studio-bulk {
        bottom: 12px;
        border-radius: 18px;
        padding: 8px 8px 8px 14px;
    }
}

/* touch screens: no hover, so the tick boxes always show, and targets stay 44 px */
@media (pointer: coarse) {
    .nav-studio,
    .source .toggle {
        min-height: 44px;
    }

    .studio-pick {
        opacity: 1;
        width: 44px;
        height: 44px;
        top: 4px;
        left: 4px;
    }

    .studio-pick input {
        width: 22px;
        height: 22px;
    }

    .studio-filter,
    .studio-search input,
    .studio-sort select {
        min-height: 44px;
    }

    .studio-tag-x {
        width: 32px;
        height: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .studio-drop,
    .studio-thumb img,
    .studio-q-bar i,
    .studio-pick {
        transition: none;
    }

    .studio-card:hover .studio-thumb img {
        transform: none;
    }

    .studio-spinner {
        animation-duration: 2.4s;
    }
}

/* ---------- Report (#34, report.js) ---------- */
.lb-report {
    align-self: flex-start;
    margin-top: 14px;
    padding: 6px 0;
    font-size: 11px;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.lb-report:hover,
.lb-report:focus-visible {
    color: var(--paper);
}

.lb-report[hidden] {
    display: none;
}

.pbc-del + .pbc-report {
    margin-left: 0;
}

.report {
    position: fixed;
    inset: 0;
    z-index: 97;
    display: grid;
    place-items: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    background: rgba(8, 7, 6, 0.72);
}

.report[hidden] {
    display: none;
}

.report-card {
    width: min(520px, 100%);
    padding: clamp(20px, 4vw, 32px);
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--paper);
}

.report-card [hidden] {
    display: none;
}

.report-card :focus-visible {
    outline: 2px solid var(--paper);
    outline-offset: 2px;
}

.report-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.report-title {
    font: 400 clamp(28px, 5vw, 38px) / 1 var(--serif);
}

.report-what {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.report-form {
    display: grid;
    gap: 16px;
}

.report-reasons {
    display: grid;
    gap: 8px;
    border: 0;
}

.report-legend {
    margin-bottom: 8px;
    font-size: 15px;
}

.report-reason {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.report-reason:hover,
.report-reason.is-picked {
    border-color: var(--paper);
    background: rgba(236, 231, 220, 0.04);
}

.report-reason input {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent);
}

.report-reason span {
    display: grid;
    gap: 2px;
}

.report-reason b {
    font-weight: 500;
    font-size: 15px;
}

.report-reason small {
    font-size: 13px;
    line-height: 1.4;
    color: rgba(236, 231, 220, 0.7);
}

@media (pointer: coarse) {
    .lb-report,
    .pbc-report {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .report-reason {
        transition: none;
    }
}

/* ---------- Account (launch panel L3, account.js): reuses the Studio's page ---------- */
.account .studio-stage {
    grid-template-columns: minmax(0, 1fr);
    width: min(960px, 100%);
    padding-top: clamp(28px, 6vh, 64px);
}

.account-body[hidden] {
    display: none;
}

.account-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
    min-width: 0;
}

.account-avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    font: 400 34px/1 var(--serif);
    color: #120f0c;
    background: var(--accent);
}

.account-head-text {
    min-width: 0;
}

.account-name {
    margin: 0 0 8px;
    font: 400 clamp(30px, 4.4vw, 48px) / 1 var(--serif);
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.account-sub {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.account-sub span:empty {
    display: none;
}

.account-note {
    margin-bottom: 16px;
    font-size: 14px;
}

.account-inline {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    max-width: 480px;
}

.account-inline .studio-field {
    flex: 1;
    min-width: 0;
}

.account-inline .acct-quiet {
    flex: none;
}

.account-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--s-line);
}

.account-method,
.account-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--s-line);
}

.account-method > div,
.account-action > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.account-method b,
.account-action b {
    font-weight: 500;
    font-size: 15px;
}

.account-method small,
.account-action small {
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.account-method > :last-child:not(div),
.account-action > button {
    flex: none;
}

.account-on {
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--s-ok);
    border: 1px solid rgba(143, 199, 154, 0.35);
}

.account-stats {
    margin-bottom: 14px;
}

.account-creator .studio-badge[data-status="approved"] .studio-dot {
    background: var(--s-ok);
}

.account-creator .studio-badge[data-status="blocked"] .studio-dot {
    background: var(--muted);
}

.account-creator a.acct-quiet {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.account-actions {
    border-top: 1px solid var(--s-line);
}

.account-danger-zone .studio-section-h {
    color: var(--accent);
}

.account-confirm {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 18px;
    border: 1px solid var(--accent);
    border-radius: 14px;
    background: rgba(255, 91, 46, 0.06);
}

.account-confirm[hidden],
.account-confirm .studio-field[hidden] {
    display: none;
}

.account-confirm-h {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.account-confirm-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(236, 231, 220, 0.82);
}

.account-confirm .studio-danger-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.account .acct-error:empty {
    display: none;
}

@media (max-width: 640px) {
    .account-head {
        gap: 14px;
    }

    .account-avatar {
        width: 56px;
        height: 56px;
        font-size: 26px;
    }

    .account-action {
        flex-direction: column;
        align-items: stretch;
    }

    .account-action > button {
        align-self: flex-start;
    }
}

/* ---------- Studio: how the photos are doing (launch panel L4) ---------- */
.studio-insights {
    margin-bottom: 24px;
    padding: 18px 20px 20px;
    border: 1px solid var(--s-line);
    border-radius: 14px;
    background: var(--s-raise);
}

.studio-insights[hidden] {
    display: none;
}

.studio-insights-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 18px;
}

.studio-insights-h {
    margin: 0;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-range {
    display: flex;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--s-line);
    border-radius: 999px;
}

.studio-range-btn {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

.studio-range-btn:hover {
    color: var(--paper);
}

.studio-range-btn[aria-pressed="true"] {
    background: var(--paper);
    color: var(--bg);
}

.studio-insights-body {
    display: grid;
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr) minmax(0, 280px);
    gap: 28px;
    align-items: start;
}

.studio-figures {
    display: grid;
    gap: 16px;
    margin: 0;
}

.studio-figures > div {
    display: grid;
    gap: 4px;
}

.studio-figures dt {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-figures dd {
    margin: 0;
    font: 400 30px/1 var(--serif);
    font-variant-numeric: tabular-nums;
}

.studio-figures small {
    font-size: 12px;
    color: var(--muted);
}

/* views a day: thin bars on a recessive baseline */
.studio-chart {
    position: relative;
    margin: 0;
    min-width: 0;
}

.studio-chart figcaption {
    margin-bottom: 10px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 150px;
    border-bottom: 1px solid var(--s-line-2);
}

.studio-bar {
    flex: 1;
    display: flex;
    align-items: flex-end;
    min-width: 0;
    height: 100%;
    cursor: default;
    outline: none;
}

.studio-bar i {
    display: block;
    width: 100%;
    max-width: 18px;
    margin: 0 auto;
    border-radius: 4px 4px 0 0;
    background: var(--accent);
    opacity: 0.85;
}

.studio-bars.is-dense .studio-bar i {
    border-radius: 2px 2px 0 0;
}

.studio-bar:hover i,
.studio-bar:focus-visible i {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--paper);
}

/* a day with no views still gets a hint of a baseline mark */
.studio-bar i.is-zero {
    height: 2px;
    background: var(--s-line-2);
}

.studio-chart-axis {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
}

.studio-chart-tip {
    position: absolute;
    top: 18px;
    transform: translateX(-50%);
    margin: 0;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    white-space: nowrap;
    color: var(--bg);
    background: var(--paper);
    pointer-events: none;
    z-index: 1;
}

.studio-chart-tip[hidden] {
    display: none;
}

.studio-top-h {
    margin: 0 0 10px;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.studio-top-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.studio-top-row {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 4px 6px 4px 4px;
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
}

.studio-top-row:hover {
    background: var(--s-raise-2);
}

.studio-top-row img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
}

.studio-top-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
}

.studio-top-n {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.studio-top-none {
    font-size: 13px;
    color: var(--muted);
}

@media (max-width: 1180px) {
    .studio-insights-body {
        grid-template-columns: minmax(0, 180px) minmax(0, 1fr);
    }

    .studio-top-photos {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .studio-insights {
        padding: 16px;
    }

    .studio-insights-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
    }

    .studio-figures {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .studio-figures dd {
        font-size: 24px;
    }

    .studio-figures dt {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .studio-bars {
        height: 110px;
    }
}

@media (pointer: coarse) {
    .studio-range-btn {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .studio-range-btn {
        transition: none;
    }
}

/* ==========================================================
   Canvas in the nav: the wall is one tap away from the first frame,
   on every width, without scrolling down to the results.
========================================================== */
.nav-canvas {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    /* filled: the nav blends with `difference`, so white reads as the light pill
       and black text shows whatever is behind it */
    background: #fff;
    border-color: #fff;
    color: #000;
    white-space: nowrap;
    transition: opacity 0.3s;
}

.nav-canvas:hover {
    opacity: 0.82;
}

.nav-canvas svg {
    width: 13px;
    height: 13px;
    flex: none;
    fill: currentColor;
}

/* the openers set their own display, so `hidden` (no WebGL) needs saying */
.nav-canvas[hidden],
.cv-enter[hidden],
.dock-canvas[hidden] {
    display: none;
}

.nav-end .nav-credit {
    white-space: nowrap;
}

@media (pointer: coarse) {
    .nav-canvas {
        min-height: 44px;
    }
}

@media (max-width: 520px) {
    #nav {
        gap: 10px;
    }

    .nav-end {
        gap: 6px;
    }

    .nav-end .nav-credit {
        padding: 9px 12px;
    }

    /* photos and the footer credit Unsplash; the nav keeps its room for actions */
    .nav-end a.nav-credit {
        display: none;
    }
}

/* the smallest phones: the icon carries it, the name stays for screen readers */
@media (max-width: 380px) {
    .nav-canvas-label {
        display: none;
    }

    .nav-canvas {
        min-width: 44px;
        justify-content: center;
        padding-inline: 0;
    }
}

/* mid widths (tablets, small laptops): the frame count gives way to the actions */
@media (max-width: 1100px) {
    .nav-long {
        display: none;
    }
}

@media (max-width: 960px) {
    #nav {
        grid-template-columns: 1fr auto;
    }

    .nav-hud {
        display: none;
    }
}

/* ==========================================================
   Board header on phones (1 Dec): the board gets the screen.
   Upright: name, boards ▾ and Delete share one row, the tools a second.
   Sideways (short screens): everything in one row, extras behind ⋯.
========================================================== */
@media (max-width: 760px), (max-height: 500px) {
    .pb-head {
        gap: 8px;
        padding-top: 10px;
        padding-bottom: 8px;
    }

    .pb-titlebar {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .pb .pb-title {
        width: auto;
        font-size: 26px;
    }

    .pb-name {
        max-width: 46vw;
    }

    /* the name is already the title: the picker shows just its chevron
       (the name stays in its accessible label) */
    .pb-picker-btn {
        width: 40px;
        height: 40px;
        padding: 0;
        gap: 0;
        justify-content: center;
    }

    .pb-picker-btn #pb-picker-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .pb-switch > button {
        min-height: 40px;
    }
}

@media (max-width: 760px) {
    .pb-titlebar {
        width: 100%;
    }

    /* Delete goes to the far end, away from the boards menu */
    .pb-switch {
        flex: 1;
    }

    .pb-switch > #pb-delete {
        margin-left: auto;
    }
}

@media (max-height: 500px) and (min-width: 761px) {
    .pb-head {
        flex-wrap: nowrap;
        align-items: flex-start;
    }

    .pb-titlebar {
        flex: none;
        min-height: 44px;
    }

    .pb-tools {
        flex: 1;
        width: auto;
        justify-content: flex-end;
    }

    .pb-tools:not(.is-more) > .pb-wide {
        display: none;
    }

    .pb-tools > .pb-wide {
        order: 2;
    }

    .pb-tools > .pb-more {
        margin-left: 0;
    }

    .pb-tools > button {
        min-height: 44px;
        padding: 0 14px;
    }
}

@media (pointer: coarse) {
    .pb-picker-btn,
    .pb-switch > button {
        min-height: 44px;
    }

    @media (max-width: 760px), (max-height: 500px) {
        .pb-picker-btn {
            width: 44px;
            height: 44px;
        }
    }
}

/* the boards menu hangs from the whole title row on phones, so it opens from
   the left edge instead of running off the right one */
@media (max-width: 760px), (max-height: 500px) {
    .pb-picker {
        position: static;
    }

    .pb-picker-pop {
        top: calc(100% + 8px);
        left: 0;
    }
}

/* ==========================================================
   Phones: put the board's top bar away (⌃), bring it back (Tools ⌄).
   Only phones get the switch; wider screens always show the bar.
========================================================== */
.pb-hide,
.pb-show {
    display: none;
}

.pb-hide svg,
.pb-show svg {
    width: 12px;
    height: 12px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

@media (max-width: 760px), (max-height: 500px) {
    .pb-hide {
        display: grid;
        place-items: center;
        flex: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        border: 1px solid var(--line);
        color: var(--ink);
        cursor: pointer;
        transition: border-color 0.3s;
    }

    .pb-hide:hover {
        border-color: var(--paper);
    }

    /* view-only boards have no Delete to push it over */
    .pb.is-readonly .pb-hide {
        margin-left: auto;
    }

    .pb.is-bare .pb-head {
        display: none;
    }

    .pb.is-bare .pb-show {
        position: absolute;
        top: 12px;
        right: 12px;
        z-index: 9;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 44px;
        padding: 0 16px 0 14px;
        border-radius: 100px;
        border: 1px solid var(--line);
        background: rgba(22, 21, 18, 0.86);
        color: var(--ink);
        font-size: 12px;
        text-transform: uppercase;
        cursor: pointer;
        box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
    }
}

