/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a1714;
  --bg-card: #231f1b;
  --bg-panel: #2a2420;
  --bg-hover: #332d26;
  --text: #e8e0d6;
  --text-muted: #9e9488;
  --text-dim: #6b6258;
  --accent: #d4a574;
  --accent-hover: #e0b88a;
  --accent-dim: #8a6d4b;
  --warm: #c4835a;
  --warm-light: #e8c4a0;
  --success: #7da87b;
  --danger: #c97b7b;
  --border: #3a332c;
  --border-light: #4a4238;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --font: 'Georgia', 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

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;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-family: var(--font); line-height: 1.3; color: var(--text); }
h1 { font-size: 2.2rem; font-weight: 400; margin-bottom: 0.75rem; }
h2 { font-size: 1.5rem; font-weight: 400; margin-bottom: 0.6rem; }
h3 { font-size: 1.1rem; font-weight: 400; margin-bottom: 0.5rem; color: var(--accent); }
p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.35rem; }

/* ===== HEADER ===== */
.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 1.1rem;
  font-family: var(--font);
}
.logo:hover { color: var(--accent); }
.logo-icon { color: var(--accent); }
.main-nav {
  display: flex;
  gap: 1.5rem;
}
.nav-link {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid transparent;
}
.nav-link:hover { color: var(--accent); border-bottom-color: var(--accent-dim); }

/* ===== BROWSE SECTION ===== */
.section-browse {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}
.browse-intro { text-align: center; margin-bottom: 2.5rem; }
.browse-intro .subtitle {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto;
}

.browser-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
}

/* Feeling Panel */
.feeling-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: 70px;
}
.feeling-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text);
}
.feeling-panel h3 {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 1.5rem 0 0.75rem;
  font-family: var(--font-sans);
}

.feeling-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.feeling-btn {
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  color: var(--text);
  font-family: var(--font);
}
.feeling-btn:hover {
  border-color: var(--accent-dim);
  background: var(--bg-hover);
}
.feeling-btn[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(212, 165, 116, 0.12);
}
.feeling-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.feeling-emoji { grid-row: 1 / 3; font-size: 1.3rem; text-align: center; }
.feeling-label { font-size: 0.95rem; font-weight: 600; }
.feeling-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

.outcome-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.outcome-btn {
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
}
.outcome-btn:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.outcome-btn[aria-checked="true"] {
  border-color: var(--accent);
  background: rgba(212, 165, 116, 0.12);
  color: var(--accent);
}
.outcome-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  margin-top: 1.5rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }

/* Ritual Output */
.ritual-output { min-height: 400px; }
.ritual-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-illustration { margin-bottom: 1.5rem; color: var(--border-light); }
.ritual-empty h2 { font-size: 1.3rem; color: var(--text-dim); margin-bottom: 0.5rem; }
.ritual-empty p { font-family: var(--font-sans); font-size: 0.9rem; max-width: 360px; margin: 0 auto; }

.ritual-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.ritual-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.ritual-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.ritual-feeling, .ritual-outcome {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ritual-outcome { border-color: var(--accent-dim); color: var(--accent); }

.ritual-actions { display: flex; gap: 0.25rem; }
.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.btn-icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-favorite[aria-pressed="true"] { color: var(--danger); border-color: var(--danger); }

.ritual-title { font-size: 1.6rem; margin-bottom: 0.75rem; color: var(--warm-light); }
.ritual-narrative {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.ritual-details {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.ritual-detail { display: flex; flex-direction: column; gap: 0.2rem; }
.detail-label {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.detail-value { font-size: 0.95rem; color: var(--accent); }

.ritual-steps { margin-bottom: 1.5rem; }
.ritual-steps h3 { margin-bottom: 0.75rem; }
.ritual-steps ol { padding-left: 1.25rem; }
.ritual-steps li {
  margin-bottom: 0.6rem;
  padding-left: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.55;
}

.ritual-materials { margin-bottom: 1.5rem; }
.ritual-materials h3 { margin-bottom: 0.75rem; }
.ritual-materials ul { list-style: disc; }
.ritual-materials li { font-size: 0.92rem; color: var(--text-muted); }
.substitution-note {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 0.75rem;
  font-style: italic;
}

.ritual-variations, .ritual-seasonal {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.variation-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  margin: 0.25rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
}
.ritual-seasonal p {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
}

/* ===== FAVORITES ===== */
.section-favorites {
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem;
}
.favorites-header {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  text-align: center;
}
.favorites-header p {
  font-family: var(--font-sans);
  color: var(--text-muted);
  font-size: 0.9rem;
}
.favorites-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.favorite-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
}
.favorite-card:hover { border-color: var(--accent-dim); background: var(--bg-hover); }
.favorite-card h3 { font-size: 1rem; margin-bottom: 0.35rem; color: var(--warm-light); }
.favorite-card p {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.favorite-card .fav-meta {
  display: flex;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.favorites-empty {
  text-align: center;
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  grid-column: 1 / -1;
  padding: 2rem;
}

/* ===== GUIDE SECTION ===== */
.section-guide {
  max-width: 760px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}
.section-guide h2 { text-align: center; margin-bottom: 1.5rem; }
.section-guide h3 { margin-top: 2rem; margin-bottom: 0.75rem; }
.section-guide p {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.guide-list { margin-top: 1rem; }
.guide-list li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.guide-list li strong { color: var(--text); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.footer-logo { font-size: 0.95rem; color: var(--text); }
.footer-date { font-family: var(--font-sans); font-size: 0.78rem; color: var(--text-dim); }
.footer-nav { display: flex; gap: 1.25rem; }
.footer-nav a {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.footer-nav a:hover { color: var(--accent); }

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .section-browse, .section-favorites, .section-guide,
  .feeling-panel, .ritual-actions { display: none !important; }
  body { background: #fff; color: #222; }
  .ritual-card { border: 1px solid #ccc; padding: 2rem; }
  .ritual-title { color: #333; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 860px) {
  .browser-layout { grid-template-columns: 1fr; }
  .feeling-panel { position: static; }
  h1 { font-size: 1.7rem; }
  .ritual-card { padding: 1.5rem; }
  .header-inner { flex-wrap: wrap; }
  .main-nav { gap: 1rem; flex-wrap: wrap; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.4rem; }
  .ritual-card { padding: 1.25rem; }
  .ritual-details { flex-direction: column; gap: 0.75rem; }
  .outcome-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ===== NOTIFICATION ===== */
.notification {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  z-index: 200;
  animation: slideUp 0.3s ease;
  box-shadow: var(--shadow);
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }



/* 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;
}
