@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Instrument+Serif:ital@0;1&family=Noto+Naskh+Arabic:wght@400;600&display=swap");
:root {
  color-scheme: light;
  --paper: #f7f2e9;
  --ink: #263b3b;
  --teal: #315c59;
  --line: #dcd8ce;
  --muted: #646f68;
  --white: #fffdf8;
  --accent: #b66d50;
  font-family: "DM Sans", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
[hidden] { display: none !important; }
.founder-mission { font-size: 21px; line-height: 1.8; max-width: 950px; }
.founder-note { scroll-margin-top: 24px; }
.founder-note blockquote { margin: 18px 0; padding-inline-start: 18px; border-inline-start: 3px solid var(--accent); line-height: 1.65; }
.founder-reference { border-top: 1px solid var(--line); padding: 12px 0; }
#founder-intro li { padding: 5px 0; line-height: 1.6; }
#founder-list { max-width: 1050px; }
.brief-mode { margin: 20px 0; border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.brief-mode legend { font-size: 13px; padding: 0 5px; }
.brief-mode label { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.brief-mode input { width: auto; margin: 0; }
.suggestion-card { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; }
.suggestion-choice { text-align: start; width: 100%; line-height: 1.5; }
.suggestion-choice[aria-pressed="true"] { border-color: var(--teal); background: #eaf0e8; }
.suggestion-card p { margin: 8px 0; line-height: 1.5; }
.generate-suggestion, #choose-for-me { width: 100%; font-size: 12px; line-height: 1.5; }
#suggestion-panel h3 { margin: 18px 0 10px; }
body {
  margin: 0;
}
header {
  padding: 22px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
a {
  color: var(--teal);
}
.brand {
  text-decoration: none;
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 38px;
}
.brand span {
  font:
    500 14px "DM Sans",
    sans-serif;
  margin-inline-start: 20px;
}
.brand img {
  display: inline-block;
  width: 120px;
  height: 54px;
  object-fit: contain;
  vertical-align: middle;
}
nav {
  display: flex;
  align-items: center;
  gap: 24px;
}
main {
  max-width: 1420px;
  margin: auto;
  padding: 24px 4% 80px;
}
h1,
h2,
h3 {
  font-weight: 500;
}
h1 {
  font-family: "Instrument Serif", serif;
  font-size: 34px;
  margin: 4px 0 24px;
}
h2 {
  font-size: 21px;
  margin: 0 0 16px;
}
h3 {
  font-size: 17px;
}
p {
  line-height: 1.65;
}
button,
select,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--white);
  padding: 10px 16px;
  border-radius: 7px;
}
button:hover {
  border-color: var(--teal);
}
button:disabled {
  cursor: wait;
  opacity: 0.55;
}
.primary {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
  width: 100%;
  margin-top: 8px;
}
label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin: 18px 0 8px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  color: var(--ink);
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  gap: 6px;
  margin: 20px 0 30px;
  overflow-x: auto;
}
.tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: nowrap;
  padding: 13px 20px;
}
.tabs .active {
  border-bottom: 2px solid var(--teal);
  font-weight: 700;
}
.work-grid {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 28px;
  align-items: start;
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 22px;
  overflow-wrap: anywhere;
}
.embedding-heading {display:flex;justify-content:space-between;gap:24px;align-items:baseline;}
.embedding-heading p {max-width:850px;margin-top:0;}
.embedding-actions {display:flex;flex-wrap:wrap;gap:10px;}
.embedding-metrics {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:20px 0;}
.embedding-metric {background:var(--white);border:1px solid var(--line);border-radius:10px;padding:20px;}
.embedding-metric p:first-child {margin-top:0;}
.embedding-metric strong {font-size:27px;font-weight:500;}
.embedding-metric p:last-child {margin-bottom:0;line-height:1.5;}
.embedding-worker {border-inline-start:3px solid var(--teal);padding:8px 14px;background:var(--white);}
.embedding-views {display:flex;gap:10px;flex-wrap:wrap;margin:24px 0;}
.embedding-views button[aria-pressed="true"] {background:var(--teal);border-color:var(--teal);color:white;}
.embedding-bucket-progress {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;margin:24px 0;}
#embedding progress {display:block;width:100%;height:9px;accent-color:var(--teal);margin-top:10px;}
.embedding-filters {display:grid;grid-template-columns:2fr 1fr 1fr 1.3fr;gap:15px;align-items:end;}
.embedding-filters label {margin:0;}
.embedding-table-wrap {max-width:100%;overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:var(--white);margin-bottom:36px;}
.embedding-table {width:100%;min-width:1020px;margin:0;border-collapse:collapse;}
.embedding-table th,.embedding-table td {padding:16px;text-align:start;vertical-align:top;border-bottom:1px solid var(--line);}
.embedding-table th {font-size:13px;background:#eeece5;}
.embedding-table td:first-child {width:29%;}
.embedding-table td:nth-child(2) {width:110px;min-width:110px;}
.embedding-table td:nth-child(3) {width:175px;}
.embedding-table td:nth-child(4) {min-width:260px;line-height:1.5;font-size:13px;}
.embedding-table strong,.embedding-table small {display:block;margin-top:5px;}
.embedding-table small {color:var(--muted);font-size:12px;}
.embedding-table button {white-space:nowrap;font-size:12px;padding:8px 10px;}
.embedding-state {display:inline-block;font-size:12px;padding:5px 8px;border-radius:5px;background:#f1eee5;}
.state-complete {background:#e1eee4;color:#264c36;}
.state-embedding_pending,.state-checks_pending {background:#e1eeec;color:#254f4d;}
.state-scope_hold {background:#f5e7dc;color:#744a2a;}
.embedding-streams {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px;}
.embedding-streams .card {margin:0;}
.embedding-streams ul {padding-inline-start:20px;}
.embedding-streams li {margin:9px 0;}
.embedding-streams button {border:0;background:transparent;text-align:start;padding:4px 0;text-decoration:underline;text-underline-offset:3px;line-height:1.4;}
#embedding-detail {width:min(900px,92vw);max-height:88vh;overflow-y:auto;color:var(--ink);background:var(--white);border:1px solid var(--line);border-radius:12px;padding:28px;}
#embedding-detail::backdrop {background:#142d2b80;}
#embedding-close {display:block;margin-inline-start:auto;margin-bottom:15px;}
.embedding-checklist {list-style:none;padding:0;}
.embedding-checklist li {padding:7px 0;border-bottom:1px solid var(--line);}
@media(max-width:800px){.embedding-heading{display:block}.embedding-metrics{grid-template-columns:1fr}.embedding-filters{grid-template-columns:1fr 1fr}.embedding-streams{grid-template-columns:1fr}.embedding-metric strong{font-size:24px}}
@media(max-width:480px){.embedding-filters{grid-template-columns:1fr}.embedding-bucket-progress{grid-template-columns:1fr;gap:14px}.embedding-actions button{width:100%}#embedding-detail{padding:18px}}
.reader {
  min-height: 580px;
  padding: 35px 7%;
}
.reader .story-text {
  white-space: pre-wrap;
  font-family: "Instrument Serif", serif;
  font-size: 23px;
  line-height: 1.65;
}
.reader [lang="ar"] {
  font-family: "Noto Naskh Arabic", serif;
  font-size: 25px;
  line-height: 1.9;
}
.reader details {
  margin: 24px 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.reader summary {
  cursor: pointer;
  font-weight: 600;
}
.character {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.character pre {
  white-space: pre-wrap;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
}
.bucket-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.bucket-grid button {
  text-align: start;
  padding: 24px;
  font-size: 19px;
  line-height: 1.5;
}
.bucket-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 20px;
  margin: 14px 0 30px;
}
.sources {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.source-card h2 {
  margin-bottom: 8px;
  font-size: 19px;
}
.source-card p {
  font-size: 13px;
}
.source-id {
  font-family: monospace;
  font-size: 12px;
  color: var(--accent);
}
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 5px 9px;
  background: #eaf0e7;
  border-radius: 4px;
  margin: 3px 4px 3px 0;
}
.draft-button {
  display: block;
  text-align: start;
  width: 100%;
  margin: 8px 0;
}
.narrow {
  max-width: 760px;
}
.score-grid {
  display: grid;
  grid-template-columns: 120px 70px 1fr;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}
.score-grid label {
  margin: 0;
}
.score-grid input {
  margin: 0;
}
.score-grid textarea {
  margin: 0;
}
.checks label {
  margin-top: 18px;
}
.checks select {
  max-width: 220px;
}
.reader .review-form {
  font-size: 14px;
}
.reader .review-form h2 {
  font-family: inherit;
  font-size: 21px;
}
.error {
  color: #9a3429;
}
#notice {
  min-height: 24px;
  font-size: 14px;
}
#method-content {
  max-width: 900px;
}
#method-content li {
  line-height: 1.7;
  margin: 12px 0;
}
table {
  border-collapse: collapse;
  width: 100%;
}
td,
th {
  text-align: start;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
small {
  line-height: 1.5;
}
[hidden] {
  display: none !important;
}
body[dir="rtl"] {
  font-family: "Noto Naskh Arabic", serif;
}
body[dir="rtl"] h1 {
  font-family: inherit;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (max-width: 900px) {
  .work-grid {
    grid-template-columns: 280px 1fr;
    gap: 18px;
  }
  .reader {
    padding: 24px;
  }
  .sources {
    grid-template-columns: 1fr;
  }
  .brand span {
    display: block;
    margin: 0;
    font-size: 12px;
  }
  .bucket-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 680px) {
  header {
    padding: 16px 5%;
  }
  .brand {
    font-size: 32px;
  }
  nav {
    gap: 16px;
  }
  .work-grid {
    grid-template-columns: 1fr;
  }
  .reader {
    min-height: 300px;
  }
  .filters {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .tabs button {
    padding: 12px;
  }
  .score-grid {
    grid-template-columns: 1fr 65px;
  }
  .score-grid textarea {
    grid-column: 1/-1;
  }
  .card {
    padding: 22px;
  }
  main {
    padding: 16px 4% 50px;
  }
  h1 {
    font-size: 31px;
  }
  .reader .story-text {
    font-size: 22px;
  }
}

/* Automatic checks shown above a draft. */
.defects { margin: 16px 0 24px; }
.defects h3 { margin-bottom: 4px; }
.defects-summary { font-weight: 600; }
.defect { margin: 10px 0; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--line); border-radius: 7px; }
.defect-blocker { border-inline-start-color: var(--accent); }
.defect-should_fix { border-inline-start-color: var(--teal); }
.defect-head { margin: 0 0 6px; }
.defect p { margin: 6px 0; }
.defect blockquote { margin: 8px 0; padding-inline-start: 12px; border-inline-start: 2px solid var(--line); color: var(--muted); overflow-wrap: anywhere; }
.defect-waive { margin-top: 10px; }
.defect-waive textarea { display: block; width: 100%; margin: 6px 0 8px; }

/* Film stage of a draft. */
.film { margin: 16px 0; }
.film-stages { padding-inline-start: 22px; }
.film-stage { margin: 6px 0; }
.film-locked { color: var(--muted); }
.film-signed strong { color: var(--teal); }
.film-shot { margin: 10px 0; padding: 12px 14px; background: var(--white); border: 1px solid var(--line); border-radius: 7px; }
.film-shot h4 { margin: 0 0 8px; }
.film-shot dl { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 4px 12px; margin: 0; }
.film-shot dt { color: var(--muted); }
.film-shot dd { margin: 0; overflow-wrap: anywhere; }
.film input { display: block; width: 100%; margin: 6px 0 8px; }
@media (max-width: 560px) { .film-shot dl { grid-template-columns: 1fr; } }

/* Reader and reviser loop control. */
.loop { margin: 0 0 24px; }
.loop select { display: block; width: 100%; margin: 6px 0 8px; }

/* One-button creation and the simple result view. */
#create-finished { display: block; width: 100%; margin: 14px 0 6px; padding: 12px; font-size: 1.05em; }
#create-progress ol { padding-inline-start: 20px; }
.story-status { margin: 0 0 20px; padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--teal); border-radius: 7px; }
.story-status.story-warning { border-inline-start-color: var(--accent); }
.story-status p { margin: 4px 0; }
.story-verdict { font-weight: 600; font-size: 1.05em; }
.story-decision { margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.workings { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 12px; }
.workings > summary { color: var(--muted); cursor: pointer; }

/* One action per form; the rest is tucked away. */
.advanced { margin-top: 16px; }
.advanced > summary { color: var(--muted); cursor: pointer; }
.advanced button { display: block; margin: 10px 0; }
#create-progress p { margin: 6px 0; }
.story-finish { margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.story-finish ol { padding-inline-start: 20px; }

/* An explicit yes or no, in the page, before anything is written. */
.confirm-start { margin: 10px 0; padding: 12px 14px; background: var(--white); border: 1px solid var(--teal); border-radius: 7px; }
.confirm-start p { margin: 0 0 8px; }
.confirm-start button { margin-inline-end: 8px; }

/* Heart-first pitches. */
#pitch-stories { display: block; width: 100%; margin: 14px 0 6px; padding: 12px; font-size: 1.05em; }
#pitch-cards { display: grid; gap: 14px; margin: 10px 0 18px; }
.pitch-card { padding: 14px 16px; background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--line); border-radius: 7px; }
.pitch-card.chosen { border-inline-start-color: var(--teal); }
.pitch-card h3 { margin: 0 0 8px; }
.pitch-card dl { margin: 0 0 10px; }
.pitch-card dt { font-weight: 600; margin-top: 8px; }
.pitch-card dd { margin: 2px 0 0; }
.pitch-ar { direction: rtl; unicode-bidi: isolate; }
.pitch-card .pitch-title-ar { margin: -4px 0 8px; font-weight: 600; }
.starter-examples { margin: 12px 0; }
.starter-examples > summary { color: var(--muted); cursor: pointer; }
.pitch-card .pitch-goal { margin: 0 0 8px; font-style: italic; }
