/* BA layout formats — approval gallery (print-spread mockups) */

.ba-layout-page {
  /* Cool print paper — not warm-cream / terracotta */
  --ba-paper: #f7f8fa;
  --ba-paper-edge: #e2e6ec;
  --ba-ink: #1c2430;
  --ba-muted: #5a6573;
  --ba-accent: #1f5c7a;
  --ba-frame-bg: rgba(255, 255, 255, 0.72);
  --ba-label: rgba(28, 36, 48, 0.7);
  --ba-shadow: 0 10px 24px rgba(28, 36, 48, 0.12), 0 2px 6px rgba(28, 36, 48, 0.06);
  --ba-gutter: 0.55rem;
}

html[data-theme="dark"] .ba-layout-page,
html[data-theme-resolved="dark"] .ba-layout-page {
  --ba-paper: #1e2430;
  --ba-paper-edge: #2c3444;
  --ba-ink: #e8edf4;
  --ba-muted: #9aa6b5;
  --ba-accent: #6eb3d0;
  --ba-frame-bg: rgba(0, 0, 0, 0.28);
  --ba-label: rgba(232, 237, 244, 0.65);
  --ba-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.25);
}

.ba-layout-page .main {
  max-width: 1180px;
}

.ba-fmt-header {
  margin-bottom: 1.25rem;
}

.ba-fmt-header .lede {
  max-width: 42rem;
}

/* Sticky vote summary */
.ba-vote-summary {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  font-size: 0.82rem;
  line-height: 1.45;
}

.ba-vote-summary__title {
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.ba-vote-summary__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.ba-vote-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.ba-vote-chip strong {
  font-weight: 600;
}

.ba-vote-chip.is-a { border-color: color-mix(in srgb, var(--ba-accent) 45%, var(--border)); }
.ba-vote-chip.is-b { border-color: color-mix(in srgb, #3d6b5a 45%, var(--border)); }
.ba-vote-chip.is-defer { opacity: 0.75; }

/* Pair sections */
.ba-pair {
  margin: 2.5rem 0 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.ba-pair:first-of-type {
  border-top: none;
  padding-top: 0.5rem;
}

.ba-pair__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.ba-pair__meta h2 {
  font-family: "Newsreader", var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.ba-pair__meta .mini {
  margin: 0;
}

.ba-pair__codes {
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* A | B row */
.ba-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 820px) {
  .ba-compare {
    grid-template-columns: 1fr;
  }
}

.ba-option {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ba-option__label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.ba-option__label h3 {
  font-family: "Manrope", var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.ba-status {
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.ba-status--exists {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
}

.ba-status--build {
  background: color-mix(in srgb, var(--warn) 18%, transparent);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
}

.ba-status--blueprint {
  background: color-mix(in srgb, var(--muted) 14%, transparent);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Spread mock container */
.ba-spread-wrap {
  perspective: 1200px;
}

.ba-spread {
  display: flex;
  gap: var(--ba-gutter);
  padding: 0.65rem;
  background: linear-gradient(145deg, var(--ba-paper-edge), color-mix(in srgb, var(--ba-paper) 80%, #fff));
  border-radius: 6px;
  box-shadow: var(--ba-shadow);
}

.ba-spread--1pp .ba-page {
  flex: 1;
  max-width: 100%;
}

.ba-page {
  flex: 1;
  min-width: 0;
  aspect-ratio: 210 / 297;
  background: var(--ba-paper);
  color: var(--ba-ink);
  border-radius: 2px;
  padding: 0.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.ba-page::after {
  content: attr(data-page);
  position: absolute;
  bottom: 0.2rem;
  right: 0.3rem;
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.04em;
  color: var(--ba-muted);
  opacity: 0.6;
}

/* Labeled text frames */
.ba-frame {
  position: relative;
  background: var(--ba-frame-bg);
  border: 1px dashed color-mix(in srgb, var(--ba-muted) 35%, transparent);
  border-radius: 2px;
  padding: 0.35rem 0.4rem 0.3rem;
  min-height: 0;
}

.ba-frame::before {
  content: attr(data-field);
  position: absolute;
  top: 0;
  left: 0;
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.44rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: var(--ba-label);
  background: var(--ba-paper);
  padding: 0.02rem 0.25rem;
  border-radius: 0 0 3px 0;
  line-height: 1.2;
  z-index: 1;
}

.ba-frame--section {
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ba-accent);
  padding-top: 0.5rem;
  flex-shrink: 0;
}

.ba-frame--title {
  font-family: "Newsreader", var(--display);
  font-size: clamp(0.72rem, 2.2vw, 0.95rem);
  font-weight: 700;
  line-height: 1.12;
  padding-top: 0.55rem;
  flex-shrink: 0;
}

.ba-frame--standfirst {
  font-family: "Newsreader", var(--display);
  font-style: italic;
  font-size: clamp(0.48rem, 1.4vw, 0.58rem);
  line-height: 1.35;
  color: var(--ba-muted);
  flex-shrink: 0;
}

.ba-frame--body {
  font-family: "Newsreader", var(--display);
  font-size: clamp(0.38rem, 1.1vw, 0.46rem);
  line-height: 1.38;
  flex: 1;
  overflow: hidden;
}

.ba-frame--subhead {
  font-family: "Manrope", var(--font);
  font-size: clamp(0.44rem, 1.2vw, 0.52rem);
  font-weight: 700;
  padding-top: 0.48rem;
  flex-shrink: 0;
}

.ba-frame--pullquote {
  font-family: "Newsreader", var(--display);
  font-size: clamp(0.44rem, 1.25vw, 0.54rem);
  font-weight: 600;
  font-style: italic;
  line-height: 1.25;
  border-left: 2px solid var(--ba-accent);
  padding-left: 0.35rem;
  flex-shrink: 0;
}

.ba-frame--ingredients {
  font-family: "Newsreader", var(--display);
  font-size: clamp(0.36rem, 1vw, 0.44rem);
  line-height: 1.32;
  white-space: pre-line;
  flex-shrink: 0;
}

.ba-frame--byline {
  font-family: "Manrope", var(--font);
  font-size: clamp(0.4rem, 1vw, 0.46rem);
  color: var(--ba-muted);
  flex-shrink: 0;
}

/* Photo frames */
.ba-photo {
  position: relative;
  background: #d8d2c8 center/cover no-repeat;
  border-radius: 2px;
  overflow: hidden;
  min-height: 0;
}

.ba-photo::before {
  content: attr(data-role);
  position: absolute;
  top: 0;
  right: 0;
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.42rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.52);
  padding: 0.1rem 0.28rem;
  border-radius: 0 0 0 3px;
  z-index: 1;
}

.ba-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Layout: DPS Classic */
.ba-layout-classic .ba-page {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
}

.ba-layout-classic .ba-frame--section,
.ba-layout-classic .ba-frame--title,
.ba-layout-classic .ba-frame--standfirst {
  grid-column: 1 / -1;
}

.ba-layout-classic .ba-photo--main {
  grid-column: 1 / -1;
  min-height: 2.8rem;
}

.ba-layout-classic .ba-frame--body1 {
  grid-column: 1;
  grid-row: 5 / 8;
}

.ba-layout-classic .ba-photo--support {
  min-height: 1.4rem;
}

.ba-layout-classic .ba-side {
  grid-column: 2;
  grid-row: 5 / 8;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}

.ba-layout-classic .ba-side .ba-photo--support {
  min-height: 1.6rem;
  flex: 0 0 auto;
}

.ba-layout-classic .ba-frame--pullquote {
  grid-column: 1 / -1;
}

/* Layout: DPS Story */
.ba-layout-story .ba-page {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.28rem;
}

.ba-layout-story .ba-frame--section,
.ba-layout-story .ba-frame--title,
.ba-layout-story .ba-frame--standfirst {
  grid-column: 1 / -1;
}

.ba-layout-story .ba-photo--main {
  grid-column: 1;
  grid-row: 4 / 7;
  min-height: 3.2rem;
}

.ba-layout-story .ba-frame--body1 {
  grid-column: 2;
  grid-row: 4 / 7;
}

.ba-layout-story .ba-frame--pullquote {
  grid-column: 1 / -1;
}

.ba-layout-story .ba-side {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ba-layout-story .ba-support-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
}

.ba-layout-story .ba-support-row .ba-photo {
  min-height: 1.1rem;
}

/* Layout: DPS Recipe (2-up) */
.ba-layout-recipe .ba-page {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.28rem;
}

.ba-layout-recipe .ba-recipe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  flex: 1;
  min-height: 0;
}

.ba-layout-recipe .ba-recipe-col {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}

.ba-layout-recipe .ba-photo {
  min-height: 1.5rem;
  flex: 1;
}

.ba-layout-recipe .ba-frame--ingredients {
  max-height: 3.2rem;
  overflow: hidden;
}

.ba-layout-recipe .ba-frame--body1 {
  flex: 1;
  overflow: hidden;
}

/* Layout: DPS Food Solo */
.ba-layout-solo .ba-page {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 0.28rem;
}

.ba-layout-solo .ba-photo--hero {
  grid-column: 1 / -1;
  min-height: 2.6rem;
}

.ba-layout-solo .ba-solo-body {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 0.28rem;
  flex: 1;
  min-height: 0;
}

.ba-layout-solo .ba-solo-body .ba-frame--ingredients {
  overflow: hidden;
}

.ba-layout-solo .ba-solo-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.22rem;
  margin-top: 0.25rem;
}

.ba-layout-solo .ba-solo-photos .ba-photo {
  min-height: 1rem;
}

/* Layout: CLO Fridge (1pp) */
.ba-layout-fridge .ba-page {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 0.3rem;
}

.ba-layout-fridge .ba-photo--hero {
  min-height: 4.5rem;
}

.ba-layout-fridge .ba-frame--body1 {
  max-height: 2.5rem;
  overflow: hidden;
}

/* Layout: CLO Good Taste (1pp list) */
.ba-layout-goodtaste .ba-page {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0.3rem;
}

.ba-layout-goodtaste .ba-list-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
}

.ba-layout-goodtaste .ba-photo--hero {
  min-height: 2.2rem;
}

/* Layout: Fashion Quad (1pp) */
.ba-layout-quad .ba-page {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 0.25rem;
}

.ba-layout-quad .ba-hero-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.28rem;
  min-height: 2.4rem;
}

.ba-layout-quad .ba-hero-row .ba-photo {
  min-height: 2.2rem;
}

.ba-layout-quad .ba-hero-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  justify-content: center;
}

.ba-layout-quad .ba-quad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.25rem;
  min-height: 0;
}

.ba-layout-quad .ba-quad-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
}

.ba-layout-quad .ba-quad-item .ba-photo {
  flex: 1;
  min-height: 1.1rem;
}

.ba-layout-quad .ba-quad-item .ba-frame--body {
  max-height: 2.2rem;
  flex: none;
}

/* Layout: Fashion Ladder (2pp) */
.ba-layout-ladder .ba-page--1 {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.28rem;
}

.ba-layout-ladder .ba-page--1 .ba-hero-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
  min-height: 2.8rem;
}

.ba-layout-ladder .ba-page--1 .ba-photo--hero {
  min-height: 2.6rem;
}

.ba-layout-ladder .ba-page--2 .ba-quad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.25rem;
  height: 100%;
}

.ba-layout-ladder .ba-page--2 {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ba-layout-ladder .ba-quad-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
}

.ba-layout-ladder .ba-quad-item .ba-photo {
  flex: 1;
  min-height: 1.2rem;
}

/* Checklist */
.ba-checklist {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
  margin: 0;
  padding: 0.45rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ba-checklist strong {
  color: var(--text);
  font-weight: 600;
}

.ba-checklist ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
}

.ba-checklist li {
  margin: 0.1rem 0;
}

/* Vote controls */
.ba-vote-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.ba-vote-row button {
  font-family: "Manrope", var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.ba-vote-row button:hover {
  border-color: var(--ba-accent);
}

.ba-vote-row button.is-selected {
  background: color-mix(in srgb, var(--ba-accent) 14%, var(--surface));
  border-color: var(--ba-accent);
  color: var(--text);
}

.ba-vote-row button[data-vote="b"].is-selected {
  background: color-mix(in srgb, #3d6b5a 14%, var(--surface));
  border-color: #3d6b5a;
}

.ba-vote-row button[data-vote="defer"].is-selected {
  background: color-mix(in srgb, var(--muted) 12%, var(--surface));
}

.ba-compare-divider {
  display: none;
}

@media (min-width: 821px) {
  .ba-compare {
    position: relative;
  }

  .ba-compare::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 2.5rem;
    bottom: 3rem;
    width: 1px;
    background: var(--border);
    transform: translateX(-50%);
    opacity: 0.5;
  }
}

/* Char-band frame heights — visual capacity ≈ BA length_table */
.ba-frame[data-chars]::after {
  content: attr(data-chars) " ch";
  position: absolute;
  bottom: 0;
  right: 0;
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.4rem;
  letter-spacing: 0.03em;
  color: var(--ba-accent);
  background: var(--ba-paper);
  padding: 0.02rem 0.22rem;
  border-radius: 3px 0 0 0;
  line-height: 1.2;
  opacity: 0.9;
  z-index: 1;
}

.ba-frame[data-band="xs"] { min-height: 1.15rem; }
.ba-frame[data-band="s"] { min-height: 1.85rem; }
.ba-frame[data-band="m"] { min-height: 3.4rem; }
.ba-frame[data-band="l"] { min-height: 5.2rem; }
.ba-frame[data-band="xl"] { min-height: 7.5rem; }
.ba-frame[data-band="xxl"] { min-height: 10.5rem; }

.ba-frame--body[data-band="l"],
.ba-frame--body[data-band="xl"],
.ba-frame--body[data-band="xxl"],
.ba-frame--ingredients[data-band="m"],
.ba-frame--ingredients[data-band="l"] {
  overflow-y: auto;
  max-height: none;
}

/* Feature spreads need room for ~5k body */
.ba-layout-classic .ba-page,
.ba-layout-story .ba-page {
  aspect-ratio: auto;
  min-height: 34rem;
}

.ba-layout-classic .ba-frame--body1[data-band="xxl"],
.ba-layout-story .ba-frame--body1[data-band="xl"],
.ba-layout-story .ba-frame--body1[data-band="xxl"] {
  min-height: 9.5rem;
}

.ba-layout-classic .ba-side .ba-frame--body[data-band="m"],
.ba-layout-classic .ba-side .ba-frame--body[data-band="l"] {
  min-height: 4.2rem;
}

.ba-lock-banner {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--ba-accent) 40%, var(--border));
  background: color-mix(in srgb, var(--ba-accent) 8%, var(--surface));
  font-size: 0.84rem;
  line-height: 1.45;
}

.ba-lock-banner strong {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ba-accent);
  margin-bottom: 0.25rem;
}

.ba-lock-banner ol {
  margin: 0.35rem 0 0;
  padding-left: 1.15rem;
}

.ba-lock-banner li {
  margin: 0.15rem 0;
}

.ba-option.is-preferred {
  outline: 2px solid color-mix(in srgb, var(--ba-accent) 55%, transparent);
  outline-offset: 3px;
  border-radius: 8px;
}

.ba-option.is-preferred .ba-option__label h3::after {
  content: " · PREFERRED DEFAULT";
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--ba-accent);
  font-weight: 600;
}

.ba-option:not(.is-preferred) {
  opacity: 0.88;
}

/* Vocab strip — BA form vs Layout */
.ba-vocab {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.85rem 0 0;
}

@media (max-width: 720px) {
  .ba-vocab { grid-template-columns: 1fr; }
}

.ba-vocab__card {
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  line-height: 1.4;
}

.ba-vocab__card strong {
  display: block;
  font-family: "IBM Plex Mono", var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ba-accent);
  margin-bottom: 0.2rem;
}

.ba-pair__layers {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.ba-pair__layers code {
  font-size: 0.72rem;
}

/* Celebrity interview layouts */
.ba-layout-interview-classic .ba-page {
  aspect-ratio: auto;
  min-height: 36rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.ba-layout-interview-classic .ba-photo--main {
  min-height: 5.5rem;
  flex: 0 0 auto;
}

.ba-layout-interview-classic .ba-embed-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.28rem;
  align-items: start;
}

.ba-layout-interview-classic .ba-embed-row .ba-photo {
  min-height: 2.4rem;
}

.ba-layout-interview-portrait .ba-page--1 {
  display: grid;
  grid-template-rows: 1fr auto auto auto;
  gap: 0.28rem;
  aspect-ratio: auto;
  min-height: 34rem;
}

.ba-layout-interview-portrait .ba-photo--main {
  min-height: 16rem;
}

.ba-layout-interview-portrait .ba-page--2 {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  aspect-ratio: auto;
  min-height: 34rem;
}

.ba-layout-interview-portrait .ba-embed-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.28rem;
}

.ba-layout-interview-portrait .ba-embed-row .ba-photo {
  min-height: 2.2rem;
}
