/* ==========================================================================
   V Kedar's Command Center — stylesheet
   ========================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-2: #121212;
  --bg-3: #181818;
  --ink: #f0ece3;
  --ink-70: rgba(240, 236, 227, .7);
  --ink-50: rgba(240, 236, 227, .5);
  --ink-30: rgba(240, 236, 227, .3);
  --ink-12: rgba(240, 236, 227, .12);
  --ink-06: rgba(240, 236, 227, .06);
  --gold: #d4af37;
  --gold-2: #f4d03f;
  --gold-10: rgba(212, 175, 55, .10);
  --gold-25: rgba(212, 175, 55, .25);
  --gold-40: rgba(212, 175, 55, .4);
  --warn: #ffcf8a;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pad: 40px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  background: var(--bg);
  background-image:
    linear-gradient(rgba(212, 175, 55, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img, video { max-width: 100%; }
.hidden { display: none !important; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--pad); }
.mono { font-family: var(--mono); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--pad);
  background: rgba(10, 10, 10, .9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ink-12);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.monogram {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--gold); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 15px; letter-spacing: .5px;
}
.brand-name { font-family: var(--serif); font-size: 18px; font-weight: 700; white-space: nowrap; }
.brand-name em { color: var(--gold); font-style: italic; }

/* ---------- segmented control & buttons ---------- */
.seg { display: inline-flex; border: 1px solid var(--ink-12); }
.seg button {
  background: none; border: none; color: var(--ink-50);
  padding: 8px 14px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  transition: color .15s, background .15s;
}
.seg button + button { border-left: 1px solid var(--ink-12); }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--gold); color: #000; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--gold); color: #000; border: 1px solid transparent;
  font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--gold-2); }
.btn-ghost { background: transparent; color: var(--ink-70); border-color: var(--ink-12); }
.btn-ghost:hover { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------- hero ---------- */
.hero { padding: 48px 0 8px; }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--gold); }
.hero h1 { font-family: var(--serif); font-size: clamp(40px, 7vw, 76px); font-weight: 900; line-height: 1; margin: 10px 0 12px; }
.hero h1 em { color: var(--gold); font-style: italic; }
.tagline { font-size: 17px; color: var(--ink-70); max-width: 560px; }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--ink-12); border: 1px solid var(--ink-12);
  margin-top: 28px;
}
.stat { background: var(--bg); padding: 18px 20px; min-width: 0; }
.stat-label { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-30); }
.stat-value { font-family: var(--serif); font-size: 28px; font-weight: 700; color: var(--gold); margin-top: 6px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12px; color: var(--ink-50); margin-top: 4px; }

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; margin: 30px 0 22px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.search {
  width: 100%; max-width: 520px;
  padding: 12px 16px 12px 42px;
  background: var(--bg-2); border: 1px solid var(--ink-12); color: var(--ink);
  font: inherit; font-size: 15px; outline: none; border-radius: 0; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23d4af37' stroke-width='1.6'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.search:focus { border-color: var(--gold); }
.search::placeholder { color: var(--ink-30); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chips-label { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-30); margin-right: 4px; }
.chip {
  font-size: 12px; padding: 6px 12px;
  border: 1px solid var(--ink-12); background: transparent; color: var(--ink-70);
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { border-color: var(--gold-40); color: var(--ink); }
.chip.on { border-color: var(--gold); color: var(--gold); background: var(--gold-10); }
.chip small { color: var(--ink-30); margin-left: 5px; font-size: 11px; }
.chip-more { border-style: dashed; color: var(--ink-50); }
.result-count { font-family: var(--mono); font-size: 12px; color: var(--ink-50); }
.right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- notices ---------- */
.notice { border: 1px solid rgba(255, 180, 80, .35); background: rgba(255, 180, 80, .08); color: var(--warn); padding: 12px 16px; font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.notice code { font-family: var(--mono); font-size: 13px; }
.empty { border: 1px dashed var(--gold-25); padding: 56px 28px; text-align: center; color: var(--ink-50); }
.empty h3 { font-family: var(--serif); color: var(--ink); font-size: 26px; margin-bottom: 10px; font-weight: 700; }
.empty p { max-width: 520px; margin: 0 auto 8px; line-height: 1.6; }
.empty code { font-family: var(--mono); color: var(--gold); font-size: 13px; }
.empty .btn { margin-top: 16px; }

/* ---------- library grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; align-items: start; }
.card {
  background: var(--bg-2); border: 1px solid var(--ink-12);
  overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .2s, border-color .2s;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); border-color: var(--gold-40); outline: none; }
.thumb { position: relative; background: #000; aspect-ratio: 16 / 9; overflow: hidden; }
.thumb.v { aspect-ratio: 9 / 16; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s;
}
.card:hover .play, .card:focus-visible .play { opacity: 1; }
.play-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--gold); color: #000;
  display: flex; align-items: center; justify-content: center;
}
.play-btn svg { width: 20px; height: 20px; margin-left: 3px; }
.num {
  position: absolute; top: 8px; left: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px;
  background: rgba(0, 0, 0, .7); color: var(--gold); padding: 3px 7px;
}
.dur {
  position: absolute; right: 8px; bottom: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .5px;
  background: rgba(0, 0, 0, .75); color: var(--ink); padding: 2px 6px;
}
.tl-thumb .dur { right: 4px; bottom: 4px; font-size: 10px; padding: 1px 5px; }
.card-body { padding: 12px 14px 14px; }
.card-title { font-size: 15px; font-weight: 500; line-height: 1.35; }
.card-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-50); margin-top: 6px; letter-spacing: .3px; }
.card-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; color: var(--ink-50); border: 1px solid var(--ink-12); padding: 2px 7px; }

/* ---------- evolution timeline ---------- */
.tl { position: relative; padding-left: 28px; margin-top: 6px; }
.tl::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: linear-gradient(180deg, var(--gold), var(--ink-12)); }
.tl-month { font-family: var(--serif); font-size: 22px; font-weight: 700; margin: 34px 0 10px; position: relative; }
.tl-month:first-child { margin-top: 8px; }
.tl-month::before { content: ''; position: absolute; left: -24px; top: 13px; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); }
.tl-month small { font-family: var(--mono); font-size: 11px; color: var(--ink-30); letter-spacing: 1px; margin-left: 10px; font-weight: 400; }
.tl-item {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--ink-06); cursor: pointer;
}
.tl-item:hover .tl-title { color: var(--gold); }
.tl-thumb { position: relative; width: 128px; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.tl-thumb.v { width: 68px; aspect-ratio: 9 / 16; }
.tl-thumb img, .tl-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-date { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); }
.tl-title { font-size: 17px; font-weight: 500; margin-top: 3px; transition: color .15s; }
.tl-notes { color: var(--ink-70); font-size: 14px; line-height: 1.55; margin-top: 5px; }
.tl-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-30); margin-top: 8px; }
.tl-meta .num-inline { color: var(--ink-50); }

/* ---------- player ---------- */
.player { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.player[hidden] { display: none; }
.player-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .86); backdrop-filter: blur(6px); }
.player-box {
  position: relative; background: var(--bg-2); border: 1px solid var(--gold-25);
  max-width: 1100px; width: 100%; max-height: 92vh;
  display: flex; overflow: hidden;
}
.player-box.h { flex-direction: column; max-width: 960px; }
.player-box.v { flex-direction: row; }
.player-stage { background: #000; flex-shrink: 0; }
.h .player-stage { width: 100%; aspect-ratio: 16 / 9; }
.v .player-stage { aspect-ratio: 9 / 16; height: min(80vh, 720px); }
.player-stage iframe, .player-stage video { width: 100%; height: 100%; border: 0; display: block; }
.player-info { padding: 22px 24px; overflow: auto; flex: 1; min-width: 0; }
.player-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border: 1px solid var(--ink-12);
  background: rgba(0, 0, 0, .65); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.player-close:hover { border-color: var(--gold); color: var(--gold); }
.player-meta { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); padding-right: 40px; }
.player-info h2 { font-family: var(--serif); font-size: 24px; margin: 8px 0 10px; line-height: 1.2; }
.player-notes { color: var(--ink-70); line-height: 1.6; font-size: 15px; white-space: pre-wrap; }
.player-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.player-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; align-items: center; }
.player-actions .spacer { flex: 1; }

/* ---------- owner help ---------- */
.help { margin: 56px 0 0; border-top: 1px solid var(--ink-12); padding-top: 24px; }
.help summary { cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-50); list-style: none; }
.help summary::-webkit-details-marker { display: none; }
.help summary::before { content: '+ '; color: var(--gold); }
.help[open] summary::before { content: '− '; }
.help ol { margin: 16px 0 0 20px; color: var(--ink-70); font-size: 14px; line-height: 1.7; }
.help code { font-family: var(--mono); color: var(--gold); font-size: 13px; }

/* ---------- footer ---------- */
.footer { padding: 36px var(--pad); margin-top: 40px; border-top: 1px solid var(--ink-12); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-30); font-family: var(--mono); letter-spacing: .5px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  :root { --pad: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .player { padding: 0; }
  .player-box, .player-box.h, .player-box.v { flex-direction: column; max-height: 100vh; height: 100vh; border: none; }
  .v .player-stage { height: auto; width: 100%; max-height: 62vh; aspect-ratio: 9 / 16; align-self: center; }
  .h .player-stage { max-height: 62vh; }
  .player-info { padding: 18px 18px 28px; }
}
@media (max-width: 600px) {
  :root { --pad: 16px; }
  .top { padding: 10px var(--pad); }
  .brand-name { font-size: 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 11px 12px; }
  .card-title { font-size: 13px; }
  .tl { padding-left: 22px; }
  .tl-thumb { width: 96px; }
  .tl-thumb.v { width: 54px; }
  .hero { padding-top: 32px; }
  .footer { flex-direction: column; }
}
