/* Focal - shared design tokens.
   Every extension page links this file before its own stylesheet so the
   whole product reads as one thing. */

:root {
  --ink-950: hsl(222, 16%, 8%);
  --ink-900: hsl(222, 15%, 12%);
  --ink-800: hsl(222, 13%, 18%);
  --line: hsl(222, 12%, 24%);

  --paper-100: hsl(40, 14%, 93%);
  --paper-400: hsl(220, 9%, 68%);
  --paper-600: hsl(220, 8%, 48%);

  --tally-500: hsl(4, 86%, 56%);
  --tally-600: hsl(4, 76%, 48%);
  --tally-700: hsl(4, 45%, 26%);
  --tally-tint: hsl(4, 55%, 18%);

  --focus-500: hsl(202, 92%, 58%);
  --focus-600: hsl(202, 80%, 50%);
  --focus-700: hsl(202, 55%, 26%);
  --focus-tint: hsl(202, 55%, 16%);

  --segment-500: hsl(142, 60%, 62%);
  --segment-700: hsl(142, 35%, 20%);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-12: 48px;

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Any element can carry the plain `hidden` attribute to be hidden, full
   stop, regardless of what its own class sets `display` to. Without this,
   an author rule like `.progress { display: flex; }` has the same
   specificity as the browser's built-in `[hidden] { display: none; }` and,
   being an author rule, always wins over the user-agent one, so the
   element stays visible even while `hidden` is set (this is exactly the
   bug .timeline-toolbar's comment in editor.html works around by staying
   commented out instead of relying on `hidden`, and the reason
   #progressWrap has actually been visible on load since this project
   started, it just used to sit far enough down the page not to notice). */
[hidden] {
  display: none !important;
}

/* Shared elevated-card system. Every logical group on both pages sits in
   one of these, same radius/shadow as the dropdown menu, so the whole
   product reads as one consistent, floating-panel language rather than
   flat sections divided by hairlines. */

.card {
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4) var(--sp-4);
}

.card + .card {
  margin-top: var(--sp-4);
}

.card__eyebrow {
  margin: 0 0 var(--sp-3);
  font-size: 12px;
  font-weight: 600;
  color: var(--paper-400);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
}

.card__row:first-of-type {
  padding-top: 0;
}

.card__row:last-of-type {
  padding-bottom: 0;
}

.card__divider {
  height: 1px;
  background: var(--line);
}

/* Shared page header: a status dot + title + one-line subtitle on the
   left, and a slot for the page's primary action(s) on the right, so
   Start recording / Save+Export don't require scrolling to reach. Sticky
   so those actions stay reachable while scrolling too, background is set
   to the page background color rather than bled edge-to-edge, since both
   pages already use the same ink-950 body color, so it reads as seamless
   without needing to know either page's own horizontal padding. Wraps to
   two rows on narrow widths. */

.head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: var(--sp-3);
  column-gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  padding: var(--sp-4) 0;
  background: var(--ink-950);
}

.head__title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.head__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tally-500);
  box-shadow: 0 0 0 4px var(--tally-tint);
  flex-shrink: 0;
}

.head__dot--live {
  animation: dr-pulse 1.2s ease-in-out infinite;
}

.head h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--paper-600);
}

.head__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  flex-shrink: 0;
}

@keyframes dr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .head__dot--live {
    animation: none !important;
  }
}

/* Shared custom dropdown component. Progressively enhances a native
   <select> (see dropdown.js) into a trigger button + a floating rounded
   menu: soft elevation, one hover state, bold item text, a chevron that
   flips when open, no dividers unless a page opts in via
   .dr-select__divider. The native <select> stays in the DOM, display:none,
   as the real source of truth (value/disabled/"change" events), so every
   existing page script that reads .value or listens for "change" keeps
   working untouched. */

.dr-select {
  position: relative;
  display: inline-flex;
  width: 100%;
}

.dr-select__native {
  display: none;
}

.dr-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  background: var(--ink-800);
  color: var(--paper-100);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: var(--sp-2) var(--sp-3);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.dr-select__trigger:hover:not(:disabled) {
  border-color: var(--paper-600);
}

.dr-select__trigger:focus-visible {
  outline: 2px solid var(--focus-500);
  outline-offset: 2px;
}

.dr-select__trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dr-select__trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dr-select__chevron {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--paper-600);
  transition: transform 0.15s ease;
}

.dr-select__chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

.dr-select--open .dr-select__chevron {
  transform: rotate(180deg);
}

.dr-select__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 320px;
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  padding: var(--sp-2);
  z-index: 30;
}

.dr-select__item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--paper-100);
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
}

.dr-select__item + .dr-select__item {
  margin-top: 2px;
}

.dr-select__item:hover,
.dr-select__item--active {
  background: var(--ink-800);
}

.dr-select__item--selected {
  color: var(--focus-500);
}

.dr-select__divider {
  height: 1px;
  margin: var(--sp-1) 0;
  background: var(--line);
}