/* ==========================================================================
   Fermentation Tools — Light Theme
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:           #faf7f2;
  --bg-surface:   #fff;
  --bg-card:      #fff;
  --bg-input:     #faf7f2;
  --border:       #e0d5c0;
  --border-focus: #a16207;
  --accent:       #a16207;
  --accent-hover: #854d0e;
  --accent-light: #b97a1e;
  --accent-glow:  rgba(161, 98, 7, 0.10);
  --text:         #2d1f0e;
  --text-muted:   #8a7560;
  --text-dim:     #b3a48e;
  --success:      #4caf50;
  --error:        #c0392b;
  --radius:       10px;
  --font-heading: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

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; transition: color 0.2s; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

/* ==========================================================================
   Site Header
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
}

.site-header .logo {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

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

.site-header nav a {
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 20px;
  color: var(--text-muted);
}

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

/* ==========================================================================
   Hero / Homepage
   ========================================================================== */
.hero {
  text-align: center;
  padding: 56px 24px 32px;
  max-width: 720px;
  margin: 0 auto;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.hero h1 span { color: var(--accent); }

.hero .tagline {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-weight: 300;
}

/* ==========================================================================
   Calculator Cards (homepage featured)
   ========================================================================== */
.calculators-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.calculators-section h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}

.calculators-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.calc-feature-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.calc-feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(161, 98, 7, 0.08);
  text-decoration: none;
}

.calc-feature-card .card-icon {
  font-size: 2.2rem;
  display: block;
  margin-bottom: 12px;
}

.calc-feature-card .card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
}

.calc-feature-card .card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Cluster Sections (homepage article grid)
   ========================================================================== */
.clusters-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.cluster-group {
  margin-bottom: 32px;
}

.cluster-header {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  user-select: none;
}

.cluster-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.cluster-header .cluster-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.cluster-header .cluster-toggle {
  font-size: 0.9rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.cluster-header[aria-expanded="false"] .cluster-toggle {
  transform: rotate(-90deg);
}

.cluster-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.cluster-body[hidden] { display: none; }

/* ==========================================================================
   Article Card (shared for homepage)
   ========================================================================== */
.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(161, 98, 7, 0.08);
  text-decoration: none;
}

.article-card .card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  line-height: 1.35;
}

.article-card .card-excerpt {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.article-card .card-meta {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Article Layout
   ========================================================================== */
.article-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.article-container h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 12px;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 6px; color: var(--text-dim); }

/* Article body typography */
.article-body h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 16px;
}

.article-body h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 12px;
}

.article-body h4 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 24px 0 8px;
}

.article-body p {
  margin-bottom: 16px;
  color: var(--text);
}

.article-body ul, .article-body ol {
  margin: 0 0 16px 24px;
  color: var(--text);
}

.article-body li { margin-bottom: 6px; }

.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 20px 0;
  padding: 12px 20px;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

.article-body code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--accent);
}

.article-body pre {
  background: #2d1f0e;
  color: #faf7f2;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.article-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.article-body th, .article-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--bg);
  font-weight: 600;
  color: var(--accent);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 16px 0;
}

/* ==========================================================================
   Calculator CTA (inline widget replacement in articles)
   ========================================================================== */
.calculator-cta {
  display: block;
  background: var(--bg-surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.calculator-cta:hover {
  background: var(--bg);
  border-color: var(--accent-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

.calculator-cta .cta-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.calculator-cta .cta-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.calculator-cta .cta-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Amazon Product Card
   ========================================================================== */
.product-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  transition: border-color 0.2s;
}

.product-card:hover { border-color: var(--accent); }

.product-card .product-info { flex: 1; }

.product-card .product-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  display: block;
  margin-bottom: 8px;
}

.product-card .product-btn {
  display: inline-block;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}

.product-card .product-btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* ==========================================================================
   Calculator Placeholder Page
   ========================================================================== */
.calculator-placeholder {
  max-width: 520px;
  margin: 0 auto;
  padding: 80px 20px;
  text-align: center;
}

.calculator-placeholder .placeholder-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.calculator-placeholder h1 {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

.calculator-placeholder p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.calculator-placeholder .cta-btn {
  display: inline-block;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, transform 0.15s;
}

.calculator-placeholder .cta-btn:hover {
  background: var(--accent-hover);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 0.82rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  max-width: 720px;
  margin: 0 auto;
}

.site-footer a { color: var(--accent); }

.site-footer .affiliate-disclosure {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .article-container h1 { font-size: 1.55rem; }
  .article-body h2 { font-size: 1.25rem; }
  .product-card { flex-direction: column; text-align: center; }
  .calculators-grid { grid-template-columns: 1fr; }
  .cluster-body { grid-template-columns: 1fr; }
}
