:root {
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-alt: #f3ede2;
  --text: #2e2418;
  --text-muted: #6b5e4e;
  --accent: #8b4513;
  --accent-light: #c4834a;
  --accent-dark: #5c2d0a;
  --border: #d9cdb8;
  --border-light: #e8dfce;
  --shadow: 0 2px 8px rgba(46, 36, 24, 0.08);
  --shadow-lg: 0 8px 24px rgba(46, 36, 24, 0.12);
  --radius: 8px;
  --radius-lg: 12px;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max-width: 1100px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

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

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
}

.brand-text h1 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  color: var(--text);
  line-height: 1.2;
}

.tagline {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.site-nav a {
  color: var(--text-muted);
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero-section {
  background: linear-gradient(135deg, var(--surface-alt) 0%, var(--bg) 100%);
  padding: 4rem 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.hero-content h2 {
  font-size: 2.25rem;
  color: var(--accent-dark);
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-content p {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat strong {
  font-size: 1.75rem;
  color: var(--accent);
  font-family: var(--font-ui);
}

.stat span {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-ui);
}

/* Sections */
section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.75rem;
  color: var(--accent-dark);
  margin-bottom: 0.5rem;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Era Tabs */
.era-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.era-tab {
  flex: 1;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-right: 1px solid var(--border-light);
}

.era-tab:last-child { border-right: none; }
.era-tab:hover { background: var(--surface-alt); color: var(--text); }
.era-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Recipe Grid */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.recipe-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.recipe-card-header {
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
}

.recipe-card-header h3 {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.3;
}

.recipe-meta {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.recipe-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.difficulty-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.difficulty-easy { background: #e6f4ea; color: #137333; }
.difficulty-medium { background: #fef7e0; color: #b06000; }
.difficulty-hard { background: #fce8e6; color: #c5221f; }

.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--text-muted);
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.fav-btn:hover { color: #e74c3c; }
.fav-btn.saved { color: #e74c3c; }

.recipe-card-body {
  display: none;
  padding: 0 1.5rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

.recipe-card.expanded .recipe-card-body {
  display: block;
}

.recipe-card.expanded .recipe-card-header {
  background: var(--surface-alt);
}

.recipe-original {
  margin: 1.25rem 0;
  padding: 1rem;
  background: #fdf8f0;
  border-left: 3px solid var(--accent-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.recipe-original h4 {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.recipe-original p {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

.recipe-modern {
  margin: 1.25rem 0;
}

.recipe-modern h4 {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin-bottom: 0.75rem;
}

.recipe-modern ul {
  list-style: none;
  padding: 0;
}

.recipe-modern ul li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.93rem;
}

.recipe-modern ul li:last-child { border-bottom: none; }

.recipe-notes {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--surface-alt);
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text-muted);
}

.recipe-notes strong {
  color: var(--text);
}

.recipe-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--surface-alt);
  border-color: var(--accent-light);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

/* Substitutions */
.substitutions-section {
  background: var(--surface-alt);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.sub-table-wrap {
  overflow-x: auto;
  margin-top: 1.5rem;
}

.sub-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sub-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sub-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.sub-table tr:nth-child(even) td {
  background: var(--surface);
}

/* Favorites */
.favorites-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  font-size: 1rem;
}

.fav-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.fav-card h4 {
  font-size: 0.95rem;
  color: var(--text);
}

.fav-card .era-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.fav-card .remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0.25rem;
}

.fav-card .remove-btn:hover { color: #e74c3c; }

/* About */
.about-section p {
  margin-bottom: 1rem;
  color: var(--text);
}

.last-updated {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

/* Footer */
.site-footer {
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
}

.footer-inner p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

/* Print */
@media print {
  .site-header, .site-footer, .era-tabs, .recipe-actions, .fav-btn, #favorites, #substitutions, #about-section { display: none !important; }
  .recipe-card-body { display: block !important; }
  .recipe-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 1rem; flex-wrap: wrap; }
  .hero-content h2 { font-size: 1.75rem; }
  .hero-stats { gap: 1.5rem; }
  .recipe-grid { grid-template-columns: 1fr; }
  .era-tabs { flex-direction: column; }
  .era-tab { border-right: none; border-bottom: 1px solid var(--border-light); }
  .era-tab:last-child { border-bottom: none; }
}

@media (max-width: 480px) {
  .hero-section { padding: 2.5rem 1rem; }
  section { padding: 2rem 1rem; }
  .recipe-card-header { padding: 1rem; }
  .recipe-card-body { padding: 0 1rem 1rem; }
}


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