/* Reel Recipes look: cream, coral, navy, green and gold. Light theme only (color-scheme: light).
   Fonts are self-hosted (CSP default-src 'self'); Fraunces and Nunito Sans are OFL, see fonts/OFL-*.txt. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/Fraunces.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito Sans";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/fonts/NunitoSans.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --bg: #f3ede4;          /* cream */
  --card: #fffcf7;
  --sunk: #f8f3eb;        /* input wells */
  --ink: #2f4a6d;         /* navy */
  --muted: #5e6b7a;
  --line: #e6dccd;
  --coral: #d9674a;       /* decorative only */
  --accent: #b4502f;      /* button fill (white text) */
  --accent-ink: #ffffff;
  --accent-text: #a9482b; /* links / coral text */
  --accent-tint: #fbe3da;
  --green: #6e8b4f;       /* checks (non-text) */
  --green-text: #4f6b34;
  --green-tint: #e8eedd;
  --gold: #c9a24b;        /* decorative */
  --gold-text: #7a5c17;
  --gold-tint: #f7ebcb;
  --danger: #9c3324;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tap: 48px;
  --tabs-h: 64px;
  --r: 16px;
  --shadow: 0 1px 2px rgba(47, 74, 109, .06), 0 6px 18px rgba(47, 74, 109, .07);
  color-scheme: light;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  font: 17px/1.5 var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-optical-sizing: auto; text-wrap: balance; }
p, label, .banner, .meta, .item .name, .chip { text-wrap: pretty; }
a { color: var(--accent-text); text-underline-offset: 3px; }
svg { flex: 0 0 auto; }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 16px) 20px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.top .titles { min-width: 0; }
.brand {
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
  font: 800 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text);
}
.brand svg { width: 16px; height: 16px; }
.top h1 { font-size: 30px; line-height: 1.12; font-weight: 600; margin: 0; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Recipe titles: short ones are balanced; long ones (class "long", > 32 chars) wrap "pretty" so the first line stays full.
   Sizes are set so the first two words of a long title fit on line one at 320px. */
body[data-screen="recipe"] .top h1 { white-space: normal; overflow-wrap: break-word; text-wrap: balance; font-size: clamp(24px, 7.4vw, 30px); }
body[data-screen="recipe"] .top h1.long, .rcard .t.long { text-wrap: pretty; }
.net { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--gold-tint); color: var(--gold-text); font-weight: 700; margin-bottom: 4px; }

main {
  max-width: 680px; margin: 0 auto;
  /* keep content clear of the bottom tab bar + home indicator */
  padding: 8px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px);
}

/* ---------- bottom tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tabs a {
  flex: 1; min-height: var(--tabs-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font: 700 12px/1 var(--sans); letter-spacing: .02em;
}
.tabs a svg { width: 24px; height: 24px; }
.tabs a.active { color: var(--accent-text); }
.tabs a[data-tab="new"] svg { background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 4px; width: 32px; height: 32px; margin: -4px 0 -1px; }

/* ---------- basics */
.pad { padding: 8px 4px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 0 0 14px; box-shadow: var(--shadow); }
.banner { background: var(--gold-tint); color: var(--ink); border-radius: 14px; padding: 12px 16px; margin: 0 0 14px; border-left: 4px solid var(--gold); }
.error { color: var(--danger); font-weight: 600; }
h2 { font-size: 21px; font-weight: 600; color: var(--ink); margin: 24px 4px 10px; display: flex; align-items: center; gap: 10px; }
h2::after { content: ""; flex: 1; height: 1px; background: var(--line); }
label { display: block; font-weight: 700; font-size: 15px; margin: 14px 0 6px; color: var(--ink); }
.card > label:first-child { margin-top: 0; }
input, textarea, select, button { font: inherit; color: inherit; }
input, textarea, select {
  width: 100%; min-height: var(--tap); padding: 11px 14px;
  background: var(--sunk); border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 17px; /* >=16px avoids iOS zoom-on-focus */
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: #646b75; opacity: 1; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--coral); box-shadow: 0 0 0 4px var(--accent-tint); background-color: var(--card); }
textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235E6B7A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
button, .btn {
  min-height: var(--tap); padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; font-weight: 700; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:focus-visible, a:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 4px 12px rgba(180, 80, 47, .25); }
button.danger { color: var(--danger); border-color: transparent; background: transparent; }
button.block { width: 100%; }
button:disabled { opacity: .6; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row .shrink { flex: 0 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions > * { flex: 1 1 auto; }

/* ---------- shopping list rows */
.list { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; column-gap: 6px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  margin: 0 0 8px; padding: 2px 8px 2px 0; min-height: 60px;
}
.item .body { display: contents; }
.item .check {
  grid-column: 1; grid-row: 1 / span 4; align-self: center;
  width: 46px; height: 52px; min-height: 52px; border: 0; background: transparent; padding: 0; box-shadow: none;
  display: flex; align-items: center; justify-content: center;
}
.item .box { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #857f75; display: flex; align-items: center; justify-content: center; }
.item.checked .box { background: var(--green); border-color: var(--green); }
.item.checked .box::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.item .name { grid-column: 2; grid-row: 1; padding-top: 10px; font-weight: 700; line-height: 1.3; overflow-wrap: break-word; }
.item .meta { grid-column: 2 / 4; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; margin-top: 2px; }
.item .body > :last-child { padding-bottom: 10px; }
.item.checked { background: transparent; }
.item.checked .name { text-decoration: line-through; text-decoration-color: var(--green); color: var(--muted); font-weight: 600; }
.item .meta.by { color: var(--green-text); font-weight: 600; }
.item .meta.grew { color: var(--accent-text); font-weight: 600; }
.item > select {
  grid-column: 3; grid-row: 1; align-self: start; justify-self: end; margin: 8px 0 0;
  width: auto; min-height: 30px; height: 30px; max-width: 140px; line-height: 28px;
  font-size: 13px; font-weight: 700; padding: 0 26px 0 10px; border-radius: 999px;
  background-color: var(--bg); border-color: transparent; color: var(--muted); background-position: right 9px center;
}
.item.checked > select { background-color: transparent; }
@media (max-width: 479px) {
  .item > select { grid-row: auto; grid-column: 2 / 4; justify-self: start; margin: 4px 0 10px; }
  .item .body > :last-child { padding-bottom: 2px; }
}
.item > button.danger { grid-column: 4; grid-row: 1 / span 4; width: 40px; min-height: 40px; padding: 0; }
@media (max-width: 379px) {
  main { padding-left: 12px; padding-right: 12px; }
  .card { padding: 14px; }
  input, textarea, select { padding-left: 12px; padding-right: 12px; }
  input::placeholder, textarea::placeholder { font-size: 15px; }
}

.cooking { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 6px; padding: 0; }
.cooking .lbl { font-size: 14px; font-weight: 700; color: var(--muted); margin-right: 2px; }
.chip {
  display: inline-block; padding: 5px 12px 5px 5px; border-radius: 18px; line-height: 26px;
  background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--ink); text-decoration: none;
}
.chip .n { color: var(--muted); font-weight: 600; }
.tile {
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
  font: 600 34px/1 var(--serif); color: var(--gold-text);
  background: radial-gradient(circle at 30% 25%, #fbf1d8, var(--gold-tint));
}
.chip .tile { display: inline-flex; vertical-align: top; width: 26px; height: 26px; border-radius: 50%; font-size: 14px; margin-right: 6px; }
.pill {
  display: inline-block; font: 800 11px/1.6 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  padding: 1px 8px; border-radius: 999px; background: var(--gold-tint); color: var(--gold-text); margin: 0 6px 0 0; vertical-align: 1px;
}

/* ---------- recipe cards (Recipes tab) */
.rcard {
  position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; column-gap: 14px; row-gap: 4px; align-items: center;
  grid-template-areas: "tile title title" "tile meta cook" "step step step";
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 10px 12px 10px 10px; margin: 0 0 12px; box-shadow: var(--shadow);
}
.rcard.planned { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.rcard > .tile { grid-area: tile; width: 76px; height: 76px; border-radius: 13px; align-self: center; }
.rcard .body { display: contents; }
.rcard .t { grid-area: title; align-self: end; padding-top: 4px; font: 600 19px/1.22 var(--serif); color: var(--ink); text-decoration: none; display: block; text-wrap: balance; overflow-wrap: break-word; }
.rcard .t:hover { color: var(--accent-text); }
.rcard .meta { grid-area: meta; align-self: center; font-size: 14px; color: var(--muted); }
.rcard .meta .on { color: var(--green-text); font-weight: 700; white-space: nowrap; }
.rcard .side { grid-area: cook; display: flex; flex-direction: column; align-items: flex-end; }
.cook { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; border: 2px solid #857f75; background: transparent; box-shadow: none; }
.cook.on { background: var(--green); border-color: var(--green); }
.cook.on::after { content: ""; width: 8px; height: 15px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -2px); }
.rcard .stepper-wrap { grid-area: step; margin-left: 90px; display: flex; justify-content: flex-end; border-top: 1px dashed var(--line); padding-top: 8px; margin-top: -2px; }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 999px; padding: 3px; }
.stepper button { width: 34px; min-height: 34px; height: 34px; padding: 0; border: 0; background: var(--card); font-size: 18px; box-shadow: 0 1px 2px rgba(47, 74, 109, .12); }
.stepper output { min-width: 2.4ch; text-align: center; font-weight: 700; font-size: 15px; }
@media (max-width: 379px) {
  .rcard { grid-template-columns: 60px minmax(0, 1fr) auto; column-gap: 12px; }
  .rcard .stepper-wrap { margin-left: 72px; }
  .rcard > .tile { width: 60px; height: 60px; border-radius: 11px; font-size: 28px; }
  .rcard .t { font-size: 17px; }
}

/* ---------- sign in */
body[data-screen="signin"] .top { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; }
body[data-screen="signin"] main { padding-top: calc(env(safe-area-inset-top) + 40px); max-width: 460px; }
.hero-mark { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 8px 22px; }
.hero-mark .plate { width: 88px; height: 88px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; margin-bottom: 18px; border: 1px solid var(--line); }
.hero-mark .plate svg { width: 46px; height: 46px; }
.hero-mark .word { font: 600 36px/1.05 var(--serif); letter-spacing: -.015em; margin: 0; color: var(--ink); }
.hero-mark .word em { font-style: normal; color: var(--accent-text); }
.hero-mark > p:not(.word) { margin: 12px 0 0; max-width: 32ch; }
#pin { font-weight: 700; font-size: 24px; letter-spacing: .28em; text-align: center; font-variant-numeric: tabular-nums; }
#pin::placeholder { letter-spacing: .28em; font-weight: 400; }
.signin-alt { text-align: center; }

/* ---------- add recipe */
#url { padding-left: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235E6B7A' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.7 0l3.2-3.2a4 4 0 0 0-5.7-5.7l-1 1'/%3E%3Cpath d='M14 10a4 4 0 0 0-5.7 0l-3.2 3.2a4 4 0 0 0 5.7 5.7l1-1'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
#caption { min-height: 190px; }
@media (max-width: 379px) { #url { padding-left: 12px; background-image: none; } }
.note { padding-left: 28px; margin: 12px 0 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236E8B4F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l7 3v5.5c0 4.3-3 7.8-7 9.5-4-1.7-7-5.2-7-9.5V6z'/%3E%3Cpath d='M9 12l2.2 2.2L15.5 10'/%3E%3C/svg%3E") no-repeat 0 2px; }

/* ---------- recipe detail */
.dhead { display: flex; align-items: center; gap: 14px; margin: 0 4px 16px; }
.dhead > .tile { width: 64px; height: 64px; border-radius: 14px; font-size: 30px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.facts span { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.facts span.on { background: var(--green-tint); border-color: transparent; color: var(--green-text); }
.back {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px 0 10px; margin: 4px 0 14px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink);
  font: 700 14px/1 var(--sans); text-decoration: none; box-shadow: var(--shadow);
}
.back::before { content: ""; width: 8px; height: 8px; border: solid currentColor; border-width: 0 0 2.4px 2.4px; transform: rotate(45deg); margin: 0 4px 0 2px; }
.ing-row { border-top: 1px solid var(--line); padding: 12px 0; }
.ing-row:first-of-type { border-top: 0; padding-top: 0; }
.ing-grid { display: grid; grid-template-columns: 60px 72px minmax(0, 1fr) auto; gap: 8px; }
.ing-grid input, .ing-grid select { min-height: 42px; padding: 8px 10px; font-size: 16px; }
.ing-grid .wide { grid-column: 1 / 4; grid-row: 1; font-weight: 700; }
.ing-grid > button.danger { grid-column: 4; grid-row: 1; min-height: 42px; padding: 0 8px; font-size: 15px; }
.ing-grid > input:nth-child(2) { grid-column: 1; grid-row: 2; }
.ing-grid > input:nth-child(3) { grid-column: 2; grid-row: 2; }
.ing-grid > select { grid-column: 3 / 5; grid-row: 2; font-size: 14px; font-weight: 700; color: var(--muted); background-color: var(--bg); border-color: transparent; border-radius: 999px; padding-right: 30px; }
.ing-grid > input:nth-child(4) { grid-column: 1 / 5; grid-row: 3; font-size: 15px; }
@media (max-width: 379px) {
  .ing-grid { grid-template-columns: 52px 60px minmax(0, 1fr) auto; }
  .ing-grid input { padding-left: 8px; padding-right: 8px; }
  .ing-grid > select { font-size: 13px; padding-left: 10px; padding-right: 26px; background-position: right 10px center; }
}
.addline { width: 100%; border-style: dashed; color: var(--accent-text); background: transparent; margin-top: 6px; }
.sticky-actions {
  position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); z-index: 4;
  flex-wrap: wrap; gap: 8px; padding: 12px 16px; margin: 18px -16px 0;
  background: var(--bg); border-top: 1px solid var(--line);
}
.sticky-actions > * { flex: 1 1 auto; padding: 10px 14px; min-width: 0; }
.sticky-actions > .primary { flex-grow: 2; }
.sticky-actions > .danger { flex: 0 0 auto; padding: 10px 8px; }
@media (max-width: 379px) {
  .sticky-actions { margin-left: -12px; margin-right: -12px; padding: 12px; flex-wrap: nowrap; }
  .sticky-actions > * { font-size: 15px; padding: 10px 12px; }
  .sticky-actions > .danger { padding: 10px 6px; }
}

/* ---------- desktop: tabs become a pill nav in the header, recipes become a grid */
@media (min-width: 900px) {
  .top { max-width: 1180px; margin: 0 auto; padding: 28px 380px 16px 40px; align-items: center; min-height: 106px; }
  body { overflow-x: clip; }
  .top { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .top::before { content: ""; position: absolute; z-index: -1; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); background: var(--bg); border-bottom: 1px solid var(--line); }
  .top h1 { font-size: 40px; }
  .net { margin: 0 auto 0 16px; }
  .tabs {
    top: 30px; bottom: auto; left: auto; right: max(40px, calc(50vw - 550px));
    gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); box-shadow: var(--shadow); -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .tabs a { flex: 0 0 auto; flex-direction: row; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; font-size: 15px; }
  .tabs a svg { width: 18px; height: 18px; }
  .tabs a.active { background: var(--accent-tint); }
  .tabs a[data-tab="new"] svg { width: 18px; height: 18px; padding: 0; margin: 0; background: none; color: inherit; border-radius: 0; }
  main { padding: 28px 40px 60px; }
  main:has(> .grid) { max-width: 1180px; }
  .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
  .grid .rcard {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 190px auto auto 1fr;
    grid-template-areas: "tile tile" "title cook" "meta cook" "step step";
    align-content: start; align-items: start; row-gap: 0; column-gap: 12px; padding: 0; overflow: hidden; margin: 0;
  }
  .grid .rcard > .tile { width: 100%; height: 190px; border-radius: 0; font-size: 72px; }
  .grid .rcard .t { font-size: 22px; padding: 18px 0 0 20px; align-self: start; }
  .grid .rcard .meta { padding: 6px 0 18px 20px; align-self: start; }
  .grid .rcard .side { padding: 18px 18px 0 0; }
  .grid .rcard .stepper-wrap { align-self: end; margin: -6px 20px 18px; padding-top: 12px; }
  .sticky-actions { bottom: 0; }
  body[data-screen="signin"] main { padding-top: 80px; }
}
