/* The application shell (four areas, the About drawer, the phone tab bar) and Watch. Loaded after responsive.css, so
   Watch's own phone rules live here, in the same three media queries (reflow, narrow, short). */

/* ---- shell ------------------------------------------------------------------------------------------------ */
.sbar { gap: 28px; }
.navseg.areas { border: 0; background: none; gap: 6px; overflow: visible; }
.navseg.areas a { height: 40px; padding: 0 18px; border-radius: 9px; font-size: 16px; font-weight: 600; letter-spacing: 0; color: var(--ink-3); }
.navseg.areas a + a { border-left: 0; }
.navseg.areas a.on { background: var(--bg-3); color: var(--ink-1); }
.aboutbtn { background: none; border: 1px solid transparent; color: var(--ink-3); font: 600 15px var(--font-ui); height: 36px; padding: 0 12px; border-radius: 8px; cursor: pointer; }
.aboutbtn:hover, .aboutbtn[aria-expanded="true"] { color: var(--ink-1); border-color: var(--line-2); }
.tabbar { display: none; }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); z-index: 60; display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid var(--line-2); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5); }
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--line-1); font-size: 15px; font-weight: 700; flex: none; }
.drawer-x { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--ink-1); font-size: 22px; line-height: 1; cursor: pointer; }
.drawer-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 20px 28px; }
.about-drawer .ab-wrap { max-width: none; padding: 0; }
/* About: a wide panel in the middle of the screen (a full-screen sheet on a phone), not a side drawer */
.drawer.about-drawer { left: 50%; right: auto; top: 4vh; bottom: 4vh; width: min(1120px, calc(100vw - 32px)); transform: translateX(-50%); border-radius: 16px; border: 1px solid var(--line-2); }
@media (max-width: 599px) { .drawer.about-drawer { top: 0; bottom: 0; width: 100vw; border-radius: 0; border: 0; } }

/* ---- Watch ------------------------------------------------------------------------------------------------ */
.storyview { padding: 16px var(--st-pad) 14px; gap: 0; }
.storyview .st-stage { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.st-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 24px; align-items: start; flex: none; }
.st-hero .st-kicker, .st-hero .st-titlerow, .st-hero .st-lead { grid-column: 1; }
.st-titlerow { display: flex; align-items: baseline; gap: 10px 26px; flex-wrap: wrap; margin-top: 4px; }
.st-titlerow h1 { margin: 0; font-size: clamp(26px, 4vh, 44px); }
.st-titlerow .st-world { margin: 0; font-size: clamp(14px, 2vh, 20px); }
.st-hero .st-lead { margin-top: 6px; font-size: clamp(13px, 1.8vh, 17px); padding: 4px 10px; justify-self: start; }
.st-detailsbtn { grid-column: 2; grid-row: 1 / span 3; display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-3); font: 500 13px var(--font-mono); cursor: pointer; white-space: nowrap; }
.st-detailsbtn b { font: 700 14px var(--font-ui); color: var(--ink-1); }
.st-detailsbtn:hover, .st-detailsbtn.on { border-color: var(--ink-2); }

.storyview .st-duel { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr) auto; gap: 6px 28px; }
.storyview .st-side { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; gap: 10px; min-height: 0; padding: 0; border: 0; background: none; box-shadow: none; }
.st-vbox { container-type: size; min-height: 0; display: grid; align-items: start; justify-items: start; }
.storyview .st-video { width: min(100%, calc(100cqh * 16 / 9)); aspect-ratio: 16 / 9; border-radius: 14px; border-width: 2px; }
.st-side.left .st-video { border-color: color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: 0 0 36px rgba(255, 77, 94, 0.14); }
.st-side.ai .st-video, .st-side.jisr .st-video { border-color: color-mix(in srgb, var(--ai-a) 70%, transparent); box-shadow: 0 0 36px rgba(34, 211, 238, 0.12); }
.storyview .st-video.frozen { border-color: var(--bad); box-shadow: 0 0 28px var(--bad-glow); }
.st-tag { position: absolute; left: 16px; top: 13px; right: 150px; pointer-events: none; text-shadow: 0 1px 8px #000; z-index: 2; }
.st-tag .st-label { font-size: clamp(15px, 2.1vh, 21px); font-weight: 700; }
.st-tag .st-note { font-size: clamp(11px, 1.45vh, 14px); color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.storyview .st-vbadge { right: 12px; top: 12px; z-index: 2; font-size: 13px; }
.storyview .st-vhud span:first-child { top: auto; bottom: 0; }
.storyview .st-vhud span:last-child { left: auto; right: 0; }
.st-label .ai-w, .st-label em { font-style: normal; }

.st-stats { display: flex; gap: 10px clamp(18px, 2.2vw, 36px); flex-wrap: wrap; }
.ss { display: flex; flex-direction: column; min-width: 0; }
.ss b { font-family: var(--font-mono); font-size: clamp(20px, 3.1vh, 32px); font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ss b small { font-size: 0.62em; color: var(--ink-3); font-weight: 500; }
.ss span { font-size: clamp(12px, 1.5vh, 15px); color: var(--ink-3); white-space: nowrap; }
.ss.bad b { color: var(--bad); }
.ss.good b { color: var(--ok); }
.ss.worse b { color: var(--warn); }
.storyview .st-status { font-size: clamp(13px, 1.8vh, 17px); min-height: 1.3em; }

.storyview .st-scrub { flex: none; height: 154px; }
.st-scrub .fz-down { fill: url(#stHatch); }
.st-scrub .fz-hatch { stroke: rgba(160, 175, 200, 0.32); stroke-width: 2.5; }
.st-scrub .fz-on { stroke: var(--ink-3); stroke-dasharray: 4 4; }
.st-scrub .fz-risk { fill: none; stroke: var(--warn); stroke-width: 2; }
.st-scrub .fz-rv { font-family: var(--font-mono); font-size: 11px; fill: var(--warn); }
.st-scrub .fz-l.link, .st-scrub .fz-l.risk { fill: var(--ink-3); font-weight: 650; }
.st-scrub .mo-up.hedge { stroke: var(--warn); }
.st-scrub .mo-up.jisr { stroke: var(--ok); }
.st-scrub .mo-up.fell { stroke: var(--bad); opacity: 0.6; }
.st-scrub .mo.fell { stroke: var(--bad); }
.st-scrub .mol.fell { fill: var(--bad); }

.storyview .st-time { flex: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.st-sources { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.src { height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-3); font: 500 15px var(--font-ui); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.src:hover { color: var(--ink-1); }
.src.on { border-color: var(--ink-2); color: var(--ink-1); font-weight: 700; background: var(--bg-3); }
.src[hidden] { display: none; }
.src.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); animation: pulse 1.6s ease-out infinite; }

.st-drawer h3 { margin: 0 0 8px; font-size: 17px; }
.dt-sides { display: grid; gap: 18px; }
.dt-side .st-techp, .dt-side > div { position: static; }
.dt-how { margin-top: 22px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.dt-how ul { padding-left: 18px; margin: 6px 0; }
.dt-how b { color: var(--ink-1); }
.dt-amber { color: var(--warn); }
.dt-lab { display: inline-block; margin-top: 16px; color: var(--ink-1); font-weight: 650; }

/* ---- reflow: tablets and phones, Watch is a page that scrolls ------------------------------------------------ */
@media (max-width: 1100px), (max-height: 500px) {
  .storyview { overflow-y: auto; overflow-x: hidden; }
  .storyview .st-stage { flex: none; }
  .storyview .st-duel { flex: none; grid-template-rows: auto auto; }
  .st-vbox { container-type: normal; display: block; }
  .storyview .st-video { width: 100%; }
  .st-detailsbtn span { display: none; }
  .src { height: var(--tap); }
  .st-detailsbtn { height: var(--tap); }
}

/* ---- narrow: phones upright, the four areas move to a tab bar at the bottom ---------------------------------- */
@media (max-width: 599px) {
  .sbar .navseg.areas { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--bg-1); border-top: 1px solid var(--line-2); }
  .tabbar a { flex: 1; height: 56px; display: grid; place-items: center; color: var(--ink-3); text-decoration: none; font-size: 13px; font-weight: 650; }
  .tabbar a.on { color: var(--ink-1); box-shadow: inset 0 2px 0 var(--ink-1); }
  .shell .view, .app { padding-bottom: 72px; }  /* clear of the tab bar */
  .storyview .st-duel { column-gap: 8px; }
  .st-tag .st-note { display: none; }
  .storyview .st-vhud { display: none; }
  .st-stats { flex-direction: column; gap: 8px; }
  .ss b { font-size: 19px; }
  .ss span { white-space: normal; }
  .st-titlerow h1 { font-size: 24px; }
  .st-hero { grid-template-columns: minmax(0, 1fr); }
  .st-detailsbtn { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 8px; }
  .storyview .st-time { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "btns clock" "src src"; gap: 10px; }
  .storyview .st-btns { grid-area: btns; flex-wrap: wrap; min-width: 0; }
  .storyview .st-clock { grid-area: clock; justify-self: end; font-size: 24px; min-width: 0; }
  .st-sources { grid-area: src; }
}

/* ---- short: phones on their side ------------------------------------------------------------------------------ */
@media (max-height: 500px) {
  .st-titlerow h1 { font-size: 24px; }
  .storyview .st-clock { font-size: 22px; min-width: 96px; }
}
.dt-tech { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.storyview .st-scrub .fz-l { font-size: 13px; }
@media (max-width: 599px) { .storyview .st-scrub .fz-l { font-size: 12px; } }
/* the earlier Story layout's narrower-screen rules (story.css) put the figures beside the video: Watch keeps one column */
.storyview .st-side { grid-template-columns: minmax(0, 1fr); column-gap: 0; }
.storyview .st-side > * { grid-column: 1; grid-row: auto; }
.src-sep { width: 1px; height: 28px; background: var(--line-3); margin: 0 4px; align-self: center; }
.st-video.field canvas, .st-video.field video.st-robot { display: none; }
.st-fieldv { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; background: #000; display: block; }
.st-fieldv::cue { font-family: var(--font-ui); font-size: 12px; line-height: 1.35; background: rgba(5, 7, 10, 0.72); }
.st-fnotes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 26px; font-size: clamp(13px, 1.7vh, 16px); color: var(--ink-1); }
.st-fnotes[hidden] { display: none; }
.st-fnotes li b { margin-right: 6px; }
.st-fnotes li[title] { cursor: help; }
.st-fnotes li span { display: block; font-size: 12.5px; color: var(--ink-3); }
.st-sound { height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--ink-2); font: 600 13px var(--font-ui); cursor: pointer; }
.st-sound[hidden] { display: none; }
.st-sound[aria-pressed="true"] { color: var(--ink-1); border-color: var(--ink-2); }
.st-scrub .fm { stroke-width: 3; }
.st-scrub .fm.bad { stroke: var(--bad); }
.st-scrub .fm.ok { stroke: var(--ok); }
.st-scrub .fm.approx { stroke-dasharray: 3 2; }
.st-scrub .fml { font-size: 12px; fill: var(--ink-1); font-family: var(--font-ui); font-weight: 600; }
.dt-marks { padding-left: 18px; margin: 6px 0; font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.dt-marks span { color: var(--ink-3); }
@media (max-width: 1100px), (max-height: 500px) { .st-sound { height: var(--tap); } }
@media (max-width: 599px) { .st-scrub .fml { font-size: 12px; } }

/* an open drawer dims the page behind it (and covers it for a finger) */
body:has(.drawer:not([hidden]))::before { content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(5, 7, 10, 0.72); }
.drawer { z-index: 60; }
.rs-drawer { width: min(1180px, 100vw); }

/* touch screens: every control a finger's size; nothing shortened with an ellipsis */
@media (max-width: 1100px), (max-height: 500px) {
  .aboutbtn, .storyview .st-plug, .st-sound { min-height: var(--tap); }
  .storyview .st-play { width: 46px; height: 46px; }
  .dt-lab, .rs-dep a, .st-sources .src { min-height: var(--tap); display: inline-flex; align-items: center; }
  .st-tag .st-note, .storyview .st-robonote { white-space: normal; overflow: visible; text-overflow: clip; }
  .dt-tech .tk span { white-space: normal; overflow: visible; }
}
@media (max-width: 599px), (max-height: 500px) {
  .storyview .st-vbadge, .storyview .st-vbadge span { font-size: 12px; }
  .ss b small { font-size: 12px; }
  .st-scrub .fz-rv { font-size: 12px; }
  .dt-tech { grid-template-columns: minmax(0, 1fr); }
  .dt-tech .tk, .dt-tech .th { font-size: 12px; }
  .st-tag .st-label { white-space: normal; overflow: visible; text-overflow: clip; font-size: 12px; line-height: 1.2; }
}
/* phones: a tile is too small to write on, so each side's name sits above its video (lined up at the bottom, room for
   three lines) and the badge is a small pill in the video's lower corner, where the hidden timestamps were */
@media (max-width: 599px) {
  .storyview .st-vbox { padding-top: 48px; }
  .storyview .st-video.robot .st-vhud, .storyview .st-vhud { display: none; }
  .storyview .st-side { grid-template-rows: none; align-content: start; }
  .storyview .st-video { overflow: visible; }
  .storyview .st-video > canvas, .storyview .st-video > video { border-radius: 12px; }
  .st-tag { left: 0; right: 0; top: auto; bottom: calc(100% + 6px); text-shadow: none; }
  .st-tag .st-label { font-size: 12px; line-height: 1.2; white-space: normal; overflow: visible; text-overflow: clip; }
  .storyview .st-vbadge { top: auto; bottom: 6px; right: 6px; padding: 2px 6px; border-radius: 4px; background: rgba(5, 7, 10, 0.72); font-size: 12px; }
}

/* phones: the robots and the numbers; the setup, each figure's explanation and each time's source stay in Details */
@media (max-width: 599px) {
  #stKicker, #stWorld, .st-leadmore, .st-fnotes li span { display: none; }
  .rs-detailsbtn span, .rs-facts .rs-card p, .rs-foot { display: none; }
}

.st-sound + .st-sound { margin-left: 6px; }
.dt-note { margin: 4px 0 12px; color: var(--ink-2); font-size: 14px; }
.st-video.fwait::after { content: "Loading the recording…"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
/* the field test: the camera in the lab over the dashboard recording while it lasts (the dashboard keeps the clock and the sound) */
.st-video.field video.st-fieldv.cam { display: none; object-position: center; }
.st-video.field.camview video.st-fieldv.cam { display: block; }
.st-video.field.camview video.st-fieldv:not(.cam) { visibility: hidden; }
.st-robonote a { color: var(--ink-2); }
/* the camera is bright: a dark band at its top keeps the side's name readable */
.st-video.field.camview::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 84px; background: linear-gradient(rgba(5, 7, 10, 0.78), rgba(5, 7, 10, 0)); z-index: 1; pointer-events: none; }
@media (max-width: 599px) { .st-video.field.camview::before { display: none; } }

/* the field test on a wide, short screen: the other recording, small, in the room beside each tile (a click swaps) */
.storyview .st-vbox { position: relative; }
.st-mini { display: none; position: absolute; top: 0; left: calc(min(100%, 100cqh * 16 / 9) + 14px); width: min(100% - min(100%, 100cqh * 16 / 9) - 14px, min(100%, 100cqh * 16 / 9) * 0.75); cursor: pointer; }
.st-vbox.has-mini .st-mini { display: block; }
.st-minivideo { display: block; width: 100%; max-height: calc(100cqh - 26px); object-fit: contain; background: #05070a; border-radius: 10px; border: 1px solid var(--line-2); }
.st-mini:hover .st-minivideo { border-color: var(--ink-3); }
.st-minilabel { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

/* while a tile's videos download it shows their first frame (a poster), with a small note, not an empty box */
.storyview .st-video.wait, .storyview .st-video.field.fwait { background: var(--poster, #05070a) center / cover no-repeat; }
.storyview .st-video.field.fwait video.st-fieldv { visibility: hidden; }
.storyview .st-video.wait::after, .storyview .st-video.field.fwait::after { inset: auto auto 10px 10px; display: block; padding: 3px 8px; border-radius: 4px; background: rgba(5, 7, 10, 0.72); color: var(--ink-2); }
.st-robonote.wrap { white-space: normal; overflow: visible; text-overflow: clip; }
