/* ==================================================
   Stirring Stories — shared design system
   Warm-orange theme · Playfair Display + Inter
   Single stylesheet for every page. Class names match
   the markup already used across the app so pages only
   need to <link> this file and drop their inline <style>.
   ================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* ---------- Design tokens (Light / default) ---------- */
:root {
  --brand:        #e0367a;   /* raspberry pink (logo) */
  --brand2:       #ff5c9d;   /* hover / accent */
  --brand-soft:   #fff0f6;   /* tinted surface */
  --brand-ring:   rgba(224,54,122,0.25);
  --bg:           #fdf5f9;
  --text:         #2b2028;
  --muted:        #8a7480;
  --card:         #ffffff;
  --border:       #f3dde8;
  --shadow:       0 10px 30px rgba(150,40,90,0.10);
  --shadow-sm:    0 4px 14px rgba(150,40,90,0.08);
  --radius:       14px;
  --nav-bg:       rgba(255,255,255,0.85);
}

/* ---------- Theme overrides (profile page picker) ---------- */
body.dark {
  --brand:#fb923c; --brand2:#fdba74; --brand-soft:#2a211c; --brand-ring:rgba(251,146,60,0.30);
  --bg:#181310; --text:#f2e9e2; --muted:#b6a79d; --card:#241d18;
  --border:#382d26; --nav-bg:rgba(36,29,24,0.85); --shadow:0 10px 30px rgba(0,0,0,0.45);
}
body.blue {
  --brand:#3f88c5; --brand2:#66a5e3; --brand-soft:#eef5fc; --brand-ring:rgba(63,136,197,0.25);
  --bg:#eef5fc; --text:#1c2a39; --muted:#49607a; --card:#ffffff; --border:#d6e4f2; --nav-bg:rgba(255,255,255,0.85);
}
body.pastel {
  --brand:#f0799a; --brand2:#ffb3c6; --brand-soft:#fff5f7; --brand-ring:rgba(240,121,154,0.25);
  --bg:#fff5f7; --text:#4a3a3f; --muted:#8a6f77; --card:#ffffff; --border:#f6dde4; --nav-bg:rgba(255,255,255,0.85);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text);
  line-height: 1.2;
}

a { color: var(--brand); }

/* The old pages ship a full-width <div class="banner"><img></div>.
   The redesign drops it in favour of the sticky nav + hero. */
.banner { display: none !important; }

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.nav-content, .nav-inner {
  width: 92%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Brand logo (added to nav markup) */
.brand {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--brand);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  display: inline-block;
  width: 54px;
  height: 54px;
  background: url("ss_logo.jpg") center/contain no-repeat;
  border-radius: 10px;
  flex: 0 0 auto;
}

.nav-links { display: flex; gap: 20px; align-items: center; }

/* Language switcher, injected into the nav row by i18n.js. Without a width it
   inherits the global `select { width: 100% }` and swallows the whole bar. */
.nav .lang-select {
  width: auto;
  max-width: 160px;
  margin: 0 0 0 14px;
  padding: 6px 12px;
  font-size: .88rem;
  font-weight: 600;
  border-radius: 999px;
  flex: 0 0 auto;
}

.nav-links a, .nav a {
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  transition: color .2s;
}
.nav-links a:hover, .nav a:hover { color: var(--brand); }

.nav-right button,
.nav-right #logoutBtn,
#logoutBtn {
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 600;
  border-radius: 999px;
  padding: 7px 16px;
  background: var(--card);
  color: var(--brand);
  transition: background .2s, color .2s;
}
.nav-right button:hover, #logoutBtn:hover { background: var(--brand); color: #fff; }

/* ---------- Layout containers ---------- */
.container {
  width: 92%;
  max-width: 1000px;
  margin: 40px auto;
}

.layout {
  width: 92%;
  max-width: 1100px;
  margin: 40px auto;
  display: flex;
  gap: 28px;
  align-items: flex-start;
}
.right-col { flex: 1; display: flex; flex-direction: column; gap: 24px; }
.left-card { flex: 2; }

/* ---------- Cards ---------- */
.card,
.profile-card,
.left-card,
.side-card,
.community-card,
.item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card, .profile-card, .left-card, .side-card { padding: 24px; }
.community-card { padding: 16px 18px; margin: 12px 0; }
.item { padding: 16px; text-align: center; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.item:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.profile-card { text-align: center; margin-bottom: 30px; }
.card h2, .side-card h3, .profile-card h2 { margin-top: 0; color: var(--text); }
.side-card h3 { text-align: center; color: var(--brand); margin-bottom: 16px; }
.community-card h4 { margin: 0 0 6px; color: var(--brand); cursor: pointer; }

/* ---------- Grid feeds ---------- */
.feed, .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 22px;
  margin-top: 16px;
}
.card img, .item img {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
}
.card h3 { color: var(--text); margin: 12px 0 6px; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-weight: 600;
  margin-top: 16px;
  font-size: .92rem;
}
input, textarea, select {
  width: 100%;
  padding: 11px 12px;
  font-size: 14px;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 6px;
  background: var(--card);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
textarea { min-height: 110px; resize: vertical; }

/* Preserve line breaks in saved recipe text */
#recipeIngredients, #recipeInstructions { white-space: pre-line; }

/* ---------- Allergen warning banner ---------- */
.allergen-banner {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4f4;
  border: 1px solid #f7b7b7;
  border-left: 5px solid #dc2626;
}
body.dark .allergen-banner { background: #2c1a1a; border-color: #7f3838; border-left-color: #f87171; }
.allergen-head {
  font-weight: 700;
  color: #b91c1c;
  font-size: .98rem;
}
body.dark .allergen-head { color: #fca5a5; }
.allergen-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.allergen-chip {
  background: #dc2626;
  color: #fff;
  font-size: .8rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.allergen-note {
  margin-top: 8px;
  font-size: .78rem;
  color: var(--muted);
}

/* ---------- Nutrition estimate ---------- */
.nutrition-facts {
  margin: 16px 0 4px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--brand-soft);
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand);
}
.nutrition-head {
  font-weight: 700;
  color: var(--brand);
  font-size: 1rem;
}
.nutrition-sub {
  margin-top: 2px;
  font-size: .8rem;
  color: var(--muted);
}
.nutrition-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.nutrition-cell {
  padding: 8px 6px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.nutrition-cell-cal { grid-column: span 2; }
.nutrition-value {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}
.nutrition-label {
  margin-top: 2px;
  font-size: .72rem;
  color: var(--muted);
}
.nutrition-note {
  margin-top: 10px;
  font-size: .74rem;
  color: var(--muted);
}
.nutrition-empty { margin: 12px 0 0; font-size: .85rem; }
@media (max-width: 480px) {
  .nutrition-grid { grid-template-columns: repeat(2, 1fr); }
  .nutrition-cell-cal { grid-column: span 2; }
}

/* Per-comment translate toggle */
.comment-translate {
  margin-top: 6px;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--brand);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.comment-translate:hover { color: var(--brand2); }
.comment-translate:disabled { opacity: .5; cursor: default; }

/* ---------- Allergen filter bar (list pages) ---------- */
.allergen-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 4px 0 20px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.allergen-filter-label {
  font-weight: 700;
  font-size: .9rem;
  margin-right: 2px;
}
.allergen-toggle {
  background: var(--brand-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.allergen-toggle:hover { border-color: var(--brand); }
.allergen-toggle.active {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.allergen-clear {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.allergen-clear:hover { color: var(--brand); }

/* Allergen chips on recipe cards */
.card-allergens {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 4px;
}
.card-allergen-chip {
  background: #fdecec;
  color: #b91c1c;
  border: 1px solid #f3c0c0;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
body.dark .card-allergen-chip { background: #2c1a1a; color: #fca5a5; border-color: #7f3838; }

/* ---------- Healthy quick search ---------- */
.quick-search { margin: 4px 0 14px; }
.quick-search-row { display: flex; gap: 8px; }
.quick-search-input {
  flex: 1;
  padding: 11px 14px;
  font-size: .95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.quick-search-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Same shape as the allergen bar, but green — this one INCLUDES rather
   than hides, so it must not read as a warning. */
.diet-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 20px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}
.diet-filter-label { font-weight: 700; font-size: .9rem; margin-right: 2px; }
.diet-toggle {
  background: #eef7ee;
  color: #256029;
  border: 1px solid #cfe6cf;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 12px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.diet-toggle:hover { border-color: #3f9142; }
.diet-toggle.active { background: #2f7d32; color: #fff; border-color: #2f7d32; }
body.dark .diet-toggle { background: #17301a; color: #a7d8a9; border-color: #2f5c33; }
body.dark .diet-toggle.active { background: #3f9142; color: #fff; border-color: #3f9142; }

/* Healthy chips on recipe cards */
.card-diets { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }
.card-diet-chip {
  background: #eef7ee;
  color: #256029;
  border: 1px solid #cfe6cf;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
body.dark .card-diet-chip { background: #17301a; color: #a7d8a9; border-color: #2f5c33; }

/* Diet preference checkboxes on the Profile page */
.diet-prefs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.diet-pref {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  padding: 5px 11px;
  border: 1px solid #cfe6cf;
  border-radius: 999px;
  background: #eef7ee;
  color: #256029;
  cursor: pointer;
}
.diet-pref input { margin: 0; accent-color: #2f7d32; width: auto; }
body.dark .diet-pref { background: #17301a; color: #a7d8a9; border-color: #2f5c33; }

/* ---------- Paste importer ---------- */
.paste-panel {
  margin: 4px 0 22px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--brand-soft);
}
.paste-panel h3 { margin: 0 0 4px; font-size: 1rem; }
.paste-panel textarea { min-height: 120px; font-family: inherit; }
.paste-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------- Share row ---------- */
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.share-btn {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .84rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.share-btn:hover { border-color: var(--brand); color: var(--brand); }
.recipe-source { font-size: .85rem; margin: 2px 0 10px; }

/* ---------- Ingredient row builder ---------- */
.ingredient-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.ingredient-row > * { margin-top: 0; }
.ingredient-row .ing-amount        { flex: 0 0 64px;  width: 64px; }
.ingredient-row .ing-measure,
.ingredient-row .ing-measure-other { flex: 0 0 110px; width: 110px; }
.ingredient-row .ing-item,
.ingredient-row .ing-item-other    { flex: 1 1 160px; }
.ingredient-row .ing-remove {
  flex: 0 0 auto;
  width: 40px;
  height: 42px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.ingredient-row .ing-remove:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand);
}

/* ---------- Buttons ---------- */
.btn, .quick-btn {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: .95rem;
  padding: 11px 18px;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}
.btn:hover, .quick-btn:hover { background: var(--brand2); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.quick-btn { width: 100%; margin-top: 10px; text-align: center; }

.btn-secondary {
  background: var(--card);
  color: var(--brand);
  border: 2px solid var(--brand);
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-secondary:hover { background: var(--brand); color: #fff; }

/* ---------- Misc bits reused across pages ---------- */
.muted { color: var(--muted); font-size: 14px; }
.hidden { display: none; }
.preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-top: 12px; display: none; }

#profilePhoto {
  width: 130px; height: 130px; border-radius: 50%;
  object-fit: cover; margin-bottom: 12px;
  border: 4px solid var(--brand);
  box-shadow: 0 4px 14px var(--brand-ring);
}
.stat-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.stat-row:last-child { border-bottom: none; }

/* Tier badge pill */
.tier-badge {
  display: inline-block;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}
.tier-free    { background:#f1e9e2; color:#7c6f68; }
.tier-pro     { background:#ffedd5; color:#c2410c; }
.tier-premium { background:#fef3c7; color:#92400e; }

/* ==================================================
   Landing hero + features + pricing (index.html)
   ================================================== */
.hero {
  position: relative;
  min-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 40px 20px;
  background: linear-gradient(rgba(40,12,28,0.72), rgba(40,12,28,0.82)), url('banner.jpg') center/cover no-repeat;
}
.hero-inner { max-width: 720px; }
.pill {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #ffe3f0;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 20px;
  backdrop-filter: blur(4px);
}
.hero h1 {
  color: #fff;
  font-size: clamp(2.4rem, 6vw, 4rem);
  margin: 0 0 18px;
}
.hero p { font-size: 1.15rem; color: #f4e7dd; margin: 0 0 28px; }
.hero .btn { padding: 14px 30px; font-size: 1.05rem; }

.section { width: 92%; max-width: 1100px; margin: 70px auto; }
.section-title { text-align: center; font-size: 2rem; margin-bottom: 8px; }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 40px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 22px; }
.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform .18s, box-shadow .18s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature .ico { font-size: 1.8rem; }
.feature h3 { margin: 12px 0 8px; }
.feature p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Pricing (dark band) */
.pricing-band { background: #1e1008; padding: 70px 0; margin-top: 70px; }
.pricing-band .section-title, .pricing-band .section-sub { color: #fff; }
.pricing-band .section-sub { color: #d8c7bb; }
.pricing {
  width: 92%; max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px,1fr)); gap: 22px;
}
.price-card {
  background: #2a1a10;
  border: 1px solid #3d2717;
  border-radius: var(--radius);
  padding: 28px;
  color: #f4e7dd;
  text-align: center;
}
.price-card.featured { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.price-card h3 { color: #fff; margin: 0 0 6px; }
.price-card .price { font-size: 2.2rem; font-weight: 800; color: var(--brand2); font-family:'Playfair Display',serif; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0; text-align: left; }
.price-card li { padding: 6px 0; border-bottom: 1px solid #3d2717; font-size: .92rem; }
.price-card li::before { content: "✓ "; color: var(--brand2); font-weight: 700; }

/* ==================================================
   Home banner + CTA row (index.html) — banner stays clean
   ================================================== */
/* The banner art is only 1281px wide, so it must never be stretched past that
   or it goes soft. Instead the <picture> becomes a full-width band filled with
   the artwork's own edge colour (#191333 — every edge of banner-source.png
   averages within 2% of it), so the seam is invisible and the banner reads
   edge-to-edge on desktop without upscaling a single pixel. */
.home-banner-pic {
  display: block;
  width: 100%;
  background: #191333;
}
.home-banner {
  display: block;
  width: 100%;
  max-width: 2560px;   /* native asset width — do not exceed */
  margin: 0 auto;
  height: auto;
}
.home-cta {
  width: 92%;
  max-width: 1100px;
  margin: 16px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.home-cta-left { display: flex; align-items: center; gap: 10px; }
.lang-label { font-weight: 600; color: var(--muted); font-size: .95rem; }
.home-cta-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cta-buttons { display: flex; gap: 12px; }
.remember { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; color: var(--muted); cursor: pointer; }
.remember input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

/* Footer */
.site-footer { text-align: center; padding: 46px 20px 60px; color: var(--muted); }
.footer-logo { width: 110px; height: auto; border-radius: 14px; margin-bottom: 12px; }
.site-footer p { margin: 6px 0; font-size: .9rem; }
.foot-links a { color: var(--brand); text-decoration: none; font-weight: 600; }
.foot-links a:hover { text-decoration: underline; }
/* Fine print. On phones it wraps to a couple of balanced lines; from the tablet
   breakpoint up there is room for the whole sentence on one line across the bottom.
   (The old 640px cap forced it to wrap at every width.) */
.site-footer p.foot-fine { margin: 12px auto 0; max-width: 52ch; font-size: .78rem; opacity: .8; text-wrap: balance; }
@media (min-width: 721px) {
  .site-footer p.foot-fine { max-width: none; font-size: .8rem; white-space: nowrap; }
}

/* ==================================================
   Dashboard welcome bar (user.html)
   ================================================== */
.welcome-bar {
  background: linear-gradient(120deg, var(--brand), var(--brand2));
  color: #fff;
  border-radius: var(--radius);
  padding: 28px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}
.welcome-bar h2 { color: #fff; margin: 0 0 6px; }
.welcome-bar .btn { background: #fff; color: var(--brand); }
.welcome-bar .btn:hover { background: var(--brand-soft); }

/* ==================================================
   Toasts (toast.js)
   ================================================== */
#toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 220px;
  max-width: 340px;
  box-shadow: var(--shadow);
  font-size: .92rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: #16a34a; }
.toast.error   { border-left-color: #dc2626; }
.toast.info    { border-left-color: var(--brand); }

/* ---------- Modal (upgrade plan) ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,12,6,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: 16px;
  max-width: 860px;
  width: 100%;
  padding: 30px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow: auto;
}
.modal-close {
  float: right; border: none; background: none;
  font-size: 1.5rem; cursor: pointer; color: var(--muted); line-height: 1;
}

/* ---------- PayPal checkout panel ---------- */
.pay-panel { max-width: 460px; margin: 10px auto 0; text-align: center; }
.pay-panel h3 { margin: 14px 0 4px; font-family: 'Playfair Display', serif; }
.pay-back { float: left; padding: 6px 12px; font-size: .85rem; }
.pay-pick {
  font-size: .9rem; margin: 16px 0 0;
  background: var(--brand-soft); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.pay-warn {
  font-size: .85rem; line-height: 1.55; text-align: left;
  background: #fff8e6; border: 1px solid #f0d089; color: #6b4c05;
  border-radius: 10px; padding: 12px 14px; margin: 16px 0 18px;
}
.paypal-mount { margin: 22px 0 6px; min-height: 60px; }
.pay-note {
  font-size: .82rem; color: var(--muted); line-height: 1.5;
  border-top: 1px solid var(--border); padding-top: 14px; margin-top: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .layout { flex-direction: column; }

  /* Nav wraps instead of overflowing off-screen */
  .nav-content, .nav-inner { flex-wrap: wrap; justify-content: center; gap: 8px 16px; row-gap: 6px; }
  .nav-links { gap: 12px; font-size: .9rem; flex-wrap: wrap; justify-content: center; }
  .brand { font-size: 1.1rem; }

  .container { width: 92%; margin: 24px auto; }

  /* Home: banner is edge-to-edge via its band, controls stack and go full-width */
  .home-cta { flex-direction: column; align-items: stretch; gap: 14px; }
  .home-cta-left { justify-content: center; }
  .home-cta-right { align-items: stretch; }
  .cta-buttons { flex-direction: column; }
  .cta-buttons .btn, .cta-buttons .btn-secondary { width: 100%; text-align: center; }
  .remember { justify-content: center; }
  .lang-select { flex: 1; }

  /* Dashboard header stacks */
  .welcome-bar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 20px; }
  .welcome-bar .btn { width: 100%; }

  /* Grids collapse to one column with comfortable spacing */
  .features, .pricing { grid-template-columns: 1fr; }
  .section, .pricing { width: 92%; }
  .section { margin: 40px auto; }

  .modal { width: 94%; padding: 20px; }
}

/* Extra squeeze for small phones */
@media (max-width: 400px) {
  .brand::before { width: 40px; height: 40px; }
  .btn, .btn-secondary { padding: 12px 18px; }
}

/* ---------- Tablet / small laptop: smoother mid-range ---------- */
@media (min-width: 721px) and (max-width: 1024px) {
  .container, .layout, .section, .pricing,
  .nav-content, .nav-inner, .home-cta { width: 94%; }
  .layout { gap: 20px; }
  /* keep cards from getting too narrow before the phone breakpoint */
  .feed, .grid, .features,
  .pricing { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

/* ---------- Large desktops: use the extra width instead of a narrow column ---------- */
@media (min-width: 1400px) {
  .nav-content, .nav-inner,
  .layout, .section,
  .home-cta { max-width: 1280px; }
  .container, .pricing { max-width: 1180px; }
  .hero-inner { max-width: 820px; }
}

/* ---------- Ultra-wide / 4K: scale up once more, but keep text readable ---------- */
@media (min-width: 1800px) {
  .nav-content, .nav-inner,
  .layout, .section,
  .home-cta { max-width: 1440px; }
  .container, .pricing { max-width: 1320px; }
}

/* ==================================================
   Page-specific components (recipe-view / community)
   ================================================== */

/* recipe-view.html */
.card .section-title { font-size: 1.15rem; text-align: left; color: var(--brand); margin: 18px 0 6px; }
.recipe-photo { width: 100%; max-height: 360px; object-fit: cover; border-radius: 10px; margin: 16px 0; }
.communityTag {
  display: inline-block; margin: 4px 0 10px; padding: 4px 12px;
  background: var(--brand); color: #fff; border-radius: 999px; font-size: 13px;
}
#commentInput {
  width: 100%; min-height: 80px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); box-sizing: border-box; font-size: 14px;
  margin-bottom: 8px; font-family: inherit; background: var(--card); color: var(--text);
}
.comment {
  background: var(--brand-soft); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.comment-header { display: flex; align-items: center; margin-bottom: 4px; }
.comment-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: var(--border); margin-right: 10px; flex-shrink: 0;
}
.comment-meta { display: flex; flex-direction: column; }
.comment-author { font-weight: 600; font-size: 14px; color: var(--text); }
.comment-time { font-size: 12px; color: var(--muted); }
.comment-text { font-size: 14px; margin-top: 4px; white-space: pre-wrap; word-wrap: break-word; }
.like-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
#likeBtn.liked { background: var(--brand2); transform: scale(1.06); }

/* community-view.html + community-recipe.html */
.code-pill {
  display: inline-block; padding: 5px 12px; background: var(--brand-soft);
  border: 1px solid var(--border); border-radius: 999px; font-size: 13px; margin-top: 8px;
}
.recipe-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow-sm); text-align: center;
  cursor: pointer; transition: transform .18s, box-shadow .18s;
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.recipe-card img { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.recipe-card h3 { margin: 8px 0 4px; color: var(--brand); }
.recipe-card p { font-size: 13px; color: var(--muted); min-height: 20px; }
.btn-main {
  background: var(--brand); color: #fff; border: none; padding: 11px 18px;
  border-radius: 10px; font-weight: 600; cursor: pointer; margin-bottom: 20px;
}
.btn-main:hover { background: var(--brand2); }

/* ---------- Recipe photo prompt ----------
   Shown on your own recipe when it has no picture, because the upload
   control lives on the edit form and nothing used to point at it. */
.photo-prompt {
  margin: 10px 0 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px dashed #cbd5e0;
  border-radius: 10px;
  color: #5b7288;
  font-size: 0.92rem;
  line-height: 1.5;
}
.photo-prompt a { color: #4aa3d4; font-weight: 600; }
body.dark .photo-prompt { background: #241d3f; border-color: #43395f; color: #c3b9dd; }

/* ---------- How-To page ---------- */
.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.help-toc a {
  text-decoration: none;
  font-size: .88rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--brand-soft);
  color: var(--brand);
}
.help-toc a:hover { background: var(--brand); color: #fff; }

.help-section { margin-top: 22px; scroll-margin-top: 90px; }
.help-section h3 {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 1.28rem;
}
.help-section p { margin: 10px 0; }

.help-steps, .help-list { margin: 10px 0 10px 4px; padding-left: 22px; }
.help-steps li, .help-list li { margin-bottom: 9px; }

.help-note {
  font-size: .9rem;
  color: var(--muted);
  border-left: 3px solid var(--border);
  padding-left: 12px;
}

.help-callout {
  margin: 14px 0;
  padding: 13px 15px;
  border-radius: 10px;
  background: var(--brand-soft);
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand);
  font-size: .94rem;
  line-height: 1.55;
}

.help-q {
  font-weight: 700;
  margin: 20px 0 4px !important;
  color: var(--text);
}
.help-q:first-of-type { margin-top: 6px !important; }

kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .82em;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--bg);
}

/* Plan comparison grid */
.help-table {
  margin: 14px 0 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  font-size: .9rem;
}
.help-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.help-row:last-child { border-bottom: 0; }
.help-row span + span { text-align: center; }
.help-row-head { background: var(--brand-soft); font-weight: 700; color: var(--brand); }

/* The How To link earns a nudge — it's the answer to most support mail. */
.nav-links a.nav-howto { color: var(--brand); }

@media (max-width: 560px) {
  .help-row { grid-template-columns: 1.6fr 1fr 1fr 1fr; font-size: .82rem; padding: 8px; }
  .nav-links { flex-wrap: wrap; gap: 12px; }
}
