/* Add → Pharos (renderer/pharos/add.js): the dialog the top bar's Add opens for a
 * film, a show, an audiobook or music. It sits on the request popout's scrim and
 * tokens (media/cinema-request.css, --cr-*), so the release picker that opens over
 * it is one family; what is its own is the lamp: Pharos's beacon orange marks the
 * kind in use and every button that asks Pharos for something. */
.pa-scrim { --pa-beacon: #ff8c1a; --pa-beacon-2: #ff6000; --pa-well: rgba(0, 0, 0, .28); --pa-have: #8fdc8a; }
.pa-dlg {
  width: min(880px, 100%); height: min(760px, 88vh); max-height: 88vh;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(255, 140, 26, .10), transparent 60%),
    var(--hearth-grain, none), var(--cr-panel);
  border-color: var(--hearth-brass-edge, var(--cr-line));
  box-shadow: inset 0 1px 0 rgba(255, 226, 170, .08), 0 0 0 1.5px var(--hearth-ink, #0b0806), 0 40px 80px -30px rgba(0, 0, 0, .95);
}
.pa-dlg [hidden] { display: none !important; }

/* ── head ─────────────────────────────────────────────────────────────── */
.pa-head { display: flex; align-items: center; gap: 14px; padding: 20px 20px 14px 22px; }
.pa-lamp { flex: none; width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 0 14px rgba(255, 140, 26, .45)) drop-shadow(0 3px 4px #0009); }
.pa-head-t { flex: 1 1 auto; min-width: 0; }
.pa-eyebrow { margin: 0 0 2px; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cr-accent); }
.pa-head h2 { margin: 0; font-family: var(--hearth-font, inherit); font-size: 24px; line-height: 1.15; color: var(--hearth-cream, var(--cr-ink)); }
.pa-via { margin: 3px 0 0; min-height: 1.3em; font-size: 13px; color: var(--cr-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-close {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  border-radius: 11px; border: 1px solid var(--cr-line); background: rgba(255, 255, 255, .04); color: var(--cr-muted);
  transition: background-color .15s, color .15s, transform .12s;
}
.pa-close:hover { background: rgba(255, 255, 255, .09); color: var(--cr-ink); }
.pa-close:active { transform: translateY(1px); }

/* ── the kind switch: four equal cells, one lamp that slides ──────────── */
.pa-kinds {
  --pa-i: 0;
  position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  margin: 0 20px; padding: 4px; border-radius: 15px; border: 1px solid var(--cr-line); background: var(--pa-well);
}
.pa-kind {
  position: relative; z-index: 1; min-width: 0; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 6px 10px; border: 0; border-radius: 11px; background: none; color: var(--cr-muted); font: inherit; font-weight: 650; font-size: 14.5px; cursor: pointer;
  transition: color .18s;
}
.pa-kind img { flex: none; width: 26px; height: 26px; object-fit: contain; filter: saturate(.7) brightness(.82) drop-shadow(0 2px 2px #0008); transition: filter .2s, transform .28s var(--cr-ease); }
.pa-kind span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-kind:hover { color: var(--cr-ink); }
.pa-kind.is-on { color: #fff3df; }
.pa-kind.is-on img { filter: drop-shadow(0 2px 3px #0009); transform: scale(1.08); }
.pa-kind-lamp {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4);
  transform: translateX(calc(var(--pa-i) * 100%)); transition: transform .34s var(--cr-ease);
  border-radius: 11px; border: 1px solid rgba(255, 170, 80, .55);
  background: linear-gradient(180deg, rgba(255, 140, 26, .30), rgba(255, 96, 0, .14));
  box-shadow: inset 0 1px 0 rgba(255, 226, 170, .22), 0 6px 18px -8px rgba(255, 120, 10, .7);
  pointer-events: none;
}

/* ── the search field ─────────────────────────────────────────────────── */
.pa-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 14px 20px 0; }
.pa-field {
  min-width: 0; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 8px; height: 48px; padding: 0 6px 0 14px;
  border-radius: 13px; border: 1px solid var(--cr-line); background: var(--pa-well); cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.pa-field:focus-within { border-color: rgba(255, 170, 80, .75); box-shadow: 0 0 0 3px rgba(255, 140, 26, .16); }
.pa-glass { display: grid; place-items: center; color: var(--cr-muted); }
.pa-input {
  min-width: 0; width: 100%; height: 100%; border: 0; outline: 0; background: none; color: var(--cr-ink); font: inherit; font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.pa-input::placeholder { color: #8f8a82; }
.pa-input::-webkit-search-cancel-button { display: none; }
.pa-clear { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--cr-muted); cursor: pointer; }
.pa-clear:hover { background: rgba(255, 255, 255, .08); color: var(--cr-ink); }
.pa-clear svg { width: 15px; height: 15px; }
.pa-go, .pa-act {
  min-height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid var(--cr-line); background: rgba(255, 255, 255, .05);
  color: var(--cr-ink); font: inherit; font-weight: 650; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.pa-go { height: 48px; padding: 0 22px; border-radius: 13px; }
/* One lit plaque per view (Search, or the refusal's door). A row's own button is a
   plate with the lamp's colour in its words, and lights only under the hand: twenty
   lit buttons down a list would shout over the titles. */
.pa-go, .pa-plate .pa-act.is-lead, .pa-row .pa-act.is-lead:is(:hover, :focus-visible):not(:disabled) {
  color: #1c1206; border-color: rgba(255, 220, 160, .7); background: linear-gradient(180deg, #ffc56b, var(--pa-beacon));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 8px 18px -10px rgba(255, 120, 10, .9);
}
.pa-row .pa-act.is-lead { color: #ffc98a; border-color: rgba(255, 170, 80, .45); background: rgba(255, 140, 26, .09); }
.pa-go:hover, .pa-act:hover:not(:disabled) { transform: translateY(-1px); }
.pa-go:active, .pa-act:active:not(:disabled) { transform: translateY(1px); }
.pa-act:hover:not(:disabled):not(.is-lead) { background: rgba(255, 255, 255, .1); }
.pa-act:disabled { cursor: default; opacity: .7; }
.pa-act.is-sent { color: var(--pa-have); border-color: rgba(143, 220, 138, .45); background: rgba(143, 220, 138, .10); box-shadow: none; opacity: 1; }
.pa-dlg :is(.pa-close, .pa-kind, .pa-clear, .pa-go, .pa-act):focus-visible { outline: 2px solid var(--pa-beacon); outline-offset: 2px; }
.pa-dlg.is-refused .pa-search { opacity: .4; pointer-events: none; }

/* ── the status line ──────────────────────────────────────────────────── */
.pa-say { margin: 10px 22px 0; min-height: 1.4em; font-size: 13px; color: var(--cr-muted); text-wrap: pretty; }
.pa-say.is-warn { color: #ffb27a; font-weight: 600; }

/* ── results: rows on a ruled ledger, never boxes in boxes ────────────── */
.pa-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-top: 6px; padding: 0 20px 6px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; outline: none; scrollbar-gutter: stable; }
.pa-body > * { flex: none; }
.pa-list { list-style: none; margin: 0; padding: 0; }
.pa-body > .pa-rest { flex: 1 1 0; min-height: 0; margin: 10px 0 4px; background: center / auto min(120px, 100%) no-repeat; opacity: .13; filter: grayscale(.4); }
.pa-group { margin: 16px 2px 4px; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cr-accent); }
.pa-group:first-child { margin-top: 6px; }
.pa-row {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 2px;
  border-bottom: 1px solid var(--cr-line);
  animation: pa-row .34s var(--cr-ease) backwards; animation-delay: calc(var(--pa-n, 0) * 28ms);
}
.pa-row:last-child { border-bottom: 0; }
@keyframes pa-row { from { opacity: 0; transform: translateY(8px); } }
.pa-art { width: 52px; border-radius: 8px; overflow: hidden; display: grid; place-items: center; background: rgba(255, 255, 255, .05); box-shadow: 0 4px 10px -4px #000c; }
.pa-art.is-poster { height: 78px; }
.pa-art.is-cover { height: 52px; }
.pa-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pa-art.is-mark img { width: 30px; height: 30px; object-fit: contain; opacity: .8; }
.pa-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pa-t { font-size: 15.5px; font-weight: 650; line-height: 1.25; color: var(--cr-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-t span { font-weight: 500; color: var(--cr-muted); }
.pa-m { font-size: 13px; line-height: 1.4; color: var(--cr-muted); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.pa-row:has(.is-cover) .pa-m { -webkit-line-clamp: 1; line-clamp: 1; }
.pa-tag { font-size: 12px; color: #a39c91; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-tag.is-have { color: var(--pa-have); font-weight: 600; }

/* waiting: the same rows, unlit */
.pa-row.is-ghost { animation: none; }
.pa-row.is-ghost .pa-art, .pa-row.is-ghost .pa-main, .pa-ghost-act { background: linear-gradient(100deg, rgba(255, 255, 255, .05) 40%, rgba(255, 190, 120, .13) 50%, rgba(255, 255, 255, .05) 60%) 0 0 / 300% 100%; animation: pa-sweep 1.5s linear infinite; }
.pa-row.is-ghost .pa-main { height: 34px; border-radius: 8px; }
.pa-ghost-act { width: 96px; height: 40px; border-radius: 11px; }
@keyframes pa-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* the open plate: before a search, nothing found, an error, a refusal */
.pa-body > .pa-plate { flex: 1 0 auto; }
.pa-plate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px 16px; text-align: center; animation: pa-row .4s var(--cr-ease) backwards; }
.pa-plate img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 10px 14px #000a); margin-bottom: 4px; }
.pa-plate h3 { margin: 0; font-family: var(--hearth-font, inherit); font-size: 20px; color: var(--hearth-cream, var(--cr-ink)); text-wrap: balance; }
.pa-plate p { margin: 0; max-width: 52ch; font-size: 14.5px; line-height: 1.5; color: var(--cr-muted); text-wrap: pretty; }
.pa-plate .pa-act { margin-top: 8px; }
.pa-plate .pa-act + .pa-act { margin-top: 0; }
.pa-plate.is-refusal img { filter: grayscale(.85) brightness(.75) drop-shadow(0 10px 14px #000a); }
.pa-plate.is-refusal h3, .pa-plate.is-error h3 { color: #ffb27a; }
.pa-plate.is-refusal p { color: var(--cr-ink); }

/* ── foot: where it lands ─────────────────────────────────────────────── */
.pa-foot { padding: 12px 22px 16px; border-top: 1px solid var(--cr-line); }
.pa-lands { margin: 0; font-size: 12.5px; color: #a39c91; text-wrap: pretty; }
.pa-dlg.is-refused .pa-foot { display: none; }

/* ── the Add menu's Pharos rows (the kind picker, renderer/app.js) ────── */
.kind-picker-sub { display: flex; align-items: center; gap: 7px; margin: 8px 6px 4px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-mute); }
.kind-picker-sub:first-child { margin-top: 2px; }
.kind-picker-sub img { width: 16px; height: 16px; object-fit: contain; }
.kind-picker-item.is-off .kind-picker-icon img { filter: grayscale(1) brightness(.7); }
.kind-picker-item.is-off .kind-picker-hint { color: #ffb27a; }

/* ── a phone ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .pa-dlg { width: 100%; height: 92vh; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .pa-head { padding: 16px 14px 12px 16px; gap: 12px; }
  .pa-head h2 { font-size: 21px; }
  .pa-close, .pa-clear { width: 44px; height: 44px; }
  .pa-field { height: 52px; }
  .pa-go { height: 52px; }
  .pa-kinds { margin: 0 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 0; }
  .pa-kind { min-height: 48px; }
  /* 2 × 2: the lamp's cell by name, so it needs no CSS maths a phone may lack. */
  .pa-kind-lamp { width: calc((100% - 8px) / 2); height: 48px; bottom: auto; transform: none; }
  .pa-dlg[data-kind="tv"] .pa-kind-lamp { transform: translateX(100%); }
  .pa-dlg[data-kind="audiobook"] .pa-kind-lamp { transform: translateY(100%); }
  .pa-dlg[data-kind="music"] .pa-kind-lamp { transform: translate(100%, 100%); }
  .pa-search { margin: 12px 14px 0; }
  .pa-go { padding: 0 16px; }
  .pa-say { margin: 8px 16px 0; }
  .pa-body { padding: 0 14px 6px; }
  .pa-row { gap: 12px; }
  .pa-row:has(.pa-act) { grid-template-columns: 52px minmax(0, 1fr); }
  .pa-row .pa-act { grid-column: 1 / -1; min-height: 44px; }
  .pa-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
}
@media (prefers-reduced-motion: reduce) {
  .pa-row, .pa-plate { animation: none; }
  .pa-kind-lamp, .pa-kind img, .pa-go, .pa-act, .pa-close { transition: none; }
  .pa-row.is-ghost .pa-art, .pa-row.is-ghost .pa-main, .pa-ghost-act { animation: none; }
}
