/* TBF Recipes — light, editorial food-blog look.
   White page, charcoal text, a warm serif (Fraunces) for recipe names and headings,
   a friendly sans (Figtree) for everything you read while cooking.
   Photos are square and sit edge to edge; recipes without a photo get a soft pastel block
   in their category's colour with a small line drawing. Green is the one accent: soft sage. */

:root {
  --page: #FFFFFF;
  --soft: #F6F7F5;          /* quiet panels */
  --line: #E6E8E4;
  --ink: #1E2320;
  --ink-2: #555D58;
  --ink-3: #8A918C;
  --sage: #5E8F6C;          /* links, small labels on white */
  --sage-soft: #DCEBDF;     /* highlights, ticked items */
  --btn: #1E2320;           /* main buttons: charcoal, like most food blogs */
  --btn-ink: #FFFFFF;
  --warn: #B4483B;

  /* category tints for recipes without a photo */
  --t-breakfast: #F6EDCB;
  --t-dinner: #DCEBDF;
  --t-braai: #F5DFD2;
  --t-salads: #E1F0D9;
  --t-sides: #EEE8DD;
  --t-sauces: #F3DDDB;
  --t-baking: #F1E7D4;
  --t-desserts: #F4DEE5;
  --t-drinks: #E5EEDA;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Figtree", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 400 18px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex; flex-direction: column;
}
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--sage); outline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; margin: 0; font-family: var(--serif); font-weight: 500; line-height: 1.12; letter-spacing: -0.01em; font-optical-sizing: auto; }
p { margin: 0; }
.muted { color: var(--ink-2); }
.hide { display: none !important; }
.label { font: 600 13px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage); }

/* ---------- header ---------- */
.site-head { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.head-row {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  max-width: 1200px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 10px;
}
.wordmark { font: 500 clamp(26px, 3.4vw, 34px)/1 var(--serif); text-decoration: none; letter-spacing: -0.02em; text-align: center; }
.head-search { justify-self: start; width: 44px; height: 44px; display: grid; place-items: center; }
.head-search svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.head-actions { justify-self: end; display: flex; gap: 8px; align-items: center; }
.cat-nav {
  display: flex; gap: 26px; justify-content: center; overflow-x: auto; scrollbar-width: none;
  max-width: 1200px; margin: 0 auto; padding: 4px clamp(16px, 4vw, 40px) 12px;
}
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a { flex: none; text-decoration: none; font: 600 14px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); padding: 6px 0; border-bottom: 2px solid transparent; }
.cat-nav a:hover { color: var(--ink); }
.cat-nav a[aria-current="page"] { color: var(--ink); border-color: var(--sage); }
@media (max-width: 700px) { .cat-nav { justify-content: flex-start; gap: 20px; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--page); font-weight: 600; font-size: 16px; text-decoration: none;
}
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
.btn-primary:hover { background: #333a36; border-color: #333a36; }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--warn); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn[aria-pressed="true"] { background: var(--sage-soft); border-color: var(--sage); color: var(--ink); }

/* ---------- pictures & placeholders ---------- */
.pic { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: var(--soft); }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease; }
.ph { position: absolute; inset: 0; display: grid; place-items: center; background: var(--tint, var(--soft)); }
.ph svg { width: 34%; height: 34%; fill: none; stroke: rgba(30, 35, 32, 0.45); stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- home ---------- */
.hello { text-align: center; max-width: 720px; margin: 8px auto 34px; display: grid; gap: 18px; justify-items: center; }
.hello h1 { font-size: clamp(36px, 5.2vw, 60px); font-weight: 400; }
.hello h1 em { font-style: italic; color: var(--sage); }
.search { width: 100%; max-width: 540px; position: relative; }
.search input { width: 100%; min-height: 54px; padding: 0 20px 0 50px; border: 1px solid var(--line); border-radius: 999px; background: var(--soft); font-size: 17px; }
.search input:focus { outline: none; border-color: var(--sage); background: var(--page); }
.search svg { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; pointer-events: none; }

.featured { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(20px, 4vw, 56px); align-items: center; margin-bottom: 56px; text-decoration: none; }
.featured .pic { aspect-ratio: 5 / 4; }
.featured:hover .pic img { transform: scale(1.03); }
.featured-text { display: grid; gap: 14px; }
.featured-text h2 { font-size: clamp(34px, 4.4vw, 54px); }
.featured-text .meta { color: var(--ink-2); }
.featured-text .go { font-weight: 600; text-decoration: underline; text-decoration-color: var(--sage); text-underline-offset: 5px; text-decoration-thickness: 2px; }
@media (max-width: 760px) { .featured { grid-template-columns: 1fr; } }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); }
.section-head a { color: var(--ink-2); font-size: 15px; font-weight: 600; text-decoration: none; }
.section-head a:hover { color: var(--ink); }

.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 56px; }
.cat { text-decoration: none; display: grid; gap: 10px; }
.cat .ph { position: relative; aspect-ratio: 1 / 1; }
.cat .ph svg { width: 42%; height: 42%; }
.cat span { font: 500 19px/1.2 var(--serif); }
.cat small { color: var(--ink-3); font-size: 14px; margin-top: -6px; }
.cat:hover .ph { filter: brightness(0.97); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 34px 22px; }
.card { text-decoration: none; display: grid; gap: 10px; align-content: start; }
.card:hover .pic img { transform: scale(1.04); }
.card:hover h3 { text-decoration: underline; text-decoration-color: var(--sage); text-underline-offset: 4px; }
.card h3 { font-size: 22px; }
.card .meta { color: var(--ink-3); font-size: 15px; }

.sub-nav { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 26px; }
.pill { display: inline-flex; align-items: center; text-decoration: none; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--page); color: var(--ink-2); font-weight: 600; font-size: 15px; }
.pill:hover { color: var(--ink); border-color: var(--ink-3); }
.pill[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-title { text-align: center; margin: 4px 0 26px; display: grid; gap: 6px; }
.page-title h1 { font-size: clamp(38px, 5vw, 58px); font-weight: 400; }

.empty { padding: 40px 0; display: grid; gap: 12px; justify-items: center; text-align: center; max-width: 520px; margin: 0 auto; }
.empty h2 { font-size: 30px; }

.notice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 16px 20px; margin-bottom: 26px; background: var(--sage-soft); border-radius: 4px; }

/* ---------- recipe page ---------- */
.recipe { max-width: 860px; margin: 0 auto; }
.crumbs { display: flex; gap: 8px; align-items: center; color: var(--ink-3); font-size: 15px; margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.recipe-head { text-align: center; display: grid; gap: 14px; justify-items: center; margin-bottom: 24px; }
.recipe-head h1 { font-size: clamp(38px, 5.4vw, 64px); font-weight: 400; max-width: 16ch; }
.facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fact { padding: 10px 22px; display: grid; justify-items: center; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact span { font: 600 12px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.fact strong { font: 500 20px/1.3 var(--serif); }
.recipe-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.recipe-photo { aspect-ratio: 3 / 2; margin: 8px 0 28px; }
.recipe-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-box { border: 1px solid var(--line); border-top: 4px solid var(--sage-soft); padding: clamp(22px, 4vw, 40px); scroll-margin-top: 130px; }
.card-box > h2 { font-size: 32px; margin-bottom: 4px; }
.card-cols { display: grid; grid-template-columns: minmax(240px, 0.85fr) 1.4fr; gap: clamp(24px, 4vw, 52px); margin-top: 22px; }
@media (max-width: 760px) { .card-cols { grid-template-columns: 1fr; } }
.card-cols h3 { font: 600 14px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 10px; }
.hint { color: var(--ink-3); font-size: 14px; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 6px; }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li + li .ing { border-top: 1px solid var(--line); }
.ing { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 0; background: none; border: none; font-size: 18px; }
.ing .box { flex: none; width: 22px; height: 22px; margin-top: 3px; border: 1.5px solid #C5CBC6; border-radius: 4px; display: grid; place-items: center; background: #fff; }
.ing .box svg { width: 14px; height: 14px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ing[aria-checked="true"] .box { background: var(--sage-soft); border-color: var(--sage); }
.ing[aria-checked="true"] .box svg { opacity: 1; }
.ing[aria-checked="true"] .txt { color: var(--ink-3); text-decoration: line-through; }
.ing-head { padding: 14px 0 4px; font: 500 italic 19px/1.3 var(--serif); color: var(--ink); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.step { display: grid; grid-template-columns: 40px 1fr; gap: 12px; width: 100%; text-align: left; padding: 10px 8px 12px 0; background: none; border: none; font-size: 18px; line-height: 1.65; border-radius: 4px; }
.step .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 500 17px/1 var(--serif); background: var(--soft); color: var(--ink); margin-top: 2px; }
.step:hover { background: var(--soft); }
.step[aria-checked="true"] { color: var(--ink-3); }
.step[aria-checked="true"] .num { background: var(--sage-soft); color: var(--ink); }
.notes { margin-top: 26px; padding: 18px 22px; background: var(--soft); border-left: 3px solid var(--sage); font-size: 17px; white-space: pre-wrap; }
.notes strong { display: block; font: 500 20px/1.3 var(--serif); margin-bottom: 4px; }
.byline { margin-top: 18px; color: var(--ink-3); font-size: 14px; }

/* Cook mode: bigger text for reading from across the kitchen */
body.cook .ing { font-size: 21px; }
body.cook .step { font-size: 22px; }

/* ---------- forms ---------- */
.form { max-width: 760px; margin: 0 auto; display: grid; gap: 20px; }
.form h1 { font-size: clamp(34px, 4vw, 48px); font-weight: 400; }
.field { display: grid; gap: 8px; }
.field label, .field .flabel { font-weight: 600; }
.field small { color: var(--ink-3); font-size: 15px; }
.field input, .field select, .field textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid #D5D9D5; border-radius: 4px; background: #fff; }
.field textarea { min-height: 180px; line-height: 1.6; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .row3, .row2 { grid-template-columns: 1fr; } }
.photo-pick { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-prev { width: 150px; aspect-ratio: 1 / 1; overflow: hidden; background: var(--soft); border: 1px dashed #C5CBC6; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; border-radius: 4px; }
.photo-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.error { color: var(--warn); font-weight: 600; min-height: 1em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }
.back { justify-self: start; }

.auth { max-width: 420px; margin: 6vh auto 0; display: grid; gap: 18px; }
.auth h1 { font-size: 44px; font-weight: 400; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20; background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 4px; font-weight: 600; font-size: 16px; }
.confirm { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: rgba(30, 35, 32, 0.45); }
.confirm-box { background: #fff; border-radius: 6px; padding: 24px; max-width: 420px; display: grid; gap: 16px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.4); }

.site-foot { border-top: 1px solid var(--line); padding: 26px clamp(16px, 4vw, 40px) calc(26px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; color: var(--ink-3); font-size: 15px; }
.site-foot span:first-child { font: 500 17px/1.2 var(--serif); color: var(--ink); }

@media (max-width: 560px) {
  body { font-size: 17px; }
  main { padding-top: 22px; }
  .head-actions .btn { min-height: 40px; padding: 0 12px; font-size: 15px; }
  .head-actions .btn span.long { display: none; }
  .grid { grid-template-columns: 1fr 1fr; gap: 24px 12px; }
  .card h3 { font-size: 18px; }
  .card .meta { font-size: 13px; }
  .cats { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .cat span { font-size: 16px; }
  .fact { padding: 8px 14px; }
}

@media print {
  .site-head, .site-foot, .crumbs, .recipe-actions, .recipe-photo, .hint { display: none !important; }
  body { font-size: 12pt; }
  main { padding: 0; }
  .card-box { border: none; padding: 0; }
  .ing .box { border-color: #999; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
