/* ════════════════════════════════════════════════════════════════════════
   PHASE 136 — Shine & polish pass (paired with phase136-writer-shine.js)
   Runtime/eighths chips, save pulse, suggestion strip, ⌘K chip, Learn links,
   hub card stats, dark sheet texture, print revision footer, a11y rings.
   Everything here is additive — removing this file + the JS reverts cleanly.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Status bar chips (runtime estimate + session word delta) ──────────── */
#stat-runtime, #stat-delta {
  white-space: nowrap;
}
#stat-delta {
  color: #34d399;
  font-weight: 700;
}

/* ── Save pulse: the “✓ Saved” pill breathes green on each save ─────────── */
@keyframes p136-save-pulse {
  0%   { text-shadow: 0 0 0 rgba(52, 211, 153, 0); }
  35%  { text-shadow: 0 0 10px rgba(52, 211, 153, .85); }
  100% { text-shadow: 0 0 0 rgba(52, 211, 153, 0); }
}
#save-status.p136-pulse {
  animation: p136-save-pulse .9s ease-out 1;
}

/* ── Eighths chip on scene-list rows ────────────────────────────────────── */
.p136-eighths {
  margin-left: auto;
  flex-shrink: 0;
  font-size: .64rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #8a6d3b;
  background: rgba(212, 160, 23, .12);
  border: 1px solid rgba(212, 160, 23, .25);
  border-radius: 999px;
  padding: 1px 6px;
  line-height: 1.3;
}
body.dark .p136-eighths {
  color: #d4b06a;
  background: rgba(212, 160, 23, .14);
  border-color: rgba(212, 160, 23, .3);
}

/* ── Autocomplete suggestion strip (sluglines + character names) ────────── */
#p136-suggest {
  position: fixed;
  z-index: 1200;
  display: none;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(520px, 70vw);
}
#p136-suggest.open { display: flex; }
#p136-suggest .p136-sug {
  appearance: none;
  border: 1px solid rgba(17, 24, 39, .18);
  background: rgba(255, 255, 255, .97);
  color: #1f2937;
  font: 700 .72rem/1 ui-monospace, 'Courier New', monospace;
  letter-spacing: .02em;
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
  transition: transform .1s ease, background .1s ease;
}
#p136-suggest .p136-sug:hover { transform: translateY(-1px); background: #fef9eb; }
body.dark #p136-suggest .p136-sug {
  background: rgba(31, 41, 55, .97);
  border-color: rgba(255, 255, 255, .16);
  color: #e5e7eb;
}
body.dark #p136-suggest .p136-sug:hover { background: #283548; }

/* ── ⌘K command-palette chip in the header ──────────────────────────────── */
#p136-cmdk-chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(105, 74, 36, .25);
  background: rgba(255, 252, 245, .85);
  color: #6b4516;
  font: 700 .68rem/1 ui-monospace, monospace;
  border-radius: 7px;
  padding: 5px 8px;
  cursor: pointer;
  transition: background .12s ease;
}
#p136-cmdk-chip:hover { background: #fff; }
body.dark #p136-cmdk-chip {
  background: rgba(37, 45, 66, .9);
  border-color: rgba(255, 255, 255, .16);
  color: #cbd5e1;
}
@media (max-width: 760px) { #p136-cmdk-chip { display: none; } }

/* ── “📖 Learn” chip on view headers (links to the companion book) ──────── */
.p136-learn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  vertical-align: middle;
  border: 1px solid rgba(216, 166, 87, .45);
  background: rgba(216, 166, 87, .12);
  color: #8a6d3b;
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .03em;
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  transition: background .12s ease;
}
.p136-learn:hover { background: rgba(216, 166, 87, .25); }
body.dark .p136-learn { color: #e6c684; }

/* ── Hub project-card stats row ─────────────────────────────────────────── */
.p136-hubstats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: .68rem;
  font-weight: 600;
  color: #8a7a5c;
}
.p136-hubstats span { display: inline-flex; align-items: center; gap: 3px; }
body.dark .p136-hubstats { color: #9aa6b8; }

/* ── Dark-mode paper texture parity for the Writer sheet ────────────────── */
/* phase121 sets the dark sheet color with a background shorthand; this file
   loads later, so the image layer below wins and restores the subtle dot
   grid the light sheet has. */
body.dark[data-active-view="writer-app"] #editor-frame {
  background-image:
    radial-gradient(rgba(255, 255, 255, .035) 15%, transparent 16%),
    radial-gradient(rgba(255, 255, 255, .035) 15%, transparent 16%) !important;
  background-position: 0 0, 2px 2px !important;
  background-size: 4px 4px, 4px 4px !important;
}

/* ── Print: revision name on every printed page (Ch. 6 change control) ──── */
@media print {
  body[data-cbs-revision]:not([data-cbs-revision="white"])::after {
    content: "Revision: " attr(data-cbs-revision);
    position: fixed;
    bottom: 6px;
    right: 10px;
    font: 700 9px/1 'Courier New', Courier, monospace;
    color: #555;
    text-transform: capitalize;
  }
  #p136-suggest, #p136-cmdk-chip, .p136-learn { display: none !important; }
}

/* ── Accessibility: consistent focus rings + reduced-motion respect ─────── */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #2563eb !important;
  outline-offset: 2px !important;
  border-radius: 4px;
}
body.dark button:focus-visible,
body.dark a:focus-visible,
body.dark select:focus-visible,
body.dark input:focus-visible,
body.dark textarea:focus-visible,
body.dark [role="button"]:focus-visible {
  outline-color: #7fb4ff !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
