/* Recipe tracker — direction B ("Fresh, kitchen-first") from the mock-up. */

:root {
  --bg: #f8faf8;
  --surface: #ffffff;
  --ink: #16201b;
  --ink-2: #3b4740;
  --muted: #56635b;
  --line: #dde3de;
  --field: #b9c2bb;
  --accent: #1b6b48;
  --accent-hover: #124a32;
  --accent-ink: #14533a;
  --tint: #e4f0e8;
  --tile: #e3e8e4;
  --danger: #a3261b;
  --danger-tint: #fbe9e7;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: Figtree, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.4; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.page { min-height: 100vh; padding: 28px 20px 96px; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; }
.narrow { width: 100%; max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 40px; }

/* ---- header ---------------------------------------------------------- */
.site-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 36px; }
.brand { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.site-nav { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 4px 28px; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 17px; font-weight: 600; text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 8px; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.who { font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.who button { border: 0; background: none; padding: 0; min-height: 44px; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

/* ---- buttons --------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-size: 16px; font-weight: 700; text-decoration: none; }
.btn:hover { color: var(--ink); background: rgba(22, 32, 27, 0.05); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); color: var(--danger); }
.btn-lg { min-height: 52px; padding: 0 30px; font-size: 17px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.link-btn { min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); font-size: 15px; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.dashed-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px dashed var(--muted); background: transparent; color: var(--ink-2); font-size: 16px; font-weight: 600; }

/* ---- form fields ----------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-width: 0; border: 1px solid var(--field); border-radius: 12px; background: var(--surface); font-size: 17px; color: var(--ink); }
.input, .select { height: 50px; padding: 0 16px; }
.select { padding: 0 12px; }
.textarea { padding: 12px 16px; line-height: 1.5; resize: vertical; }
.input-strong { font-size: 19px; font-weight: 600; height: 52px; }
.search { width: 100%; height: 60px; padding: 0 22px; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--surface); font-size: 19px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 16px; }
.hint { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); }

/* ---- messages -------------------------------------------------------- */
.notice { margin: 0; padding: 14px 18px; border-radius: 12px; background: var(--tint); color: var(--accent-ink); font-size: 16px; line-height: 1.5; }
.notice.error { background: var(--danger-tint); color: var(--danger); }
.empty { margin: 0; padding: 40px 4px; font-size: 18px; color: var(--muted); }
.loading { padding: 40px 4px; color: var(--muted); }

/* ---- skill dots ------------------------------------------------------ */
.skill { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.dots { display: inline-flex; gap: 3px; }
.dots span { width: 9px; height: 9px; border-radius: 999px; border: 1.5px solid var(--ink); }
.dots span.on { background: var(--ink); }
.skill-lg { font-size: 18px; font-weight: 700; }
.skill-lg .dots { gap: 4px; }
.skill-lg .dots span { width: 11px; height: 11px; }

/* ---- library --------------------------------------------------------- */
.filters-toggle { display: flex; }
.filters { display: none; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px 10px; }
.filters[data-open="true"] { display: grid; }
@media (min-width: 720px) {
  .filters-toggle { display: none; }
  .filters { display: grid; }
}
.filters .select { height: 46px; padding: 0 10px; border-radius: 10px; font-size: 15px; }
.filters .field > label { font-size: 13px; }

.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); font-size: 15px; font-weight: 600; color: var(--muted); min-height: 44px; }
.recipe-row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; padding: 20px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.recipe-row:hover { color: var(--ink); background: rgba(27, 107, 72, 0.04); }
.thumb { flex: none; width: 72px; height: 72px; border-radius: 14px; background: var(--tile); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row-title { font-family: var(--display); font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.row-sub { font-size: 15px; line-height: 1.4; color: var(--muted); }
.row-meta { display: flex; flex-wrap: wrap; gap: 6px 24px; align-items: center; font-size: 16px; }
.row-time { min-width: 104px; font-weight: 700; font-variant-numeric: tabular-nums; }
.row-meta .skill { min-width: 112px; }

/* ---- recipe page ----------------------------------------------------- */
.recipe-head { display: flex; flex-direction: column; gap: 24px; }
.title-row { display: flex; flex-wrap: wrap; gap: 24px 28px; align-items: center; }
.title-row h1 { flex: 2 1 360px; min-width: 0; margin: 0; font-family: var(--display); font-size: clamp(34px, 6vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
.hero { flex: 1 1 240px; min-width: 0; margin: 0; }
.hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px; display: block; background: var(--tile); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 16px 24px; padding: 18px 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.fact { display: flex; flex-direction: column; gap: 2px; }
.fact-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.fact-value { font-size: 24px; font-weight: 700; }
.fact-note { font-size: 14px; color: var(--muted); }
.difficulty { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
.difficulty p { flex: 1 1 300px; margin: 0; font-size: 17px; line-height: 1.5; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 13px; border-radius: 999px; border: 1px solid var(--field); font-size: 15px; font-weight: 500; }
.byline { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; font-size: 16px; color: var(--muted); }
.byline a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; overflow-wrap: anywhere; }

.section-title { margin: 0; font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -0.01em; }
.ingredients { display: flex; flex-direction: column; gap: 20px; }
.ing-group h3 { margin: 0; padding-bottom: 8px; border-bottom: 1px solid var(--ink); font-size: 15px; font-weight: 700; color: var(--accent); }
.ing-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.ing-list li { display: flex; gap: 18px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 20px; line-height: 1.35; }
.ing-amt { flex: none; width: 96px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.ing-orig { font-size: 17px; color: var(--muted); }
.steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 28px; }
.steps li { display: flex; gap: 20px; align-items: baseline; }
.step-n { flex: none; width: 40px; font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.step-text { font-size: 20px; line-height: 1.6; text-wrap: pretty; white-space: pre-line; }
.notes { display: flex; flex-direction: column; gap: 14px; background: var(--tint); border-radius: 18px; padding: clamp(20px, 4vw, 32px); }
.notes h2 { margin: 0; font-family: var(--display); font-size: 26px; font-weight: 700; }
.notes ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; font-size: 18px; line-height: 1.55; }
.notes li { display: flex; flex-direction: column; gap: 2px; }
.note-label { font-size: 14px; font-weight: 700; color: var(--accent-ink); }

@media (max-width: 520px) {
  .ing-list li { font-size: 18px; gap: 12px; }
  .ing-amt { width: 72px; }
  .step-text { font-size: 18px; }
  .steps li { gap: 14px; }
  .step-n { width: 30px; font-size: 30px; }
}

/* ---- add / edit form ------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 44px; }
.form-section { display: flex; flex-direction: column; gap: 16px; }
.form-section > h2 { margin: 0; padding-bottom: 10px; border-bottom: 2px solid var(--ink); font-family: var(--display); font-size: 24px; font-weight: 700; }
.page-title { margin: 0; font-family: var(--display); font-size: clamp(32px, 5vw, 44px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.panel { display: flex; flex-direction: column; gap: 14px; background: var(--tint); border-radius: 18px; padding: clamp(20px, 4vw, 28px); }
.panel h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 700; }

.toggle-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toggle { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--field); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; }
.toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.toggle-lg { min-height: 48px; padding: 0 22px; font-size: 17px; }
.pill-input { width: 160px; height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--surface); font-size: 16px; }
.tag-group { display: flex; flex-direction: column; gap: 6px; }
.new-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding-top: 14px; border-top: 1px solid var(--line); }

.ing-rows, .step-rows { display: flex; flex-direction: column; gap: 10px; }
.ing-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ing-row .amt { flex: 0 0 110px; font-weight: 700; }
.ing-row .name { flex: 3 1 180px; }
.ing-row .orig { flex: 1 1 140px; color: var(--muted); }
.ing-row.section-row .name { flex: 1 1 260px; font-weight: 700; color: var(--accent); }
.row-tools { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.icon-btn:hover { background: var(--tile); color: var(--ink); }
.step-row { display: flex; gap: 14px; align-items: flex-start; }
.step-row .step-n { width: 32px; padding-top: 8px; font-size: 30px; }
.step-row .textarea { flex: 1 1 auto; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-actions .spacer { flex: 1; }

.photo-edit { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.photo-slot { flex: none; width: 132px; height: 99px; border: 1.5px dashed var(--muted); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--muted); overflow: hidden; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot.has-photo { border: 0; }
.photo-side { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* ---- use what I have ------------------------------------------------- */
.intro { display: flex; flex-direction: column; gap: 6px; }
.intro h1 { margin: 0; font-family: var(--display); font-size: clamp(30px, 5vw, 42px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.intro p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted); }
.finder { width: 100%; max-width: 640px; display: flex; flex-direction: column; gap: 6px; position: relative; }
.suggest { display: flex; flex-direction: column; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--surface); overflow: hidden; box-shadow: 0 10px 24px rgba(22, 32, 27, 0.12); }
.suggest button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 54px; padding: 0 22px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 18px; text-align: left; }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button[aria-selected="true"] { background: var(--tint); }
.suggest button span:first-child { font-weight: 700; }
.suggest button span:last-child { font-size: 15px; color: var(--muted); }
.suggest p { margin: 0; padding: 16px 22px; font-size: 16px; color: var(--muted); }
.picked { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.picked-chip { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px 0 20px; border-radius: 999px; border: 1.5px solid var(--accent); background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; }
.mode { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.mode > span { font-size: 16px; font-weight: 600; color: var(--muted); }
.segmented { display: flex; padding: 4px; gap: 4px; border-radius: 999px; background: var(--tile); }
.segmented button { min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font-size: 16px; font-weight: 700; }
.segmented button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.match-summary { margin: 0; padding-bottom: 10px; border-bottom: 2px solid var(--ink); font-size: 15px; font-weight: 600; line-height: 1.5; color: var(--muted); }
.match-frac { flex: none; min-width: 64px; display: flex; flex-direction: column; align-items: flex-start; }
.match-frac strong { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.match-frac span { font-size: 13px; font-weight: 600; color: var(--muted); }
.uses { font-weight: 700; color: var(--accent-ink); }

/* ---- people (admins) ------------------------------------------------- */
.people-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.people-list li { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.people-list .p-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.people-list .p-email { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.people-list .p-sub { font-size: 14px; color: var(--muted); }
.badge { padding: 3px 10px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700; }

/* ---- sign-in --------------------------------------------------------- */
.signin { max-width: 460px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 20px; align-items: flex-start; }
.signin h1 { margin: 0; font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -0.02em; }
.signin p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted); }

@media (max-width: 520px) {
  .page { padding-top: 18px; }
  .site-header { gap: 4px 20px; }
  .brand { flex: 1 1 auto; }
  .who-name { display: none; }
  .header-actions .btn { min-height: 44px; padding: 0 18px; }
  .site-nav { order: 3; flex-basis: 100%; gap: 4px 22px; }
}

/* "Start from a link" panel on Add a recipe */
.import-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.panel .panel-label { color: var(--accent-ink); }
.input-dark { border: 1.5px solid var(--ink, #16201b); height: 52px; }
.panel-msg { margin: 0; font-size: 16px; line-height: 1.5; color: var(--accent-ink); }
.panel-msg.error { color: var(--danger); font-weight: 600; }
