/* ── DESIGN TOKENS ── */
:root {
  --bg: #F7F3E8;
  --card: #FFFFFF;
  --cream-deep: #EFE6CF;
  --text-dark: #1E2620;
  --text-gray: #5B6358;
  --border: #E1D7BD;
  --blue: #2F4A3B;        
  --blue-dark: #1C2E24;   
  --gold: #AD8A52;        
  --gold-soft: #E9DAB7;
  --shadow: 0 10px 30px rgba(30,28,18,.05);
  --max-w: 1200px;
  --font: 'Public Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

[data-theme="dark"] {
  --bg: #161D19;
  --card: #1E2622;
  --cream-deep: #212A24;
  --text-dark: #F1ECDD;
  --text-gray: #A9B2A4;
  --border: #2F3A33;
  --blue: #8FB89C;
  --blue-dark: #6E9C81;
  --gold: #D7BA82;
  --gold-soft: #3C341F;
}

/* Base Body Styles matching original template */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-gray);
  display: flex; flex-direction: column; min-height: 100vh;
  transition: background .35s ease, color .35s ease;
}
a { text-decoration: none; color: inherit; }

/* Progress & Navigation Header */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--blue)); width: 0%; z-index: 1002;
  transition: width .1s linear;
}
.header {
  position: fixed; top: 0; left: 0; right: 0; height: 64px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  z-index: 1000; display: flex; align-items: center;
  transition: box-shadow .25s ease, background .35s ease, border-color .35s ease;
}
.header.scrolled { box-shadow: 0 8px 24px rgba(20,18,10,.04); }
.header-inner {
  width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center;
}
.brand { font-size: 21px; font-family: var(--font-display); color: var(--text-gray); display: flex; align-items: center; gap: 16px; }
.brand span { font-weight: 600; color: var(--text-dark); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  font-size: 18px; cursor: pointer; color: var(--text-gray);
  padding: 9px; border-radius: 50%; transition: background .15s, color .15s;
  border: none; background: transparent;
}
.icon-btn:hover { background: var(--cream-deep); color: var(--blue); }

/* Sidebar Navigation Drawer */
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(20,18,10,.55); z-index: 1100;
  opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
}
.sidebar-backdrop.active { opacity: 1; visibility: visible; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--card); z-index: 1101;
  transform: translateX(-100%); transition: transform .35s cubic-bezier(.4,0,.2,1);
  padding: 28px 24px; display: flex; flex-direction: column;
}
.sidebar.active { transform: translateX(0); }
.sidebar-header {
  margin-bottom: 28px; font-size: 21px; font-weight: 600; font-family: var(--font-display);
  color: var(--text-dark); display: flex; align-items: center; justify-content: space-between;
}
.nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; font-size: 15.5px; font-weight: 500; color: var(--text-dark);
  border-bottom: 1px solid var(--border); transition: color .2s, padding-left .2s;
}
.nav-link:hover { color: var(--blue); padding-left: 8px; }

/* ── TOOL WORKSPACE STYLES ── */
.workspace-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-bottom: 48px;
}
@media (min-width: 992px) {
  .workspace-section { grid-template-columns: 1.5fr 1fr; }
}

.workspace-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius, 12px);
  padding: 28px;
  box-shadow: var(--shadow);
}
.tool-main-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--text-dark);
}
.editor-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.quick-actions { display: flex; gap: 16px; }
.action-link {
  background: none; border: none; color: var(--text-dark);
  font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.clear-action { color: #AD5252; }

/* Large Textarea Box */
textarea {
  width: 100%; height: 360px; padding: 18px;
  font-family: var(--font); font-size: 16px;
  background-color: var(--bg); color: var(--text-dark);
  border: 1px solid var(--border); border-radius: 8px;
  resize: vertical; outline: none; transition: border-color 0.2s;
}
textarea:focus { border-color: var(--gold); }

/* Formatting Toolbar */
.format-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.format-btn {
  background: var(--cream-deep); border: 1px solid var(--border);
  color: var(--text-dark); padding: 8px 16px; border-radius: 20px;
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.format-btn:hover { background: var(--blue); color: #FFFFFF; }

/* Sidebar Layout */
.sidebar-layout { display: flex; flex-direction: column; gap: 24px; }
.stats-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; box-shadow: var(--shadow);
}
.section-title {
  font-family: var(--font-display); color: var(--text-dark);
  font-size: 18px; font-weight: 500; margin-bottom: 16px; border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-item {
  display: flex; flex-direction: column; padding: 12px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
}
.stat-value { font-size: 20px; font-weight: 700; color: var(--blue); }
.stat-label { font-size: 11px; text-transform: uppercase; color: var(--text-gray); margin-top: 4px; }

/* Readability Estimate Row */
.estimation-grid { display: flex; flex-direction: column; gap: 8px; }
.estimate-item {
  display: flex; justify-content: space-between; padding: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
.estimate-label { font-size: 14px; }
.estimate-value { font-weight: 600; color: var(--text-dark); }

/* Density Tables */
.table-container { max-height: 180px; overflow-y: auto; }
.density-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.density-table th, .density-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.density-table th { color: var(--text-dark); font-weight: 600; }
.empty-state-text { text-align: center; font-style: italic; color: var(--text-gray); padding: 16px 0; }

/* Bottom SEO Section */
.editorial-info-section { margin-top: 64px; margin-bottom: 64px; }
.editorial-section-title { font-family: var(--font-display); font-size: 32px; color: var(--text-dark); margin-bottom: 16px; }
.editorial-p { margin-bottom: 16px; line-height: 1.7; }

/* Accordion Component */
.faq-accordion { margin-top: 36px; }
.faq-main-heading { font-family: var(--font-display); font-size: 22px; color: var(--text-dark); margin-bottom: 16px; }
.faq-element { border-bottom: 1px solid var(--border); }
.faq-header {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 16px 0; background: none; border: none; font-family: var(--font-display);
  font-size: 17px; font-weight: 500; color: var(--text-dark); cursor: pointer;
}
.faq-body { max-height: 0; overflow: hidden; transition: max-height 0.25s ease-out; }
.faq-body p { padding-bottom: 16px; color: var(--text-gray); font-size: 15px; }

/* ── HIGH CONTRAST DARK FOOTER ── */
.site-footer { background: #111111; color: #A9B2A4; padding: 64px 24px 32px; margin-top: auto; }
.footer-inner-grid {
  max-width: var(--max-w); margin: 0 auto; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 32px; padding-bottom: 32px;
  border-bottom: 1px solid #222222;
}
.footer-brand-title { font-family: var(--font-display); font-size: 24px; color: #F7F3E8; }
.footer-brand-title span { color: var(--blue); }
.footer-col h4 { color: #F7F3E8; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col ul li a { color: #888888; font-size: 14px; transition: color 0.15s; }
.footer-col ul li a:hover { color: #F7F3E8; }
.footer-bottom-bar { max-width: var(--max-w); margin: 24px auto 0; text-align: center; }
.footer-copyright { font-size: 12px; color: #888888; }

/* Utilities */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 32px; }
.back-to-top {
  position: fixed; bottom: 26px; right: 26px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--blue); color: #F7F3E8; border: none; display: flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer; opacity: 0; visibility: hidden; transition: all .25s ease;
}
.back-to-top.visible { opacity: 1; visibility: visible; }
