/* The deck: bezel, recessed well, transport keys, OSD.
   The whole app sits inside a tape deck, so the window chrome IS the product. */

body {
  background: var(--room);
  color: var(--label);
  font-family: var(--font-label);
  font-size: var(--step-0);
  line-height: 1.45;
}

/* ── shell ────────────────────────────────────────────────────────────── */
.deck {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: var(--bezel-h) 1fr;
  background:
    linear-gradient(180deg, var(--shell-hi) 0, var(--shell) 8%, var(--shell) 92%, var(--shell-lo) 100%);
  box-shadow: inset 0 0 0 1px var(--shell-lo);
}

/* ── bezel / titlebar ─────────────────────────────────────────────────── */
.bezel {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-2) 0 var(--sp-4);
  background: linear-gradient(180deg, var(--shell-hi), var(--shell));
  border-bottom: 1px solid var(--shell-lo);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  -webkit-app-region: drag;
}

.bezel-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 0 0 auto;
}

.bezel-mark {
  color: var(--accent-lit);
  font-size: var(--step--1);
  filter: drop-shadow(0 0 4px var(--accent));
}

.bezel-name {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.22em;
  color: var(--osd-dim);
}

.bezel-keys {
  margin-left: auto;
  display: flex;
  gap: var(--sp-1);
  -webkit-app-region: no-drag;
}

.key-sm {
  width: 30px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--osd-dim);
  font-family: var(--font-osd);
  font-size: var(--step-0);
  border-radius: var(--r-sm);
  transition: background 120ms, color 120ms;
}

.key-sm:hover {
  background: var(--shell-lo);
  color: var(--osd);
}

.key-close:hover {
  background: var(--bad);
  color: #fff;
}

/* ── OSD — every counter in the app renders here or in this face ───────── */
.osd {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--osd);
  text-shadow: 0 0 calc(10px * var(--bloom-op)) var(--osd);
}

.osd-dim {
  color: var(--osd-dim);
}

.osd-row,
#osd {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.osd-sep::before {
  content: "·";
  margin: 0 var(--sp-2);
  color: var(--osd-dim);
}

/* the blinking transport glyph */
.osd-cursor::after {
  content: "▌";
  color: var(--accent-lit);
  animation: osd-blink 1.06s steps(1, end) infinite;
}

[data-motion="off"] .osd-cursor::after {
  animation: none;
}

@keyframes osd-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ── the recessed well every surface renders into ─────────────────────── */
.well {
  position: relative;
  margin: var(--sp-3);
  border-radius: var(--r-lg);
  background: var(--well);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px var(--well-line);
  overflow: hidden;
}

.surface {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.surface-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.surface-head,
.surface-foot {
  flex: 0 0 auto;
  padding: var(--sp-3) var(--sp-4);
}

.surface-head {
  border-bottom: 1px solid var(--well-line);
}

.surface-foot {
  border-top: 1px solid var(--well-line);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25));
}

/* scrollbars, deck-coloured */
.surface-body::-webkit-scrollbar {
  width: 10px;
}

.surface-body::-webkit-scrollbar-track {
  background: transparent;
}

.surface-body::-webkit-scrollbar-thumb {
  background: var(--well-line);
  border-radius: 5px;
  border: 2px solid var(--well);
}

.surface-body::-webkit-scrollbar-thumb:hover {
  background: var(--ink-soft);
}

/* ── transport keys — the physical buttons ────────────────────────────── */
.key {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 11px 18px;
  font-family: var(--font-osd);
  font-size: var(--step-0);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--label);
  background: linear-gradient(180deg, var(--shell-hi), var(--shell));
  border: 1px solid var(--shell-lo);
  border-radius: var(--r-sm);
  box-shadow:
    0 2px 0 var(--shell-lo),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  transition:
    transform var(--t-key) ease-out,
    box-shadow var(--t-key) ease-out,
    filter 120ms;
}

.key:hover:not(:disabled) {
  filter: brightness(1.18);
}

/* 2px of travel — they depress and they clunk */
.key:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 0 0 var(--shell-lo),
    inset 0 2px 5px rgba(0, 0, 0, 0.55);
}

.key:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.key-primary {
  color: var(--accent-lit);
  border-color: var(--accent);
  box-shadow:
    0 2px 0 var(--shell-lo),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent);
}

.key-danger:hover:not(:disabled) {
  color: var(--bad);
}

.key-big {
  padding: 18px 46px;
  font-size: var(--step-2);
  letter-spacing: 0.24em;
}

.key-ghost {
  background: none;
  border-color: var(--well-line);
  box-shadow: none;
  color: var(--osd-dim);
}

.key-ghost:hover:not(:disabled) {
  color: var(--osd);
  border-color: var(--ink-soft);
}

/* ── small controls ───────────────────────────────────────────────────── */
.chip {
  padding: 5px 11px;
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--osd-dim);
  border: 1px solid var(--well-line);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.25);
  transition: color 120ms, border-color 120ms, background 120ms;
}

.chip:hover {
  color: var(--osd);
  border-color: var(--ink-soft);
}

.chip[aria-pressed="true"],
.chip.on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent-lit);
}

.field {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

.field label {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--osd-dim);
}

.field select,
.field input[type="number"],
.field input[type="text"] {
  padding: 5px 8px;
  font-family: var(--font-osd);
  font-size: var(--step--1);
  color: var(--osd);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--well-line);
  border-radius: var(--r-sm);
}

.field.alert select,
.field.alert input {
  border-color: var(--warn);
  color: var(--warn);
}

/* ── utilities ────────────────────────────────────────────────────────── */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

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

.spacer {
  flex: 1 1 auto;
}

.center {
  display: grid;
  place-items: center;
  height: 100%;
}

.hidden {
  display: none !important;
}

.marker {
  font-family: var(--font-marker);
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ── shared surface furniture (src/js/ui.js) ──────────────────────────────
   Every surface used to letter its own title with an inline margin, which is why no
   two of them lined up. */
.surface-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* The deck brings its own header row rather than a title and actions. Making the head a
   flex container turned that row into a flex *item*, which stopped it filling the width
   and left Settings stranded next to the country code instead of out at the right. */
.surface-head > .shelf-head {
  flex: 1 1 auto;
  min-width: 0;
}

.surface-title {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--osd);
}

/* A destructive action that asks first, in place — see `danger()` in ui.js. */
.chip-danger {
  color: color-mix(in srgb, var(--bad) 80%, var(--osd-dim));
  border-color: color-mix(in srgb, var(--bad) 40%, var(--well-line));
}

.chip-danger:hover {
  color: var(--bad);
  border-color: var(--bad);
}

.chip-danger.armed {
  color: var(--accent-ink);
  background: var(--bad);
  border-color: var(--bad);
}

/* a poster slot that holds its size whether or not the image ever arrives */
.thumb {
  flex: 0 0 auto;
  width: 46px;
  height: 66px;
  border-radius: 2px;
  background: var(--shell-lo);
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Focus you can actually see. The default ring is invisible against the well on every
   one of the three tape stocks. */
:focus-visible {
  outline: 2px solid var(--accent-lit);
  outline-offset: 2px;
}

/* Content dropped straight into a surface body needs the gutter that older surfaces got
   from their own wrapper (`.settings`, `.search`, `.follow-list`). Direct children only,
   so the nested groups in Settings keep the padding they already have. */
.surface-body > .set-group,
.surface-body > .row {
  padding: var(--sp-4) var(--sp-5);
}

.surface-body > .set-group + .row {
  padding-top: 0;
}
