/* ============================================================
   Simple Recipes — digital recipe book
   Design tokens + view styles. Source of truth for values:
   design_handoff_recipe_app/README.md  (§ Design Tokens, § Screens)
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face { font-family:"Fraunces"; src:url("fonts/Fraunces-Light.ttf") format("truetype"); font-weight:300; font-style:normal; font-display:swap; }
@font-face { font-family:"Fraunces"; src:url("fonts/Fraunces-Regular.ttf") format("truetype"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Fraunces"; src:url("fonts/Fraunces-SemiBold.ttf") format("truetype"); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:"Fraunces"; src:url("fonts/Fraunces-Italic.ttf") format("truetype"); font-weight:400; font-style:italic; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url("fonts/SourceSerif4-Regular.ttf") format("truetype"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url("fonts/SourceSerif4-SemiBold.ttf") format("truetype"); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url("fonts/SourceSerif4-Bold.ttf") format("truetype"); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:"Source Serif 4"; src:url("fonts/SourceSerif4-Italic.ttf") format("truetype"); font-weight:400; font-style:italic; font-display:swap; }

/* ---------- Design tokens ---------- */
:root {
  --page: #FBF8F2;        /* cream app bg */
  --surface: #FFFFFF;
  --surface-2: #FFFDF9;   /* inputs */
  --tint: #F3ECE0;        /* warm tile / footer text */
  --ink: #2A2622;         /* primary text, dark footer bg */
  --ink-soft: #3A342E;    /* body / step text */
  --muted: #5B544C;
  --muted-2: #7C7368;     /* subheads */
  --stone: #A39A8C;       /* meta, captions */
  --placeholder: #B3A99C;
  --footer-text: #F3ECE0;
  --footer-num: #E9A584;

  --hair-06: rgba(42,38,34,0.06);
  --hair-08: rgba(42,38,34,0.08);
  --hair-09: rgba(42,38,34,0.09);
  --hair-12: rgba(42,38,34,0.12);
  --hair-14: rgba(42,38,34,0.14);
  --hair-16: rgba(42,38,34,0.16);

  /* Accent — Sage (default, shipped) */
  --accent: #6F7F5C;
  --accent-tint: rgba(111,127,92,0.10);
  --accent-line: rgba(111,127,92,0.30);

  --display: "Fraunces", Georgia, serif;
  --body: "Source Serif 4", Georgia, serif;

  --col: 680px;
  --pad: 22px;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* shared label / eyebrow style — the digital echo of the print spaced caps */
.eyebrow {
  font-family: var(--body); font-weight: 600;
  text-transform: uppercase; color: var(--accent);
  font-size: 11.5px; letter-spacing: 0.24em;
}

/* entrance animation (translateY only, no opacity — per spec) */
@keyframes fadeUp { from { transform: translateY(7px); } to { transform: translateY(0); } }
.view { animation: fadeUp 0.45s ease both; }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } }

/* generic centered content column */
.col { width: 100%; max-width: var(--col); margin: 0 auto; }

/* sticky translucent header shared by home/recipe/contributor */
.appbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(251,248,242,0.88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair-08);
}
.appbar-inner {
  max-width: var(--col); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--pad);
  padding-top: max(18px, env(safe-area-inset-top));
}
.backlink {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--display); font-size: 16px; color: var(--muted);
  min-height: 44px;
}
.backlink .chev { color: var(--stone); }
.wordmark { font-family: var(--display); font-weight: 500; font-size: 20px; color: var(--ink); }
.appbar .note { font-family: var(--display); font-style: italic; font-size: 15px; color: var(--stone); }

/* pill buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--body); font-size: 15px;
  border-radius: 999px; min-height: 48px; padding: 13px 32px;
  transition: filter 0.15s ease;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn .ico { width: 1em; height: 1em; }

/* ============================================================
   1. Cover
   ============================================================ */
.cover {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  padding: 48px 28px; gap: 0;
}
.cover .kicker { font-family: var(--display); font-weight: 300; font-style: italic; font-size: 23px; color: var(--stone); margin: 0 0 14px; }
.cover .title { font-family: var(--display); font-weight: 300; font-size: clamp(58px, 17vw, 116px); line-height: 0.92; letter-spacing: -0.015em; color: var(--ink); margin: 0; }
.cover .title span { display: block; }
.cover .rule { width: 52px; height: 1px; background: var(--accent); margin: 32px 0; }
.cover .attribution { font-family: var(--body); font-weight: 600; font-size: 11.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--stone); margin: 0; }
.cover .actions { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.cover .textlink {
  font-family: var(--display); font-style: italic; font-size: 16px; color: var(--muted);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent-line);
}
.cover .pdflink { font-family: var(--body); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); text-decoration: none; margin-top: 6px; }
.cover .pdflink:hover { color: var(--muted); }

/* ============================================================
   2. Dedication
   ============================================================ */
.dedication { position: relative; max-width: 560px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 96px 30px 64px; }
.dedication .backlink { position: absolute; top: 22px; left: 22px; }
.dedication .eyebrow { letter-spacing: 0.26em; margin-bottom: 28px; }
.dedication .body { font-family: var(--body); font-size: 19px; line-height: 1.72; color: var(--ink-soft); margin: 0 0 22px; }
.dedication .signoff { font-family: var(--display); font-style: italic; font-weight: 300; font-size: 21px; color: var(--muted); margin-top: 18px; }
.dedication .org { font-family: var(--display); font-weight: 500; font-size: 24px; color: var(--ink); margin: 6px 0 22px; line-height: 1.2; }
.dedication .leaders { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 20px; margin-bottom: 36px; }
.dedication .leader { font-family: var(--body); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--stone); }

/* ============================================================
   3. Home / Contents
   ============================================================ */
.home-content { max-width: var(--col); margin: 0 auto; padding: 24px var(--pad) 90px; }
.search { position: relative; margin-bottom: 18px; }
.search .mag { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--placeholder); pointer-events: none; }
.search input {
  width: 100%; font-family: var(--body); font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--hair-16); border-radius: 13px;
  padding: 13px 42px;
}
.search input::placeholder { color: var(--placeholder); }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; color: var(--stone); font-size: 20px; }

.chips { display: flex; gap: 9px; overflow-x: auto; padding: 2px 0 4px; margin-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; font-family: var(--body); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: transparent; border: 1px solid var(--hair-16);
  border-radius: 999px; padding: 8px 15px; white-space: nowrap; min-height: 38px;
}
.chip[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.resultcount { font-family: var(--body); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); margin: 14px 2px 2px; }
.noresults { text-align: center; font-family: var(--display); font-style: italic; font-size: 21px; color: var(--stone); padding: 60px 0; }

.catsection { margin-top: 26px; }
.catdivider { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.catdivider h2 { font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin: 0; white-space: nowrap; }
.catdivider .line { flex: 1; height: 1px; background: var(--hair-14); }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left;
  padding: 15px 8px; border-bottom: 1px solid var(--hair-09); border-radius: 8px;
  transition: background 0.12s ease;
}
.row:hover { background: var(--accent-tint); }
.row .row-title { font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--ink); line-height: 1.15; }
.row .row-sub { font-family: var(--body); font-size: 13.5px; color: var(--stone); margin-top: 3px; }
.row .row-eyebrow { font-family: var(--body); font-weight: 600; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.row .chev { color: var(--accent); font-size: 22px; flex: 0 0 auto; }

/* ============================================================
   4. Recipe detail
   ============================================================ */
.recipe { max-width: var(--col); margin: 0 auto; padding: 30px 24px 96px; }
.recipe .cat { display: block; margin-bottom: 12px; }
.recipe h1 { font-family: var(--display); font-weight: 500; font-size: clamp(33px, 7.5vw, 48px); line-height: 1.06; color: var(--ink); margin: 0 0 14px; }
.recipe .sharedby { font-family: var(--display); font-style: italic; font-size: 18px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.recipe .sharedby .arrow { color: var(--accent); }
.recipe .cookbtn { margin-top: 22px; }
.recipe .note { font-family: var(--display); font-style: italic; font-weight: 300; font-size: 18px; line-height: 1.5; color: var(--muted); border-left: 2px solid var(--accent-line); padding-left: 18px; margin: 26px 0 0; }

.section-label { display: flex; align-items: center; gap: 14px; margin: 34px 0 16px; }
.section-label .lbl { font-family: var(--body); font-weight: 600; font-size: 12px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.section-label .line { flex: 1; height: 1px; background: var(--accent-line); }

.ingsub { font-family: var(--body); font-weight: 600; font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); margin: 18px 0 8px; }
ul.ing { list-style: none; margin: 0; padding: 0; }
ul.ing li { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; line-height: 1.5; color: var(--ink); padding: 4px 0; }
ul.ing li::before { content: ""; flex: 0 0 auto; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 0.62em; }

ol.met { list-style: none; margin: 0; padding: 0; }
ol.met li { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--hair-06); }
ol.met li:last-child { border-bottom: none; }
ol.met .num { font-family: var(--display); font-weight: 300; font-size: 26px; color: var(--accent); min-width: 30px; line-height: 1.1; }
ol.met .step { font-size: 17px; line-height: 1.62; color: var(--ink-soft); }

.recipe .footmeta { margin-top: 40px; font-family: var(--body); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.recipe .footmeta button { letter-spacing: 0.08em; text-transform: uppercase; color: var(--stone); }
.recipe .footmeta button:hover { color: var(--muted); }

/* ============================================================
   5. Contributor
   ============================================================ */
.contributor { max-width: var(--col); margin: 0 auto; padding: 42px 24px 96px; }
.contributor .eyebrow { letter-spacing: 0.24em; }
.contributor h1 { font-family: var(--display); font-weight: 500; font-size: clamp(34px, 8vw, 52px); line-height: 1.05; color: var(--ink); margin: 12px 0 4px; }
.contributor .count { font-family: var(--body); font-size: 13px; letter-spacing: 0.06em; color: var(--stone); margin-bottom: 14px; }

/* ============================================================
   6. Cook mode
   ============================================================ */
.cook { display: flex; flex-direction: column; height: 100dvh; }
.cook-head { padding: 24px 24px 16px; padding-top: max(20px, env(safe-area-inset-top)); border-bottom: 1px solid var(--hair-08); }
.cook-head .toprow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cook-head .back { color: var(--stone); font-size: 22px; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; }
.cook-head .modelabel { font-family: var(--body); font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--stone); }
.cook-head .stepcount { font-family: var(--body); font-size: 13px; color: var(--accent); }
.cook-head h1 { font-family: var(--display); font-weight: 500; font-size: 26px; color: var(--ink); margin: 10px 0 14px; line-height: 1.1; }
.progress { display: flex; gap: 6px; }
.progress .seg { flex: 1; height: 3px; border-radius: 2px; background: var(--hair-12); transition: background 0.2s ease; }
.progress .seg.on { background: var(--accent); }

.cook-mid { flex: 1; overflow-y: auto; padding: 20px 24px 28px; -webkit-overflow-scrolling: touch; }
.cook-mid .gatherrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.cook-mid .gathered { font-family: var(--body); font-size: 12.5px; color: var(--stone); }
.checkrow { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 9px 0; }
.checkrow .circle { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid rgba(42,38,34,0.25); display: flex; align-items: center; justify-content: center; transition: background 0.12s ease, border-color 0.12s ease; }
.checkrow .circle svg { width: 15px; height: 15px; color: #fff; opacity: 0; }
.checkrow .label { font-size: 17px; color: var(--ink); line-height: 1.4; }
.checkrow[aria-checked="true"] .circle { background: var(--accent); border-color: var(--accent); }
.checkrow[aria-checked="true"] .circle svg { opacity: 1; }
.checkrow[aria-checked="true"] .label { color: var(--placeholder); text-decoration: line-through; }
.cook-mid .ingsub { color: var(--muted-2); }

.cook-foot { background: var(--ink); padding: 20px 24px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.cook-foot .current { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.cook-foot .num { font-family: var(--display); font-weight: 300; font-size: 38px; color: var(--footer-num); line-height: 1; min-width: 40px; }
.cook-foot .text { font-size: 16px; line-height: 1.5; color: var(--footer-text); padding-top: 2px; }
.cook-foot .btns { display: flex; gap: 12px; }
.cook-foot .btn-back { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,0.26); color: #E5E0D6; border-radius: 999px; min-height: 52px; font-family: var(--body); font-size: 15px; }
.cook-foot .btn-next { flex: 2; background: var(--accent); color: #fff; border-radius: 999px; min-height: 52px; font-family: var(--body); font-size: 15px; }
.cook-foot .btn-back:disabled { opacity: 0.4; cursor: default; }
