@import url('https://fonts.googleapis.com/css2?family=Marcellus&family=Spectral:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&display=swap');

:root {
  /* Ola-chuvadi (palm-leaf manuscript) palette */
  --paper: #EFE3CB;         /* palm cream */
  --paper-raised: #F6EEDA;  /* lighter card surface */
  --ink: #3A2B18;           /* sepia ink */
  --ink-soft: #6E5B41;      /* softer sepia */
  --leaf: #3B4A2A;          /* deep green */
  --leaf-dark: #2A3720;     /* darker green for headings */
  --turmeric: #B8892F;      /* gold (kept var name for compatibility) */
  --kumkum: #B25A34;        /* terracotta (kept var name for compatibility) */
  --gold: #B8892F;
  --terracotta: #B25A34;
  --line: #D8C6A2;          /* soft rule line */

  /* Type */
  --font-display: 'Marcellus', 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Spectral', Georgia, 'Times New Roman', serif;
  --font-label: 'Spectral', Georgia, serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.65;
  /* Parchment: faint horizontal palm-leaf striations + a fine paper grain,
     layered over the palm-cream base. Fully self-contained (no external assets). */
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(58,43,24,0.022) 7px 8px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  background-attachment: fixed, fixed;
}

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Motif watermark (per-page background image) ----------
   A fixed, faint line-drawing behind everything. The image URL is set by a
   small script in the layout: section pages pin one via `data-bg`, recipe
   pages pick one at random on each visit. Falls back to the CSS default. */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.10;
  background-repeat: no-repeat;
  background-position: right -35px bottom -35px;
  background-size: 235px auto;
  background-image: url("/assets/images/backgrounds/kolam-lotus.svg"); /* no-JS fallback */
}
@media (max-width: 640px) {
  .page-bg { background-size: 150px auto; opacity: 0.07; background-position: right -25px bottom -25px; }
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--leaf-dark);
  line-height: 1.18;
  letter-spacing: 0.01em;
}

a {
  color: var(--kumkum);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--leaf-dark); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--turmeric);
  outline-offset: 2px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--leaf);
  border-bottom: 3px solid var(--turmeric);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  flex-wrap: wrap;
  gap: 10px;
}
.site-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  color: #F6EEDA !important;
  text-decoration: none;
}
.site-header nav a {
  color: #EFE6CE !important;
  margin-left: 20px;
  font-family: var(--font-label);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
}
.site-header nav a:hover { color: #fff !important; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px;
  border-top: 1px solid var(--line);
  padding: 20px 0 40px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

/* ---------- Top page ---------- */
.hero {
  padding: 56px 0 20px;
  border-bottom: 1px dashed var(--line);
  margin-bottom: 32px;
}
.hero h1 {
  font-size: 2.6rem;
  margin: 0 0 8px;
}
.tagline {
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 46ch;
}

.browse-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0 48px;
}
.browse-card {
  display: block;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px;
  text-decoration: none;
}
.browse-card:hover { border-color: var(--turmeric); }
.browse-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--leaf-dark) !important;
}
.browse-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}
@media (max-width: 640px) {
  .browse-links { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2rem; }
}

/* ---------- Recipe card ---------- */
.recipe {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 32px 36px 40px;
  margin: 28px 0 60px;
  position: relative;
  box-shadow: 3px 4px 0 rgba(43,35,24,0.06);
}
.recipe::before {
  content: "";
  position: absolute;
  top: -1px; left: 24px; right: 24px;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--turmeric) 0 10px, transparent 10px 18px);
}
.back-link {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--ink-soft) !important;
  margin-bottom: 18px;
  text-decoration: none;
}
.back-link:hover { color: var(--kumkum) !important; }

.recipe h1 { font-size: 1.9rem; margin: 0 0 2px; }
.tamil-name { color: var(--ink-soft); margin: 0 0 14px; font-style: italic; }

.status-flag {
  background: #FBEFD9;
  border: 1px solid var(--turmeric);
  color: #6B4A0E;
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 3px;
  margin: 14px 0;
}

/* ---------- Recipe photo ---------- */
.recipe-photo {
  margin: 20px 0 4px;
}
.recipe-photo img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.recipe-photo figcaption {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-style: italic;
}

/* ---------- Personal note (intro) ---------- */
.recipe-intro {
  margin: 18px 0 6px;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--turmeric);
  color: var(--ink-soft);
  font-style: italic;
  font-size: 1.02rem;
}
.recipe-intro p { margin: 0 0 8px; }
.recipe-intro p:last-child { margin-bottom: 0; }

.recipe h2 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.recipe ul, .recipe ol { padding-left: 1.3em; }
.recipe li { margin-bottom: 4px; }

.source-note {
  margin-top: 28px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: var(--font-label);
}

/* ---------- Tag pills ---------- */
.tag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 6px;
}
.pill {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  background: var(--leaf);
  color: #F7F2E7 !important;
  padding: 3px 10px;
  border-radius: 20px;
  text-decoration: none !important;
}
.pill:hover { background: var(--kumkum); }

/* ---------- Index page ---------- */
.recipe-index {
  list-style: none;
  padding: 0;
  columns: 2;
  column-gap: 32px;
}
.recipe-index li {
  break-inside: avoid;
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
}
.mini-flag { color: var(--turmeric); margin-left: 6px; }
@media (max-width: 640px) { .recipe-index { columns: 1; } }

/* ---------- Meal slot tables ---------- */
.meal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 36px;
  font-size: 0.92rem;
}
.meal-table th {
  text-align: left;
  font-family: var(--font-label);
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--leaf);
  padding: 6px 10px 6px 0;
}
.meal-table td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tag-cell { color: var(--ink-soft); font-size: 0.82rem; }

/* ---------- Occasion list ---------- */
.occasion-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 36px;
}
.occasion-list li {
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
}

/* ---------- Empty-state note ---------- */
.empty-note {
  color: var(--ink-soft);
  font-style: italic;
  background: var(--paper-raised);
  border: 1px dashed var(--line);
  border-radius: 3px;
  padding: 16px 18px;
  max-width: 58ch;
}

/* ---------- Best Combos ---------- */
.combo-intro {
  color: var(--ink-soft);
  max-width: 60ch;
  margin-bottom: 28px;
}
.combo-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 20px 24px 22px;
  margin: 0 0 20px;
  box-shadow: 3px 4px 0 rgba(43,35,24,0.06);
}
.combo-card h2 {
  font-size: 1.2rem;
  margin: 0 0 10px;
  color: var(--leaf-dark);
}
.combo-recipes {
  font-size: 1.05rem;
  margin: 0 0 12px;
}
.combo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}
.combo-tag {
  font-family: var(--font-label);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  background: var(--leaf);
  color: #F7F2E7;
  padding: 3px 10px;
  border-radius: 20px;
}
.combo-tag.occasion { background: var(--kumkum); }
.combo-links {
  font-size: 0.9rem;
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.combo-links a {
  font-weight: 500;
}
.combo-evidence {
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--line);
  padding-left: 14px;
  margin: 12px 0 0;
}
.combo-notes {
  font-size: 0.9rem;
  background: #FBEFD9;
  border-radius: 3px;
  padding: 8px 12px;
  margin: 12px 0 0;
}
.combo-notes strong { color: var(--leaf-dark); }
