/*
 * writer-report.css
 *
 * Shared styling for the analysis report panel: summary headlines, tile
 * grid + thumbnails, inline signals block, format-mismatch banner,
 * shapes panel, click-to-open window overlay. Loaded by /writer
 * (registered upload form) AND by /writers, /screenwriters, /agents
 * landing pages whose "See it in action" modal renders the same report.
 *
 * Class names match those produced by static/js/writer-report.js
 * (SlushproofReport.scaffoldHtml + render).
 */

.sp-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

/* ── Summary block ───────────────────────────────────────────── */
.sp-summary { margin-bottom: 2rem; }
.sp-summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--ink);
  margin-top: 0.6rem;
}
.sp-summary-strip .sp-headline {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}
.sp-summary-strip .sp-headline-label {
  color: var(--muted);
  font-size: 0.85rem;
}
.sp-summary-strip .sp-headline-value {
  color: var(--ink);
  font-weight: 600;
}

/* ── Finder-style tile grid ──────────────────────────────────── */
.sp-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.sp-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  text-align: center;
}
.sp-tile:hover,
.sp-tile:focus-visible {
  border-color: var(--ink);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transform: translateY(-1px);
  outline: none;
}
.sp-tile-thumb {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.sp-tile-label {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

/* Tile thumbnail glyphs (CSS-only stylized previews until real
   per-manuscript thumbnails ship in Phase 2). */
.sp-thumb-letter,
.sp-thumb-list {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}
.sp-thumb-letter span {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.55;
}
.sp-thumb-letter span:nth-child(1) { width: 70%; opacity: 0.85; }
.sp-thumb-letter span:nth-child(2) { width: 92%; }
.sp-thumb-letter span:nth-child(3) { width: 88%; }
.sp-thumb-letter span:nth-child(4) { width: 95%; }
.sp-thumb-letter span:nth-child(5) { width: 60%; }
.sp-thumb-letter span:nth-child(6) { width: 90%; }
.sp-thumb-letter span:nth-child(7) { width: 75%; }

.sp-thumb-list { gap: 8px; }
.sp-thumb-list .sp-thumb-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-thumb-list .sp-thumb-bullet {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--concern);
  flex-shrink: 0;
}
.sp-thumb-list .sp-thumb-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.55;
}

/* SIGNALS AND CONCERNS thumbnail: paired label/value rows */
.sp-thumb-signals { gap: 9px; padding: 4px 0; }
.sp-thumb-signals .sp-thumb-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sp-thumb-signals .sp-thumb-label {
  flex: 0 0 38%;
  height: 4px;
  border-radius: 2px;
  background: var(--muted);
  opacity: 0.7;
}
.sp-thumb-signals .sp-thumb-value {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--ink);
  opacity: 0.85;
}

/* Save-the-Cat thumbnail: horizontal beat timeline with markers */
.sp-thumb-beats {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-thumb-beats .sp-thumb-beats-line {
  width: 90%;
  height: 2px;
  background: var(--ink);
  opacity: 0.55;
  position: relative;
}
.sp-thumb-beats .sp-thumb-beat {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
}

/* Hero's Journey thumbnail: circular map with stage markers */
.sp-thumb-journey {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-thumb-journey-circle {
  position: relative;
  width: 70%;
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  border-radius: 50%;
  opacity: 0.65;
}
.sp-thumb-journey-circle .sp-thumb-stage {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink);
  transform: translate(-50%, -50%);
}

/* Inline SIGNALS AND CONCERNS block — sits above the tile grid as
   the immediate "reward" for waiting on the analysis. The tile +
   window pattern still exists for focused / printable viewing of
   the same content. */
.sp-inline-signals {
  margin: 1.5rem 0 0;
  padding: 1.25rem 1.5rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
}
.sp-inline-signals:empty { display: none; }

/* Format-mismatch warning. The text auto-detector and the user's
   Novel / Screenplay toggle disagree — flag it so the writer can
   re-run with the right setting. */
.sp-format-mismatch {
  margin: 1.25rem 0 0;
  padding: 0.85rem 1.1rem;
  background: #fff7e6;
  border: 1px solid #f0c674;
  border-left: 3px solid #d68f00;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.92rem;
  color: #6b4500;
}
.sp-format-mismatch strong { color: #4a3000; }

/* Shapes tile thumbnail — decorative SVG of two overlapping
   wave forms. Same visual language as the other tile thumbs. */
.sp-thumb-shapes {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 0.75rem;
  color: var(--ink);
}
.sp-thumb-shapes svg {
  width: 100%; height: 100%;
}

/* Shapes window content — 6 server-rendered sparklines in a
   2-column grid. Lives inside the click-to-open tile window. */
.sp-shapes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.5rem;
}
@media (max-width: 720px) {
  .sp-shapes-grid { grid-template-columns: 1fr; }
}
.sp-shape {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.sp-shape-label {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.sp-shape img {
  width: 100%;
  height: auto;
  display: block;
}

/* Tiles that aren't wired yet: subtly muted, not interactive. The
   grid still shows the full 5-tile shape; the muted state signals
   "this exists but isn't ready" without a "coming soon" placard. */
.sp-tile.sp-tile-inert {
  opacity: 0.55;
  cursor: default;
}
.sp-tile.sp-tile-inert:hover,
.sp-tile.sp-tile-inert:focus-visible {
  border-color: var(--rule);
  box-shadow: none;
  transform: none;
}

/* ── Window overlay (Termly-pattern; long, scrollable, dismissible) ── */
.sp-window {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sp-window-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.sp-window-frame {
  position: relative;
  background: #fff;
  width: min(900px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  overflow: hidden;
}
.sp-window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.sp-window-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}
.sp-window-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sp-window-actions .sp-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  margin: 0;
}
.sp-btn-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}
.sp-btn-icon:hover { color: var(--ink); background: rgba(0,0,0,0.05); }
.sp-window-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
body.sp-window-open { overflow: hidden; }

/* ── Print: hide everything except the open window body ──────── */
@media print {
  body * { visibility: hidden; }
  .sp-window,
  .sp-window * { visibility: visible; }
  .sp-window-backdrop { display: none; }
  .sp-window-frame {
    position: static;
    box-shadow: none;
    max-height: none;
    width: 100%;
  }
  .sp-window-actions { display: none; }
  .sp-window-header { border-bottom: 1px solid #ccc; }
  .sp-window-body { overflow: visible; }
}
