/* ── Reset & tokens ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paper tones */
  --paper:        #fdf6e3;
  --paper-light:  #fffdf5;
  --paper-dark:   #f5e8cc;
  --ruled:        rgba(160,110,60,.1);

  /* Ink & text */
  --ink:          #1c0a00;
  --text:         #2d1a08;
  --muted:        #7a5a3a;

  /* Accents */
  --leather:      #1a0a02;
  --gold:         #c4882a;
  --gold-light:   #f0d070;
  --burgundy:     #6b2435;
  --burgundy-dark:#4f1927;
  --tan:          #c8a878;
  --tan-light:    #e8d5b0;

  /* Feedback */
  --green:        #2d5a3d;
  --red:          #8b2020;

  /* Misc */
  --radius:       3px;
  --radius-card:  2px;
  --shadow-warm:  2px 4px 18px rgba(50,20,0,.13);
  --shadow-lift:  3px 8px 28px rgba(50,20,0,.18);

  --font-serif:    'Playfair Display', Georgia, serif;
  --font-sans:     'Inter', system-ui, sans-serif;
  --font-script:   'Caveat', cursive;
}

/* ── Body — aged paper with faint stains ─────────────────────── */
body {
  font-family: var(--font-sans);
  background-color: var(--paper);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

/* Stain overlay — fixed so it stays put as page scrolls */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    /* Coffee ring, upper right */
    radial-gradient(ellipse 74px 68px at 84% 13%, transparent 57%, rgba(148,96,36,.07) 62%, transparent 69%),
    radial-gradient(ellipse 70px 64px at 85% 14%, rgba(148,96,36,.025) 56%, transparent 63%),
    /* Cooking splatter cluster, left-center */
    radial-gradient(circle 5px  at  6%   44%,  rgba(120,68,18,.08) 100%, transparent 100%),
    radial-gradient(circle 3px  at  7.8% 45.5%,rgba(120,68,18,.06) 100%, transparent 100%),
    radial-gradient(circle 2px  at  5.4% 42.8%,rgba(120,68,18,.05) 100%, transparent 100%),
    radial-gradient(circle 1.5px at 8.2% 43.2%,rgba(120,68,18,.05) 100%, transparent 100%),
    /* Faint grease stain, lower left */
    radial-gradient(ellipse 88px 38px at 14% 83%, rgba(160,108,52,.045) 100%, transparent 100%),
    /* Second coffee ring, lower center-right */
    radial-gradient(ellipse 58px 52px at 71% 79%, transparent 54%, rgba(148,96,36,.055) 59%, transparent 67%),
    radial-gradient(ellipse 55px 49px at 72% 80%, rgba(148,96,36,.02)  53%, transparent 60%),
    /* Cooking splash, right side */
    radial-gradient(circle 7px  at 91%  57%,  rgba(160,98,28,.05)  100%, transparent 100%),
    radial-gradient(circle 3px  at 93%  59.5%,rgba(160,98,28,.04)  100%, transparent 100%),
    radial-gradient(circle 2px  at 89.5% 60.8%,rgba(160,98,28,.04) 100%, transparent 100%);
}

/* ── Nav — leather book binding ──────────────────────────────── */
.nav {
  background:
    linear-gradient(180deg, #22080066 0%, transparent 100%),
    var(--leather);
  border-bottom: 3px solid var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 3px 16px rgba(0,0,0,.45);
}

.nav-brand {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.55rem;
  font-weight: 600;
  color: var(--gold-light);
  text-decoration: none;
  letter-spacing: .04em;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  position: relative;
}
/* Subtle coffee-ring stain — nod to the site name */
.nav-brand::after {
  content: '';
  position: absolute;
  width: 52px;
  height: 52px;
  right: -22px;
  top: -14px;
  border-radius: 50%;
  border: 2px solid rgba(196,136,42,.18);
  pointer-events: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: #d4b888;
  text-decoration: none;
  font-size: 1rem;
  letter-spacing: .02em;
  transition: color .15s;
}
.nav-links a:hover { color: var(--gold-light); }

.notif-link { position: relative; }

.badge {
  background: var(--burgundy);
  color: #f8e8d0;
  font-size: .62rem;
  padding: .1em .45em;
  border-radius: 999px;
  margin-left: .2rem;
  font-weight: 700;
  vertical-align: middle;
}

.lang-form { display: inline; }
.btn-link {
  background: none;
  border: none;
  cursor: pointer;
  color: #d4b888;
  font-size: 1rem;
  padding: 0;
  font-family: inherit;
  letter-spacing: .02em;
  transition: color .15s;
}
.btn-link:hover { color: var(--gold-light); }
.lang-btn { opacity: .7; }
.lang-btn:hover { opacity: 1; }

.inline { display: inline; }

/* ── Container ───────────────────────────────────────────────── */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.25rem 1.5rem;
}

/* ── Card — parchment page ───────────────────────────────────── */
.card {
  background: var(--paper-light);
  border: 1px solid var(--tan);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-warm);
  position: relative;
}
/* Inner highlight gives parchment depth */
.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 -1px 0 rgba(0,0,0,.04);
  pointer-events: none;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: .5rem 1.2rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--tan);
  background: var(--paper-dark);
  color: var(--text);
  letter-spacing: .02em;
  transition: background .15s, border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.btn:hover {
  background: var(--tan-light);
  border-color: var(--tan);
  box-shadow: 0 2px 6px rgba(50,20,0,.1);
}

.btn-primary {
  background: var(--burgundy);
  border-color: var(--burgundy-dark);
  color: #f8e8d0;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.btn-primary:hover {
  background: var(--burgundy-dark);
  border-color: #3a1020;
  box-shadow: 0 2px 8px rgba(80,0,20,.25);
}

.btn-danger {
  background: var(--red);
  border-color: #6b1010;
  color: #ffe8e8;
}
.btn-danger:hover { background: #6b1010; }

.btn-ghost {
  background: transparent;
  border-color: var(--tan);
  color: var(--muted);
}
.btn-ghost:hover { background: var(--paper-dark); color: var(--text); }

.btn-full  { width: 100%; text-align: center; display: block; }
.btn-sm    { padding: .22rem .65rem; font-size: .78rem; }

.btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--tan);
  font-size: 1rem;
  padding: .25rem .5rem;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
}
.btn-remove:hover { color: var(--red); background: #f8eded; }

.btn-warn {
  background: #fff3cd;
  border-color: #c9952a;
  color: #6b4400;
}
.btn-warn:hover { background: #fce0a0; }

/* ── Inputs ──────────────────────────────────────────────────── */
.input {
  display: block;
  width: 100%;
  padding: .5rem .8rem;
  border: 1px solid var(--tan);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: inherit;
  background: var(--paper-light);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(196,136,42,.15);
  background: #fffef8;
}
.textarea { resize: vertical; min-height: 80px; }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label {
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.form-stacked { display: flex; flex-direction: column; gap: 1rem; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-grid-2 .full-width { grid-column: 1 / -1; }

.form-card { margin-top: 1.25rem; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  cursor: pointer;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: .75rem;
}
.form-row .input { flex: 1; min-width: 150px; }

.divider-text {
  text-align: center;
  color: var(--muted);
  font-family: var(--font-script);
  font-size: 1.2rem;
  margin: .75rem 0 0;
}

.field-hint {
  font-size: .93rem;
  color: var(--muted);
  margin-top: .2rem;
  display: block;
  font-style: italic;
}

/* ── Alert ───────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem .75rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 1rem;
  border-left-width: 4px;
  border-left-style: solid;
}
.alert-error   { background: #f8edec; border-color: var(--red);  color: var(--red);   border: 1px solid #d4a09a; border-left: 4px solid var(--red); }
.alert-success { background: #edf5f0; border-color: var(--green); color: var(--green); border: 1px solid #a0c4b0; border-left: 4px solid var(--green); }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
}
.page-header h1, .page-header h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-style: italic;
  color: var(--ink);
}

/* ── Search / filter bar ─────────────────────────────────────── */
.search-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.75rem;
  background: var(--paper-light);
  border: 1px solid var(--tan-light);
  border-radius: var(--radius);
  padding: .75rem;
}
.search-bar .input { flex: 1; min-width: 160px; }

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

/* Index-card aesthetic */
.recipe-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: var(--paper-light);
  border: 1px solid var(--tan);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-warm);
  transition: box-shadow .2s, transform .2s;
  overflow: hidden;
  position: relative;
}
/* Top ruled stripe like an index card */
.recipe-card::before {
  content: '';
  display: block;
  height: 6px;
  background: var(--burgundy);
  flex-shrink: 0;
}
.recipe-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-3px) rotate(.4deg);
}

.recipe-card-body { padding: 1.1rem 1.25rem 1.25rem; flex: 1; }

.recipe-card-meta {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .5rem;
}

.recipe-card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: .15rem;
  color: var(--ink);
  line-height: 1.3;
}

.recipe-card-author {
  font-family: var(--font-script);
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: .35rem;
}

.recipe-card-desc { font-size: 1rem; color: var(--muted); line-height: 1.5; }

/* ── Tags — vintage rubber-stamp look ────────────────────────── */
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.tag {
  background: transparent;
  color: var(--muted);
  font-family: var(--font-script);
  font-size: 1.05rem;
  padding: .1rem .55rem;
  border-radius: 2px;
  border: 1px solid var(--tan);
  text-decoration: none;
  transition: background .15s, color .15s;
  letter-spacing: .01em;
}
a.tag:hover { background: var(--paper-dark); color: var(--text); }

.recipe-lang {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--paper-dark);
  border: 1px solid var(--tan);
  padding: .1rem .4rem;
  border-radius: 2px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.badge-private {
  font-size: .68rem;
  background: #fef8e7;
  border: 1px solid #d4a830;
  color: #7a5000;
  padding: .1rem .4rem;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.lang-tag {
  font-size: .75rem;
  color: var(--muted);
  font-style: italic;
}

/* ── Recipe show — cookbook page ─────────────────────────────── */
.recipe-show { max-width: 840px; margin: 0 auto; }

.variant-banner {
  background: var(--paper-dark);
  border: 1px solid var(--tan);
  border-radius: var(--radius-card);
  padding: .55rem 1rem;
  font-size: 1.03rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-style: italic;
  color: var(--muted);
}
.variant-banner a { color: var(--burgundy); font-weight: 600; font-style: normal; text-decoration: none; }
.variant-banner a:hover { text-decoration: underline; }

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--tan-light);
  position: relative;
}
/* Decorative stain ring on recipe title area */
.recipe-header::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 80px;
  right: 80px;
  top: -10px;
  border-radius: 50%;
  border: 2.5px solid rgba(196,136,42,.1);
  pointer-events: none;
}

.recipe-header h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.4rem;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: .3rem;
}

.recipe-byline {
  font-family: var(--font-script);
  font-size: 1.3rem;
  color: var(--muted);
  margin-bottom: .5rem;
}
.recipe-byline a { color: var(--burgundy); text-decoration: none; }
.recipe-byline a:hover { text-decoration: underline; }

.recipe-description {
  color: var(--text);
  font-size: 1.1rem;
  font-style: italic;
  margin-top: .4rem;
}

.recipe-actions { display: flex; gap: .5rem; flex-shrink: 0; padding-top: .25rem; }

/* Parchment banner for meta info */
.recipe-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  color: var(--muted);
  margin-bottom: 1rem;
  padding: .8rem 1.25rem;
  background: var(--paper-dark);
  border-radius: var(--radius-card);
  border: 1px solid var(--tan-light);
  font-family: var(--font-script);
  font-size: 1.2rem;
}

/* Two-column cookbook layout */
.recipe-body {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 2.5rem;
  margin-top: 1.75rem;
}

.ingredients-section,
.steps-section {
  position: relative;
}

.ingredients-section h2,
.steps-section h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: var(--ink);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--tan);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.ingredients-section h2::after,
.steps-section h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--tan), transparent);
}

.ingredient-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.ingredient-list li {
  display: flex;
  gap: .3rem;
  align-items: baseline;
  font-size: 1.05rem;
  padding: .35rem 0;
  border-bottom: 1px dotted var(--tan-light);
}
.ingredient-list li:last-child { border-bottom: none; }
.amount { font-weight: 700; color: var(--ink); font-family: var(--font-serif); }
.unit   { color: var(--muted); font-size: .83rem; font-style: italic; }
.ing-name { color: var(--text); }
.ing-notes { color: var(--muted); font-style: italic; font-size: .8rem; margin-left: .1rem; }

.step-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  counter-reset: steps;
}
.step-list li {
  font-size: .92rem;
  line-height: 1.7;
  padding-left: 2.8rem;
  position: relative;
  counter-increment: steps;
}
.step-list li::before {
  content: counter(steps);
  position: absolute;
  left: 0;
  top: .05rem;
  width: 1.8rem;
  height: 1.8rem;
  background: var(--burgundy);
  color: #f8e8d0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(80,0,20,.25);
}

.translate-link { margin-top: 1.75rem; }

/* ── Suggestions ─────────────────────────────────────────────── */
.suggestions-section { margin-top: 2.5rem; }
.suggestions-section h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  margin-bottom: 1.1rem;
  color: var(--ink);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--tan);
}

.suggestion-card {
  background: var(--paper-dark);
  border: 1px solid var(--tan-light);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  border-left: 3px solid var(--tan);
}
.suggestion-card h3 { font-family: var(--font-serif); font-size: 1.2rem; margin-bottom: .35rem; }
.suggestion-meta {
  font-family: var(--font-script);
  font-size: 1.1rem;
  color: var(--muted);
  margin-top: .5rem;
}

.suggest-form {
  margin-top: 1rem;
  background: var(--paper-dark);
  border: 1px solid var(--tan-light);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
}
.suggest-form summary { cursor: pointer; font-weight: 600; color: var(--burgundy); font-family: var(--font-serif); font-style: italic; }
.suggest-form form { margin-top: .75rem; display: flex; flex-direction: column; gap: .75rem; }

/* ── Ingredient/step rows (form) ─────────────────────────────── */
.ingredient-row {
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: .5rem;
}
.ingredient-row .ing-name   { flex: 3; }
.ingredient-row .ing-amount { flex: 1.2; }
.ingredient-row .ing-unit   { flex: 1.2; }
.ingredient-row .ing-notes  { flex: 2; }

.step-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: .5rem;
}
.step-num {
  min-width: 1.7rem;
  height: 1.7rem;
  background: var(--burgundy);
  color: #f8e8d0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: .82rem;
  font-weight: 700;
  margin-top: .35rem;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(80,0,20,.2);
}

/* Decorative ruled divider for section headings */
.section-heading {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  margin: 1.75rem 0 .85rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: .7rem;
}
.section-heading::before,
.section-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--tan));
}
.section-heading::before {
  background: linear-gradient(to left, transparent, var(--tan));
}

/* ── Upload section ──────────────────────────────────────────── */
.upload-section { margin-bottom: 1.5rem; }
.upload-section h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  margin-bottom: .85rem;
  color: var(--ink);
}

/* ── Auth pages — membership card feel ───────────────────────── */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 3.5rem;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  border-top: 5px solid var(--burgundy);
}
.auth-card h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: 1.5rem;
  color: var(--ink);
}
.auth-switch {
  text-align: center;
  margin-top: 1.1rem;
  font-size: 1.05rem;
  color: var(--muted);
  font-style: italic;
}
.auth-switch a { color: var(--burgundy); text-decoration: none; font-style: normal; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Profile page ────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--tan-light);
  padding-bottom: 1.5rem;
}
.profile-avatar {
  width: 68px;
  height: 68px;
  background: var(--burgundy);
  color: #f8e8d0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(80,0,20,.25);
}
.profile-header h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.6rem;
  color: var(--ink);
}
.profile-meta {
  font-family: var(--font-script);
  font-size: 1.15rem;
  color: var(--muted);
  margin-top: .2rem;
}

.profile-edit-section { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
.edit-panel { padding: 1rem 1.25rem; }
.edit-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--burgundy);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2rem;
}

/* ── Notifications ───────────────────────────────────────────── */
.notifications-page h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: 1.35rem;
  color: var(--ink);
}
.notifications-list { display: flex; flex-direction: column; gap: .75rem; }
.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
}
.notification-item.unread {
  border-left: 4px solid var(--burgundy);
  background: #fdf5ee;
}
.notification-body { flex: 1; }
.notification-body p { font-size: 1.05rem; margin-bottom: .35rem; }
.notification-date {
  font-family: var(--font-script);
  font-size: 1.1rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Translate pages ─────────────────────────────────────────── */
.translate-page { max-width: 520px; }
.translate-page h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.6rem;
  margin-bottom: 1.35rem;
  color: var(--ink);
}

.translate-preview-page h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: 1.35rem;
  color: var(--ink);
}
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.preview-col h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  margin-bottom: .75rem;
  color: var(--ink);
}
.preview-col h3 { font-size: .9rem; font-weight: 600; margin: .75rem 0 .4rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-family: var(--font-sans); font-style: normal; }
.preview-col-new { border: 2px solid var(--burgundy); }
.preview-actions { display: flex; gap: .75rem; align-items: center; margin-top: .5rem; }

/* ── Error page ──────────────────────────────────────────────── */
.error-page {
  display: flex;
  justify-content: center;
  padding-top: 5rem;
}
.error-card {
  text-align: center;
  max-width: 440px;
  width: 100%;
  border-top: 5px solid var(--burgundy);
}
.error-card h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: .5rem;
  color: var(--ink);
}
.error-message { color: var(--muted); margin-bottom: 1.35rem; font-style: italic; }

/* ── Misc ────────────────────────────────────────────────────── */
.empty { color: var(--muted); font-style: italic; font-family: var(--font-script); font-size: 1.2rem; }

/* ── Admin panel — ledger/records aesthetic ──────────────────── */
.admin-page h1 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.9rem;
  margin-bottom: 1.35rem;
  color: var(--ink);
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--tan-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  text-align: center;
  padding: 1.35rem 1rem;
  border-top: 3px solid var(--burgundy);
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--burgundy);
  line-height: 1;
}
.stat-label {
  font-size: .75rem;
  color: var(--muted);
  margin-top: .4rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .865rem;
}
.admin-table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 2px solid var(--tan);
  color: var(--muted);
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--paper-dark);
}
.admin-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--tan-light);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--burgundy); text-decoration: none; font-weight: 500; }
.admin-table a:hover { text-decoration: underline; }
.row-banned td { opacity: .55; }

.action-row { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }

.role-badge {
  font-size: .67rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.role-owner  { background: #fef3c7; color: #7a4000; border: 1px solid #d4a030; }
.role-admin  { background: #f0ecfc; color: #4a1a8a; border: 1px solid #b8a0e0; }
.role-member { background: var(--paper-dark); color: var(--muted); border: 1px solid var(--tan); }

.badge-pending {
  font-size: .67rem;
  background: #e8f0fe;
  border: 1px solid #90a8d8;
  color: #1a3a7a;
  padding: .1rem .45rem;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge-banned {
  font-size: .67rem;
  background: #fce8e8;
  border: 1px solid #d49090;
  color: var(--red);
  padding: .1rem .45rem;
  border-radius: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  padding: .75rem 1.75rem;
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
  border-top: 1px solid var(--tan-light);
  margin-top: 2rem;
}

/* ── Home page ───────────────────────────────────────────────── */
.home-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 5rem;
}
.home-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  border-top: 5px solid var(--burgundy);
  padding: 2.5rem 2rem;
}
.home-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 2.4rem;
  color: var(--ink);
  margin-bottom: .6rem;
}
.home-subtitle {
  font-family: var(--font-script);
  font-size: 1.3rem;
  color: var(--muted);
  margin-bottom: 2rem;
}
.home-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
}

/* ── Cover image ──────────────────────────────────────────────── */
.recipe-cover {
  margin: 1rem 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-warm);
}
.recipe-cover-img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

/* Recipe card cover thumbnail */
.recipe-card-cover {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Cover image form preview ─────────────────────────────────── */
.cover-image-preview { margin-bottom: .6rem; }
.cover-thumb {
  max-width: 220px;
  max-height: 150px;
  border-radius: var(--radius-card);
  border: 1px solid var(--tan);
  display: block;
  margin-bottom: .4rem;
  object-fit: cover;
}

/* ── Step photos (form) ───────────────────────────────────────── */
.step-input-col { flex: 1; display: flex; flex-direction: column; gap: .35rem; }
.step-image-input { font-size: .85rem; }
.step-image-thumb {
  max-width: 140px;
  max-height: 100px;
  object-fit: cover;
  border-radius: var(--radius-card);
  border: 1px solid var(--tan);
}

/* ── Step photos (show page) ──────────────────────────────────── */
.step-photo { margin-top: .75rem; }
.step-photo-img {
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-card);
  border: 1px solid var(--tan-light);
  box-shadow: var(--shadow-warm);
}

/* ── Community photos section ─────────────────────────────────── */
.photos-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--tan-light);
}
.photos-section h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  margin-bottom: 1.1rem;
  color: var(--ink);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--tan);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.photo-item {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-warm);
  background: var(--paper-dark);
}
.photo-thumb {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: opacity .15s;
}
.photo-thumb:hover { opacity: .9; }
.photo-credit {
  font-family: var(--font-script);
  font-size: .95rem;
  color: var(--muted);
  padding: .25rem .5rem .1rem;
  text-align: center;
}
.photo-delete-btn {
  position: absolute;
  top: .3rem;
  right: .3rem;
  background: rgba(255,255,255,.85);
  border: none;
  border-radius: 50%;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .7rem;
  color: var(--red);
  transition: background .15s;
}
.photo-delete-btn:hover { background: #fce8e8; }

.photo-upload-form {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .5rem;
  flex-wrap: wrap;
}
.photo-upload-label {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── Comments section ─────────────────────────────────────────── */
.comments-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--tan-light);
}
.comments-section h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.3rem;
  margin-bottom: 1.1rem;
  color: var(--ink);
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--tan);
}

.comments-list { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.25rem; }

.comment-item {
  background: var(--paper-dark);
  border: 1px solid var(--tan-light);
  border-radius: var(--radius-card);
  padding: .9rem 1.1rem;
  border-left: 3px solid var(--tan);
}
.comment-item .comment-edit-form { margin-top: .5rem; }

.comment-meta {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin-bottom: .4rem;
}
.comment-author {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: .95rem;
  color: var(--ink);
}
.comment-author a { color: var(--burgundy); text-decoration: none; }
.comment-author a:hover { text-decoration: underline; }
.comment-date {
  font-family: var(--font-script);
  font-size: 1rem;
  color: var(--muted);
}
.comment-body {
  font-size: .95rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: .4rem;
}
.comment-btn-row {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .4rem;
  align-items: center;
}

.new-comment-form {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* ── Bilingual titles ────────────────────────────────────────── */
.recipe-title-ru {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .15rem;
  margin-bottom: .5rem;
}
.auto-translated-mark {
  font-size: .75em;
  color: var(--gold);
  font-style: normal;
  vertical-align: middle;
  cursor: help;
}
.recipe-card-title-ru {
  font-size: .85rem;
  color: var(--muted);
  font-style: italic;
  margin: .1rem 0 .3rem;
  line-height: 1.3;
}
.page-header-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.recipe-action-links {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

/* ── Shopping list — browse page ─────────────────────────────── */
.recipe-card-wrapper {
  position: relative;
}
.card-select-label {
  position: absolute;
  top: .5rem;
  right: .5rem;
  z-index: 2;
  background: var(--paper);
  border: 1px solid var(--tan);
  border-radius: var(--radius);
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}
.recipe-card-wrapper:hover .card-select-label,
.card-select-label:has(input:checked) {
  opacity: 1;
}
.card-select-cb {
  cursor: pointer;
}
#bulk-add-btn {
  align-self: center;
}

/* ── Shopping list page ──────────────────────────────────────── */
.shopping-page { max-width: 680px; margin: 0 auto; }
.shopping-header-actions { display: flex; gap: .5rem; }

.shopping-list {
  padding: 1.2rem 1.5rem;
}
.shopping-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.shopping-item-label {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  cursor: pointer;
  padding: .35rem .2rem;
  border-radius: var(--radius);
  transition: background .1s;
}
.shopping-item-label:hover { background: var(--paper-dark); }
.shopping-cb { cursor: pointer; accent-color: var(--gold); width: 1.1em; height: 1.1em; flex-shrink: 0; }
.shopping-item-name {
  flex: 1;
  font-size: 1rem;
}
.shopping-item-qty {
  color: var(--muted);
  font-size: .9rem;
  white-space: nowrap;
}
.shopping-item-done .shopping-item-name {
  text-decoration: line-through;
  color: var(--muted);
}
.shopping-items-checked { opacity: .7; }
.shopping-divider {
  border: none;
  border-top: 1px solid var(--tan-light);
  margin: .75rem 0;
}
.shopping-clear-form {
  margin-top: .75rem;
  text-align: right;
}

/* Shopping edit table */
.shopping-edit-table { width: 100%; border-collapse: collapse; }
.shopping-edit-table th {
  text-align: left;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  padding: .4rem .5rem;
  border-bottom: 1px solid var(--tan-light);
}
.shopping-edit-table td { padding: .4rem .5rem; vertical-align: middle; }
.shopping-edit-table tr.row-checked td { opacity: .55; }
.input-sm { padding: .3rem .5rem; font-size: .9rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 680px) {
  .recipe-body    { grid-template-columns: 1fr; }
  .preview-grid   { grid-template-columns: 1fr; }
  .form-grid-2    { grid-template-columns: 1fr; }
  .form-grid-2 .full-width { grid-column: 1; }
  .ingredient-row { flex-wrap: wrap; }
  .ingredient-row .ing-name { flex: 100%; }
  .nav { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .recipe-header h1 { font-size: 1.7rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .shopping-edit-table { font-size: .85rem; }
}
