/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #1a1714;
  --bg-elevated: #231f1b;
  --bg-card: #2a2520;
  --bg-input: #332e28;
  --text: #e8e0d4;
  --text-muted: #9e9488;
  --text-dim: #6b6157;
  --accent: #d4a853;
  --accent-light: #e8c97a;
  --accent-dark: #b08930;
  --border: #3d362e;
  --border-light: #4a4239;
  --success: #7cb87c;
  --error: #c97b7b;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'Courier New', monospace;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --max-width: 1100px;
}
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== HEADER ===== */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.logo-icon { flex-shrink: 0; }
.main-nav ul { display: flex; gap: 1.5rem; list-style: none; }
.main-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.main-nav a:hover, .main-nav a:focus { color: var(--accent); }

/* ===== HERO ===== */
.hero-section {
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}
.hero-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 1rem;
  font-weight: 700;
}
.hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== SEARCH ===== */
.search-shell { position: relative; max-width: 520px; margin: 0 auto; }
.search-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 1rem;
  transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: var(--accent); }
.search-input-wrap .search-icon { color: var(--text-dim); flex-shrink: 0; margin-right: 0.5rem; }
.search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.05rem;
  padding: 0.85rem 0;
  outline: none;
}
.search-input-wrap input::placeholder { color: var(--text-dim); }
.search-clear-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  display: flex;
  align-items: center;
}
.search-clear-btn:hover { color: var(--text-muted); }
.search-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
}
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow);
}
.suggestion-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover, .suggestion-item[aria-selected="true"] {
  background: var(--bg-input);
}
.suggestion-item .sugg-title { color: var(--text); font-weight: 600; }
.suggestion-item .sugg-author { color: var(--text-dim); font-size: 0.8rem; }

/* ===== FILTER PILLS ===== */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.25rem 0;
}
.pill {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}
.pill:hover { border-color: var(--accent); color: var(--text); }
.pill.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}

/* ===== RESULTS ===== */
.results-section { padding: 1rem 1.5rem 3rem; }
.results-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
}
.results-header h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}
.results-header h2 span { color: var(--accent); }
.recommendations-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1rem; }
.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.rec-card:hover { border-color: var(--border-light); }
.rec-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.rec-card-title { font-size: 1.1rem; font-weight: 700; }
.rec-card-author { color: var(--text-muted); font-size: 0.88rem; }
.rec-card-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.tag.mood { border-color: #7a6a4a; color: var(--accent-light); }
.tag.theme { border-color: #4a6a5a; color: #8bc9a0; }
.tag.pacing { border-color: #5a4a6a; color: #b09cc9; }
.tag.emotion { border-color: #6a4a4a; color: #c99c9c; }
.rec-card-why {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  border-left: 2px solid var(--accent-dark);
  padding-left: 0.75rem;
  margin-top: 0.4rem;
}
.results-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--text); }
.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline:hover { background: var(--accent); color: var(--bg); }
.btn-sm { font-size: 0.82rem; padding: 0.4rem 0.8rem; }

/* ===== SIDEBAR ===== */
.results-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.sidebar-card h3 {
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.sidebar-card p { font-size: 0.88rem; color: var(--text-muted); }
.reading-path-list {
  list-style: none;
  counter-reset: path;
  margin-top: 0.75rem;
}
.reading-path-list li {
  counter-increment: path;
  font-size: 0.88rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
}
.reading-path-list li::before {
  content: counter(path);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  width: 1.2rem;
  flex-shrink: 0;
}
.saved-list { list-style: none; margin: 0.5rem 0; }
.saved-list li {
  font-size: 0.85rem;
  padding: 0.3rem 0;
  color: var(--text-muted);
  cursor: pointer;
}
.saved-list li:hover { color: var(--accent); }

/* ===== BROWSE ===== */
.browse-section {
  padding: 2.5rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}
.browse-section h2 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.section-sub { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.25rem; }
.book-chips { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.book-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s;
}
.book-chip:hover { border-color: var(--accent); color: var(--text); background: var(--bg-input); }

/* ===== HOW SECTION ===== */
.how-section {
  padding: 3rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}
.how-section h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.how-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.how-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.how-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.how-card p { font-size: 0.92rem; color: var(--text-muted); line-height: 1.55; }
.info-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.info-block h3 { font-size: 1.05rem; color: var(--accent); margin-bottom: 0.75rem; }
.info-block p { font-size: 0.93rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 0.75rem; }
.info-block p:last-child { margin-bottom: 0; }
.faq-list dt {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  margin-top: 1rem;
}
.faq-list dd {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  margin-left: 0;
  line-height: 1.55;
}

/* ===== REQUEST ===== */
.request-section {
  padding: 2.5rem 1.5rem 4rem;
  max-width: 520px;
  margin: 0 auto;
}
.request-section h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.request-section > p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.25rem; }
.request-form { display: flex; flex-direction: column; gap: 0.75rem; }
.request-form label { font-size: 0.88rem; color: var(--text-muted); font-weight: 600; }
.request-form input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.request-form input:focus { border-color: var(--accent); }
.request-form .btn { align-self: flex-start; margin-top: 0.5rem; }
.request-confirm {
  color: var(--success);
  font-size: 0.95rem;
  margin-top: 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
}
.empty-state p { font-size: 0.95rem; }

/* ===== FOOTER ===== */
.site-footer {
  margin-top: auto;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-inner p { font-size: 0.82rem; color: var(--text-dim); }
.footer-inner ul { display: flex; gap: 1.25rem; list-style: none; }
.footer-inner a { font-size: 0.82rem; color: var(--text-dim); text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .search-shell, .filter-pills, .results-actions, .results-sidebar, .browse-section, .how-section, .request-section { display: none !important; }
  body { background: #fff; color: #000; }
  .results-section { display: block !important; }
  .rec-card { border: 1px solid #ccc; break-inside: avoid; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .results-layout { grid-template-columns: 1fr; }
  .results-sidebar { order: -1; }
  .how-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .header-inner { height: 48px; }
  .logo-text { font-size: 0.9rem; }
  .main-nav ul { gap: 1rem; }
  .main-nav a { font-size: 0.82rem; }
  .hero-section { padding: 2rem 1rem 1.5rem; }
  .hero-content h1 { font-size: 1.5rem; }
  .filter-pills { gap: 0.35rem; }
  .pill { font-size: 0.78rem; padding: 0.3rem 0.7rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}


/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
