:root {
  --color-cream: #faf8f5;
  --color-cream-dark: #f0ebe4;
  --color-charcoal: #2d3436;
  --color-charcoal-light: #636e72;
  --color-gold: #d4a373;
  --color-gold-light: #f5e6d0;
  --color-sage: #6b8f71;
  --color-sage-light: #e8f0e9;
  --color-rose: #c2847a;
  --color-rose-light: #f5e6e3;
  --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-charcoal);
  background: var(--color-cream);
  line-height: 1.6;
}

h1, h2, h3 {
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }

@media (min-width: 600px) {
  h1 { font-size: 2.5rem; }
}

p { margin: 0 0 12px; }

a { color: var(--color-charcoal); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-cream-dark);
  border-bottom: 1px solid rgba(45, 52, 54, 0.1);
  padding: 16px 20px;
}

.site-header a {
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  color: var(--color-charcoal);
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}

.site-header a:hover {
  color: var(--color-gold);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(45, 52, 54, 0.06);
  border: 1px solid rgba(45, 52, 54, 0.05);
}

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-gold);
  margin-bottom: 8px;
}

.btn {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 10px;
  border: none;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  width: 100%;
  transition: transform 0.15s ease, background 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-gold);
  color: var(--color-charcoal);
}

.btn-primary:hover { background: #c99566; }

.btn-secondary {
  background: var(--color-cream-dark);
  color: var(--color-charcoal);
}

.btn-secondary:hover { background: #e6ddd0; }

textarea, input, select {
  width: 100%;
  padding: 12px;
  font-family: var(--font-sans);
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(45, 52, 54, 0.15);
  margin-bottom: 12px;
  background: var(--color-cream);
  color: var(--color-charcoal);
}

textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--color-gold);
  outline-offset: 1px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--color-charcoal-light);
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-completed {
  background: var(--color-sage-light);
  color: var(--color-sage);
}

.status-skipped {
  background: var(--color-rose-light);
  color: var(--color-rose);
}

.status-not-started {
  background: var(--color-cream-dark);
  color: var(--color-charcoal-light);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.progress-track {
  flex: 1 1 auto;
  height: 8px;
  border-radius: 999px;
  background: var(--color-cream-dark);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-sage);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-label {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--color-charcoal-light);
  white-space: nowrap;
}

.time-estimate {
  font-size: 13px;
  color: var(--color-charcoal-light);
  margin: -4px 0 10px;
}

.faq-item {
  border-bottom: 1px solid rgba(45, 52, 54, 0.08);
  padding: 14px 0;
}

.faq-item:last-child { border-bottom: none; }

.faq-item h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.faq-item p {
  color: var(--color-charcoal-light);
  margin: 0;
}

@media (min-width: 600px) {
  .btn { width: auto; }
}

.example-item {
  border-bottom: 1px solid rgba(45, 52, 54, 0.08);
  padding: 14px 0;
}

.example-item:last-child { padding-bottom: 0; border-bottom: none; }

.example-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.example-readtime {
  color: var(--color-charcoal-light);
  font-size: 13px;
  font-weight: 400;
}

.btn-add-example {
  flex-shrink: 0;
  width: auto;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--color-cream-dark);
  color: var(--color-charcoal);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-add-example:hover { background: #e6ddd0; }

.example-text {
  margin: 0 0 6px;
  font-size: 15px;
}

.example-breakdown {
  margin: 0;
  color: var(--color-charcoal-light);
  font-size: 13px;
}

/* Quiet save indicator on the builder pages. */
.save-note {
  font-size: 0.75rem;
  font-weight: 500;
  color: #7a736c;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

/* Builder page footer: Back and Next share a row, Skip and Dashboard stack below. */
#section-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-row {
  display: flex;
  gap: 10px;
}

.nav-row .btn {
  flex: 1;
}

/* Save state and undo sit on one quiet line under the writing box. */
.save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
  margin: 8px 0 4px;
}

/* The preview reads like the finished document: a plain white page, document
   type rather than the site's display font, and no editing controls in the way. */
.script-page {
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 56px 64px;
  margin-bottom: 24px;
  font-family: Arial, Helvetica, sans-serif;
  color: #1a1a1a;
  line-height: 1.6;
}

.script-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 32px;
}

.script-title:empty {
  display: none;
}

.script-section {
  margin-bottom: 28px;
}

.script-section h3 {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.script-section p {
  margin: 0 0 12px;
  white-space: pre-wrap;
}

.script-empty {
  color: #8a8a8a;
  font-style: italic;
}

.script-skipped {
  color: #8a8a8a;
  font-size: 0.85rem;
  margin: 0 0 10px;
}

.script-edit {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b6560;
  text-decoration: none;
  border: 1px solid #d8d0c6;
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}

.script-edit:hover {
  background: var(--color-cream-dark);
}

@media (max-width: 640px) {
  .script-page { padding: 32px 24px; }
}

/* Page-level links (dashboard, preview) sit at opposite edges, quieter than the
   section title so they never compete with it. */
.page-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
}

.page-links a {
  color: #6b6560;
  text-decoration: underline;
}

/* Small text-style control for actions on this section: undo, skip. */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: #6b6560;
  text-decoration: underline;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--color-charcoal);
}

/* Previous/Next keep a fixed label with the section name in small type below. */
.nav-label {
  display: block;
}

.nav-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.75;
  margin-top: 2px;
}

/* Confirmation dialog, used before anything overwrites a document. */
/* The browser hides [hidden] elements with display:none, which a display:flex
   class would otherwise beat. This keeps the attribute in charge. */
.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.modal {
  position: relative;
  background: var(--color-cream, #fdfbf7);
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  padding-right: 32px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: #8a8279;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover {
  color: var(--color-charcoal);
}

.modal p {
  margin: 0 0 24px;
  color: #57514c;
}

.modal .btn {
  display: block;
  width: 100%;
  margin-bottom: 10px;
}

.modal-cancel {
  display: block;
  margin: 6px auto 0;
}

/* While the document is building, its button reports progress instead of
   inviting a click. */
.btn:disabled {
  cursor: default;
  opacity: 0.75;
}

.btn:disabled:hover {
  transform: none;
}
