/* ==========================================================================
   Rooms — the switchable visual system (Admin → Визия).
   Every colour comes from the generated theme tokens (--brand…); every style
   (.style-gallery / .style-theatre / .style-classic) only re-binds the role
   tokens below. Components never name a style directly unless the form differs.
   ========================================================================== */

.site {
    /* Role tokens — what a "wall" (brand-owned field) looks like */
    --wall-bg: var(--brand);
    --wall-ink: var(--on-brand);
    --wall-mute: var(--on-brand-mute);
    --wall-line: rgba(255, 255, 255, 0.2);
    --wall-deep: var(--brand-ink);
    --soft-bg: var(--brand-wash);

    /* Frames — the mat around photographs */
    --mat: #ffffff;
    --mat-pad: clamp(10px, 1.8vw, 22px);
    --frame-radius: 0px;
    --frame-shadow: 0 1px 1px rgba(15, 20, 25, 0.06), 0 22px 44px -26px rgba(15, 20, 25, 0.55);

    /* Shapes and type */
    --act-radius: 0px;
    --card-radius: 0px;
    --title-case: none;
    --title-track: -0.02em;
    --title-weight: 400;

    font-family: var(--body);
    color: var(--ink);
    background: var(--ground);
}

.site.is-calm {
    --wall-bg: var(--brand-wash);
    --wall-ink: var(--ink);
    --wall-mute: var(--ink-2);
    --wall-line: var(--rule);
    --wall-deep: var(--brand-wash);
}

::selection { background: var(--brand-tint); color: var(--brand-ink); }
html { scrollbar-color: var(--brand-line) var(--ground); }
:focus-visible { outline: 2px solid var(--brand-lift); outline-offset: 3px; }
a { text-underline-offset: 0.2em; }

/* ---- Fields --------------------------------------------------------- */

.wall {
    background: var(--wall-bg);
    color: var(--wall-ink);
    position: relative;
}

.wall-soft { background: var(--soft-bg); color: var(--ink); }
.wall-deep { background: var(--wall-deep); color: var(--wall-ink); }
.is-calm .wall-deep { color: var(--ink); }

.wall-in,
.room {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: clamp(3.5rem, 8vw, 7rem) var(--gutter);
}

.room + .room { padding-top: 0; }

.room-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem 3rem;
    align-items: end;
    margin-bottom: clamp(1.8rem, 4vw, 3rem);
}

.room-title,
.wall-title {
    margin: 0;
    font-family: var(--display);
    font-weight: var(--title-weight);
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: var(--title-track);
    text-transform: var(--title-case);
    text-wrap: balance;
}

.wall-title { font-size: clamp(2.4rem, 6vw, 4.6rem); }

.room-lede,
.wall-lede {
    margin: 0;
    max-width: 52ch;
    font-size: 1.06rem;
    line-height: 1.6;
    color: var(--ink-2);
    text-wrap: pretty;
}

.wall .wall-lede, .wall .room-lede { color: var(--wall-mute); }
.wall-soft .room-lede { color: var(--ink-2); }
.wall-head .wall-in { padding-block: clamp(3rem, 7vw, 5.5rem); display: grid; gap: 1.2rem; }

.room-more { margin-top: 2rem; }

.prose { max-width: 68ch; font-size: 1.08rem; line-height: 1.72; color: var(--ink); }
.prose p { margin: 0 0 1.1em; }

.empty-note {
    margin: 0;
    padding: 1.4rem 1.6rem;
    border: 1px dashed var(--rule-strong);
    color: var(--ink-2);
    max-width: 60ch;
}

/* ---- Actions -------------------------------------------------------- */

.acts { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

.act {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 3rem;
    padding: 0.8rem 1.35rem;
    border-radius: var(--act-radius);
    font-family: var(--ui);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 220ms var(--ease), color 220ms var(--ease), border-color 220ms var(--ease), transform 220ms var(--ease), box-shadow 300ms var(--ease);
}

.act svg { width: 1.05rem; height: 1.05rem; fill: currentColor; flex-shrink: 0; }
.act b { font-weight: 700; font-variant-numeric: tabular-nums; }

.act-primary {
    background: var(--brand);
    color: var(--on-brand);
    box-shadow: 0 10px 24px -14px rgba(var(--brand-rgb), 0.9);
}

.act-primary:hover { background: var(--brand-deep); transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(var(--brand-rgb), 0.9); }

.act-quiet {
    border: 1px solid var(--rule-strong);
    color: var(--ink);
    background: transparent;
}

.act-quiet:hover { border-color: var(--brand); color: var(--brand-deep); }

/* On a brand wall the brightest point is the call: an inverted button */
.wall:not(.wall-soft) .act-primary { background: var(--sheet); color: var(--brand-deep); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.55); }
.wall:not(.wall-soft) .act-primary:hover { background: var(--brand-tint); }
.wall:not(.wall-soft) .act-quiet { border-color: var(--wall-line); color: var(--wall-ink); }
.wall:not(.wall-soft) .act-quiet:hover { border-color: var(--wall-ink); color: var(--wall-ink); }
.is-calm .wall .act-primary { background: var(--brand); color: var(--on-brand); }
.is-calm .wall .act-primary:hover { background: var(--brand-deep); }
.is-calm .wall .act-quiet { border-color: var(--rule-strong); color: var(--ink); }

/* ---- Frames (photograph on a mat, with a label) ---------------------- */

.frame {
    position: relative;
    display: block;
    margin: 0;
    padding: var(--mat-pad);
    background: var(--mat);
    border-radius: var(--frame-radius);
    box-shadow: var(--frame-shadow);
    color: var(--ink);
    text-decoration: none;
}

.frame img,
.frame iframe {
    display: block;
    width: 100%;
    border-radius: calc(var(--frame-radius) * 0.6);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.frame img { aspect-ratio: 4 / 3; object-fit: cover; }

.frame-label {
    display: grid;
    gap: 0.15rem;
    padding: 0.85rem 0.15rem 0.1rem;
    font-family: var(--ui);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--ink-2);
}

.frame-label strong { color: var(--ink); font-size: 0.92rem; }

.frame-empty {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    background: var(--brand-wash);
    color: var(--brand-line);
    font-family: var(--display);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    letter-spacing: 0.04em;
}

/* ---- Hero ----------------------------------------------------------- */

.hero2 { overflow: hidden; }

.hero2-in {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: center;
    padding-block: clamp(3rem, 7vw, 6rem) clamp(3.5rem, 8vw, 7rem);
}

.hero2-copy { display: grid; gap: 1.3rem; justify-items: start; }

.hero2-name {
    margin: 0;
    display: grid;
    gap: 0.35rem;
    font-weight: var(--title-weight);
    line-height: 0.92;
}

.hero2-given {
    font-family: var(--ui);
    font-size: clamp(1.1rem, 1.9vw, 1.45rem);
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.2;
    color: var(--wall-mute);
}

.hero2-family {
    font-family: var(--display);
    font-size: clamp(3.4rem, 9vw, 6rem);
    letter-spacing: var(--title-track);
    text-transform: var(--title-case);
}

.hero2-role {
    margin: 0;
    font-family: var(--ui);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--wall-ink);
}

.hero2-lede { margin: 0; max-width: 46ch; font-size: 1.08rem; line-height: 1.6; color: var(--wall-mute); }

.hero2 .status { color: var(--wall-mute); margin: 0; }

.hero2-frame { justify-self: end; width: min(100%, 30rem); }
.hero2-frame img { aspect-ratio: 4 / 5; object-position: center 22%; }

/* The one authored motion: the portrait is hung on the wall — it settles, its shadow lands */
@media (prefers-reduced-motion: no-preference) {
    .hero2-frame { animation: hang 1.1s var(--ease) both; }
    .hero2-copy > * { animation: settle 0.9s var(--ease) both; }
    .hero2-copy > :nth-child(2) { animation-delay: 60ms; }
    .hero2-copy > :nth-child(3) { animation-delay: 120ms; }
    .hero2-copy > :nth-child(4) { animation-delay: 180ms; }
    .hero2-copy > :nth-child(5) { animation-delay: 240ms; }
}

@keyframes hang {
    from { transform: translateY(-14px) rotate(-0.6deg); box-shadow: 0 1px 1px rgba(15, 20, 25, 0.06), 0 4px 10px -6px rgba(15, 20, 25, 0.2); }
    to { transform: none; box-shadow: var(--frame-shadow); }
}

@keyframes settle {
    from { opacity: 0.001; transform: translateY(10px); filter: blur(3px); }
    to { opacity: 1; transform: none; filter: none; }
}

/* ---- Facts (a wall label, not a metric strip) ------------------------ */

.facts-room { padding-block: clamp(2rem, 4vw, 3rem); }

.facts {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    border-top: 1px solid var(--ink);
}

.fact {
    display: grid;
    grid-template-rows: auto auto 1fr;
    gap: 0.35rem;
    padding: 1.1rem 1.4rem 1.2rem 0;
    border-bottom: 1px solid var(--rule);
}

.fact + .fact { padding-left: 1.4rem; border-left: 1px solid var(--rule); }

.fact dt { order: 2; font-family: var(--ui); font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.fact-value { order: 1; margin: 0; font-family: var(--display); font-size: clamp(1.9rem, 3.4vw, 2.6rem); line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.fact-note { order: 3; margin: 0; font-size: 0.86rem; line-height: 1.45; color: var(--ink-2); }

/* ---- Operations ------------------------------------------------------ */

.proc-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.6rem, 3.5vw, 3rem) clamp(1.2rem, 2.6vw, 2.2rem);
}

.proc-card {
    display: grid;
    gap: 1.05rem;
    height: 100%;
    color: var(--ink);
    text-decoration: none;
}

.proc-frame { transition: transform 450ms var(--ease), box-shadow 450ms var(--ease); }
.proc-card:hover .proc-frame { transform: translateY(-4px); box-shadow: 0 1px 1px rgba(15, 20, 25, 0.06), 0 30px 54px -28px rgba(15, 20, 25, 0.6); }

.proc-label { display: grid; gap: 0.45rem; align-content: start; }

.proc-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
    font-family: var(--ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink-2);
}

.proc-no {
    display: inline-grid;
    place-items: center;
    min-width: 2.2rem;
    padding: 0.18rem 0.45rem;
    background: var(--brand);
    color: var(--on-brand);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
    border-radius: calc(var(--act-radius) * 0.5);
}

.proc-name {
    font-family: var(--display);
    font-weight: var(--title-weight);
    font-size: clamp(1.25rem, 1.9vw, 1.5rem);
    line-height: 1.15;
    letter-spacing: var(--title-track);
    text-wrap: balance;
}

.proc-sum { font-size: 0.95rem; line-height: 1.55; color: var(--ink-2); }

.proc-go {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-family: var(--ui);
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--brand-deep);
}

.proc-go svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform 300ms var(--ease); }
.proc-card:hover .proc-go svg { transform: translateX(4px); }

.proc-hero-in {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: center;
}

.proc-hero-copy { display: grid; gap: 1.1rem; justify-items: start; }
.proc-meta-lg { color: var(--wall-mute); font-size: 0.9rem; }
.wall:not(.wall-soft) .proc-meta-lg .proc-no { background: var(--sheet); color: var(--brand-deep); }
.is-calm .wall .proc-meta-lg .proc-no { background: var(--brand); color: var(--on-brand); }

.crumb {
    font-family: var(--ui);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--wall-mute);
    text-decoration: none;
}

.crumb:hover { color: var(--wall-ink); text-decoration: underline; }

.proc-hero-frame img { aspect-ratio: 5 / 4; }

.proc-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
}

.spec-card {
    position: sticky;
    top: calc(var(--rail-h) + 1.5rem);
    padding: 1.4rem 1.5rem 1.2rem;
    background: var(--sheet);
    border: 1px solid var(--rule);
    border-radius: var(--card-radius);
    box-shadow: inset 0 3px 0 var(--brand);
}

.spec-title {
    margin: 0 0 0.8rem;
    font-family: var(--ui);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
}

.spec-list { margin: 0; display: grid; }
.spec-list > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 1rem; padding: 0.7rem 0; border-top: 1px solid var(--rule); }
.spec-list dt { font-family: var(--ui); font-size: 0.85rem; color: var(--ink-2); }
.spec-list dd { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--ink); }
.spec-list a { color: var(--brand-deep); }

/* ---- Patient path: one vertical axis --------------------------------- */

.path {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    counter-reset: step;
    border-top: 2px solid var(--brand);
}

.path > li {
    position: relative;
    display: grid;
    gap: 0.5rem;
    align-content: start;
    padding: 1.6rem 1.6rem 0 0;
    counter-increment: step;
}

.path > li::before {
    content: counter(step);
    position: absolute;
    top: -0.95rem;
    left: 0;
    display: grid;
    place-items: center;
    width: 1.8rem;
    height: 1.8rem;
    background: var(--ground);
    border: 2px solid var(--brand);
    border-radius: 50%;
    font-family: var(--ui);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--brand-deep);
}

.path > li strong { font-family: var(--ui); font-size: 1.02rem; font-weight: 600; line-height: 1.4; color: var(--ink); }
.path > li span { font-size: 0.93rem; color: var(--ink-2); }
.path > li a { font-weight: 700; color: var(--brand-deep); font-variant-numeric: tabular-nums; }

/* ---- About ------------------------------------------------------------ */

.about2-in { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(1.5rem, 5vw, 5rem); align-items: start; }
.about2-text { margin: 0 0 1.6rem; max-width: 60ch; font-family: var(--display); font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.about2-logos { display: flex; flex-wrap: wrap; gap: 1.6rem; align-items: center; margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.about2-logos img { height: 2.2rem; width: auto; filter: grayscale(1); opacity: 0.75; transition: filter 300ms ease, opacity 300ms ease; }
.about2-logos a:hover img { filter: none; opacity: 1; }
.about2-logos span { font-family: var(--ui); font-weight: 600; color: var(--ink-2); }

/* ---- Principles -------------------------------------------------------- */

.principles { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3rem; }
.principles > div { padding: 1.3rem 0; border-top: 1px solid var(--rule); }
.principles dt { font-family: var(--ui); font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--ink); }
.principles dd { margin: 0; max-width: 52ch; color: var(--ink-2); line-height: 1.6; }

/* ---- Gallery wall ------------------------------------------------------ */

.gallery2 .room-title { color: var(--wall-ink); }
.is-calm .gallery2 .room-title { color: var(--ink); }

.hang { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: clamp(1.2rem, 3vw, 2.6rem); align-items: start; }
.hang .frame:nth-child(2) { margin-top: clamp(1.5rem, 5vw, 4rem); }
.hang .frame:nth-child(3) { margin-top: clamp(0.6rem, 2vw, 1.5rem); }
.hang .frame:hover { transform: translateY(-3px); }
.hang .frame { transition: transform 450ms var(--ease); }

/* ---- Notes (thanks) ---------------------------------------------------- */

.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1.4rem, 3vw, 2.4rem); }
.note { margin: 0; display: grid; gap: 1rem; align-content: space-between; padding-top: 1.2rem; border-top: 2px solid var(--brand); }
.note blockquote { margin: 0; font-family: var(--display); font-size: 1.15rem; line-height: 1.5; color: var(--ink); }
.note figcaption { display: grid; font-size: 0.86rem; color: var(--ink-2); }
.note figcaption strong { color: var(--ink); font-family: var(--ui); }

/* ---- Index (articles) --------------------------------------------------- */

.index { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.index-row {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 1.5rem;
    align-items: baseline;
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    text-decoration: none;
    transition: background-color 250ms ease;
}
.index-row > * { transition: transform 300ms var(--ease); }
.index-row:hover { background: var(--brand-wash); }
.index-row:hover > * { transform: translateX(0.9rem); }
.index-row time { font-family: var(--ui); font-size: 0.85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.index-row strong { font-family: var(--display); font-weight: var(--title-weight); font-size: 1.2rem; line-height: 1.25; }
.index-row span { font-size: 0.93rem; color: var(--ink-2); line-height: 1.5; }

/* ---- Books (compact shelf) ---------------------------------------------- */

.shelf { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.8rem 2rem; }
.spine { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.spine img { width: 3.4rem; aspect-ratio: 2 / 3; object-fit: cover; box-shadow: 0 8px 16px -10px rgba(0, 0, 0, 0.6); transition: transform 300ms var(--ease); }
.spine:hover img { transform: translateY(-3px) rotate(-1deg); }
.spine-text { display: grid; gap: 0.15rem; }
.spine-text strong { font-family: var(--display); font-weight: var(--title-weight); font-size: 1.05rem; line-height: 1.25; }
.spine-text span { font-size: 0.82rem; color: var(--ink-2); }
.spine:not(:has(img)) { grid-template-columns: 1fr; }

/* ---- Links ---------------------------------------------------------------- */

.link-group + .link-group { margin-top: 2.2rem; }
.link-group-name { margin: 0 0 0.6rem; font-family: var(--ui); font-size: 0.95rem; font-weight: 700; color: var(--ink-2); }
.link-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.link-row {
    display: grid;
    grid-template-columns: 2.8rem minmax(0, 1fr) auto;
    gap: 1.1rem;
    align-items: center;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--rule);
    color: var(--ink);
    text-decoration: none;
    transition: background-color 250ms ease;
}
.link-row > * { transition: transform 300ms var(--ease); }
.link-row:hover { background: var(--brand-wash); }
.link-row:hover > * { transform: translateX(0.6rem); }
.link-logo { width: 2.8rem; height: 2.8rem; object-fit: contain; border-radius: calc(var(--act-radius) * 0.6); background: var(--sheet); border: 1px solid var(--rule); }
.link-initial { display: grid; place-items: center; background: var(--brand); color: var(--on-brand); border: 0; font-family: var(--display); font-size: 1.2rem; }
.link-text { display: grid; gap: 0.15rem; }
.link-text strong { font-family: var(--ui); font-size: 1rem; }
.link-text span { font-size: 0.88rem; color: var(--ink-2); }
.link-host { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--ui); font-size: 0.82rem; color: var(--brand-deep); white-space: nowrap; }
.link-host svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* ---- Map ------------------------------------------------------------------- */

.map2 { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.map2-copy { display: grid; gap: 1.4rem; justify-items: start; }
.map2-copy .spec-list { width: 100%; }
.map2-frame { padding: calc(var(--mat-pad) * 0.6); }
.map2-frame iframe { aspect-ratio: 4 / 3; border: 0; height: auto; min-height: 20rem; }

/* ---- Closing call ------------------------------------------------------------ */

.call-band-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem 4rem; align-items: end; }
.call-title { margin: 0 0 0.8rem; font-family: var(--display); font-weight: var(--title-weight); font-size: clamp(1.8rem, 3.6vw, 2.8rem); line-height: 1.08; letter-spacing: var(--title-track); text-transform: var(--title-case); text-wrap: balance; max-width: 22ch; }
.call-desc { margin: 0; max-width: 48ch; color: var(--wall-mute); }
.call-side { display: grid; gap: 0.6rem; justify-items: end; text-align: right; }
.call-number {
    font-family: var(--display);
    font-size: clamp(2rem, 4.6vw, 3.6rem);
    line-height: 1;
    color: var(--wall-ink);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 100% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    padding-bottom: 0.15em;
    transition: background-size 400ms var(--ease);
}
.call-number:hover { background-size: 0% 2px; background-position: 100% 100%; }
.call-or { margin: 0; color: var(--wall-mute); font-size: 0.92rem; }
.call-or a { color: var(--wall-ink); }
.call-band .status { margin: 0; color: var(--wall-mute); }

/* ---- Custom page blocks ---------------------------------------------------------- */

.cms-room { display: grid; gap: clamp(2.5rem, 6vw, 4.5rem); }
.home-page-inline { display: grid; gap: 2rem; }
.pb { display: grid; gap: 1.2rem; }
.pb-title { margin: 0; font-family: var(--display); font-weight: var(--title-weight); font-size: clamp(1.5rem, 2.8vw, 2.2rem); letter-spacing: var(--title-track); line-height: 1.1; text-wrap: balance; }
.pb-intro { margin: 0; max-width: 60ch; color: var(--ink-2); }
.pb-figure { max-width: 56rem; }
.pb-figure img { aspect-ratio: auto; }
.pb-video { width: 100%; max-width: 56rem; }
.pb-embed { max-width: 56rem; }
.pb-caption { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.pb-quote { margin: 0; max-width: 46rem; padding: 0.4rem 0 0 1.6rem; border-left: 1px solid var(--brand); }
.pb-quote blockquote { margin: 0; font-family: var(--display); font-size: clamp(1.35rem, 2.6vw, 1.9rem); line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.pb-quote figcaption { margin-top: 0.9rem; font-family: var(--ui); font-size: 0.9rem; color: var(--ink-2); }
.pb-callout { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.2rem 2rem; padding: clamp(1.4rem, 3vw, 2.2rem); background: var(--brand-wash); border-radius: var(--card-radius); }
.pb-callout p { margin: 0; max-width: 52ch; font-size: 1.08rem; }
.pb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.6rem; }
.pb-card { display: grid; gap: 0.6rem; align-content: start; color: var(--ink); text-decoration: none; padding-top: 1rem; border-top: 1px solid var(--rule-strong); }
.pb-card[href]:hover strong { color: var(--brand-deep); }
.pb-card strong { font-family: var(--ui); font-size: 1.05rem; }
.pb-card > span:last-child { color: var(--ink-2); font-size: 0.93rem; }
.frame-sm { --mat-pad: 8px; margin-bottom: 0.4rem; }
.pb-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: clamp(1rem, 2.5vw, 2rem); }

/* ==========================================================================
   STYLE · Изложбена зала (gallery) — painted walls, white mats, wall labels
   ========================================================================== */

.style-gallery {
    --display: "Tenor Sans", "Golos Text", Georgia, serif;
    --ui: "Golos Text", -apple-system, "Segoe UI", sans-serif;
    --body: "Golos Text", -apple-system, "Segoe UI", sans-serif;
    --radius-sm: 0px;
    --radius: 0px;
    --radius-lg: 0px;
    --title-case: none;
    --title-track: -0.01em;
}

.style-gallery .hero2-family { text-transform: uppercase; letter-spacing: 0.02em; font-size: clamp(3rem, 8.4vw, 5.6rem); }
.style-gallery .hero2-frame { --mat-pad: clamp(16px, 2.6vw, 34px); }

/* The wall label beside the portrait is a separate card, pinned to the mat's corner */
.style-gallery .hero2-frame .frame-label {
    position: absolute;
    left: calc(var(--mat-pad) * -1.4);
    bottom: calc(var(--mat-pad) * 1.6);
    max-width: 15rem;
    padding: 0.85rem 1rem;
    background: var(--sheet);
    box-shadow: 0 10px 24px -16px rgba(0, 0, 0, 0.55);
}

.style-gallery .room-title { font-size: clamp(1.9rem, 3.8vw, 3rem); }
.style-gallery .proc-grid > li:nth-child(3n+2) .proc-card { margin-top: clamp(0rem, 3vw, 2.4rem); }
.style-gallery .note blockquote,
.style-gallery .pb-quote blockquote,
.style-gallery .about2-text { font-family: var(--ui); font-weight: 400; }

/* ==========================================================================
   STYLE · Операционна зала (theatre) — dark drape field and a pool of light
   ========================================================================== */

.style-theatre {
    --display: "Onest", -apple-system, "Segoe UI", sans-serif;
    --ui: "Onest", -apple-system, "Segoe UI", sans-serif;
    --body: "Onest", -apple-system, "Segoe UI", sans-serif;
    --title-weight: 700;
    --title-track: -0.035em;
    --wall-bg: var(--brand-ink);
    --wall-deep: var(--brand-ink);
    --wall-mute: var(--on-brand-mute);
    --mat: transparent;
    --mat-pad: 0px;
    --frame-radius: 18px;
    --act-radius: 999px;
    --card-radius: 16px;
    --frame-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}

.style-theatre.is-calm { --wall-bg: var(--brand-wash); --wall-deep: var(--brand-wash); }

/* The operating lamp: a soft pool of brand light behind whatever the wall holds */
.style-theatre .wall:not(.wall-soft)::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 74% 42%, rgba(var(--brand-rgb), 0.55) 0%, rgba(var(--brand-rgb), 0.18) 26%, transparent 52%),
        radial-gradient(circle at 74% 42%, rgba(255, 255, 255, 0.10) 0%, transparent 22%);
    pointer-events: none;
}

.style-theatre.is-calm .wall:not(.wall-soft)::before { background: radial-gradient(circle at 74% 42%, rgba(var(--brand-rgb), 0.16) 0%, transparent 50%); }
.style-theatre .wall > * { position: relative; }
.style-theatre .frame img { box-shadow: none; }
.style-theatre .frame-label { padding-inline: 0; }
.style-theatre .hero2 .frame-label { color: var(--wall-mute); }
.style-theatre .hero2 .frame-label strong { color: var(--wall-ink); }
.style-theatre .hero2-frame img { border-radius: 50% 50% 18px 18px / 36% 36% 18px 18px; }
.style-theatre .proc-frame { background: var(--brand-wash); padding: 10px; border-radius: 22px; }
.style-theatre .proc-frame img { border-radius: 14px; }
.style-theatre .proc-card:hover .proc-frame { background: var(--brand-tint); }
.style-theatre .facts { border-top: 0; gap: 1rem; }
.style-theatre .fact { padding: 1.3rem 1.4rem; border: 0; border-radius: 16px; background: var(--brand-wash); }
.style-theatre .fact + .fact { border-left: 0; padding-left: 1.4rem; }
.style-theatre .spec-card { box-shadow: inset 0 3px 0 var(--brand), 0 20px 40px -30px rgba(var(--brand-rgb), 0.8); }
.style-theatre .hang .frame:nth-child(n) { margin-top: 0; }
.style-theatre .index { border-top-color: var(--rule-strong); }

@media (prefers-reduced-motion: no-preference) {
    .style-theatre .hero2::before { animation: lamp 1.6s var(--ease) both; }
}

@keyframes lamp { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   STYLE · Класически (classic) — light, calm, rounded
   ========================================================================== */

.style-classic {
    --wall-bg: var(--brand-wash);
    --wall-ink: var(--ink);
    --wall-mute: var(--ink-2);
    --wall-line: var(--rule);
    --wall-deep: var(--brand-wash);
    --mat: var(--sheet);
    --mat-pad: 0px;
    --frame-radius: 20px;
    --act-radius: 12px;
    --card-radius: 16px;
    --title-weight: 600;
    --frame-shadow: 0 24px 50px -28px rgba(15, 23, 42, 0.35);
}

.style-classic .frame { overflow: hidden; }
.style-classic .frame img { border-radius: 0; box-shadow: none; }
.style-classic .frame-label { padding: 0.9rem 1.1rem 1rem; }
.style-classic .proc-frame { box-shadow: 0 14px 34px -24px rgba(15, 23, 42, 0.4); }
.style-classic .wall .act-primary { background: var(--brand); color: var(--on-brand); }
.style-classic .wall .act-primary:hover { background: var(--brand-deep); }
.style-classic .wall .act-quiet { border-color: var(--rule-strong); color: var(--ink); }
.style-classic .hero2-name .hero2-given { color: var(--ink-2); }
.style-classic .proc-meta-lg .proc-no { background: var(--brand); color: var(--on-brand); }

/* ---- Header follows the theme ------------------------------------------------------- */

.topbar { background: var(--brand-ink); }
.topbar-facts svg { fill: var(--brand-line); }
.style-gallery .nav-cta, .style-gallery .nav-toggle, .style-gallery .lang-line { border-radius: 0; }
.style-theatre .nav-cta { border-radius: 999px; }
.style-gallery .mark-logo-wrap { border-radius: 0; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1080px) {
    .proc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .style-gallery .proc-grid > li .proc-card { margin-top: 0; }
    .proc-body { grid-template-columns: 1fr; }
    .spec-card { position: static; }
    .notes { grid-template-columns: 1fr; }
    .map2 { grid-template-columns: 1fr; }
    .about2-in { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .hero2-in, .proc-hero-in { grid-template-columns: 1fr; }
    .hero2-frame { justify-self: start; width: min(100%, 26rem); order: -1; }
    .style-gallery .hero2-frame .frame-label { position: static; max-width: none; box-shadow: none; padding: 0.85rem 0.15rem 0.1rem; background: none; }
    .room-head { grid-template-columns: 1fr; }
    .hang { grid-template-columns: 1fr 1fr; }
    .hang .frame:nth-child(n) { margin-top: 0; }
    .hang .frame:first-child { grid-column: 1 / -1; }
    .principles { grid-template-columns: 1fr; }
    .index-row { grid-template-columns: 1fr; gap: 0.35rem; }
    .call-band-in { grid-template-columns: 1fr; }
    .call-side { justify-items: start; text-align: left; }
    .fact + .fact { padding-left: 0; border-left: 0; }
    .facts { grid-template-columns: 1fr 1fr; }
    .fact:nth-child(even) { padding-left: 1.2rem; border-left: 1px solid var(--rule); }
}

@media (max-width: 600px) {
    .proc-grid { grid-template-columns: 1fr; }
    .hero2-family { font-size: clamp(2.6rem, 13vw, 3.6rem); }
    .style-gallery .hero2-family { font-size: clamp(2.3rem, 11.5vw, 3.2rem); }
    .hero2-frame { width: 100%; }
    .acts { width: 100%; }
    .acts .act-primary { flex: 1 1 100%; justify-content: center; }
    .link-row { grid-template-columns: 2.4rem minmax(0, 1fr); }
    .link-host { grid-column: 2; }
    .spec-list > div { grid-template-columns: 6rem minmax(0, 1fr); }
    .facts { grid-template-columns: 1fr; }
    .fact:nth-child(even) { padding-left: 0; border-left: 0; }
    .call-number { font-size: clamp(1.8rem, 9vw, 2.4rem); }
    .wall-in, .room { padding-inline: 1rem; }
}

/* ==========================================================================
   Admin — Визия, начална страница, операции, надписи
   ========================================================================== */

.vis-styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; }

.vis-style {
    display: grid;
    gap: 0.5rem;
    padding: 0.8rem;
    text-align: left;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    color: var(--ink);
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.vis-style:hover { border-color: var(--rule-strong); }
.vis-style.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.vis-name { font-weight: 700; }
.vis-note { font-size: 0.82rem; line-height: 1.45; color: var(--ink-2); }

/* Miniature of each style, drawn with the live palette */
.vis-mini { display: grid; gap: 6px; padding: 8px; height: 8.5rem; background: var(--ground); border-radius: 6px; overflow: hidden; }
.vis-mini .m-bar { height: 8px; background: var(--brand-ink); }
.vis-mini .m-field { display: grid; grid-template-columns: 1fr 0.8fr; gap: 8px; align-items: center; padding: 10px; background: var(--brand); }
.vis-mini .m-photo { height: 3.4rem; background: linear-gradient(160deg, var(--brand-tint), var(--brand-line)); border: 5px solid #fff; order: 2; }
.vis-mini .m-lines { display: grid; gap: 4px; }
.vis-mini .m-lines i { display: block; height: 4px; background: rgba(255, 255, 255, 0.75); }
.vis-mini .m-lines i:first-child { height: 9px; width: 80%; background: #fff; }
.vis-mini .m-lines i:nth-child(3) { width: 60%; }
.vis-mini .m-lines b { display: block; width: 50%; height: 9px; margin-top: 3px; background: #fff; }
.vis-mini .m-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vis-mini .m-row i { height: 1.4rem; background: #fff; box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.4); }
.vis-mini-theatre .m-field { background: var(--brand-ink); background-image: radial-gradient(circle at 75% 50%, rgba(var(--brand-rgb), 0.9), transparent 55%); }
.vis-mini-theatre .m-photo { border: 0; border-radius: 50% 50% 6px 6px; }
.vis-mini-theatre .m-row i { background: var(--brand-wash); border-radius: 6px; box-shadow: none; }
.vis-mini-theatre .m-lines b { border-radius: 999px; }
.vis-mini-classic .m-field { background: var(--brand-wash); }
.vis-mini-classic .m-photo { border: 0; border-radius: 6px; }
.vis-mini-classic .m-lines i { background: var(--ink-3); }
.vis-mini-classic .m-lines i:first-child { background: var(--ink); }
.vis-mini-classic .m-lines b { background: var(--brand); border-radius: 3px; }
.vis-mini-classic .m-row i { border-radius: 6px; }

.vis-presets { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.vis-preset {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    background: #fff;
    border: 1px solid var(--rule);
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--ink);
    cursor: pointer;
}
.vis-preset.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.vis-dot { width: 1.1rem; height: 1.1rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.vis-custom input[type="color"] { width: 1.5rem; height: 1.5rem; padding: 0; border: 0; background: none; cursor: pointer; }
.vis-sub { margin: 1.6rem 0 0.6rem; font-size: 0.95rem; }
.vis-swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-radius: 8px; overflow: hidden; }
.vis-swatch { display: grid; align-items: end; height: 4.2rem; padding: 0.4rem; }
.vis-swatch code { font-size: 0.72rem; }

.vis-preview { display: grid; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.vp-wall { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.2rem; align-items: center; padding: 1.4rem; background: var(--brand); color: #fff; }
.vp-frame { padding: 7px; background: #fff; box-shadow: 0 12px 20px -14px rgba(0, 0, 0, 0.7); }
.vp-frame span { display: block; width: 4.5rem; height: 5.5rem; background: linear-gradient(160deg, var(--brand-tint), var(--brand-line)); }
.vp-copy { display: grid; gap: 0.3rem; justify-items: start; }
.vp-kicker { font-size: 0.8rem; color: var(--on-brand-mute); }
.vp-copy strong { font-size: 1.3rem; }
.vp-btn { margin-top: 0.4rem; padding: 0.45rem 0.9rem; background: #fff; color: var(--brand-deep); font-weight: 700; font-size: 0.85rem; }
.vp-sheet { display: grid; gap: 0.6rem; justify-items: start; padding: 1.2rem 1.4rem; background: var(--ground); color: var(--ink); }
.vp-sheet p { margin: 0; }
.vp-sheet a { color: var(--brand-deep); text-decoration: underline; }
.vp-chip { padding: 0.15rem 0.5rem; background: var(--brand); color: #fff; font-size: 0.75rem; font-weight: 700; }

.home-order { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.home-order li { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto auto auto auto; gap: 0.6rem; align-items: center; padding: 0.55rem 0.8rem; background: #fff; border: 1px solid var(--rule); border-radius: 8px; }
.home-order li.off { background: var(--ground); }
.home-order li.off .ho-name { color: var(--ink-3); text-decoration: line-through; }
.ho-num { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 0.85rem; }
.ho-name { font-weight: 600; }
.ho-name small { margin-left: 0.4rem; font-weight: 400; color: var(--ink-3); }
.ho-add { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 1rem; }

.proc-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem; align-items: center; }
.proc-toggle { display: inline-flex; align-items: baseline; gap: 0.7rem; padding: 0.2rem 0; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.proc-toggle small { color: var(--ink-3); }
.proc-code { display: inline-block; min-width: 2.2rem; padding: 0.1rem 0.4rem; background: var(--brand); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; }
.proc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.spec-edit { display: grid; gap: 0.5rem; padding: 0.8rem; margin-bottom: 0.5rem; background: var(--ground); border-radius: 8px; justify-items: start; }
.spec-edit > .fields { width: 100%; }
.sec-add { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.label-grid { display: grid; grid-template-columns: minmax(8rem, 0.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.4rem 0.6rem; align-items: center; }
.label-key { font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; color: var(--ink-3); }

@media (max-width: 700px) {
    .label-grid { grid-template-columns: 1fr; }
    .label-key { margin-top: 0.6rem; }
    .home-order li { grid-template-columns: 2rem minmax(0, 1fr) auto auto; }
    .home-order li .switch { grid-column: 2; }
}

/* ---- Fixes after the first inspection round ---- */

/* Header: wider than the content column, the call never shrinks */
.rail { padding-inline: max(var(--gutter), calc((100% - 1400px) / 2)); }
.nav-cta { flex-shrink: 0; }
.nav-item, .nav-drop { flex-shrink: 0; }

/* Blazor focuses the page heading after navigation; that focus is programmatic, not keyboard */
h1:focus { outline: none; }

/* A heading directly above the path axis needs room for the step markers */
.room-title + .path,
.pb-title + .path { margin-top: 2.6rem; }

/* Theatre frames have no mat, so labels sit straight on the dark wall */
.style-theatre .wall:not(.wall-soft) .frame-label { color: var(--wall-mute); }
.style-theatre .wall:not(.wall-soft) .frame-label strong { color: var(--wall-ink); }
.style-theatre.is-calm .wall .frame-label { color: var(--ink-2); }

@media (max-width: 820px) {
    /* The path turns into a vertical axis: one stop per step */
    .path {
        grid-template-columns: 1fr;
        border-top: 0;
        border-left: 2px solid var(--brand);
        padding-left: 1.7rem;
        margin-left: 0.9rem;
    }
    .path > li { padding: 0.1rem 0 1.6rem; }
    .path > li:last-child { padding-bottom: 0.2rem; }
    .path > li::before { top: 0; left: calc(-1.7rem - 0.9rem - 1px); }
    .room-title + .path, .pb-title + .path { margin-top: 1.8rem; }
}

@media (max-width: 600px) {
    .facts { grid-template-columns: 1fr 1fr; }
    .fact { padding-right: 0.8rem; }
    .fact:nth-child(even) { padding-left: 1rem; border-left: 1px solid var(--rule); }
    .fact-note { display: none; }
}

/* The custom-colour chip is a <label>; undo the admin form-label styling */
.vis-preset.vis-custom { display: inline-flex; flex-direction: row; align-items: center; margin: 0; }
.vis-preset.vis-custom span { margin: 0; font-size: 0.9rem; font-weight: 400; letter-spacing: normal; text-transform: none; color: var(--ink); }
