/* billys-bar/app/public/style.css — neutral graphite board, white light table. */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }  /* author CSS must never defeat the hidden attribute */

:root {
  --bg: #1c1c1e; --bg-subtle: #242426; --surface: #2a2a2d; --border: #3a3a3e;
  --text: #f5f5f7; --text-2: #a1a1a6;
  --accent: #0a84ff;          /* actions */
  --picked: #30d158;          /* semantic: a look has been chosen */
  --comment: #0a84ff;
  --tile-w: 136px;
  /* overshoot-and-settle spring (linear() approximation) */
  --spring: linear(0, 0.218 2.1%, 0.693 6.4%, 0.914 9%, 1.027 11.4%, 1.08 13.7%,
    1.097 15.5%, 1.099 17.6%, 1.071 21.4%, 0.986 28.7%, 0.967 32.1%, 0.967 36.4%,
    1.001 47%, 1.007 52.8%, 0.998 71.7%, 1);
}

body {
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- login / error ---------- */
.screen { min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.screen h1 { font-size: 28px; font-weight: 700; text-align: center; letter-spacing: -0.01em; }
.screen h1 span { display: block; font-size: 15px; font-weight: 500; color: var(--text-2); letter-spacing: 0.12em; text-transform: uppercase; margin-top: 4px; }
#login-form { display: flex; flex-direction: column; gap: 10px; width: 260px; }
#login-form input { padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
#login-form button, #error-retry { padding: 11px; border-radius: 10px; border: none; background: var(--accent); color: #fff; font-weight: 600; }
.error { color: #ff6961; text-align: center; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 20px;
  background: rgba(28, 28, 30, 0.82);
  backdrop-filter: saturate(160%) blur(20px); -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; margin-right: 8px; }
.brand strong { font-size: 15px; }
.brand span { font-size: 11px; color: var(--text-2); letter-spacing: 0.1em; text-transform: uppercase; }
#search, #topbar select {
  height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
}
#search { width: 190px; }
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.seg button { border: none; background: none; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.seg button.on { background: #48484d; color: var(--text); }
.spacer { flex: 1; }
#progress { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
#view-badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
#refresh-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: 15px; }
#refresh-btn.spinning { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#notice-bar { margin: 12px 20px 0; padding: 8px 12px; border-radius: 8px; background: var(--bg-subtle); border: 1px solid var(--border); color: var(--text-2); font-size: 13px; }

/* ---------- grid of actors ---------- */
#grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-w), 1fr));
  gap: 22px 16px; padding: 22px 24px 60px;
}
#empty { text-align: center; color: var(--text-2); padding: 60px; }
.tile { position: relative; cursor: pointer; outline: none; }
.tile-img {
  position: relative; aspect-ratio: 1 / 2.1; border-radius: 8px; overflow: hidden;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.tile-img img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
/* several looks, none picked yet: prints peeking out behind the top one */
.tile.stack .tile-img {
  overflow: visible;
  box-shadow: 4px -4px 0 -1px #2f2f33, 4px -4px 0 0 #4a4a4f, 8px -8px 0 -2px #28282b, 8px -8px 0 -1px #3e3e43;
}
.tile.stack .tile-img img { border-radius: 8px; }
.tile.picked .tile-img { outline: 2px solid var(--picked); outline-offset: 2px; }
.tile:focus-visible .tile-img { outline: 2px solid var(--accent); outline-offset: 3px; }
.check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--picked); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.tile-cap { display: flex; flex-direction: column; padding: 7px 2px 0; }
.tile-cap .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-cap .meta { font-size: 11.5px; color: var(--text-2); display: flex; gap: 8px; align-items: center; }
.cm { display: inline-flex; align-items: center; gap: 3px; color: var(--comment); }
.ico { width: 12px; height: 12px; fill: currentColor; flex: none; }

/* ---------- hover fan ---------- */
#fan { position: fixed; z-index: 50; }
.fan-card {
  position: absolute; margin: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: var(--from); transform-origin: 50% 50%;
  transition: transform 420ms var(--spring) var(--d);
}
#fan.open .fan-card { transform: var(--to); }
.fan-card img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; }
.fan-card figcaption:not(:empty) {
  position: absolute; left: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: rgba(0, 0, 0, 0.62); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.fan-card.sel { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 3px var(--picked); }
@media (prefers-reduced-motion: reduce) { .fan-card { transition: none; } }

/* ---------- light table ---------- */
#lighttable {
  width: min(96vw, 1900px); height: 93vh; max-width: none; max-height: none; margin: auto;
  border: none; border-radius: 16px; padding: 0; overflow: hidden;
  background: #ffffff; color: #1d1d1f;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}
#lighttable[open] { display: grid; grid-template-rows: auto 1fr auto; }
#lighttable::backdrop { background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(6px); }
.lt-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #e5e5ea; }
.lt-title { flex: 1; min-width: 0; }
.lt-title h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.lt-title p { font-size: 13px; color: #6e6e73; }
.lt-title #lt-check { color: #b25000; }
.lt-head button { width: 34px; height: 34px; border-radius: 50%; border: none; background: #f2f2f7; font-size: 18px; color: #1d1d1f; }
.lt-head button:disabled { opacity: 0.3; cursor: default; }
.lt-nav { font-size: 22px !important; line-height: 1; }

#lt-surface {
  --cap-h: 150px; --img-h: 500px;
  display: flex; gap: 20px; align-items: flex-start; justify-content: safe center;
  overflow: auto; padding: 18px 22px; min-height: 0;
  background: #f5f5f7;
}
.lt-card { flex: none; width: calc(var(--img-h) * var(--ar)); margin: 0; }
.lt-img {
  position: relative; height: var(--img-h); width: 100%; cursor: zoom-in;
  border-radius: 6px; overflow: hidden; background: #e5e5ea;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 6px 18px rgba(0, 0, 0, 0.08);
}
#lt-surface.zoomed .lt-img { cursor: zoom-out; }
#lt-surface.zoomed figcaption { display: none; }
.lt-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lt-num {
  position: absolute; top: 8px; left: 8px; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 12px; display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 13px; font-weight: 700;
}
.lt-card.selected .lt-img { outline: 3px solid var(--picked); outline-offset: 3px; }
.lt-card figcaption { height: var(--cap-h); overflow-y: auto; padding-top: 10px; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.lt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.lt-date { color: #6e6e73; font-variant-numeric: tabular-nums; }
.lt-select {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid #d2d2d7; background: #fff;
  font-size: 13px; font-weight: 600; color: #1d1d1f;
}
.lt-select kbd { font: 11px ui-monospace, SFMono-Regular, monospace; color: #8e8e93; }
.lt-select[aria-pressed="true"] { background: var(--picked); border-color: var(--picked); color: #fff; }
.lt-select[aria-pressed="true"] kbd { color: rgba(255, 255, 255, 0.8); }
.lt-sel-ro { font-size: 13px; font-weight: 600; color: #248a3d; }
.lt-tags { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #e8e8ed; color: #3a3a3c; }
.lt-comments { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.lt-comments li { display: flex; gap: 6px; align-items: flex-start; padding: 5px 8px; border-radius: 8px; background: #eef5ff; color: #1d1d1f; }
.lt-comments .ico { fill: var(--comment); margin-top: 2px; }
.lt-note { width: 100%; min-height: 34px; border: 1px solid #d2d2d7; border-radius: 6px; padding: 5px 7px; font-size: 12px; resize: vertical; background: #fff; }
.lt-note:focus, #lt-notes:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.lt-note-ro { padding: 5px 8px; border-radius: 6px; background: #f2f2f7; white-space: pre-wrap; }

.lt-foot { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 14px; align-items: center; padding: 10px 22px 12px; border-top: 1px solid #e5e5ea; }
.lt-foot label { font-size: 13px; font-weight: 600; }
#lt-notes { width: 100%; border: 1px solid #d2d2d7; border-radius: 8px; padding: 7px 9px; font-size: 13px; resize: vertical; background: #fff; }
#lt-notes[readonly] { background: #f2f2f7; resize: none; }
.lt-foot.empty-ro label, .lt-foot.empty-ro #lt-notes { visibility: hidden; }
.lt-hint { font-size: 11.5px; color: #8e8e93; white-space: nowrap; }
.lt-hint kbd { font: 11px ui-monospace, SFMono-Regular, monospace; padding: 0 4px; border: 1px solid #d2d2d7; border-radius: 4px; background: #fff; }
body.view-only .lt-hint { visibility: hidden; }

/* ---------- toast / pending ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  padding: 9px 14px; border-radius: 10px; background: #2c2c2e; border: 1px solid var(--border);
  color: var(--text); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
#pending-badge {
  position: fixed; right: 16px; bottom: 16px; z-index: 100;
  padding: 5px 11px; border-radius: 999px; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}
