/* Rewriter — app styles. Builds on colors_and_type.css from the design system. */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }

/* ============ Topbar ============ */
.suite-topbar {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 14px 28px; border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 5;
}
.suite-mark { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.suite-mark-glyph {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px;
  border: 1px solid var(--ink); border-radius: 2px;
  font-size: 14px; letter-spacing: 0.02em;
}
.suite-mark-name { font-size: 14px; letter-spacing: 0.04em; }
.suite-nav { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.suite-nav-item.is-current { color: var(--ink); font-weight: 500; }
.suite-nav-item.is-past, .suite-nav-item.is-future { color: var(--ink-faint); }
.suite-nav-sep { color: var(--ink-faint); }
.topbar-spacer { flex: 1; }
.back-link {
  background: none; border: 0; color: var(--ink-muted);
  font-size: 13px; padding: 4px 8px; border-radius: 3px;
  display: inline-flex; align-items: center; gap: 6px;
}
.back-link:hover { color: var(--ink); }

.gear { font-size: 16px; }

/* ============ Stepper ============ */
.stepper {
  display: flex; align-items: center; gap: 18px; flex: 1; justify-content: center;
  list-style: none; margin: 0; padding: 0;
}
.stepper-stop { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.stepper-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 1px solid var(--ink-faint);
}
.stepper-stop.is-current { color: var(--ink); }
.stepper-stop.is-current .stepper-dot { background: var(--ink); border-color: var(--ink); }
.stepper-stop.is-past { color: var(--ink-muted); }
.stepper-stop.is-past .stepper-dot { background: var(--ink-muted); border-color: var(--ink-muted); }

/* ============ Buttons & inputs ============ */
.btn-primary {
  background: var(--ink); color: var(--paper);
  border: 0; padding: 10px 18px; border-radius: 3px;
  font-size: 14px; letter-spacing: 0.01em;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { background: #1a1a1a; }
.btn-primary[disabled], .btn-primary.is-disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.large { padding: 14px 26px; font-size: 15px; }
.btn-primary.full { width: 100%; justify-content: center; }
.btn-ghost {
  background: transparent; border: 1px solid transparent; color: var(--ink-muted);
  padding: 8px 14px; border-radius: 3px; font-size: 13px;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--rule); }
.btn-ghost.small { padding: 6px 10px; font-size: 12px; }
.btn-ghost.icon { padding: 4px 10px; font-size: 18px; line-height: 1; }
.btn-link {
  background: none; border: 0; color: var(--ink-muted); padding: 0; font-size: 13px;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.dialog-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px;
  background: var(--paper); color: var(--ink); font-family: inherit; font-size: 14px;
}
.dialog-input:focus { outline: none; border-color: var(--ink); }
.dialog-textarea { resize: vertical; min-height: 160px; font-family: var(--font-body); line-height: 1.55; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.field-label.small { font-size: 10px; }

.muted { color: var(--ink-muted); }
.small { font-size: 12px; }
.italic { font-style: italic; }
.center { text-align: center; }
.eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.eyebrow.small { font-size: 10px; letter-spacing: 0.12em; }

/* ============ Landing ============ */
.landing-view { min-height: 100vh; }
.landing-main { max-width: 760px; margin: 0 auto; padding: 80px 32px 120px; }
.landing-hero { margin-bottom: 88px; }
.landing-title { font-family: var(--font-display); font-size: 56px; line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 18px; font-weight: 400; }
.landing-sub { font-size: 17px; line-height: 1.6; color: var(--ink-muted); max-width: 56ch; margin: 0 0 32px; }
.landing-cta-row { display: flex; align-items: center; gap: 18px; }

.paste-card {
  border: 1px solid var(--rule); border-radius: 4px; padding: 22px;
  background: var(--paper); margin-top: 12px;
}
.paste-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.dialog-actions { display: flex; gap: 8px; }

.landing-recents .recents-list { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 3px; }
.recent-item { background: var(--paper); padding: 18px 20px; cursor: pointer; position: relative; }
.recent-item:hover { background: var(--paper-tinted); }
.recent-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.recent-title { font-family: var(--font-display); font-size: 22px; margin: 0; font-weight: 400; }
.recent-meta { display: flex; align-items: center; gap: 10px; }
.recent-tag { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 2px; color: var(--ink-muted); white-space: nowrap; }
.recent-excerpt { font-size: 13px; line-height: 1.55; margin: 6px 0 12px; max-width: 78ch; }
.recent-foot { display: flex; align-items: center; gap: 14px; }
.recent-progress { display: inline-block; width: 100px; height: 2px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.recent-progress-fill { display: block; height: 100%; background: var(--ink); }
.recent-remove { margin-left: auto; background: none; border: 0; color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 2px 8px; border-radius: 2px; }
.recent-remove:hover { color: var(--ink); background: var(--rule); }

/* ============ Reading column (vision, outline, export) ============ */
.reading-main { padding: 64px 32px 120px; }
.reading-column { max-width: 680px; margin: 0 auto; }
.reading-column.wider { max-width: 820px; }
.reading-head { margin-bottom: 36px; }
.reading-title { font-family: var(--font-display); font-size: 44px; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 10px; font-weight: 400; }
.reading-byline { font-size: 14px; }
.reading-foot { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reading-actions-left { display: flex; gap: 18px; }

/* Vision */
.vision-status { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.vision-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 0.35; } 50% { opacity: 1; } }
.vision-body .vision-para { font-family: var(--font-display); font-size: 19px; line-height: 1.65; margin: 0 0 22px; color: var(--ink); text-wrap: pretty; }
.vision-edit { width: 100%; min-height: 60vh; padding: 16px; border: 1px solid var(--rule); border-radius: 3px; font-family: var(--font-display); font-size: 19px; line-height: 1.65; color: var(--ink); background: var(--paper); resize: vertical; }
.caret { display: inline-block; width: 2px; height: 1em; background: var(--ink); margin-left: 2px; vertical-align: -2px; animation: caret 0.8s steps(2, end) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* Outline */
.outline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.outline-item { display: grid; grid-template-columns: 90px 1fr; gap: 22px; padding: 22px 4px; background: var(--paper); }
.outline-item.is-streaming { background: var(--paper-tinted); }
.outline-num { font-family: var(--font-display); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); padding-top: 4px; }
.outline-title { font-family: var(--font-display); font-size: 22px; margin: 0 0 8px; font-weight: 400; }
.outline-intent { font-size: 15px; line-height: 1.6; color: var(--ink); margin: 0; cursor: text; min-height: 1.6em; text-wrap: pretty; }
.outline-intent:hover { color: var(--ink); }
.outline-edit { width: 100%; padding: 10px 12px; border: 1px solid var(--ink); border-radius: 3px; font-family: inherit; font-size: 15px; line-height: 1.5; resize: vertical; }

/* ============ Rewrite shell ============ */
.rewrite-view { min-height: 100vh; display: flex; flex-direction: column; }
.rewrite-shell { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }

/* Chapter rail */
.chapter-rail { border-right: 1px solid var(--rule); display: flex; flex-direction: column; padding: 22px 18px; background: var(--paper); }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.rail-list { list-style: none; padding: 0; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rail-item {
  width: 100%; display: grid; grid-template-columns: 14px 50px 1fr; gap: 10px;
  align-items: center;
  padding: 10px 10px; background: transparent; border: 0; border-radius: 3px;
  text-align: left; color: var(--ink-muted); font-size: 13px; line-height: 1.35;
}
.rail-item:hover { background: var(--paper-tinted); color: var(--ink); }
.rail-item.is-active { background: var(--ink); color: var(--paper); }
.rail-item.is-active .rail-num { color: var(--paper); opacity: 0.7; }
.rail-num { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.rail-title { font-family: var(--font-display); font-size: 14px; }
.rail-foot { padding-top: 14px; border-top: 1px solid var(--rule); margin-top: 14px; }

.status-pip { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pip-untouched { background: transparent; border: 1px solid var(--ink-faint); }
.pip-streaming { background: var(--ink); animation: pulse 1.4s ease-in-out infinite; }
.pip-review { background: transparent; border: 1px solid var(--ink); position: relative; }
.pip-review::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: var(--ink); }
.pip-kept { background: var(--ink); }
.rail-item.is-active .pip-untouched { border-color: rgba(255,255,255,0.4); }
.rail-item.is-active .pip-kept, .rail-item.is-active .pip-streaming { background: var(--paper); }
.rail-item.is-active .pip-review { border-color: var(--paper); }
.rail-item.is-active .pip-review::after { background: var(--paper); }

/* Rewrite main */
.rewrite-main { display: flex; flex-direction: column; min-width: 0; }
.chapter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 36px 14px; border-bottom: 1px solid var(--rule); }
.chapter-title { font-family: var(--font-display); font-size: 30px; margin: 0; font-weight: 400; line-height: 1.15; }
.hitl-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.hitl-toggle input { accent-color: var(--ink); }
.hitl-toggle.compact { font-size: 12px; }

/* Rewrite surface (panes) */
.rewrite-surface { flex: 1; display: grid; min-height: 0; padding: 0; overflow: hidden; }
.rewrite-surface.layout-two-col { grid-template-columns: 1fr 1fr; }
.rewrite-surface.layout-single { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; width: 100%; }
.rewrite-pane { padding: 26px 36px 40px; overflow-y: auto; min-width: 0; min-height: 0; }
.rewrite-pane.original-pane { border-right: 1px solid var(--rule); background: var(--paper-tinted); }
.rewrite-pane.rewrite-pane-right { background: var(--paper); }
.pane-label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 18px; }
.pane-label-stream { display: inline-flex; align-items: center; gap: 8px; }

.prose .prose-para {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px;
  font-family: var(--font-display); font-size: 17px; line-height: 1.7;
  margin: 0 0 18px; color: var(--ink); text-wrap: pretty;
}
.density-compact .prose .prose-para { font-size: 15px; line-height: 1.6; margin-bottom: 14px; }
.line-num { font-family: var(--font-mono, ui-monospace, monospace); font-size: 11px; color: var(--ink-faint); padding-top: 6px; user-select: none; }
.prose-text { display: block; }
.prose-empty { font-size: 14px; color: var(--ink-muted); }
.prose-para.is-current .prose-text { color: var(--ink); }
.prose-para.is-pending .prose-text { color: var(--ink-faint); }
.prose-para.is-pending .prose-text::before { content: "·  ·  ·"; letter-spacing: 0.4em; color: var(--ink-faint); }

/* Chapter actions */
.chapter-actions { padding: 18px 36px; border-top: 1px solid var(--rule); display: flex; align-items: center; gap: 12px; background: var(--paper); }
.chapter-actions .grow { flex: 1; }
.kept-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.kept-tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: 11px; }

/* ============ Export ============ */
.export-card { border: 1px solid var(--rule); border-radius: 3px; padding: 4px 22px; }
.export-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
.export-row:last-child { border-bottom: 0; }
.export-label { font-size: 13px; color: var(--ink-muted); }
.seg { display: inline-flex; gap: 1px; background: var(--rule); border-radius: 3px; padding: 1px; }
.seg-btn { background: var(--paper); border: 0; padding: 7px 14px; font-size: 13px; color: var(--ink-muted); border-radius: 2px; }
.seg-btn.is-on { background: var(--ink); color: var(--paper); }
.seg.compact .seg-btn { padding: 5px 10px; font-size: 12px; }

/* ============ Settings ============ */
.dialog-scrim { position: fixed; inset: 0; background: rgba(20, 18, 14, 0.32); z-index: 50; display: grid; place-items: center; }
.dialog { background: var(--paper); border-radius: 4px; max-width: 560px; width: calc(100vw - 32px); max-height: 86vh; overflow: auto; box-shadow: 0 22px 48px rgba(0,0,0,0.16); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--rule); }
.dialog-title { font-family: var(--font-display); font-size: 20px; margin: 0; font-weight: 400; }
.dialog-body { padding: 20px 24px 24px; }
.settings-section { margin-bottom: 26px; }
.settings-section-head { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }

/* ============ Tweaks panel ============ */
.tweaks-panel {
  position: fixed; bottom: 18px; right: 18px; z-index: 30;
  width: 260px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 4px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.12);
}
.tweaks-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--rule); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); }
.tweaks-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.tweak { display: flex; flex-direction: column; gap: 6px; }
.tweak-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 3px;
  font-size: 13px; z-index: 100; box-shadow: 0 8px 22px rgba(0,0,0,0.18);
  animation: toastIn 0.18s ease-out;
}
@keyframes toastIn { from { transform: translate(-50%, 8px); opacity: 0; } }

/* small screens */
@media (max-width: 900px) {
  .rewrite-shell { grid-template-columns: 1fr; }
  .chapter-rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rewrite-surface.layout-two-col { grid-template-columns: 1fr; }
  .rewrite-pane.original-pane { border-right: 0; border-bottom: 1px solid var(--rule); }
}
