/* STORY.ID8 — proof of concept. Deliberately its own personality, not a
   MEME.ID8 reskin: warm paper/manuscript feel instead of black-poster,
   a serif display face for the story title instead of condensed Anton.
   Same underlying discipline as MEME.ID8 — one thing at a time, hidden
   complexity, restrained chrome — different surface. */

@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,600&family=Inter:wght@400;600;800&display=swap");

:root {
  --paper: #f7f2e8;
  --ink: #1c1712;
  --ink-dim: #6d6255;
  --line: rgba(28, 23, 18, 0.14);
  --accent: #a8551f;
  --accent-soft: rgba(168, 85, 31, 0.1);
  --white: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.4;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea {
  font-family: inherit;
}

.stage {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 8vh 6vw;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.screen[data-active="true"] {
  display: flex;
}

.brand-mark {
  margin: 0 0 1.6rem;
}

.eyebrow {
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin: 0;
}

.eyebrow-sub {
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: var(--ink-dim);
  margin: 0.15rem 0 0;
}

.question {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2rem, 6.5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 1.6rem;
}

.support {
  font-size: 1.05rem;
  color: var(--ink-dim);
  margin: -1.1rem 0 1.8rem;
}

.mode-toggle {
  margin: -0.8rem 0 1.4rem;
  font-size: 0.82rem;
}

.mode-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-dim);
  font-weight: 600;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mode-link.selected {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.mode-sep {
  margin: 0 0.5em;
  color: var(--line);
}

#upload-row[hidden] {
  display: none;
}

#upload-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0.8rem 0 0;
}

.upload-btn {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0.45em 0.9em;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  cursor: pointer;
  display: inline-block;
}

.upload-btn:hover { background: var(--ink); color: var(--paper); }

.upload-filename {
  font-size: 0.8rem;
  color: var(--ink-dim);
}

.giant-textarea {
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  font-weight: 400;
  line-height: 1.4;
  padding: 0.4em 0;
  outline: none;
  resize: none;
  min-height: 4.2em;
}

.giant-textarea::placeholder {
  color: rgba(28, 23, 18, 0.3);
}

.textarea-wrap {
  position: relative;
}

.secondary-label {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--ink-dim);
  margin: 1.8rem 0 0.6rem;
}

.format-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill {
  border: 1.5px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.5em 1em;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-radius: 999px;
}

.pill:hover { border-color: var(--ink); }
.pill.selected { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.next-btn {
  align-self: flex-start;
  margin-top: 2.2rem;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 0.9em 1.6em;
  font-weight: 800;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.12s ease;
}

.next-btn:hover { transform: translateY(-2px); }
.next-btn:active { transform: translateY(0); }
.next-btn:disabled { opacity: 0.35; cursor: default; transform: none; }

.mic-btn {
  position: absolute;
  right: 0;
  bottom: 0.5em;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-btn.listening {
  background: #c0392b;
  border-color: #c0392b;
  color: var(--white);
  animation: pulse 1.1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.45); }
  50% { box-shadow: 0 0 0 10px rgba(192, 57, 43, 0); }
}

/* Loading */
.loading-text {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.6rem, 4.5vw, 2.4rem);
  text-align: center;
}

/* Spine / results */
.screen-spine {
  max-width: 820px;
  padding-top: 6vh;
}

.spine-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  line-height: 1.08;
  margin: 0 0 0.6rem;
}

.spine-logline {
  font-size: 1.1rem;
  color: var(--ink-dim);
  font-style: italic;
  margin: 0 0 2.2rem;
  max-width: 62ch;
}

.spine-beats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}

.beat {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 1rem;
  align-items: baseline;
}

.beat-label {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
  margin: 0;
}

.beat-value {
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0;
}

.clarify-callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 0.9em 1.1em;
  margin-bottom: 1.6rem;
}

.clarify-label {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--accent);
  margin: 0 0 0.3rem;
}

.clarify-question {
  font-size: 0.98rem;
  margin: 0;
}

.copy-btn {
  align-self: flex-start;
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  padding: 0.55em 1.1em;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2.4rem;
}

.copy-btn:hover { background: var(--ink); color: var(--paper); }

.copy-status {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin: -2rem 0 2.4rem;
}

/* Refine bar */
.refine-bar {
  border-top: 2px solid var(--ink);
  padding-top: 1.6rem;
}

.refine-label {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  margin: 0 0 1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.chip {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0.5em 1em;
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
}

.chip:hover { background: var(--ink); color: var(--paper); }
.chip:disabled { opacity: 0.4; }

.refine-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  position: relative;
  max-width: 640px;
  flex-wrap: wrap;
}

.refine-input-wrap input {
  flex: 1;
  min-width: 200px;
  border: none;
  border-bottom: 1.5px solid var(--ink);
  background: transparent;
  padding: 0.5em 2.4em 0.5em 0;
  font-size: 0.98rem;
  outline: none;
  color: var(--ink);
}

.refine-input-wrap .mic-btn {
  position: static;
  width: 2em;
  height: 2em;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.refine-submit,
.reset-btn {
  border: none;
  background: var(--ink);
  color: var(--paper);
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  font-size: 1.05rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reset-btn {
  border: 1.5px solid var(--ink);
  background: transparent;
  color: var(--ink);
}

.reset-btn:hover { background: var(--ink); color: var(--paper); }

.refine-submit:disabled { opacity: 0.4; }

/* Error */
.error-text {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

footer.site-footer {
  text-align: center;
  padding: 2rem 0 3rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

@media (max-width: 560px) {
  .beat { grid-template-columns: 1fr; gap: 0.2rem; }
}
