/* write.radconsultants.com — voice-anchored BD writing studio */

:root {
  --bg: #07071a;
  --bg-elev: #0f0f24;
  --bg-card: #15152e;
  --bg-input: #0a0a1f;
  --text: #f0f0f8;
  --text-mute: #a8a8c0;
  --text-faint: #7878a0;
  --border: #2a2a4a;
  --border-bright: #3a3a6a;
  --accent: #ff4dff;         /* hot pink */
  --accent-2: #ffe066;       /* yellow */
  --accent-cool: #6e6dff;    /* purple-blue */
  --accent-glow: rgba(255, 77, 255, 0.35);
  --success: #4dffb6;
  --warn: #ffb74d;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(255, 77, 255, 0.15);
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 16px;
  --t-fast: 120ms cubic-bezier(.4,0,.2,1);
  --t-med: 240ms cubic-bezier(.4,0,.2,1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-display: "Fredoka", "Inter", -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f6f6fa;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f0f0f5;
  --text: #15152e;
  --text-mute: #404060;
  --text-faint: #707080;
  --border: #d8d8e8;
  --border-bright: #b8b8c8;
  --accent: #c81fc8;
  --accent-2: #d4a206;
  --accent-cool: #4a48d6;
  --accent-glow: rgba(200, 31, 200, 0.18);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px rgba(200, 31, 200, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ------- HEADER ------- */
.site-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}

.brand-sub {
  font-size: 13px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

#theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all var(--t-fast);
}
#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.ext-link {
  color: var(--text-mute);
  text-decoration: none;
  font-size: 14px;
  transition: color var(--t-fast);
}
.ext-link:hover { color: var(--accent); }

/* ------- APP LAYOUT ------- */
.app {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.sidebar {
  flex-shrink: 0;
  width: 280px;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 14px;
}

.sidebar-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin: 0 8px 14px;
  font-weight: 600;
}

.sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  font-size: 13px;
  color: var(--text-faint);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  transition: all var(--t-fast);
}
.sidebar-link:hover {
  color: var(--accent);
  background: var(--bg-card);
}

/* ------- PURPOSE LIST ------- */
.purpose-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 14px 8px 6px;
  font-weight: 600;
}

.purpose-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text-mute);
  font-size: 14.5px;
  line-height: 1.3;
  margin-bottom: 2px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all var(--t-fast);
}
.purpose-item:hover {
  background: var(--bg-card);
  color: var(--text);
  border-left-color: var(--accent-cool);
}
.purpose-item.active {
  background: var(--bg-card);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
  box-shadow: inset 0 0 16px rgba(255, 77, 255, 0.06);
}
.purpose-tagline {
  display: block;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
  line-height: 1.3;
  font-weight: 400;
}

/* ------- CONTENT ------- */
.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 32px 40px 48px;
}

.loading {
  color: var(--text-faint);
  font-style: italic;
  padding: 40px;
  text-align: center;
}

/* ------- HOME / WELCOME ------- */
.welcome {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 0;
}
.welcome h1 {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--text);
}
.welcome h1 .accent { color: var(--accent); }
.welcome .lede {
  font-size: 18px;
  color: var(--text-mute);
  margin-bottom: 36px;
  line-height: 1.55;
}
.welcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.welcome-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--t-med);
}
.welcome-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.welcome-tile h3 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--accent);
}
.welcome-tile p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-faint);
  line-height: 1.4;
}

.welcome-stats {
  display: flex;
  gap: 28px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-mute);
  flex-wrap: wrap;
}
.welcome-stats b { color: var(--accent-2); font-family: var(--font-mono); }

/* ------- PURPOSE PAGE ------- */
.purpose-page {
  max-width: 920px;
  margin: 0 auto;
}
.purpose-hero {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.purpose-hero .eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-2);
  font-weight: 600;
  margin-bottom: 8px;
}
.purpose-hero h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  line-height: 1.1;
}
.purpose-hero .tagline {
  font-size: 18px;
  color: var(--text-mute);
  font-style: italic;
  margin: 0;
  line-height: 1.4;
}

.purpose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 980px) {
  .purpose-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
}
.card h2 {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
}
.card h3 {
  margin: 18px 0 8px;
  font-size: 15px;
  color: var(--text);
  font-weight: 600;
}
.card p { margin: 0 0 12px; color: var(--text-mute); font-size: 14.5px; line-height: 1.55; }
.card ul { margin: 0 0 12px; padding-left: 20px; color: var(--text-mute); font-size: 14px; line-height: 1.6; }
.card li { margin-bottom: 4px; }

/* ------- DRAFTER FORM ------- */
.drafter {
  margin-top: 28px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-glow);
}
.drafter h2 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.drafter .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.drafter label {
  font-size: 13px;
  color: var(--text-mute);
  font-weight: 500;
}
.drafter label .req { color: var(--accent); margin-left: 3px; }
.drafter input[type="text"],
.drafter textarea,
.drafter select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  transition: border-color var(--t-fast);
}
.drafter input[type="text"]:focus,
.drafter textarea:focus,
.drafter select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.drafter textarea {
  resize: vertical;
  min-height: 80px;
}

.draft-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #07071a;
  border: none;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-display);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.draft-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
}
.draft-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ------- DRAFT OUTPUT ------- */
.draft-output {
  margin-top: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--border-bright);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.draft-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.draft-output-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  font-weight: 700;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--border-bright);
  color: var(--text-mute);
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--t-fast);
}
.copy-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.copy-btn.copied {
  color: var(--success);
  border-color: var(--success);
}
.draft-output-body {
  padding: 22px 24px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  font-family: var(--font-sans);
}

/* ------- QUOTES PANEL ------- */
.quote {
  border-left: 3px solid var(--accent-cool);
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-elev);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.quote-text {
  font-size: 14.5px;
  color: var(--text);
  font-style: italic;
  line-height: 1.55;
  margin: 0 0 6px;
}
.quote-meta {
  font-size: 12px;
  color: var(--text-faint);
}
.quote-meta b { color: var(--accent-2); font-weight: 600; }
.quote-note {
  font-size: 13px;
  color: var(--text-mute);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  line-height: 1.5;
}

/* ------- CHAPTER PANEL ------- */
.chapter-block { margin-bottom: 18px; }
.chapter-block:last-child { margin-bottom: 0; }
.chapter-essence {
  font-style: italic;
  color: var(--accent-2);
  font-size: 14.5px;
  margin: 4px 0 10px;
}
.chapter-rules {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.chapter-rules li {
  padding-left: 22px;
  position: relative;
  margin-bottom: 6px;
  color: var(--text-mute);
  font-size: 14px;
  line-height: 1.5;
}
.chapter-rules li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ------- STATUS / TOAST ------- */
.status {
  padding: 12px 16px;
  margin-top: 12px;
  border-radius: var(--r-md);
  font-size: 14px;
}
.status.error { background: rgba(255, 87, 87, 0.15); border: 1px solid #ff5757; color: #ff8a8a; }
.status.info { background: rgba(110, 109, 255, 0.15); border: 1px solid var(--accent-cool); color: var(--accent-cool); }

/* ------- SECTIONS PAGE (library / playbook / voice) ------- */
.section-page { max-width: 980px; margin: 0 auto; }
.section-page h1 {
  font-family: var(--font-display);
  font-size: 32px;
  margin: 0 0 8px;
  color: var(--text);
}
.section-page h1 .accent { color: var(--accent); }
.section-page .sub {
  color: var(--text-mute);
  margin-bottom: 24px;
  font-size: 16px;
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-chip {
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-mute);
  cursor: pointer;
  transition: all var(--t-fast);
  user-select: none;
}
.filter-chip:hover { color: var(--text); border-color: var(--border-bright); }
.filter-chip.active {
  background: var(--accent);
  color: #07071a;
  border-color: var(--accent);
  font-weight: 600;
}

/* ------- SCROLLBARS ------- */
.sidebar-section::-webkit-scrollbar,
.content::-webkit-scrollbar { width: 8px; height: 8px; }
.sidebar-section::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track { background: transparent; }
.sidebar-section::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.sidebar-section::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
  background: var(--border-bright);
}

/* ------- RESPONSIVE ------- */
@media (max-width: 768px) {
  .site-header { padding: 12px 16px; }
  .brand-mark { font-size: 22px; }
  .brand-sub { display: none; }
  .ext-link { display: none; }
  .app { flex-direction: column; }
  .sidebar { width: 100%; max-height: 220px; border-right: none; border-bottom: 1px solid var(--border); }
  .content { padding: 22px 18px 32px; }
  .purpose-hero h1 { font-size: 28px; }
}
