/* The Dark Sparrow Eats: a recipe box.
   Recipes are index cards; categories are the file-box tabs you flip between. */

:root {
  --ink: #1d2327;
  --slate: #3e4c59;
  --muted: #5b6670;
  --paper: #fbf6ea;
  --card: #ffffff;
  --line: #e8dcc6;
  --line-soft: #f2e9d8;
  --sage: #aa151b;   /* Spanish flag red (rojo) */
  --sage-deep: #8c1116;
  --saffron: #f1bf00;   /* Spanish flag gold (gualda) */
  --saffron-wash: #fdf1c4;
  --danger: #7d0c10;

  --hue: var(--sage);

  --serif: "Bitter", "Rockwell", "Roboto Slab", Georgia, serif;
  --sans: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;

  --radius: 6px;
  --measure: 70rem;
  --focus: 0 0 0 3px rgba(241, 191, 0, 0.55);
}

.hue-sage  { --hue: #aa151b; }
.hue-slate { --hue: #8a6500; }
.hue-rust  { --hue: #c8102e; }
.hue-ochre { --hue: #9c7200; }
.hue-plum  { --hue: #8c1116; }
.hue-teal  { --hue: #7d5c00; }
.hue-olive { --hue: #b3121f; }
.hue-hidden { --hue: #5b6670; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
code { font-size: 0.9em; background: var(--line-soft); padding: 0.05em 0.35em; border-radius: 3px; }
::selection { background: var(--saffron-wash); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--card); padding: 0.5rem 0.9rem; border-radius: var(--radius);
}
.skip:focus { top: 0.75rem; }

.i { width: 1.05em; height: 1.05em; flex: none; }

/* ---------- Top bar ---------- */

/* Barcelona paving tile (panot de flor), drawn as SVG in img/:
   panot-red.svg  tone-on-tone on the red header
   panot-sand.svg warm sand, for the home page photo and the footer */
.topbar {
  background: var(--sage) url("img/panot-red.svg") 0 0 / 58px 58px;
  border-bottom: 5px solid var(--saffron);
  color: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  min-width: 0;
}

.mark { width: 2.1rem; height: 2.1rem; color: var(--paper); flex: none; }

.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topnav { display: flex; align-items: center; gap: 0.4rem; flex: none; }

.nav-link {
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  color: #f8dfe0;
  font-weight: 500;
}
.nav-link:hover, .nav-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.14); }

.topbar .btn { background: var(--paper); color: var(--ink); box-shadow: none; }
.topbar .btn:hover { background: #fff; }
.topbar .btn[aria-current="page"] { background: var(--saffron-wash); }

/* ---------- Buttons and links ---------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-radius: var(--radius);
  padding: 0.7rem 1.2rem;
  background: var(--sage-deep);
  color: #fff;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease;
}
.btn:hover { background: #6e0d11; }
.btn:disabled { background: #a8948f; cursor: progress; }
.btn svg { width: 1.05rem; height: 1.05rem; }

.btn-small { padding: 0.5rem 0.85rem; font-size: 0.95rem; }

.btn-quiet {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-quiet:hover { background: var(--line-soft); }

.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.2rem 0;
  color: var(--sage-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }
.link-btn[hidden] { display: none; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0 0 1.25rem -0.2rem;
  color: var(--slate);
  font-weight: 600;
  text-decoration: none;
}
.back:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }

/* ---------- Page ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  outline: none;
}

.footer { color: var(--muted); font-size: 0.92rem; }
/* A strip of sidewalk along the bottom of every page. */
.footer::before {
  content: "";
  display: block;
  height: 64px;
  border-top: 4px solid var(--saffron);
  background: url("img/panot-sand.svg") 0 0 / 64px 64px;
}
.footer-inner { max-width: var(--measure); margin: 0 auto; padding: 1.25rem 1.5rem 2rem; }
.footer p { margin: 0; }

.notice, .loading { color: var(--muted); }

/* ---------- Home ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 44rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

.intro-photo { margin: 0; justify-self: end; width: 100%; max-width: 26rem; position: relative; isolation: isolate; }
/* The photo sits on a patch of paving that fades out at the edges. */
.intro-photo::before {
  content: "";
  position: absolute;
  inset: -2.25rem -2.25rem -1.25rem -2.75rem;
  z-index: -1;
  background: url("img/panot-sand.svg") 0 0 / 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 55% 50%, #000 45%, transparent 72%);
  mask-image: radial-gradient(ellipse at 55% 50%, #000 45%, transparent 72%);
  opacity: 0.9;
}
.intro-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
  border-bottom: 5px solid var(--saffron);
  box-shadow: 0 10px 28px rgba(110, 13, 17, 0.18);
  background: var(--saffron-wash);
}
.intro-photo figcaption { margin-top: 0.4rem; font-size: 0.75rem; color: var(--muted); text-align: right; }
.intro-photo figcaption a { color: inherit; }

@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; gap: 1.25rem; }
  .intro-photo { display: none; }
}

.intro-title { font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 700; }

.intro-sub { margin: 0.75rem 0 1.5rem; color: var(--muted); font-size: 1.1rem; max-width: 38rem; }

.search { position: relative; }

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 1.2rem;
  height: 1.2rem;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 0.95rem 1rem 0.95rem 2.9rem;
  border: 1px solid #c9cfc8;
  border-radius: var(--radius);
  background: var(--card);
  font-size: 1.08rem;
  box-shadow: 0 1px 0 rgba(29, 35, 39, 0.04);
}
.search input::placeholder { color: #87908f; }
.search input:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus); }

/* Category tabs: file-box dividers sitting on one shelf line. */
.tabs {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 2px solid var(--ink);
  padding: 0.4rem 0.1rem 0;
  margin-bottom: 1.1rem;
}

.tab {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--line-soft);
  color: var(--slate);
  padding: 0.55rem 0.95rem 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  top: 0;
  transition: background 120ms ease, color 120ms ease;
}
.tab::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--hue);
}
.tab:first-child::before { display: none; }
.tab:hover { background: #fff; color: var(--ink); }
.tab.is-on {
  background: var(--sage);
  border-color: var(--sage);
  color: #fff;
}
.tab.is-on::before { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
.tab:focus-visible { box-shadow: var(--focus); border-radius: 8px 8px 0 0; }

.tab-n {
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tab.is-on .tab-n { color: #f6d27a; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.count { margin: 0; color: var(--muted); }

.sort { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.95rem; }
.sort select, .field select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%233e4c59' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 0.6rem center / 1rem;
  padding: 0.5rem 2.1rem 0.5rem 0.75rem;
  color: var(--ink);
}
.sort select:focus, .field select:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus); }

/* Recipe cards: an index card with its category tab on top. */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: 2.1rem 1.25rem;
}

.cards > li { display: flex; min-width: 0; }

.card {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-top: 1.55rem;
  text-decoration: none;
}

.card-tab {
  display: inline-block;
  max-width: 85%;
  padding: 0.22rem 0.7rem 0.18rem;
  border-radius: 6px 6px 0 0;
  background: var(--hue);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .card-tab { position: absolute; top: 0; left: 0.9rem; }

.card-face {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--hue);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  padding: 1.05rem 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(29, 35, 39, 0.05);
  transition: box-shadow 140ms ease, transform 140ms ease;
}

.card:hover .card-face {
  box-shadow: 0 8px 22px rgba(29, 35, 39, 0.1);
  transform: translateY(-2px);
}
.card:focus-visible { box-shadow: none; }
.card:focus-visible .card-face { box-shadow: var(--focus); }

.card-photo {
  margin: -1.05rem -1.1rem 0.3rem;
  aspect-ratio: 16 / 10;
  background: var(--line-soft);
  overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }

.card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32rem;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.card-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line-soft);
}
.card-facts:empty { display: none; }

.fact { display: inline-flex; align-items: center; gap: 0.35rem; }

.top-mark {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--saffron-wash);
  color: #7a5200;
  font-size: 0.8rem;
  font-weight: 600;
}
.top-mark span { color: var(--saffron); }

/* Hidden recipes (only the site owner sees them) */
.card.is-hidden .card-face { opacity: 0.72; }
.card.is-hidden .card-photo img { filter: grayscale(0.7); }
.hidden-note {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 1rem 0 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--muted);
  border-radius: var(--radius);
  background: #f3efe8;
  color: var(--slate);
  font-size: 0.95rem;
}
.hidden-note .i { flex: 0 0 auto; margin-top: 0.15rem; }
.visibility-msg { margin: 0.6rem 0 0; color: var(--slate); font-size: 0.92rem; }
.visibility-msg[hidden] { display: none; }
.recipe-actions { flex-wrap: wrap; }

.card-rating { display: flex; align-items: center; gap: 0.35rem; font-size: 0.92rem; }
.card-rating[hidden] { display: none; }

.empty {
  max-width: 34rem;
  padding: 2.5rem 0;
}
.empty h2 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.empty p { margin: 0 0 1.25rem; color: var(--muted); }

/* ---------- Recipe page ---------- */

.recipe-head { max-width: 50rem; }

.recipe-cat { margin: 0 0 0.6rem; }
.recipe-cat .card-tab { border-radius: 6px; }

.recipe-title {
  font-size: clamp(2.1rem, 5vw, 3.3rem);
  font-weight: 700;
  outline: none;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.9rem 0 0;
}
.tags li {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  font-size: 0.88rem;
  color: var(--slate);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-box {
  padding: 0.75rem 1.5rem 0.8rem 0;
  margin-right: 1.5rem;
  border-right: 1px solid var(--line);
}
.fact-box:last-child { border-right: 0; margin-right: 0; }
.fact-box dt { color: var(--muted); font-size: 0.85rem; }
.fact-box dd { margin: 0.1rem 0 0; font-weight: 600; font-size: 1.05rem; }
.fact-box .card-rating { text-decoration: none; font-weight: 500; }
.fact-box a.card-rating:hover { text-decoration: underline; }

.recipe-actions { margin-top: 1rem; display: flex; gap: 0.5rem; }
.recipe-actions .btn { text-decoration: none; }

.owner-edit { margin: 2rem 0 0; color: var(--muted); font-size: 0.9rem; }
.owner-edit a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }
.owner-edit a:hover { color: var(--ink); }

.recipe-form.is-edit { margin-top: 1.5rem; }
.form-foot .link-btn { margin-left: 0.75rem; text-decoration: underline; }

.photo { margin: 1.75rem 0 0; }
.photo img { width: 100%; max-height: 30rem; object-fit: cover; border-radius: var(--radius); }

.recipe-body {
  display: grid;
  grid-template-columns: minmax(16rem, 0.85fr) minmax(0, 1.6fr);
  gap: 2.5rem;
  margin-top: 2.25rem;
  align-items: start;
}

.box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.box-head h2 { font-size: 1.5rem; }

.ingredients-box {
  position: sticky;
  top: 4.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--hue);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  padding: 1.25rem 1.25rem 1rem;
}

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-top: 1px solid var(--line-soft); }
.ingredients li:first-child { border-top: 0; }
.ingredients label {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.5rem 0;
  cursor: pointer;
}
.ingredients input {
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  border: 1.5px solid #9aa39d;
  border-radius: 4px;
  background: #fff;
  display: grid;
  place-content: center;
  cursor: pointer;
}
.ingredients input::after {
  content: "";
  width: 0.6rem;
  height: 0.35rem;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.ingredients input:checked { background: var(--sage-deep); border-color: var(--sage-deep); }
.ingredients input:checked::after { opacity: 1; }
.ingredients input:focus-visible { box-shadow: var(--focus); }
.ingredients li.is-done span { color: #8a938f; text-decoration: line-through; text-decoration-color: #b5bcb7; }

.hint { margin: 0.75rem 0 0; color: var(--muted); font-size: 0.88rem; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { margin: 0 0 0.35rem; }

.step {
  appearance: none;
  display: grid;
  grid-template-columns: 2.1rem 1fr;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.7rem 0.75rem 0.75rem 0.6rem;
  cursor: pointer;
  line-height: 1.6;
  font-size: 1.08rem;
}
.step:hover { background: rgba(255, 255, 255, 0.7); }

.step-n {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  border: 1.5px solid var(--hue);
  color: var(--hue);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1rem;
}

.steps li.is-current .step {
  background: var(--saffron-wash);
  border-left-color: var(--saffron);
}
.steps li.is-current .step-n { background: var(--hue); color: #fff; }

.notes {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-left: 3px solid var(--sage);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notes h2 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.notes p { margin: 0; white-space: pre-line; }

.source { margin: 1.25rem 0 0; color: var(--muted); font-size: 0.95rem; }
.source a { color: var(--sage-deep); font-weight: 600; }

.muted { color: var(--muted); margin: 0; }

/* ---------- Ratings & reviews (markup from reviews.js) ---------- */

.star-meter {
  position: relative;
  display: inline-block;
  line-height: 1;
  letter-spacing: 0.06em;
  font-size: 1rem;
  white-space: nowrap;
}
.star-meter.is-small { font-size: 0.88rem; }
.star-meter-base { color: #d9ddd6; }
.star-meter-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: var(--saffron); }

.rating-num { font-weight: 600; color: var(--ink); }
.rating-count { color: var(--muted); }

.reviews {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
  max-width: 50rem;
}

.reviews-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  flex-wrap: wrap;
}
.reviews-top h3 { font-size: 1.6rem; }
.reviews-summary { margin: 0; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.reviews-summary .star-meter { font-size: 1.3rem; }
.reviews-summary .rating-num { font-family: var(--serif); font-size: 1.35rem; }

.you-rated { margin: 0.5rem 0 0; color: var(--sage-deep); font-size: 0.93rem; }
.you-rated[hidden] { display: none; }

.review-form {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.review-form[hidden] { display: none; }

.star-field { margin: 0 0 1rem; padding: 0; border: 0; min-width: 0; }
.star-field legend { padding: 0; margin-bottom: 0.25rem; font-weight: 600; }
.star-picker { display: flex; gap: 0.1rem; }
.star-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.star-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.9rem;
  line-height: 1;
  color: #d3d8d2;
  cursor: pointer;
  border-radius: 50%;
}
.star-label.is-on { color: var(--saffron); }
.star-radio:focus-visible + .star-label { box-shadow: var(--focus); }

.review-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }

.review-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.review-list[hidden] { display: none; }
.review { padding: 1rem 0; border-top: 1px solid var(--line); }
.review-head { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem 0.75rem; }
.review-name { font-weight: 600; }
.review-date { color: var(--muted); font-size: 0.88rem; }
.review-text { margin: 0.35rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Forms (reviews and Add a recipe) ---------- */

.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field .label, .field-label { font-weight: 600; font-size: 0.95rem; }
.optional { color: var(--muted); font-weight: 400; }

.field input,
.field textarea,
.link-row input {
  width: 100%;
  border: 1px solid #c9cfc8;
  border-radius: var(--radius);
  background: #fff;
  padding: 0.65rem 0.8rem;
  line-height: 1.45;
}
.field textarea { resize: vertical; min-height: 5rem; }
.field input:focus,
.field textarea:focus,
.link-row input:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus); }
.field input[hidden] { display: none; }

.photo-pick { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1rem; }
.photo-btn { cursor: pointer; }
.photo-btn:focus-within { box-shadow: var(--focus); }
.photo-preview {
  width: 9rem;
  height: 6rem;
  object-fit: cover;
  border-radius: var(--radius);
  border-bottom: 3px solid var(--saffron);
}
.photo-preview[hidden], .photo-remove[hidden] { display: none; }
.field select { width: 100%; padding-top: 0.65rem; padding-bottom: 0.65rem; }

.field-help { color: var(--muted); font-size: 0.86rem; }
.char-count { align-self: flex-end; color: var(--muted); font-size: 0.8rem; }

.form-foot { display: flex; align-items: center; gap: 0.75rem 1rem; flex-wrap: wrap; margin-top: 1.1rem; }

.form-msg { margin: 0; font-size: 0.95rem; }
.form-msg:empty { display: none; }
.form-msg.is-ok { color: var(--sage-deep); font-weight: 600; }
.form-msg.is-error {
  color: var(--danger);
  background: #fbe3e1;
  border-radius: 4px;
  padding: 0.45rem 0.75rem;
}

/* ---------- Add a recipe ---------- */

.add { max-width: 46rem; }
.add-title { font-size: clamp(2rem, 4.5vw, 2.7rem); font-weight: 700; outline: none; }
.add-sub { margin: 0.6rem 0 1.75rem; color: var(--muted); font-size: 1.08rem; }

.link-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--sage);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  padding: 1.25rem;
  display: grid;
  gap: 0.6rem;
  justify-items: start;
}
.link-form .field-label { font-size: 1rem; }
.link-row { display: flex; gap: 0.5rem; width: 100%; }
.link-row input { flex: 1; font-size: 1.05rem; }
.link-row .btn { flex: none; }
.link-form .form-msg { width: 100%; }

.add-guide { margin: -0.4rem 0 1.25rem; font-size: 0.95rem; color: var(--muted); }
.add-guide a, .footer-guide a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }
.footer .footer-guide { margin-top: 0.35rem; font-size: 0.9rem; }

/* ---------- Meal plan and shopping list (planner.js) ---------- */

.nav-short { display: none; }

.sync-status { margin: -1rem 0 1.25rem; padding-left: 1.6rem; color: var(--muted); font-size: 0.9rem; position: relative; min-height: 1.3rem; }
.sync-status::before { content: ""; position: absolute; left: 0.35rem; top: 0.45rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #b8bfc4; }
.sync-status.is-synced::before { background: #2f8f4e; }
.sync-status.is-saving::before, .sync-status.is-checking::before { background: var(--saffron); }
.sync-status.is-offline::before, .sync-status.is-setup::before { background: var(--sage); }
.sync-status a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }

.plan { max-width: 64rem; }
.shop { max-width: 46rem; }
.week-nav { display: flex; align-items: center; gap: 0.75rem; margin: 0 0 1.25rem; }
.week-step { padding: 0.55rem 0.7rem; text-decoration: none; }
.week-label { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem; text-align: center; }
.week-label strong { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.week-tag { font-size: 0.82rem; color: var(--muted); }
.week-tag-link { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }

.plan-days { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plan-day {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 0.85rem 0.25rem;
  border-bottom: 1px solid var(--line);
}
.plan-day.is-today { background: var(--saffron-wash); border-radius: var(--radius); padding-left: 0.6rem; padding-right: 0.6rem; }
.plan-date { display: flex; flex-direction: column; padding-top: 0.45rem; }
.plan-dow { font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.plan-dm { color: var(--muted); font-size: 0.9rem; }
.plan-today { display: inline-block; margin-left: 0.3rem; padding: 0 0.4rem; border-radius: 999px; background: var(--sage); color: #fff; font-size: 0.72rem; font-weight: 600; vertical-align: 1px; }
.plan-meals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem 0.9rem; min-width: 0; }
.plan-slot { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.plan-meal { color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.plan-slot.is-set .plan-meal { color: var(--sage-deep); }
.plan-select, .plan-note, .plan-add-panel select, .shop-add input {
  width: 100%;
  border: 1px solid #c9cfc8;
  border-radius: var(--radius);
  background: #fff;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--ink);
}
.plan-slot.is-set .plan-select { border-color: var(--sage); font-weight: 600; }
.plan-select { text-overflow: ellipsis; }
.plan-select:focus, .plan-note:focus, .plan-add-panel select:focus, .shop-add input:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus); }
.plan-note[hidden] { display: none; }
.plan-open { align-self: flex-start; display: inline-flex; align-items: center; gap: 0.2rem; color: var(--sage-deep); font-size: 0.92rem; font-weight: 600; text-underline-offset: 0.2em; }
.plan-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.plan-foot .btn { text-decoration: none; }
.plan-count { color: var(--muted); font-size: 0.95rem; }
.plan-foot .link-btn[hidden] { display: none; }

.plan-add { display: contents; }
.plan-add-panel {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.6rem 0.75rem;
  margin-top: 0.85rem;
  padding: 0.9rem 1rem;
  max-width: 34rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--saffron);
  border-radius: var(--radius);
}
.plan-add-panel .field { flex: 1 1 14rem; }
.plan-add-panel .plan-add-meal { flex: 0 1 9rem; }
.plan-add-panel .form-msg { flex-basis: 100%; }
.plan-add-panel .form-msg a { color: var(--sage-deep); font-weight: 600; }

.shop-meals { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.shop-meals a {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}
.shop-meals a span { color: var(--sage-deep); font-weight: 600; }
.shop-meals a:hover { border-color: var(--saffron); }
.shop-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem 0.9rem; margin: 0 0 1rem; }
.shop-actions .link-btn[hidden] { display: none; }
.shop-h { display: flex; align-items: center; gap: 0.5rem; font-size: 1.3rem; margin: 1.5rem 0 0.5rem; color: var(--sage); }
.shop-n { display: inline-block; min-width: 1.6rem; padding: 0 0.45rem; border-radius: 999px; background: var(--line-soft); color: var(--slate); font-family: var(--sans); font-size: 0.85rem; text-align: center; }
.shop-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.shop-item { display: flex; align-items: flex-start; gap: 0.5rem; border-bottom: 1px solid var(--line-soft); }
.shop-item:last-child { border-bottom: 0; }
.shop-check { flex: 1; display: flex; align-items: flex-start; gap: 0.8rem; padding: 0.75rem 0.9rem; cursor: pointer; }
.shop-check input { width: 1.3rem; height: 1.3rem; margin: 0.1rem 0 0; flex: none; accent-color: var(--sage); cursor: pointer; }
.shop-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.shop-name { font-weight: 600; }
.shop-opt { margin-left: 0.25rem; color: var(--muted); font-size: 0.8rem; font-weight: 400; font-style: italic; }
.shop-uses { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; color: var(--slate); font-size: 0.88rem; }
.shop-from { color: var(--muted); }
.shop-have .shop-list { background: transparent; }
.shop-have .shop-name { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.shop-have .shop-uses { display: none; }
.shop-remove { flex: none; align-self: center; margin-right: 0.5rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.shop-remove:hover { background: var(--line-soft); color: var(--ink); }
.shop-done { margin: 0.5rem 0 0; padding: 0.9rem 1rem; background: var(--saffron-wash); border-radius: var(--radius); }
.shop-add { display: flex; gap: 0.6rem; margin-top: 1.25rem; max-width: 30rem; }
.shop-add input { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  .plan-day { grid-template-columns: 1fr; gap: 0.5rem; }
  .plan-date { flex-direction: row; align-items: baseline; gap: 0.5rem; padding-top: 0; }
  .plan-meals { grid-template-columns: 1fr; gap: 0.5rem; }
  .plan-slot { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr); align-items: center; gap: 0.35rem 0.6rem; }
  .plan-slot .plan-note, .plan-slot .plan-open { grid-column: 2; }
}
@media (max-width: 480px) {
  .nav-long { display: none; }
  .nav-short { display: inline; }
}

@media print {
  body[data-view="shopping"] .shop-actions,
  body[data-view="shopping"] .shop-add,
  body[data-view="shopping"] .shop-have,
  body[data-view="shopping"] .shop-meals,
  body[data-view="plan"] .week-step,
  body[data-view="plan"] .plan-foot,
  body[data-view="plan"] .plan-open,
  .plan-add, .plan-add-panel, .sync-status { display: none !important; }
  .shop-list { border: 0; }
  .shop-item { break-inside: avoid; }
  .plan-day.is-today { background: none; }
}

/* ---------- Contributor sign in (auth.js) ---------- */

.auth .auth-form { display: flex; flex-direction: column; gap: 1rem; max-width: 28rem; }
.auth .auth-form[hidden] { display: none; }
.auth-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.25rem; }
.auth-help { color: var(--muted); font-size: 0.95rem; margin: 1.25rem 0 0; }
.auth-form .auth-help { margin: 0; }
.auth-help a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }
.signed-in-note { margin: 0; color: var(--muted); font-size: 0.95rem; }
.signed-in-note strong { color: var(--ink); font-weight: 600; }
.footer .footer-account { margin-top: 0.35rem; font-size: 0.9rem; }
.footer-account a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }
.footer-account .link-btn { font-size: inherit; }

/* ---------- Contributor guide (guide/index.html) ---------- */

.guide { max-width: 48rem; font-size: 1.05rem; line-height: 1.65; }
.guide p { margin: 0 0 1rem; }
.guide a { color: var(--sage-deep); text-underline-offset: 0.2em; }
.guide-head { margin: 0.75rem 0 1.5rem; padding-bottom: 1.25rem; border-bottom: 3px solid var(--saffron); }
.guide-kicker { margin: 0 0 0.35rem !important; color: var(--sage-deep); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.guide-head h1 { font-size: clamp(2rem, 5vw, 2.9rem); }
.guide-lead { margin: 0.75rem 0 0 !important; color: var(--slate); font-size: 1.15rem; }

.guide-need {
  margin: 0 0 1.75rem;
  padding: 1.1rem 1.4rem;
  background: var(--card);
  border-left: 4px solid var(--saffron);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: 0 1px 2px rgba(29, 35, 39, 0.06);
}
.guide-need h2 { font-size: 1.25rem; color: var(--sage-deep); margin-bottom: 0.5rem; }
.guide-need ul { margin: 0; padding-left: 1.1rem; }
.guide-need li + li { margin-top: 0.4rem; }

.guide-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 0.75rem; margin: 1.5rem 0 0.5rem; }
.guide .guide-ways a {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--sage);
  border-radius: var(--radius);
  color: var(--slate);
  font-size: 0.92rem;
  line-height: 1.45;
  text-decoration: none;
}
.guide .guide-ways a:hover { border-color: var(--saffron); border-top-color: var(--sage); }
.guide .guide-ways a:focus-visible { outline: none; box-shadow: var(--focus); }
.guide-way-title { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; color: var(--sage-deep); }

.guide-section { padding-top: 2.25rem; scroll-margin-top: 4.5rem; }
.guide-section h2 {
  font-size: clamp(1.5rem, 3.5vw, 1.9rem);
  color: var(--sage);
  padding-bottom: 0.45rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--saffron);
}

.guide-steps { counter-reset: step; list-style: none; margin: 0 0 1.25rem; padding: 0; }
.guide-steps > li { counter-increment: step; position: relative; padding-left: 2.6rem; margin-bottom: 0.75rem; }
.guide-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.75rem;
  text-align: center;
}
.guide-steps ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.guide-steps ul li { margin-bottom: 0.3rem; }
.guide-steps ul li::marker { color: var(--sage); }

.guide-fig { margin: 1.25rem auto 1.5rem; text-align: center; }
.guide-fig img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(29, 35, 39, 0.08);
  background: var(--card);
}
.guide-fig figcaption { margin-top: 0.55rem; color: var(--muted); font-size: 0.9rem; font-style: italic; }
.guide-fig-narrow { max-width: 30rem; }
.guide-fig-wide img { border-radius: 0; }
.guide-pair { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.25rem; align-items: end; }
.guide-pair .guide-fig { margin: 1.25rem 0 0.5rem; }

.guide-tip {
  margin: 1.25rem 0 0;
  padding: 1rem 1.25rem;
  background: var(--saffron-wash);
  border-left: 4px solid var(--saffron);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.98rem;
}
.guide-tip-pic p { margin: 0 0 1rem; }
.guide-tip-pic img { display: block; width: 100%; max-width: 26rem; height: auto; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius); }

.guide-table-wrap { overflow-x: auto; }
.guide-table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 0.97rem; }
.guide-table th, .guide-table td { padding: 0.7rem 0.9rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.guide-table thead th { background: var(--sage); color: #fff; border-color: var(--sage); }
.guide-table tbody th { width: 40%; font-weight: 600; }
.guide-table tbody tr:nth-child(even) { background: var(--paper); }

.guide-end { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line); text-align: center; }
.guide-end-mark { width: 3rem; height: 3rem; color: var(--saffron); }
.guide-end-thanks { font-family: var(--serif); font-size: 1.35rem; color: var(--sage-deep); margin: 0.5rem 0 0.25rem !important; }
.guide-end .btn { margin-top: 0.5rem; color: #fff; text-decoration: none; }

@media (max-width: 600px) {
  .guide { font-size: 1rem; }
  .guide-pair { grid-template-columns: 1fr; }
  .guide-fig-phone { max-width: 20rem; margin-left: auto; margin-right: auto; }
}

@media print {
  .guide-ways, .guide-end .btn, .guide .back { display: none; }
  .guide-section { break-inside: auto; padding-top: 1.25rem; }
  .guide-fig, .guide-tip, .guide-table tr { break-inside: avoid; }
}

.add-or {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 1.1rem 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.add-or::before, .add-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

.read-form .photo-pick { width: 100%; }
.read-thumbs { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; padding: 0; list-style: none; }
.read-thumbs[hidden] { display: none; }
.read-thumbs li { position: relative; }
.read-thumbs img {
  display: block;
  width: 6.5rem;
  height: 5rem;
  object-fit: cover;
  border-radius: var(--radius);
  border-bottom: 3px solid var(--saffron);
}
.thumb-x {
  position: absolute;
  top: -0.45rem;
  right: -0.45rem;
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.thumb-x:focus-visible { outline: none; box-shadow: var(--focus); }
.read-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0.6rem 0.75rem; width: 100%; }
.read-code { flex: 0 1 16rem; }
.read-form .form-msg { width: 100%; }

.recipe-form { margin-top: 2.25rem; scroll-margin-top: 5rem; }
.recipe-form[hidden] { display: none; }
.form-head { margin-bottom: 1.25rem; }
.form-head h2 { font-size: 1.6rem; margin-bottom: 0.25rem; outline: none; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.25rem; }
.field-wide { grid-column: 1 / -1; }

.save-row {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 18rem) 1fr;
  gap: 0.75rem 1.5rem;
  align-items: center;
}
.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: var(--slate); }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--sage-deep); }

/* ---------- Small screens ---------- */

@media (min-width: 721px) {
  .review-fields { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); }
  .field-code, .field-wide-r { grid-column: auto; }
}

@media (max-width: 860px) {
  .recipe-body { grid-template-columns: 1fr; gap: 2rem; }
  .ingredients-box { position: static; }
}

@media (max-width: 640px) {
  .topbar-inner { padding: 0.6rem 1rem; }
  .brand-name { font-size: 1.02rem; }
  .page { padding: 1.75rem 1rem 3rem; }
  .cards { grid-template-columns: 1fr; gap: 1.9rem; }
  .grid-2, .save-row { grid-template-columns: 1fr; }
  .link-row { flex-direction: column; }
  .fact-box { padding-right: 1rem; margin-right: 1rem; }
}

.add-short { display: none; }

@media (max-width: 480px) {
  .add-long { display: none; }
  .add-short { display: inline; }
  .brand-name { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .card:hover .card-face { transform: none; }
}

/* ---------- Print: just the recipe ---------- */

@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .footer, .back, .recipe-actions, .reviews, .hint, .link-btn, .tags, .skip, .owner-edit, .hidden-note, .visibility-msg { display: none !important; }
  .page { padding: 0; max-width: none; }
  .recipe-body { grid-template-columns: 1fr 1.6fr; gap: 1.5rem; }
  .ingredients-box { position: static; border: 0; padding: 0; }
  .ingredients input { display: none; }
  .ingredients label { grid-template-columns: 1fr; padding: 0.2rem 0; }
  .ingredients li.is-done span { color: inherit; text-decoration: none; }
  .step { padding: 0.25rem 0; border: 0; font-size: 11pt; }
  .steps li.is-current .step { background: none; }
  .step-n { width: 1.6rem; height: 1.6rem; }
  .card-tab { background: none !important; color: #000; border: 1px solid #000; }
  .facts .fact-rating { display: none; }
  .notes { border-left: 2px solid #000; }
  .source a::after { content: " (" attr(href) ")"; font-weight: 400; }
}

/* Headings get focus on page change so screen readers start there; no ring needed. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { box-shadow: none; outline: none; }
.guide .guide-after-signin { margin-top: 2rem; }

@media (max-width: 420px) {
  .topbar-inner { padding-left: 0.75rem; padding-right: 0.75rem; }
  .topnav { gap: 0.2rem; }
  .nav-link.nav-plan { padding: 0.45rem 0.5rem; }
  .topbar .btn-small { padding-left: 0.6rem; padding-right: 0.6rem; }
  .brand { gap: 0.4rem; }
  .brand-name { font-size: 0.95rem; }
}

@media (max-width: 370px) {
  .mark { width: 1.7rem; height: 1.7rem; }
  .brand-name { font-size: 0.86rem; }
  .topbar .btn-small svg { display: none; }
}

/* ---------- Family album (family.js) ---------- */

/* Family photos keep their own shape instead of the stock 3:2 crop. */
.intro-photo.is-family img { aspect-ratio: auto; }
.intro-photo-link { display: block; border-radius: var(--radius); }
.intro-photo-link:hover img { box-shadow: 0 14px 32px rgba(110, 13, 17, 0.26); }
.intro-photo.is-family figcaption a { color: var(--sage-deep); font-weight: 600; text-underline-offset: 0.2em; }

@media (max-width: 860px) {
  /* On phones the family photo stays, under the search box. */
  .intro-photo.is-family { display: block; justify-self: stretch; max-width: 34rem; }
  .intro-photo.is-family::before { display: none; }
  .intro-photo.is-family figcaption { text-align: left; }
}

.album-head { margin-bottom: 1.75rem; }
.album-title { font-size: clamp(2rem, 4.5vw, 2.9rem); font-weight: 700; }
.album-sub { margin: 0.6rem 0 0; color: var(--muted); font-size: 1.1rem; max-width: 38rem; }

.album-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 2rem 1.75rem;
  align-items: start;
}
.album-item.is-lead { grid-column: 1 / -1; max-width: 52rem; }

.album-photo { margin: 0; }
.album-photo a { display: block; border-radius: var(--radius); }
.album-photo img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border-bottom: 5px solid var(--saffron);
  box-shadow: 0 10px 28px rgba(110, 13, 17, 0.16);
  background: var(--saffron-wash);
}
.album-photo a:hover img { box-shadow: 0 14px 32px rgba(110, 13, 17, 0.26); }
.album-photo figcaption { margin-top: 0.6rem; color: var(--slate); font-size: 0.95rem; }

@media (max-width: 640px) {
  .album-grid { gap: 1.5rem; }
}

@media print {
  .album-photo a { pointer-events: none; }
}

/* ---------- Edit categories (site owner only) ---------- */
.cat-edit { margin-left: auto; }
.cat-edit:empty { display: none; }
.cat-edit-link { font-size: 0.9rem; font-weight: 600; color: var(--sage-deep); text-underline-offset: 0.2em; }
.cat-edit-link:hover { color: var(--ink); }
.cat-editor { max-width: 44rem; }
.cat-rows { list-style: none; margin: 1.5rem 0; padding: 0; border-top: 1px solid var(--line); }
.cat-row {
  display: grid;
  grid-template-columns: 1.75rem minmax(0, 1fr) auto;
  grid-template-areas: "pos name btns" ". count count";
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.cat-pos { grid-area: pos; color: var(--muted); font-weight: 600; text-align: right; }
.cat-name {
  grid-area: name;
  width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}
.cat-name:focus { outline: none; box-shadow: var(--focus); border-color: var(--saffron); }
.cat-count { grid-area: count; color: var(--muted); font-size: 0.88rem; }
.cat-btns { grid-area: btns; display: flex; align-items: center; gap: 0.35rem; }
.icon-btn {
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:hover:not(:disabled) { border-color: var(--sage); color: var(--sage-deep); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.cat-remove { margin-left: 0.35rem; }
.cat-remove:disabled { color: var(--muted); opacity: 0.55; cursor: not-allowed; text-decoration: none; }
.cat-add { margin: 0 0 1.25rem; }
.cat-loose {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.cat-loose p { margin: 0 0 0.4rem; }
.cat-loose ul { margin: 0 0 0.5rem; padding-left: 1.2rem; }
.cat-help { margin: 0 0 1.5rem; padding-left: 1.2rem; color: var(--slate); font-size: 0.93rem; line-height: 1.6; }
@media (max-width: 560px) {
  .cat-row { grid-template-columns: 1.5rem minmax(0, 1fr); grid-template-areas: "pos name" ". count" ". btns"; }
}

/* ---------- Keep screen on switch (recipe pages) ---------- */
.wake-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.6rem;
  padding: 0 0.85rem 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
}
.wake-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wake-track {
  position: relative;
  flex: none;
  width: 2.4rem;
  height: 1.35rem;
  border-radius: 999px;
  background: #cfc6b6;
  transition: background 0.15s;
}
.wake-thumb {
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
.wake-switch input:checked + .wake-track { background: var(--sage); }
.wake-switch input:checked + .wake-track .wake-thumb { transform: translateX(1.05rem); }
.wake-switch input:focus-visible + .wake-track { box-shadow: var(--focus); }
.wake-msg { margin: 0.6rem 0 0; color: var(--danger); font-size: 0.92rem; }
.wake-msg[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .wake-track, .wake-thumb { transition: none; }
}
@media print {
  .wake-msg { display: none !important; }
}

/* ---------- Contributed by (recipe page) ---------- */
.contrib { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; margin: 0.35rem 0 0.75rem; }
.contrib-line { margin: 0; color: var(--slate); font-size: 1.02rem; }
.contrib-line strong { color: var(--ink); font-weight: 600; }
.contrib-empty { color: var(--muted); font-style: italic; }
.contrib-edit { font-size: 0.92rem; }
.contrib-added { flex-basis: 100%; color: var(--muted); font-size: 0.85rem; }
.contrib-form { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.35rem; }
.contrib-form[hidden] { display: none; }
.contrib-form input {
  flex: 1 1 14rem;
  max-width: 22rem;
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}
.contrib-form input:focus { outline: none; box-shadow: var(--focus); border-color: var(--saffron); }
.contrib-form .form-msg { flex-basis: 100%; }
@media print {
  .contrib-edit, .contrib-added, .contrib-form, .contrib-empty { display: none !important; }
}

/* ======================================================================
   Printed recipe card
   A branded one-page layout: red and gold banner, title with the cook's
   name, fact boxes, an ingredient checklist with tick boxes, numbered
   steps, a Cook's notes card, lines for your own notes, and a QR code
   that opens the recipe on a phone. The .print-only pieces are written
   into the page by app.js and stay hidden on screen.
   ====================================================================== */
.print-only { display: none; }

@media print {
  @page { size: letter; margin: 0.45in 0.5in; }

  html, body { background: #fff !important; }
  body { font-size: 10.5pt; color: #1d2327; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-only { display: block; }
  .page { padding: 0 !important; max-width: none !important; }
  .recipe { --pr: var(--hue, #aa151b); }

  /* Hide screen-only bits. */
  .contrib-line, .recipe-cat, .photo, .facts .fact-rating, .hint,
  .ingredients-box .box-head .link-btn { display: none !important; }

  /* Banner */
  .print-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 0.18in;
    padding: 0.11in 0.16in;
    background: #aa151b;
    color: #fff;
    border-bottom: 4px solid #f1bf00;
    border-radius: 6px 6px 0 0;
  }
  .print-mark { width: 26px; height: 26px; color: #fff; flex: none; }
  .print-brand-name { font-family: var(--serif); font-weight: 700; font-size: 14pt; letter-spacing: 0.02em; }
  .print-brand-tag { margin-left: auto; font-size: 8.5pt; font-style: italic; opacity: 0.9; }

  /* Title block */
  .recipe-head { margin: 0 0 0.12in; padding: 0 !important; border: 0; text-align: center; }
  .recipe-head .recipe-actions, .recipe-head .wake-msg, .recipe-head .visibility-msg { display: none !important; }
  .recipe-title { font-size: 26pt; line-height: 1.1; margin: 0 0 0.04in; color: #1d2327; }
  .contrib { justify-content: center; margin: 0 0 0.1in; }
  .print-kitchen { margin: 0; font-family: var(--serif); font-style: italic; font-size: 11.5pt; color: #3e4c59; }
  .print-kitchen strong { font-style: normal; color: var(--pr); }
  .print-kitchen::before, .print-kitchen::after { content: " ~ "; color: #f1bf00; font-style: normal; font-weight: 700; }

  /* Fact boxes */
  .facts {
    display: flex !important;
    justify-content: center;
    gap: 0.12in;
    margin: 0.06in 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }
  .facts .fact-box {
    min-width: 1.05in;
    padding: 0.05in 0.14in !important;
    border: 0 !important;
    border-radius: 6px;
    background: #fdf1c4;
    text-align: center;
  }
  .facts dt { font-size: 7.5pt; letter-spacing: 0.12em; text-transform: uppercase; color: #8c1116; font-weight: 700; }
  .facts dd { margin: 0; font-size: 11.5pt; font-weight: 700; color: #1d2327; }

  /* Two columns: ingredients | method */
  .recipe-body {
    display: grid !important;
    grid-template-columns: 2.55in 1fr !important;
    gap: 0.26in !important;
    align-items: start;
    border-top: 3px double #1d2327;
    padding-top: 0.16in;
    margin-top: 0.06in !important;
  }
  .ingredients-box h2, .steps-box h2, .print-mynotes h2 {
    font-family: var(--sans);
    font-size: 9pt;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    background: #1d2327;
    display: inline-block;
    padding: 0.03in 0.12in;
    border-radius: 4px;
    margin: 0 0 0.09in;
  }
  .ingredients-box .box-head, .steps-box .box-head { margin: 0; padding: 0; border: 0; }

  /* Ingredient checklist with boxes to tick in pencil */
  .ingredients-box {
    position: static !important;
    border: 0 !important;
    border-radius: 6px;
    padding: 0.12in 0.13in !important;
    background: #fbf6ea !important;
    box-shadow: none !important;
  }
  .ingredients { margin: 0; padding: 0; }
  .ingredients li { border: 0 !important; padding: 0 !important; break-inside: avoid; }
  .ingredients input { display: none !important; }
  .ingredients label {
    display: grid !important;
    grid-template-columns: 11px 1fr !important;
    gap: 0.08in;
    align-items: start;
    padding: 0.035in 0 !important;
    border-bottom: 1px dotted #d9c9a8;
    font-size: 10pt;
    line-height: 1.3;
  }
  .ingredients label::before {
    content: "";
    width: 9px;
    height: 9px;
    margin-top: 2px;
    border: 1.3px solid var(--pr);
    border-radius: 2px;
    background: #fff;
  }
  .ingredients li:last-child label { border-bottom: 0; }
  .ingredients li.is-done span { color: inherit !important; text-decoration: none !important; }

  /* Numbered method */
  .steps { margin: 0; padding: 0; }
  .steps li { break-inside: avoid; }
  .step {
    display: grid !important;
    grid-template-columns: 22px 1fr !important;
    gap: 0.1in;
    align-items: start;
    width: 100%;
    padding: 0 0 0.075in !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    font-size: 10.5pt;
    line-height: 1.42;
    text-align: left;
    color: #1d2327;
  }
  .step-n {
    width: 22px !important;
    height: 22px !important;
    border: 0 !important;
    border-radius: 50%;
    background: var(--pr) !important;
    color: #fff !important;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 9pt;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .steps li.is-current .step { background: none !important; }

  /* Cook's notes card */
  .notes {
    margin: 0.08in 0 0 !important;
    padding: 0.09in 0.13in !important;
    border: 0 !important;
    border-left: 4px solid #f1bf00 !important;
    border-radius: 4px;
    background: #fdf1c4 !important;
    break-inside: avoid;
  }
  .notes h2 { display: block; background: none !important; padding: 0 !important; border-radius: 0; font-family: var(--sans); font-size: 8pt; letter-spacing: 0.14em; text-transform: uppercase; color: #8c1116; margin: 0 0 0.03in; }
  .notes p { margin: 0; font-size: 10pt; font-style: italic; line-height: 1.4; }
  .source { margin: 0.07in 0 0; font-size: 8.5pt; color: #5b6670; }
  .source a { color: inherit; text-decoration: none; }
  .source a::after { content: " (" attr(href) ")"; }

  /* My notes lines beside the QR code */
  .print-end {
    display: grid !important;
    grid-template-columns: 1fr 1.65in;
    gap: 0.26in;
    align-items: start;
    margin-top: 0.16in;
    break-inside: avoid;
  }
  .print-lines span { display: block; height: 0.27in; border-bottom: 1px solid #d9c9a8; }
  .print-qrbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.04in;
    padding: 0.08in;
    border: 1.5px dashed #aa151b;
    border-radius: 8px;
    text-align: center;
    font-size: 7.5pt;
    color: #3e4c59;
  }
  .print-qr { width: 0.85in; height: 0.85in; }
  .print-qr svg { width: 100%; height: 100%; display: block; }
  .print-qrbox strong { font-size: 8pt; color: #1d2327; line-height: 1.25; }
  .print-url { word-break: break-all; line-height: 1.2; }
  .print-foot {
    display: block !important;
    margin: 0.12in 0 0;
    padding-top: 0.06in;
    border-top: 2px solid #aa151b;
    text-align: center;
    font-size: 8pt;
    font-style: italic;
    color: #5b6670;
  }
}

/* ---------- Our cooks page ---------- */
.cooks { max-width: 62rem; }
.cooks-head { margin: 0.5rem 0 1.25rem; }
.cooks-title { font-family: var(--serif); font-size: clamp(2rem, 4.5vw, 2.7rem); margin: 0; }
.cooks-sub { margin: 0.35rem 0 0; color: var(--slate); }

.cooks-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 1.75rem; }
.cooks-summary div { background: var(--card); border: 1px solid var(--line); border-top: 4px solid var(--sage); border-radius: var(--radius); padding: 0.8rem 1rem; }
.cooks-summary dt { font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cooks-summary dd { margin: 0.15rem 0 0; font-family: var(--serif); font-size: 1.9rem; font-weight: 700; color: var(--ink); }
.cooks-summary dd small { font-family: var(--sans); font-size: 0.95rem; font-weight: 500; color: var(--muted); }

.cooks-board { margin: 0 0 2rem; }
.cooks-board h2, .cooks-accounts h2 { font-family: var(--serif); font-size: 1.35rem; margin: 0 0 0.75rem; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.board li { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr 2.5rem; align-items: center; gap: 0.75rem; }
.board-name { justify-self: start; background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 0.2em; }
.board-name:hover { color: var(--hue); text-decoration-color: currentColor; }
.board-name:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }
.board-bar { display: block; height: 0.9rem; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.board-bar span { display: block; height: 100%; background: var(--hue); border-radius: 999px; }
.board-n { font-weight: 700; color: var(--slate); font-variant-numeric: tabular-nums; }

.cook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.5rem, 1fr)); gap: 1.25rem; }
.cook-card { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--hue); border-radius: var(--radius); padding: 1.1rem 1.2rem 1rem; display: flex; flex-direction: column; gap: 0.75rem; scroll-margin-top: 5rem; }
.cook-top { display: flex; align-items: center; gap: 0.85rem; }
.cook-avatar { flex: none; width: 3.1rem; height: 3.1rem; border-radius: 50%; background: var(--hue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 1.2rem; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--saffron); }
.cook-name { font-family: var(--serif); font-size: 1.3rem; margin: 0; line-height: 1.2; }
.cook-sig { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.9rem; }
.cook-sig strong { color: var(--slate); }
.cook-awards { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.cook-awards li { background: var(--saffron-wash); color: #5c4300; border: 1px solid #f3dc85; border-radius: 999px; padding: 0.1rem 0.6rem; font-size: 0.82rem; font-weight: 600; }
.cook-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.4rem; margin: 0; padding: 0.6rem 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); text-align: center; }
.cook-stats dt { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cook-stats dd { margin: 0.1rem 0 0; font-weight: 700; font-size: 1.05rem; color: var(--ink); white-space: nowrap; }
.cook-pick { margin: 0; font-size: 0.95rem; line-height: 1.4; }
.cook-pick span { display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.cook-pick a { font-weight: 600; color: var(--ink); }
.cook-pick a:hover { color: var(--hue); }
.cook-pick small { color: var(--muted); }
.cook-recipes summary { cursor: pointer; font-weight: 600; color: var(--hue); font-size: 0.92rem; }
.cook-recipes ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.cook-recipes li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--line); font-size: 0.93rem; }
.cook-recipes li a { color: var(--ink); }
.cook-r-meta { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.cooks-note { margin: 1.5rem 0 0; color: var(--muted); font-style: italic; }

.cooks-accounts { margin: 2.25rem 0 0; padding: 1rem 1.2rem; border: 1px dashed var(--muted); border-radius: var(--radius); background: #f3efe8; }
.cooks-accounts h2 small { font-family: var(--sans); font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-left: 0.4rem; }
.cooks-accounts table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.cooks-accounts th, .cooks-accounts td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.cooks-accounts th { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 640px) {
  .cooks-summary { grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
  .cooks-summary div { padding: 0.6rem 0.65rem; }
  .cooks-summary dd { font-size: 1.45rem; }
  .board li { grid-template-columns: 6.5rem 1fr 2rem; gap: 0.5rem; }
}
@media print {
  .cooks-accounts, .cook-recipes summary { display: none; }
  .cook-recipes ul { display: block; }
}

/* ---------- Cook profiles ---------- */
.contrib-name { color: var(--ink); font-weight: 600; text-underline-offset: 0.2em; }
.contrib-name:hover { color: var(--accent, #aa151b); }
img.cook-avatar { object-fit: cover; padding: 0; }
.cook-name a { color: inherit; text-decoration: none; }
.cook-name a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.cook-links { margin: 0; font-size: 0.92rem; }
.cook-links a { font-weight: 600; }
.cooks-links { margin: 0.5rem 0 0; font-weight: 600; }

.bdays { margin: 0 0 1.5rem; padding: 0.85rem 1.1rem; border-radius: var(--radius); background: var(--saffron-wash); border: 1px solid #f3dc85; }
.bdays h2 { margin: 0 0 0.35rem; font-family: var(--serif); font-size: 1.1rem; }
.bdays ul { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1.25rem; }
.bdays a { font-weight: 600; color: var(--ink); }

.cook-profile { max-width: 62rem; }
.cp-head { display: flex; align-items: center; gap: 1.5rem; margin: 0.75rem 0 1.5rem; padding-bottom: 1.25rem; border-bottom: 3px double var(--line); }
.cp-photo { flex: none; width: 8.5rem; height: 8.5rem; border-radius: 50%; object-fit: cover; background: var(--hue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-weight: 700; font-size: 2.8rem; box-shadow: 0 0 0 4px var(--card), 0 0 0 7px var(--saffron); }
.cp-name { font-family: var(--serif); font-size: clamp(2rem, 4.5vw, 2.8rem); margin: 0; line-height: 1.1; }
.cp-facts { margin: 0.35rem 0 0; color: var(--slate); font-size: 1.05rem; }
.cp-specialty { margin: 0.5rem 0 0; }
.cp-specialty span { display: inline-block; margin-right: 0.35rem; padding: 0.05rem 0.55rem; border-radius: 999px; background: var(--hue); color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 0.1em; }
.cp-actions { margin: 0.75rem 0 0; }
.cp-body { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 2rem; align-items: start; }
.cp-bio h2, .cp-recipes h2, .family-box h2 { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 0.6rem; }
.cp-bio p { margin: 0 0 0.85rem; font-size: 1.05rem; line-height: 1.65; }
.cp-side { display: flex; flex-direction: column; gap: 1rem; }
.cp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 0.5rem; }
.family-box { padding: 1rem 1.1rem; border: 1px dashed var(--muted); border-radius: var(--radius); background: #f3efe8; }
.family-box h2 small { display: block; font-family: var(--sans); font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-top: 0.15rem; }
.family-box dl { margin: 0; display: grid; gap: 0.55rem; }
.family-box dt { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.family-box dd { margin: 0; font-weight: 600; word-break: break-word; }
.family-box.is-locked p { margin: 0; color: var(--slate); }
.bday-soon { display: inline-block; margin-left: 0.25rem; padding: 0 0.45rem; border-radius: 999px; background: var(--saffron-wash); color: #5c4300; font-size: 0.8rem; }
.cp-recipes { margin-top: 2rem; }

.profile-edit { max-width: 44rem; }
.profile-form { display: flex; flex-direction: column; gap: 1.25rem; }
.pf-group { margin: 0; padding: 1rem 1.15rem 0.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.pf-group legend { padding: 0 0.4rem; font-family: var(--serif); font-weight: 700; font-size: 1.1rem; }
.pf-group legend small { font-family: var(--sans); font-weight: 600; font-size: 0.78rem; color: var(--muted); margin-left: 0.35rem; }
.pf-family { background: #f6f2ea; border-style: dashed; }
.profile-form .field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.9rem; }
.profile-form .field-label { font-weight: 600; }
.profile-form input:not([type="file"]):not([type="checkbox"]), .profile-form textarea, .profile-form select {
  font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); width: 100%;
}
.profile-form input:focus, .profile-form textarea:focus, .profile-form select:focus { outline: none; box-shadow: var(--focus); border-color: var(--saffron); }
.pf-bday { display: flex; gap: 0.5rem; }
.pf-bday select { width: auto; flex: 1; }
.pf-photo { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 1rem; }
.pf-photo .cp-photo { width: 6rem; height: 6rem; font-size: 2rem; }
.pf-photo-ctrl { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; }
.pf-file { position: relative; overflow: hidden; cursor: pointer; }
.pf-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.pf-linked { margin: 0 0 0.5rem; }
.pf-check { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.9rem; font-size: 0.93rem; }
.pf-delete { margin-left: auto; color: #8c1116; }
.pf-delete.is-armed { font-weight: 700; text-decoration: underline; }

.profiles-admin { max-width: 46rem; }
.pa-sub { font-family: var(--serif); font-size: 1.2rem; margin: 2rem 0 0.5rem; }
.pa-list { list-style: none; margin: 1rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.pa-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.pa-photo { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; background: var(--sage); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--serif); }
.pa-id { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pa-id a { color: var(--ink); }
.pa-id .muted { font-size: 0.88rem; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .cp-head { flex-direction: column; text-align: center; gap: 1rem; }
  .cp-body { grid-template-columns: 1fr; }
}

/* ---------- Phone header: brand on top, every link in a row below ---------- */

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 0.3rem; padding: 0.55rem 0.75rem 0.45rem; }
  .brand { flex: 1 1 100%; gap: 0.5rem; }
  .brand-name { font-size: 1.1rem; }
  .mark { width: 1.9rem; height: 1.9rem; }
  .topnav {
    flex: 1 1 100%;
    justify-content: space-between;
    gap: 0.15rem;
    margin: 0 -0.35rem;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav .nav-link { display: inline-flex; flex: none; padding: 0.4rem 0.6rem; font-size: 0.97rem; }
  .topnav .nav-long { display: none; }
  .topnav .nav-short { display: inline; }
  .topbar .btn-small { flex: none; padding: 0.4rem 0.7rem; }
  .topbar .btn-small svg { display: inline; }
  .topnav .add-long { display: none; }
  .topnav .add-short { display: inline; }
}

@media (max-width: 370px) {
  .brand-name { font-size: 1rem; }
  .topnav .nav-link { padding: 0.4rem 0.4rem; font-size: 0.92rem; }
  .topbar .btn-small { padding: 0.4rem 0.55rem; }
}

/* ---------- Sourdough hydration calculator (hydration.js) ---------- */

.hy { max-width: 60rem; }
.hy-head { margin-bottom: 1.5rem; max-width: 44rem; }
.hy-title { font-size: clamp(2rem, 4.5vw, 2.7rem); font-weight: 700; outline: none; }
.hy-sub { margin: 0.6rem 0 0; color: var(--muted); font-size: 1.08rem; }

.hy-tabs {
  display: flex;
  gap: 0.3rem;
  border-bottom: 2px solid var(--ink);
  padding: 0 0.1rem;
}
.hy-tab {
  appearance: none;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--line-soft);
  color: var(--slate);
  padding: 0.55rem 1rem 0.5rem;
  font-weight: 600;
  cursor: pointer;
}
.hy-tab:hover { background: #fff; color: var(--ink); }
.hy-tab.is-on { background: var(--sage); border-color: var(--sage); color: #fff; }
.hy-tab:focus-visible { box-shadow: var(--focus); border-radius: 8px 8px 0 0; }

.hy-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.25rem;
  align-items: start;
}

.hy-form, .hy-out {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 3px solid var(--sage);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  padding: 1.25rem;
}
.hy-out { border-top-color: var(--saffron); position: sticky; top: 5rem; }

.hy-lead { margin: 0 0 1rem; color: var(--muted); }

.hy-basis { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-bottom: 1rem; font-weight: 600; font-size: 0.95rem; }
.hy-basis label { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.hy-basis input { width: 1.05rem; height: 1.05rem; accent-color: var(--sage-deep); margin: 0; }

.hy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.1rem; }
.hy-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.hy-field label { font-weight: 600; font-size: 0.95rem; }
.hy-input { position: relative; }
.hy-input input {
  width: 100%;
  border: 1px solid #c9cfc8;
  border-radius: var(--radius);
  background: #fff;
  padding: 0.65rem 2.4rem 0.65rem 0.8rem;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}
.hy-input input:focus { outline: none; border-color: var(--saffron); box-shadow: var(--focus); }
.hy-unit {
  position: absolute; right: 0.8rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.hy-help { margin: 0; color: var(--muted); font-size: 0.84rem; line-height: 1.4; }

.hy-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.1rem; }
.hy-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.88rem;
  color: var(--slate);
  cursor: pointer;
}
.hy-chip b { color: var(--ink); font-weight: 600; }
.hy-chip:hover { background: #fff; }
.hy-chip.is-on { background: var(--saffron-wash); border-color: var(--saffron); }

.hy-out-title { font-size: 1.35rem; margin-bottom: 0.6rem; }
.hy-list { margin: 0; }
.hy-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line-soft);
}
.hy-row:first-child { border-top: 0; }
.hy-row dt { color: var(--slate); }
.hy-row dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.hy-row dd span { font-weight: 600; }
.hy-row dd small { display: block; color: var(--muted); font-size: 0.8rem; }
.hy-row.is-strong dt { font-weight: 600; color: var(--ink); }
.hy-row.is-strong dd span { font-family: var(--serif); font-size: 1.4rem; }
.hy-totals { margin-top: 0.75rem; padding-top: 0.5rem; border-top: 2px solid var(--line); font-size: 0.95rem; }

.hy-big {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  color: var(--sage-deep);
}
.hy-big span { display: block; margin-top: 0.3rem; font-family: var(--sans); font-size: 0.9rem; font-weight: 500; color: var(--muted); }

.hy-feel { margin: 0.9rem 0 0; color: var(--slate); font-size: 0.95rem; }
.hy-feel strong { color: var(--sage-deep); }
.hy-warn { margin: 0.75rem 0 0; color: var(--danger); background: #fbe3e1; border-radius: 4px; padding: 0.5rem 0.75rem; font-size: 0.93rem; }
.hy-empty { margin: 0; color: var(--muted); }
.hy-reset { margin: 1.25rem 0 0; }

@media (max-width: 760px) {
  .hy-body { grid-template-columns: 1fr; }
  .hy-out { position: static; }
}

@media (max-width: 420px) {
  .hy-form, .hy-out { padding: 1rem; }
  .hy-grid { gap: 0.9rem 0.75rem; }
  .hy-tab { flex: 1; padding-left: 0.5rem; padding-right: 0.5rem; }
}

@media print {
  .hy-tabs, .hy-presets, .hy-reset, .hy-basis { display: none !important; }
  .hy-out { position: static; }
}
