/* Top bar: page chrome above the picture (main.js fit keeps the film under
   it), two rows. The nav row is global: the film's name, the views as tabs
   (player/views.js), Share and, on the dev server only, the take edits'
   status (player/takes-adapter.js enableEdit). The tools row is the view's
   own: the player's version and format (player/switcher.js, safe zones with
   a vertical frame) or the scenes grid's (player/scenes-grid.js). Fullscreen
   viewer: over the film, fading out with the viewer bar. */
:root { --tb-nav: 40px; --tb-tools: 38px; }
#topbar { position: absolute; z-index: 4; left: 0; right: 0; top: 0; display: flex; flex-direction: column; color: #ddd; font-size: 11px; user-select: none; transition: opacity 0.35s, transform 0.35s; }
body.render #topbar { display: none; }
body.idle #topbar { opacity: 0; transform: translateY(-8px); pointer-events: none; }
body.fs:has(#controls:not(.tl-open)) #topbar { background: linear-gradient(#0b0b0ccc, #0b0b0c00); }
body.fs:has(#controls:not(.tl-open)) :is(.tb-nav, .tb-tools) { background: none; border-color: transparent; }

.tb-nav { height: var(--tb-nav); display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 18px; background: var(--ui-bar); border-bottom: 1px solid var(--ui-line); }
.tb-tools { height: var(--tb-tools); display: flex; align-items: center; gap: 18px; padding: 0 18px; border-bottom: 1px solid #ffffff0f; }
body.grid-open .tb-tools { background: var(--ink); }
body.grid-open #switch { display: none; }

/* The film's name: the yellow is the film's, not a control's. */
.tb-brand { justify-self: start; min-width: 0; display: flex; align-items: center; gap: 9px; white-space: nowrap; overflow: hidden; }
.tb-mark { flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--yellow); }
.tb-brand b { flex: none; font: 400 14px / 1 Anton, sans-serif; letter-spacing: 0.03em; text-transform: uppercase; color: var(--paper); }
.tb-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font: 500 12px / 1 'DM Sans Variable', sans-serif; color: #8a8a8e; }

/* The views: tabs, the current one lit and underlined on the row's edge. */
#views { justify-self: center; align-self: stretch; display: flex; gap: 2px; }
#views button { position: relative; height: 100%; padding: 0 14px; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12px; letter-spacing: 0.03em; white-space: nowrap; color: #8a8a8e; background: none; border: 0; cursor: pointer; transition: color 0.12s; }
#views button::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--ui-accent); transform: scaleX(0); transition: transform 0.2s cubic-bezier(0.2, 0.7, 0.2, 1); }
#views button:hover { color: #ddd; }
#views button[aria-pressed='true'] { color: var(--ui-accent-strong); font-weight: 700; cursor: default; }
#views button[aria-pressed='true']::after { transform: none; }
#views button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -7px; border-radius: 9px; }
#views svg { width: 12px; height: 12px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
#views [data-view=''] svg { fill: currentColor; stroke: none; }
#views kbd { width: 15px; height: 15px; display: inline-grid; place-items: center; font-family: inherit; font-size: 9px; font-weight: 400; line-height: 1; color: #5e5e62; border: 1px solid #333336; border-radius: 3px; }

.tb-end { justify-self: end; min-width: 0; display: flex; align-items: center; gap: 10px; }
#share { height: 28px; padding: 0 11px 0 9px; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 11.5px; white-space: nowrap; color: #ddd; background: #1c1c1c; border: 1px solid #333; border-radius: 6px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
#share:hover { color: #fff; border-color: #555; }
#share:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
#share svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Take edits' status (dev server only): one dashed chip, its menu says
   what to do; the dot turns orange while edits are uncommitted. */
#devstatus { height: 24px; padding: 0 10px 0 8px; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 10.5px; letter-spacing: 0.04em; white-space: nowrap; color: #9a9a9a; background: none; border: 1px dashed #3c3c40; border-radius: 12px; cursor: pointer; transition: color 0.12s, border-color 0.12s; }
#devstatus[hidden] { display: none; }
#devstatus:hover { color: #ddd; border-color: #5a5a5e; }
#devstatus:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
#devstatus .ds-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: #6c6c70; }
#devstatus.warn { color: var(--ui-accent-strong); border-color: #ff9a5266; }
#devstatus.warn .ds-dot { background: #ff9a52; }
#devstatus .ds-tag { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: #6c6c70; }

/* The player's tools: what plays, segmented, the current one lit. */
#switch { display: flex; align-items: center; gap: 18px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#switch::-webkit-scrollbar { display: none; }
.sw-group { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.sw-lab { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: #6c6c70; }
.sw-seg { display: inline-flex; border: 1px solid #333; border-radius: 6px; overflow: hidden; }
.sw-seg button, .sw-toggle { height: 26px; padding: 0 10px; display: inline-flex; align-items: baseline; gap: 6px; font: inherit; font-size: 11.5px; line-height: 26px; white-space: nowrap; color: #9a9a9a; background: #161616; border: 0; cursor: pointer; transition: color 0.12s, background-color 0.12s, border-color 0.12s; }
.sw-seg button + button { border-left: 1px solid #333; }
.sw-seg button:hover { color: #fff; background: #242424; }
.sw-seg small { font-size: 10px; font-variant-numeric: tabular-nums; color: #6c6c70; }
.sw-seg button[aria-pressed='true'] { color: var(--ui-ink); background: var(--ui-accent); font-weight: 700; cursor: default; }
.sw-seg button[aria-pressed='true'] small { color: #11111199; font-weight: 400; }
.sw-seg button:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: -2px; }
/* Narrow screens' dropdown of the same choices. */
.sw-select { display: none; height: 26px; max-width: 46vw; padding: 0 22px 0 9px; font: inherit; font-size: 11.5px; color: var(--ui-accent-strong); background: #161616 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 3 4 5.5 6.5 3' fill='none' stroke='%239a9a9a' stroke-width='1.2'/%3E%3C/svg%3E") no-repeat right 7px center / 8px; border: 1px solid #333; border-radius: 6px; -webkit-appearance: none; appearance: none; cursor: pointer; }
.sw-select:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
/* An on / off option of the format (safe zones): outlined, lit when on. */
.sw-toggle { flex: none; margin-left: -8px; border: 1px solid #333; border-radius: 6px; }
.sw-toggle:hover { color: #fff; border-color: #555; }
.sw-toggle[aria-pressed='true'] { color: var(--ui-accent); border-color: var(--ui-accent); }
.sw-toggle:focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .tb-title { display: none; }
}
/* Phones in landscape: the segments without their labels and asides. */
@media (max-width: 760px) {
  .sw-lab, .sw-seg small { display: none; }
  #devstatus { width: 24px; padding: 0; justify-content: center; }
  #devstatus > :not(.ds-dot) { display: none; }
}
@media (max-width: 640px) {
  :root { --tb-nav: 44px; }
  .tb-nav { gap: 8px; padding: 0 12px; }
  .tb-tools { gap: 8px; padding: 0 12px; }
  .tb-brand { gap: 7px; }
  .tb-brand b { font-size: 13px; }
  #views button { padding: 0 10px; gap: 6px; }
  #views kbd { display: none; }
  .tb-end { gap: 8px; }
  /* Share as its icon (the tooltip names it). */
  #share { width: 32px; padding: 0; justify-content: center; }
  #share .lbl { display: none; }
  #switch { gap: 8px; overflow: visible; }
  .sw-lab, .sw-seg { display: none; }
  .sw-select { display: inline-block; }
  .sw-toggle { margin-left: 0; padding: 0 8px; }
  /* The dropdowns shrink (ellipsis) before the row overflows. */
  .sw-group { flex: 0 1 auto; min-width: 0; }
  .sw-select { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
}
