/* XSI Signals — portrait layout (phones, tablets held upright).
   engine.js sets body.portrait when the window is taller than it is wide and
   gives the stage a 720px width with a height that follows the window. Every
   chapter then reflows into one column with larger type; captions carry the
   narration, so a few secondary details are dropped to keep each chapter on
   one screen. Landscape positions are partly inline styles in index.html,
   which is why the position resets below need !important. */

/* ── Frame: HUD, captions, player ─────────────────────── */

body.portrait .hud-brand { left: 36px; top: 40px; gap: 10px; font-size: 20px; }
body.portrait .hud-brand svg { width: 28px; height: 28px; }
body.portrait .hud-brand .sep { height: 18px; }
body.portrait .hud-chapter { right: 36px; top: 36px; }
body.portrait .hud-chapter .num { font-size: 14px; }
body.portrait .hud-chapter .name { font-size: 15px; }
body.portrait .hud-segs { gap: 4px; margin-top: 8px; }
body.portrait .hud-segs i { width: 12px; }

body.portrait #caption {
  bottom: 40px;
  width: max-content;
  max-width: 648px;
  white-space: normal;
  padding: 12px 20px;
  font-size: 23px;
  line-height: 1.4;
}

/* phones: no player bar; tap the film to pause, as on the website */
@media (max-width: 760px) {
  #controls { display: none; }
}

/* ── Scenes become one column ─────────────────────────── */

body.portrait .scene { padding: 118px 36px 190px; }
body.portrait .scene.active { display: flex; flex-direction: column; gap: 22px; }
body.portrait .scene > :not(.cursor):not(.tip):not(.intro-glow) {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
}

body.portrait .head { max-width: none; }
body.portrait .eyebrow { gap: 10px; font-size: 15px; }
body.portrait .eyebrow .bar { width: 26px; }
body.portrait .title { margin-top: 12px; font-size: 46px; line-height: 1.1; }
body.portrait .lead { margin-top: 14px; font-size: 21px; }
body.portrait .chip { font-size: 16px; }

/* ── 01 Intro ─────────────────────────────────────────── */

body.portrait .intro-logo { width: 210px; height: 210px; }
body.portrait .intro-word { margin-top: 34px; gap: 18px; font-size: 64px; }
body.portrait .intro-word .sep { height: 50px; }
body.portrait .intro-tag { margin-top: 16px; padding: 0 40px; font-size: 24px; text-align: center; }
body.portrait .intro-meta { margin-top: 30px; padding: 0 40px; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ── 02 Problem ───────────────────────────────────────── */

body.portrait .problem-copy { width: auto; }
body.portrait .problem-copy .title { font-size: 50px; }
body.portrait .problem-copy .lead { display: none; }
body.portrait .problem-strap { margin-top: 22px; font-size: 26px; }
body.portrait .mailwall { width: auto; height: 680px; flex: none; }
body.portrait .mrow { grid-template-columns: 34px 150px 1fr 46px; column-gap: 12px; padding: 0 14px; font-size: 16px; }
body.portrait .mrow .av { width: 32px; height: 32px; font-size: 12px; }
body.portrait .mrow .when { font-size: 13px; }
body.portrait .mrow .flag span { font-size: 15px; }

/* ── 03 Read-only: sources above the server, outputs below ── */

body.portrait .flow { height: auto; display: flex; flex-direction: column; }
body.portrait .flow > .src-col,
body.portrait .flow > .core,
body.portrait .flow > .out-col,
body.portrait .flow > .noroute { position: relative; top: auto; right: auto; left: auto; width: auto; }
body.portrait .src-col { flex-direction: row; gap: 12px; }
body.portrait .src { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; }
body.portrait .src .ico { width: 40px; height: 40px; }
body.portrait .src h4 { font-size: 17px; }
body.portrait .src p { font-size: 13px; }
body.portrait .core { margin-top: 64px; height: auto; padding: 24px; }
body.portrait .core svg.logo { width: 54px; height: 54px; margin: 16px auto 8px; }
body.portrait .core h3 { font-size: 26px; }
body.portrait .core p { font-size: 17px; }
body.portrait .core .steps { font-size: 14px; }
body.portrait .out-col { margin-top: 64px; flex-direction: row; gap: 12px; }
body.portrait .out { flex: 1; gap: 10px; padding: 14px; font-size: 17px; }
body.portrait .noroute { margin-top: 28px; flex-wrap: wrap; justify-content: center; gap: 10px; }
body.portrait .noroute .lbl { font-size: 16px; }
body.portrait .nr { padding: 8px 14px; font-size: 17px; }

/* ── 04 Pipeline: stages down the page ────────────────── */

body.portrait .pipe { height: auto; }
body.portrait .packet { display: none; }
body.portrait .stages { position: relative; inset: auto; display: flex; flex-direction: column; gap: 14px; }
body.portrait .stage { flex-direction: row; align-items: center; gap: 18px; }
body.portrait .stage .node { flex: none; width: 84px; height: 84px; }
body.portrait .stage .node .icon { width: 34px; height: 34px; }
body.portrait .stage .node .n { top: -8px; right: -8px; padding: 2px 7px; font-size: 12px; }
body.portrait .stage .sd { flex: 1; margin-top: 0; min-height: 0; padding: 14px 18px; transform: none; }
body.portrait .stage .sd h4 { font-size: 22px; }
body.portrait .stage .sd .tools { display: none; }
body.portrait .stage .sd p { margin-top: 6px; font-size: 17px; }

/* ── 05 Understanding ─────────────────────────────────── */

body.portrait .mail,
body.portrait .rec-card { width: auto; padding: 20px 22px; }
body.portrait .mail-h { grid-template-columns: 44px 1fr; }
body.portrait .mail-h .av { width: 44px; height: 44px; font-size: 16px; }
body.portrait .mail-h .who { font-size: 18px; }
body.portrait .mail-h .when,
body.portrait .mail-att { display: none; }
body.portrait .mail-s { margin-top: 12px; font-size: 19px; }
body.portrait .mail-b { margin-top: 8px; font-size: 18px; line-height: 1.6; }
body.portrait .record-h h4 { font-size: 16px; }
body.portrait .fld { grid-template-columns: 150px 1fr; padding: 6px 0; font-size: 17px; }
body.portrait .fld .k { font-size: 15px; }
body.portrait .families { flex-wrap: wrap; gap: 10px; }
body.portrait .families .lbl { width: 100%; font-size: 16px; }
body.portrait .fam { padding: 7px 14px; font-size: 16px; }

/* ── 06 What it watches ───────────────────────────────── */

body.portrait .watch { grid-template-columns: 1fr; gap: 16px; }
body.portrait .wcard { min-height: 0; padding: 20px 22px; }
body.portrait .wcard .wh .ico { width: 40px; height: 40px; }
body.portrait .wcard h4 { font-size: 22px; }
body.portrait .wcard > p { margin-top: 8px; font-size: 16px; }
body.portrait .wbody { padding-top: 14px; }
body.portrait .conflict { gap: 10px; }
body.portrait .cmsg { padding: 10px 14px; font-size: 16px; }

/* ── 07 Executive view: tiles two by two ──────────────── */

body.portrait .dash { height: auto; padding: 18px; grid-template-columns: 1fr 1fr; grid-template-rows: none; gap: 12px; }
body.portrait .tile { padding: 14px 16px; }
body.portrait .tile .k { font-size: 15px; }
body.portrait .tile .v { margin-top: 6px; font-size: 40px; }
body.portrait .tile .t { font-size: 13px; }
body.portrait .panel { grid-row: auto; grid-column: 1 / -1; }
body.portrait .panel.chart { height: 200px; }
body.portrait .panel.bars .bar:nth-child(n + 5) { display: none; }
body.portrait .bar { margin-top: 12px; }
body.portrait .bar .bl { font-size: 16px; }
body.portrait .tip { font-size: 17px; }

/* ── 08 Ask it anything ───────────────────────────────── */

body.portrait .chat { width: auto !important; height: auto !important; gap: 12px; padding: 18px 20px; }
body.portrait .chat-top { padding-bottom: 10px; font-size: 16px; }
body.portrait .chat-top > span:last-child { display: none; }
body.portrait .q-bubble { max-width: 92%; min-height: 0; padding: 12px 16px; font-size: 19px; }
body.portrait .chat-status { font-size: 15px; }
body.portrait .answer { font-size: 18px; }
body.portrait .atable { font-size: 16px; }
body.portrait .atable th:nth-child(2),
body.portrait .atable td:nth-child(2) { display: none; }
body.portrait .atable th,
body.portrait .atable td { padding: 8px 10px; }
body.portrait .sources .src-email:nth-child(3) { display: none; }
body.portrait .agents { width: auto; height: auto; gap: 10px; padding: 16px 18px; }
body.portrait .lead-node { grid-template-columns: 38px 1fr; padding: 10px 14px; }
body.portrait .lead-node .ico { width: 38px; height: 38px; }
body.portrait .lead-node b { font-size: 18px; }
body.portrait .lead-node small { font-size: 14px; }
body.portrait .lane { padding: 7px 12px; }
body.portrait .ln-tag,
body.portrait .critic small,
body.portrait .qmarquee { display: none; }
body.portrait .ln-s { margin-top: 3px; font-size: 13.5px; }

/* ── 09 Suggested replies ─────────────────────────────── */

body.portrait .a-bubble { max-width: none; padding: 12px 16px; font-size: 17px; }
body.portrait .opt { padding: 8px 12px; }
body.portrait .opt b { font-size: 15px; }
body.portrait .opt small { font-size: 13px; }
body.portrait .tparts { gap: 8px; }
body.portrait .tpart { font-size: 16px; }
body.portrait .tpart b { font-size: 12.5px; }
body.portrait .draft { width: auto; padding: 18px 20px; }
body.portrait .draft-b { margin-top: 12px; min-height: 0; padding: 14px 16px; font-size: 16.5px; line-height: 1.5; }
body.portrait .draft-why { display: none; }
body.portrait .draft-act .note { font-size: 13px; }

/* ── 10 Reports ───────────────────────────────────────── */

body.portrait .repsteps { width: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
body.portrait .rs { grid-template-columns: 28px 1fr; gap: 10px; font-size: 15px; }
body.portrait .rs .n { width: 28px; height: 28px; font-size: 12px; }
body.portrait .doc { width: auto; padding: 24px; }
body.portrait .doc .dh h3 { font-size: 26px; }
body.portrait .doc .dh small { font-size: 14px; }
body.portrait .doc .es { margin-top: 16px; padding: 14px 16px; font-size: 16px; }
body.portrait .sec { grid-template-columns: 30px 1fr 110px; margin-top: 10px; padding: 10px 14px; font-size: 16px; }
body.portrait .exports { flex-direction: row; gap: 10px; }
body.portrait .exp { flex: 1; width: auto; gap: 10px; padding: 12px; font-size: 16px; }
body.portrait .exp .ext { width: 38px; height: 38px; font-size: 11px; }

/* ── 11 Security ──────────────────────────────────────── */

body.portrait .trust { grid-template-columns: 1fr 1fr; gap: 14px; }
body.portrait .tc { min-height: 0; padding: 18px; }
body.portrait .tc .ico { width: 42px; height: 42px; }
body.portrait .tc h4 { margin-top: 12px; font-size: 19px; }
body.portrait .tc p { margin-top: 6px; font-size: 15px; }

/* ── 12 Outro ─────────────────────────────────────────── */

body.portrait .outro-logo { width: 120px; height: 120px; }
body.portrait .outro-title { margin-top: 28px; padding: 0 36px; font-size: 52px; }
body.portrait .outro-sub { padding: 0 40px; font-size: 22px; }
body.portrait .outro-chips { flex-wrap: wrap; padding: 0 40px; gap: 10px; }
body.portrait .outro-url { margin-top: 36px; font-size: 20px; }
