/* ═══════════════════════════════════════════════════════════════
   Inkwell — Styles
   A warm, literary, paper-and-ink aesthetic.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --paper:      #f6f1e7;
  --paper-2:    #fbf8f1;
  --ink:        #20201d;
  --ink-soft:   #4a4842;
  --ink-faint:  #8a857a;
  --rule:       #e2dac9;
  --accent:     #6b2737;   /* overridden per-author via JS */
  --accent-ink: #6b2737;
  --gold:       #a9742f;
  --shadow:     0 8px 30px rgba(40, 33, 20, 0.10);
  --radius:     14px;
  --maxw:       880px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #fffdf8 0%, var(--paper) 60%);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ─── */
.site-header {
  text-align: center;
  padding: 54px 20px 18px;
  position: relative;
}
.subscribe-btn {
  position: absolute;
  top: 28px;
  right: 28px;
  background: var(--accent-ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.subscribe-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.subscribe-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.logo {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.logo-mark { font-size: 34px; }
.logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--ink);
}
.logo-tagline {
  margin-top: 8px;
  font-family: 'Spectral', serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-faint);
}

/* ─── Layout ─── */
.main-content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 22px 60px;
}
.section { margin-bottom: 44px; }

.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}
.step-num {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--paper-2);
  background: var(--accent-ink);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background 0.4s ease;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 600;
}
.section-sub {
  color: var(--ink-faint);
  font-family: 'Spectral', serif;
  font-style: italic;
  margin-bottom: 20px;
  margin-left: 44px;
}

/* ─── Author grid ─── */
.authors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.author-card {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 16px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  overflow: hidden;
}
.author-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--card-accent, var(--gold));
  opacity: 0.85;
}
.author-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.author-card.selected {
  border-color: var(--card-accent, var(--gold));
  box-shadow: 0 0 0 2px var(--card-accent, var(--gold)) inset, var(--shadow);
}
.author-icon { font-size: 26px; display: block; margin-bottom: 8px; }
.author-name {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
}
.author-era {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 3px;
  letter-spacing: 0.2px;
}
.author-tagline {
  font-family: 'Spectral', serif;
  font-style: italic;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 9px;
}

/* ─── Mode toggle ─── */
.mode-toggle {
  display: flex;
  gap: 8px;
  background: #efe7d6;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 5px;
  margin-bottom: 18px;
  max-width: 520px;
}
.mode-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.18s ease;
}
.mode-btn.active {
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(40,33,20,0.10);
}

/* ─── Text inputs ─── */
.text-area {
  width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-family: 'Spectral', serif;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.text-area:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: 0 0 0 3px rgba(107, 39, 55, 0.10);
}
.text-area::placeholder { color: var(--ink-faint); font-style: italic; }
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

/* ─── Primary action ─── */
.action-section { text-align: center; }
.action-btn-primary {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 16px 38px;
  border: none;
  border-radius: 999px;
  background: var(--accent-ink);
  color: #f6f1e7;
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, background 0.4s ease, opacity 0.2s ease;
}
.action-btn-primary:hover { transform: translateY(-2px); }
.action-btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.action-hint {
  margin-top: 12px;
  font-family: 'Spectral', serif;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 14px;
}

/* ─── Loading ─── */
.loading-container { text-align: center; padding: 30px 0; }
.quill-loader {
  width: 180px; margin: 0 auto 22px;
  display: flex; flex-direction: column; gap: 9px;
}
.ink-line {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-ink), transparent);
  transform-origin: left;
  animation: write 1.4s ease-in-out infinite;
}
.ink-line.l2 { animation-delay: 0.25s; width: 86%; }
.ink-line.l3 { animation-delay: 0.5s; width: 64%; }
@keyframes write {
  0%   { transform: scaleX(0); opacity: 0.3; }
  50%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(0); opacity: 0.3; }
}
.loading-title {
  font-family: 'Playfair Display', serif;
  font-size: 21px;
  margin-bottom: 6px;
}
.loading-sub { color: var(--ink-faint); font-size: 14px; }

/* ─── Result ─── */
.result-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent-ink);
  border-radius: var(--radius);
  padding: 32px 36px;
  box-shadow: var(--shadow);
}
.result-byline {
  font-family: 'Spectral', serif;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 14.5px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.result-text {
  font-family: 'Spectral', serif;
  font-size: 18px;
  line-height: 1.85;
  color: var(--ink);
  white-space: pre-wrap;
}
.result-text p { margin-bottom: 1em; }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s ease;
}
.action-btn:hover {
  border-color: var(--accent-ink);
  color: var(--ink);
  transform: translateY(-1px);
}
.action-btn.listening {
  background: #8e1b1b;
  border-color: #8e1b1b;
  color: #fff;
  animation: micpulse 1.1s ease-in-out infinite;
}
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(142, 27, 27, 0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(142, 27, 27, 0); }
}

/* ─── Footer ─── */
.site-footer {
  text-align: center;
  padding: 36px 20px 50px;
  color: var(--ink-faint);
  font-size: 13px;
  border-top: 1px solid var(--rule);
  margin-top: 30px;
}
.footer-legal { font-size: 11.5px; margin-top: 5px; opacity: 0.8; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #5a1f2b;
  color: #fff;
  padding: 13px 18px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  z-index: 100;
  max-width: 90vw;
  font-size: 14px;
}
.toast button {
  background: none; border: none; color: #fff;
  cursor: pointer; font-size: 15px; opacity: 0.8;
}

/* ─── Pulitzer Prize Winners ─── */
.saves-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.save-card {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.save-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.save-author {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--accent-ink);
}
.save-date {
  font-size: 12px;
  color: var(--ink-faint);
}
.save-prompt {
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.save-excerpt {
  font-family: 'Spectral', serif;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  flex: 1;
}
.save-copy-btn {
  align-self: flex-start;
  margin-top: 4px;
}

/* ─── Responsive ─── */
@media (max-width: 560px) {
  .logo-text { font-size: 34px; }
  .section-title { font-size: 22px; }
  .section-sub { margin-left: 0; }
  .result-card { padding: 24px 22px; }
  .mode-btn { font-size: 13px; padding: 10px 8px; }
}
