/* Poem Structure Unlocker — standalone stylesheet */
:root {
  --bg: #1a1612;
  --bg-soft: #241f19;
  --surface: #2d261e;
  --surface-2: #382f25;
  --border: #4a3f32;
  --text: #ece4d6;
  --text-soft: #b8ad99;
  --muted: #8c8170;
  --accent: #d4a24c;
  --accent-2: #c2784a;
  --accent-soft: rgba(212, 162, 76, 0.15);
  --good: #7bb87b;
  --warn: #d4a24c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #e8be6e; text-decoration: underline; }

/* Header */
.site-header {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(6px);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-text em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}
.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--text-soft);
  font-size: 0.95rem;
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: center;
  padding: 60px 0 40px;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.15;
  margin: 0 0 16px;
  color: var(--text);
}
.lede {
  font-size: 1.1rem;
  color: var(--text-soft);
  margin: 0 0 24px;
  max-width: 52ch;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.85;
  box-shadow: var(--shadow);
  color: var(--text);
}
.hero-line { white-space: pre-wrap; }
.hero-line .rl {
  display: inline-block;
  width: 22px;
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-align: right;
  margin-right: 10px;
}
.hero-line .s { color: var(--accent); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: #1a1612;
}
.btn-primary:hover { background: #e8be6e; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.chip:hover { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }

/* Workspace */
.workspace {
  padding: 40px 0;
}
.workspace-head h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin: 0 0 8px;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.ws-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .compare-col label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-soft);
}
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  resize: vertical;
  width: 100%;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.presets { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.control { display: flex; flex-direction: column; gap: 6px; }
.control label { font-weight: 500; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.control select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}
.control meter { font-size: 0.8rem; color: var(--muted); }

.ws-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.saved-box {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.saved-box h3 { margin: 0 0 8px; font-size: 0.9rem; color: var(--text-soft); }
.saved-box ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.saved-box li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 0.85rem;
}
.saved-box li button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
}

/* Result shell */
.result-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.summary-line {
  background: var(--surface-2);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.summary-k { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.summary-v { font-weight: 600; font-size: 0.95rem; }

.lines {
  padding: 16px;
  overflow-y: auto;
  max-height: 520px;
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.9;
}
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-state p { margin: 6px 0; }

.annotated-line {
  display: grid;
  grid-template-columns: 32px 36px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
}
.annotated-line.stanza-break { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 6px; }
.line-num { color: var(--muted); font-family: var(--font-sans); font-size: 0.75rem; text-align: right; }
.line-count {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
}
.line-text { white-space: pre-wrap; }
.line-text .stressed { color: var(--accent); font-weight: 600; }
.line-text .unstressed { color: var(--text-soft); }
.line-meta {
  display: flex;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.rhyme-label {
  display: inline-block;
  min-width: 18px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.rhyme-label.none { background: transparent; color: var(--muted); }

/* How section */
.how { padding: 40px 0; }
.how h2, .gallery h2, .glossary h2, .compare h2, .notes h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin: 0 0 16px;
}
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.how-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.how-card h3 { margin: 0 0 8px; font-size: 1rem; color: var(--accent); }
.how-card p { margin: 0; color: var(--text-soft); font-size: 0.95rem; }
.how-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-top: 16px;
}
.how-note h3 { margin: 0 0 10px; font-size: 1rem; }
.how-note ul { margin: 0; padding-left: 20px; color: var(--text-soft); }
.how-note li { margin: 4px 0; }

/* Gallery */
.gallery { padding: 40px 0; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.gallery-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gallery-card:hover { border-color: var(--accent); background: var(--surface-2); }
.gc-title { font-weight: 600; font-family: var(--font-serif); font-size: 1.05rem; }
.gc-author { color: var(--text-soft); font-size: 0.85rem; }
.gc-meta { color: var(--muted); font-size: 0.8rem; }

/* Glossary */
.glossary { padding: 40px 0; }
.glossary-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}
.glossary-list > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.glossary-list dt { font-weight: 700; color: var(--accent); margin-bottom: 4px; font-family: var(--font-serif); font-size: 1.05rem; }
.glossary-list dd { margin: 0; color: var(--text-soft); font-size: 0.95rem; }

/* Compare */
.compare { padding: 40px 0; }
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.compare-col { display: flex; flex-direction: column; gap: 6px; }
.compare-actions { margin-top: 16px; }
.compare-output {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.compare-output .compare-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.compare-output h4 { margin: 0 0 10px; color: var(--accent); font-family: var(--font-serif); }
.compare-output .mini-line {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.04);
  display: flex;
  gap: 8px;
}
.compare-output .mini-line .mc { color: var(--accent); font-weight: 600; min-width: 20px; text-align: right; }

/* Notes */
.notes { padding: 40px 0; color: var(--text-soft); }
.notes p { margin: 0 0 12px; max-width: 70ch; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 24px 0;
  background: var(--bg-soft);
}
.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-row p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.footer-row nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-row nav a { color: var(--text-soft); font-size: 0.85rem; }
.footer-row nav a:hover { color: var(--accent); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 100;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding: 40px 0 20px; }
  .ws-grid { grid-template-columns: 1fr; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .compare-grid, .compare-output { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .header-row { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 12px; }
  .hero-card { font-size: 1rem; padding: 20px; }
  .annotated-line { grid-template-columns: 24px 28px 1fr; }
  .line-meta { display: none; }
  .summary { grid-template-columns: 1fr 1fr; }
}

/* Print */
@media print {
  .site-header, .site-footer, .hero-actions, .controls, .ws-actions, .presets, .compare, .gallery, .how, .site-nav { display: none; }
  body { background: white; color: black; }
  .result-shell { border: none; }
  .annotated-line { border-bottom: 1px solid #ddd; }
  .line-text .stressed { color: black; font-weight: 700; }
  .line-text .unstressed { color: #555; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
