/* Each study lights its own room. The marks keep their original colours. */
#detail[data-room="bio"][data-studio-study="cedar"] {
  --world-floor: #101939;
  --world-wash: #304c9d;
  --world-ink: #fff2d8;
  --world-accent: #f5c76e;
  --studio-fill: #6c62cf;
  --studio-muted: #dedcf4;
}
#detail[data-room="bio"][data-studio-study="beirutii"] {
  --world-floor: #380f25;
  --world-wash: #973441;
  --world-ink: #fff2db;
  --world-accent: #ffd38c;
  --studio-fill: #ee7943;
  --studio-muted: #f4d9ce;
}
#detail[data-room="bio"][data-studio-study="brivendale"] {
  --world-floor: #0b302f;
  --world-wash: #23665e;
  --world-ink: #fff4dd;
  --world-accent: #ffc992;
  --studio-fill: #73b097;
  --studio-muted: #d6e5da;
}
#detail[data-room="bio"][data-studio-study="brivendale"][data-studio-view="1"] {
  --world-floor: #ccdfcc;
  --world-wash: #fff2d8;
  --world-ink: #172d29;
  --world-accent: #794522;
  --studio-fill: #fff8e7;
  --studio-muted: #30493d;
}
#detail[data-room="bio"] .room-atmosphere {
  background:
    radial-gradient(ellipse at var(--lamp-x) var(--lamp-y), var(--world-wash), transparent 66%),
    radial-gradient(ellipse at 109% 107%, color-mix(in srgb, var(--studio-fill) 44%, transparent), transparent 53%);
}

#bio-panel.studio-room {
  position: relative;
  min-width: 0;
  padding: 0;
  color: var(--world-ink);
  background: transparent;
  font-family: Archivo, Arial, sans-serif;
}
.studio-room .studio-layout {
  width: 100%;
  min-height: calc(100dvh - var(--room-bar-h, 72px));
  display: grid;
  grid-template-columns: minmax(0, .89fr) minmax(0, 1.11fr);
  grid-template-areas: "intro gallery" "story gallery";
  align-content: center;
  column-gap: clamp(16px, 3vw, 64px);
  row-gap: clamp(12px, 2.3svh, 28px);
  padding: clamp(16px, 3svh, 46px) var(--pad) max(16px, 3svh, env(safe-area-inset-bottom));
}
.studio-room .studio-intro {
  grid-area: intro;
  align-self: end;
  min-width: 0;
  container-type: inline-size;
}
#bio-panel .studio-kicker {
  margin: 0 0 clamp(12px, 2.4svh, 26px);
  font: 600 clamp(.75rem, 1vw, 1rem)/1.25 Archivo, Arial, sans-serif;
}
#bio-panel .studio-kicker::before {
  display: inline-block;
  content: "";
  width: .49em;
  height: .49em;
  margin: 0 .75em .08em .09em;
  transform: rotate(45deg);
  background: var(--world-accent);
}
#bio-panel .studio-title {
  --studio-type-width: 42cqw;
  font: 900 min(var(--studio-type-width), 23svh, 20rem)/.82 BarlowPoster, "Arial Black", sans-serif;
  letter-spacing: -.043em;
  text-transform: uppercase;
  margin: 0;
  overflow-wrap: normal;
}
#bio-panel[data-study="beirutii"] .studio-title { --studio-type-width: 33cqw; }
#bio-panel[data-study="brivendale"] .studio-title { --studio-type-width: 22cqw; }
.studio-room .studio-title span { display: block; }
.studio-room .studio-title span + span { padding-left: .19em; margin-top: .025em; }
#bio-panel .studio-lead {
  max-width: 34ch;
  margin: clamp(16px, 2.7svh, 33px) 0 0;
  font: 400 clamp(1rem, 1.37vw, 1.5rem)/1.36 Archivo, Arial, sans-serif;
  letter-spacing: -.024em;
}
.studio-room .studio-story {
  grid-area: story;
  align-self: start;
  min-width: 0;
  max-width: 39ch;
}
#bio-panel .studio-story p {
  margin: 0;
  color: var(--studio-muted);
  font-size: clamp(.875rem, 1.04vw, 1.0625rem);
  line-height: 1.43;
  letter-spacing: -.012em;
}
#bio-panel .studio-story p + p { margin-top: .58em; }
.studio-room .studio-bio button {
  display: inline;
  font: inherit;
  color: var(--world-ink);
  text-decoration: underline;
  text-decoration-color: var(--world-accent);
  text-underline-offset: .19em;
  text-decoration-thickness: 1px;
}
#bio-panel button:focus-visible { outline: 2px solid var(--world-accent); outline-offset: 2px; }
.studio-room .studio-gallery {
  grid-area: gallery;
  align-self: center;
  min-width: 0;
  margin: 0;
}

/* The art fits the actual gallery on both axes, with space for the rotated bottle and optical shadow. */
.studio-room .studio-stage {
  --studio-x: 0;
  --studio-y: 0;
  position: relative;
  isolation: isolate;
  container-type: size;
  height: clamp(9rem, 59svh, 45rem);
}
.studio-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(ellipse at 55% 52%, color-mix(in srgb, var(--studio-fill) 35%, transparent), transparent 69%);
  pointer-events: none;
}
.studio-room .studio-stage :where(*) { pointer-events: none; }
.studio-room .studio-pose {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1100px;
}
.studio-room .studio-object {
  display: grid;
  place-items: center;
  position: relative;
  transform: rotateX(calc(var(--studio-y) * -4deg)) rotateY(calc(var(--studio-x) * 7deg));
  transition: transform .23s ease-out;
}
#bio-panel[data-study="cedar"] .studio-pose { perspective: none; }
#bio-panel[data-study="cedar"] .studio-object {
  width: min(89cqw, 94cqh, 43rem);
  aspect-ratio: 1056 / 1064;
  transform: none;
  transition: none;
}
.studio-room .studio-seal,
.studio-room .studio-cutout,
.studio-room .studio-wordmark {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
}
.studio-room .studio-seal { overflow: visible; }
.studio-room .studio-cutout {
  filter: drop-shadow(5px 9px 9px rgb(17 10 20 / .29));
}
#bio-panel[data-study="beirutii"] .studio-object {
  width: min(75cqw, 49cqh, 26rem);
  aspect-ratio: 510 / 950;
}
#bio-panel[data-study="beirutii"][data-view="1"] .studio-object {
  width: min(75cqw, 53cqh, 28rem);
  aspect-ratio: 550 / 941;
}
#bio-panel[data-study="beirutii"] .studio-cutout { transform: rotate(5deg); }
#bio-panel[data-study="beirutii"][data-view="1"] .studio-cutout { transform: rotate(-4deg); }
#bio-panel[data-study="brivendale"] .studio-object {
  width: min(80cqw, 63cqh, 27rem);
  aspect-ratio: 487 / 722;
}
#bio-panel[data-study="brivendale"][data-view="1"] .studio-object {
  width: min(95cqw, 230cqh, 42rem);
  aspect-ratio: 3;
  transform: none;
}
.studio-room .studio-wordmark { object-fit: contain; }

.studio-room figcaption { margin: 0; }
.studio-room .studio-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 8px;
  align-items: center;
  min-height: 44px;
  color: var(--studio-muted);
  font-size: clamp(.75rem, .86vw, .875rem);
  line-height: 1.3;
}
.studio-room .studio-caption-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: .48em;
  flex: 1 1 9em;
  min-width: 0;
}
.studio-room .studio-current-view::before {
  content: "/";
  margin-right: .48em;
  opacity: .7;
}
.studio-room .studio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5em;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  margin-left: auto;
  padding: .25em 3px;
  color: var(--world-ink);
  font-weight: 600;
  text-align: end;
  overflow-wrap: anywhere;
}
.studio-room .studio-toggle::after {
  content: "";
  flex: none;
  width: .6em;
  height: .6em;
  border-top: 1px solid var(--world-accent);
  border-right: 1px solid var(--world-accent);
  transform: rotate(45deg);
}
.studio-room .studio-index {
  border-top: 1px solid color-mix(in srgb, var(--world-ink) 33%, transparent);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0 clamp(10px, 2.3vw, 48px);
}
.studio-room .studio-choice {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  min-height: 44px;
  padding: 0 2px;
  color: var(--studio-muted);
  font: 500 clamp(.8125rem, 1.01vw, 1.0625rem)/1.15 Archivo, Arial, sans-serif;
  white-space: nowrap;
}
.studio-room .studio-choice::before {
  content: "";
  flex: none;
  width: .45em;
  height: .45em;
  margin: 0 .1em;
  border: 1px solid currentColor;
  transform: rotate(45deg);
}
.studio-room .studio-choice[aria-pressed="true"] { color: var(--world-ink); }
.studio-room .studio-choice[aria-pressed="true"]::before { background: var(--world-accent); border-color: var(--world-accent); }
@media (hover: hover) {
  .studio-room :is(.studio-choice, .studio-toggle):hover { text-decoration: underline; text-underline-offset: .27em; }
  .studio-room .studio-bio button:hover { text-decoration-thickness: 2px; }
}

/* A single reading order lets the copy and controls reflow if zoom or larger type needs more height. */
@media (max-width: 740px) {
  .studio-room .studio-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(min-content, 1fr) auto;
    grid-template-areas: "intro" "gallery" "story";
    row-gap: clamp(6px, 1.3svh, 14px);
    padding: clamp(8px, 1.8svh, 20px) var(--pad) max(10px, 2svh, env(safe-area-inset-bottom));
  }
  .studio-room .studio-gallery {
    display: grid;
    grid-template-rows: minmax(min-content, 1fr) auto;
    align-self: stretch;
  }
  #bio-panel .studio-kicker { margin-bottom: 8px; }
  #bio-panel .studio-title { --studio-type-width: 31cqw; font-size: min(var(--studio-type-width), 11.5svh, 8.5rem); }
  #bio-panel[data-study="beirutii"] .studio-title { --studio-type-width: 19.5cqw; }
  #bio-panel[data-study="brivendale"] .studio-title { --studio-type-width: 13.5cqw; }
  .studio-room .studio-title span { display: inline; }
  .studio-room .studio-title span + span { margin: 0; padding-left: .135em; }
  #bio-panel .studio-lead { max-width: 39ch; font-size: clamp(.9375rem, 3.8vw, 1.125rem); line-height: 1.32; margin-top: 8px; }
  .studio-room .studio-stage { height: auto; min-height: clamp(7.25rem, 22svh, 13rem); }
  #bio-panel[data-study="cedar"] .studio-object { width: min(87cqw, 94cqh, 27rem); }
  .studio-room .studio-index { justify-content: space-between; gap: 0 7px; }
  .studio-room .studio-story { max-width: 56ch; }
  #bio-panel .studio-story p { font-size: .875rem; line-height: 1.36; }
}

@media (min-width: 500px) and (max-height: 520px) and (orientation: landscape) {
  .studio-room .studio-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    grid-template-rows: auto auto;
    grid-template-areas: "intro gallery" "story gallery";
    column-gap: clamp(12px, 2.7vw, 36px);
    row-gap: 7px;
    padding: 9px var(--pad) max(10px, env(safe-area-inset-bottom));
  }
  .studio-room .studio-gallery { display: block; align-self: center; }
  #bio-panel .studio-kicker { font-size: .75rem; margin-bottom: 8px; }
  #bio-panel .studio-title { --studio-type-width: 31cqw; font-size: min(var(--studio-type-width), 15svh, 6rem); }
  #bio-panel[data-study="beirutii"] .studio-title { --studio-type-width: 19.5cqw; }
  #bio-panel[data-study="brivendale"] .studio-title { --studio-type-width: 13.5cqw; }
  .studio-room .studio-title span { display: inline; }
  .studio-room .studio-title span + span { margin: 0; padding-left: .135em; }
  #bio-panel .studio-lead { margin-top: 8px; font-size: .9375rem; }
  #bio-panel .studio-story p { font-size: .8125rem; line-height: 1.34; }
  .studio-room .studio-stage { min-height: 0; height: clamp(6rem, calc(100dvh - var(--room-bar-h) - 7.5rem), 16rem); }
  .studio-room .studio-index { justify-content: space-between; gap: 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  #bio-panel .studio-object { transition: none; }
}
