/* The Family Table — warm vintage cookbook design.
   Owner palette: cream / muted sage / soft brown / subtle gold.
   Member view (body.member-view): same layout, polished berry-and-blush
   palette so members' screens feel distinct and nicer, per Kenzie's choice. */

:root {
  --bg: #f6efe0;            /* cream */
  --surface: #fffaf0;
  --surface-2: #efe4cd;
  --ink: #4a3826;           /* soft brown */
  --ink-soft: #7a6552;
  --accent: #8a9a7b;        /* muted sage */
  --accent-strong: #5f7050;
  --gold: #c9a227;
  --line: #ddd0b4;
  --danger: #a4442f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(74, 56, 38, .10);
  --hero-grad: linear-gradient(135deg, #efe4cd, #f8f2e2);
}

body.member-view {
  --bg: #faf1ec;            /* blush */
  --surface: #ffffff;
  --surface-2: #f7e3dc;
  --ink: #4a2c36;
  --ink-soft: #86616d;
  --accent: #b3546e;        /* raspberry */
  --accent-strong: #93334f;
  --gold: #d99a4e;          /* apricot gold */
  --line: #eed3c8;
  --shadow: 0 4px 16px rgba(147, 51, 79, .12);
  --radius: 18px;
  --hero-grad: linear-gradient(135deg, #f9e2da, #fdf3ee);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px; line-height: 1.45;
}
body.member-view { background-image: radial-gradient(rgba(179,84,110,.07) 1px, transparent 1px); background-size: 22px 22px; }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
#topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--gold);
  padding: 10px 14px 8px;
}
.brand-title { font-size: 24px; font-weight: bold; letter-spacing: .3px; }
.brand-tag { font-size: 12.5px; color: var(--ink-soft); font-style: italic; }
#mainnav { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
#mainnav button {
  border: 0; background: transparent; color: var(--accent-strong);
  padding: 8px 12px; border-radius: 999px; cursor: pointer; font-size: 16px;
}
#mainnav button.active { background: var(--accent); color: #fff; }
.whoami { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; color: var(--ink-soft); }
.member-badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-family: Georgia, serif;
}

main { max-width: 1020px; margin: 0 auto; padding: 16px 14px 60px; }

/* ---------- generic ---------- */
.btn {
  display: inline-block; border: 1px solid var(--accent-strong);
  background: var(--accent); color: #fff; border-radius: 999px;
  padding: 9px 18px; cursor: pointer; font-size: 16px; text-decoration: none;
}
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--accent-strong); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3a2c10; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.gold-edge { border: 2px solid var(--gold); }
h1 { font-size: 28px; margin: 6px 0 10px; }
h2 { font-size: 22px; margin: 18px 0 8px; color: var(--accent-strong); }
h3 { font-size: 18px; margin: 12px 0 6px; }
.muted { color: var(--ink-soft); }
.small-text { font-size: 13.5px; }
label { display: block; font-size: 14px; color: var(--ink-soft); margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: #33261a;
}
textarea { min-height: 84px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.error-box { background: #fbe9e4; border: 1px solid var(--danger); color: var(--danger); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.ok-box { background: #edf3e6; border: 1px solid var(--accent); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px;
  z-index: 50; box-shadow: var(--shadow); max-width: 92vw; text-align: center;
}

/* ---------- hero / stats ---------- */
.hero { background: var(--hero-grad); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; }
.hero h1 { margin-top: 0; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { flex: 1 1 100px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; }
.stat .n { font-size: 26px; font-weight: bold; color: var(--accent-strong); }
.stat .l { font-size: 13px; color: var(--ink-soft); }

/* ---------- section bar (categories) ---------- */
.section-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.section-bar button {
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent-strong);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 15px;
}
.section-bar button.active { background: var(--accent); color: #fff; }
.section-bar button.quick { border-color: var(--gold); color: #8a6d14; background: #fdf6dd; }
.section-bar button.quick.active { background: var(--gold); color: #3a2c10; }

/* ---------- recipe cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.recipe-card { cursor: pointer; padding: 0; overflow: hidden; }
.recipe-card img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--surface-2); }
.recipe-card .pad { padding: 12px 14px; }
.recipe-card h3 { margin: 2px 0 4px; }
.chip { display: inline-block; background: var(--surface-2); border-radius: 999px; padding: 2px 9px; font-size: 12.5px; margin: 2px 3px 2px 0; color: var(--ink-soft); }
.chip.gold { background: #fdf0c8; color: #7c5f10; }
.fav-btn { float: right; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--gold); }

/* ---------- people ---------- */
.person-card { display: flex; gap: 14px; align-items: flex-start; }
.avatar { width: 62px; height: 62px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); background: var(--surface-2); flex: none; }
.avatar-fallback { display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--accent-strong); }
.person-name { font-size: 20px; font-weight: bold; cursor: pointer; }
.person-real { font-size: 14px; font-style: italic; color: var(--ink-soft); cursor: pointer; }
.role-label { color: var(--gold); font-size: 14.5px; margin-left: auto; white-space: nowrap; }
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 14.5px; }

/* ---------- recipe page ---------- */
.recipe-photo-main { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius); }
.thumbs { display: flex; gap: 8px; margin-top: 8px; }
.thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; cursor: pointer; border: 2px solid transparent; }
.thumbs img.active { border-color: var(--gold); }
.owner-note-box { background: #fdf6dd; border: 1.5px solid var(--gold); border-radius: var(--radius); padding: 14px; margin: 14px 0; }
.community-note { border-top: 1px dashed var(--line); padding: 10px 0; }
.stars { color: var(--gold); font-size: 19px; letter-spacing: 2px; }
.stars button { border: 0; background: transparent; cursor: pointer; font-size: 21px; color: #cfc4a6; padding: 0 1px; }
.stars button.on { color: var(--gold); }
.photo-pick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.photo-pick img { width: 74px; height: 74px; object-fit: cover; border-radius: 10px; }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick label { display: inline-flex; gap: 6px; align-items: center; background: var(--surface-2); border-radius: 999px; padding: 6px 12px; margin: 0; color: var(--ink); cursor: pointer; }

/* ---------- occasions ---------- */
.occasion-card h3 { margin-top: 0; }

/* ---------- grocery ---------- */
.grocery-cat { font-weight: bold; color: var(--accent-strong); margin: 14px 0 4px; border-bottom: 1px solid var(--line); }
.g-item { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.g-item.done span { text-decoration: line-through; color: var(--ink-soft); }

/* ---------- auth ---------- */
.auth-wrap { max-width: 460px; margin: 40px auto; }
.auth-wrap .brand-title { font-size: 32px; text-align: center; }
.auth-wrap .brand-tag { text-align: center; margin-bottom: 18px; }
.edition-pick { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; cursor: pointer; background: var(--surface); }
.edition-pick.selected { border-color: var(--accent-strong); background: var(--surface-2); }
.edition-pick .ed-name { font-size: 19px; font-weight: bold; color: var(--accent-strong); }

/* ---------- print ---------- */
#print-area { display: none; }
@media print {
  #topbar, main, .toast { display: none !important; }
  #print-area { display: block; color: #000; background: #fff; font-family: Georgia, serif; padding: 10px; }
  #print-area h1 { font-size: 26px; }
  #print-area h2 { color: #000; border-bottom: 1px solid #999; }
  #print-area .p-recipe { page-break-inside: avoid; margin-bottom: 22px; }
  #print-area img { max-width: 320px; }
}
