/* Erling Family Recipes: warm parchment, ink lines, muted watercolor. */

:root {
  --paper: #F3EBDD;
  --paper-2: #ECE1CD;
  --card: #FBF7EF;
  --ink: #2F2923;
  --ink-2: #54493D;
  --soft: #85776A;
  --line: #E3D6C0;
  --line-2: #D6C6AB;
  --ochre: #B07433;
  --ochre-2: #8A5523;
  --ochre-tint: #F3E2C8;
  --slate: #4F6476;
  --slate-tint: #DFE6EA;
  --rust: #A4532F;
  --bar: #2C3540;
  --bar-ink: #F3EBDD;
  --wash-l: 79%;
  --wash-s: 52%;
  --icon-ink: 30%;
  --shadow: 0 1px 2px rgba(70, 45, 20, .07), 0 10px 26px -18px rgba(70, 45, 20, .45);
  --shadow-lift: 0 2px 4px rgba(70, 45, 20, .08), 0 18px 36px -18px rgba(70, 45, 20, .55);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Nunito Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  color-scheme: light;
}
/* Light is the default for everyone; dark only when chosen with the theme button. */
:root[data-theme="dark"] {
  --paper: #1B1814; --paper-2: #221E19; --card: #27221C; --ink: #EEE4D3; --ink-2: #D5C7B0; --soft: #A69882;
  --line: #3A3229; --line-2: #4A4034; --ochre: #D49C5A; --ochre-2: #B07433; --ochre-tint: #3B2D1D;
  --slate: #A3B6C6; --slate-tint: #27313B; --rust: #D9876A; --bar: #121519; --bar-ink: #EEE4D3;
  --wash-l: 30%; --wash-s: 28%; --icon-ink: 82%;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 26px -18px rgba(0,0,0,.8);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.35), 0 18px 36px -18px rgba(0,0,0,.9);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--paper) url(images/paper.svg);
  color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ── top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px; background: var(--bar); color: var(--bar-ink);
  display: flex; align-items: center; gap: 14px; padding: 0 24px;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text b { font-family: var(--serif); font-weight: 600; font-size: 20px; letter-spacing: .2px; white-space: nowrap; }
.brand-text i { font-family: var(--hand); font-style: normal; font-size: 17px; color: #D9B98C; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06);
  display: inline-grid; place-items: center; cursor: pointer; color: inherit;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }
.menu-btn { display: none; }

/* ── page head ── */
.page-head { background: var(--card); border-bottom: 1px solid var(--line); padding: 14px 32px 18px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--soft); min-height: 19px; }
.crumbs a:hover { color: var(--ochre-2); text-decoration: underline; }
.crumbs .sep { opacity: .5; }
.page-head h1 { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.2; }
.page-head h1 .ico { width: 26px; height: 26px; color: var(--ochre); }

/* ── layout ── */
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 28px; max-width: 1480px; margin: 0 auto; padding: 28px 32px 64px; }
.sidebar { position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow: auto; scrollbar-width: thin; }
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.side-head, .side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; color: var(--ink-2); font-weight: 600; font-size: 14px;
}
.side-head { font-family: var(--serif); font-size: 17px; color: var(--ink); padding: 10px 12px; background: var(--ochre-tint); margin-bottom: 6px; }
.side-head .ico { color: var(--ochre-2); }
.side-link .ico { width: 16px; height: 16px; color: var(--soft); }
.side-link:hover { background: var(--paper-2); color: var(--ink); }
.side-link.active { background: var(--ochre-tint); color: var(--ochre-2); }
.side-link.active .ico { color: var(--ochre-2); }
:root[data-theme="dark"] .side-link.active, :root[data-theme="dark"] .side-head { color: var(--ink); }
.side-link .name { flex: 1; min-width: 0; }
.count {
  margin-left: auto; flex: none; font-size: 11.5px; font-weight: 700; color: var(--ochre-2); background: var(--ochre-tint);
  border-radius: 999px; padding: 1px 8px; min-width: 26px; text-align: center;
}
.side-link .count { background: var(--paper-2); color: var(--soft); }
.side-link.active .count { background: var(--card); color: var(--ochre-2); }
.side-group { font-size: 11px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--soft); padding: 14px 10px 4px; }
.side-admin { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; padding: 10px; border-top: 1px dashed var(--line-2); font-size: 12.5px; color: var(--soft); }
.side-admin .ico { width: 14px; height: 14px; }
.side-admin:hover { color: var(--ochre-2); }
.scrim { display: none; }

/* ── search card ── */
.search-card {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 10px 10px 10px 18px; margin-bottom: 28px;
}
.search-icon .ico { color: var(--soft); }
#search {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 16px;
}
#search:focus { outline: 2px solid var(--ochre); outline-offset: -1px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 20px; cursor: pointer; white-space: nowrap;
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--ochre), var(--ochre-2)); box-shadow: 0 6px 16px -8px var(--ochre-2);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary .ico { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; font-size: 14px;
}
.btn-ghost:hover { border-color: var(--ochre); color: var(--ochre-2); }
.btn-ghost .ico { width: 16px; height: 16px; }
.btn-ghost[aria-pressed="true"] { background: var(--ochre-tint); border-color: var(--ochre); color: var(--ochre-2); }

/* ── hero ── */
.hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 34px 20px 30px 40px;
  margin-bottom: 40px; overflow: hidden;
}
.hero-kicker { font-family: var(--hand); font-size: 26px; color: var(--rust); line-height: 1; }
.hero h2 { font-family: var(--serif); font-weight: 600; font-size: 40px; line-height: 1.1; margin: 8px 0 14px; letter-spacing: -.3px; }
.hero p { color: var(--ink-2); margin: 0 0 18px; max-width: 520px; font-size: 15.5px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat { display: flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; font-size: 13.5px; color: var(--ink-2); }
.stat b { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--ochre-tint); color: var(--ochre-2); font-size: 12.5px; }
.stat:hover { border-color: var(--ochre); }
.hero-art { width: 100%; height: auto; display: block; }
:root[data-theme="dark"] .hero-art { filter: invert(.88) hue-rotate(180deg) saturate(.7); }
/* ── sections & rows ── */
.section { margin-bottom: 40px; }
.section-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.section-head .titles { flex: 1; min-width: 0; }
.section-head h2 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; font-family: var(--serif); font-weight: 600; font-size: 23px; line-height: 1.25; }
.section-head h2 a:hover { color: var(--ochre-2); }
.section-head p { margin: 4px 0 0; color: var(--soft); font-size: 14px; }
.view-link { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; font-weight: 700; font-size: 14px; color: var(--ink-2); padding-top: 6px; }
.view-link:hover { color: var(--ochre-2); }
.view-link .ico { width: 16px; height: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); font-size: 11.5px; font-weight: 700; letter-spacing: .2px;
  border-radius: 999px; padding: 2px 10px; background: var(--ochre-tint); color: var(--ochre-2); border: 1px solid transparent;
}
.chip.family { background: var(--slate-tint); color: var(--slate); }
.chip .ico { width: 12px; height: 12px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(198px, 1fr)); gap: 18px; }
/* a "row" shows just the first line of cards; the rest are behind "View" */
.grid.row { grid-template-rows: auto; grid-auto-rows: 0; row-gap: 0; overflow: hidden; padding: 4px; margin: -4px; }

/* ── recipe card ── */
.card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: transform .15s ease, box-shadow .15s ease; min-width: 0;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.card:focus-visible { outline: 3px solid var(--ochre); outline-offset: 2px; }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .chip { position: absolute; top: 10px; right: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.12); background: var(--card); }
.thumb .chip.family { color: var(--slate); }
.card-body { display: flex; flex-direction: column; gap: 3px; padding: 12px 16px 0; flex: 1; }
.card-cat { font-size: 11.5px; font-weight: 700; color: var(--ochre-2); }
:root[data-theme="dark"] .card-cat { color: var(--ochre); }
.card-title { font-family: var(--serif); font-weight: 600; font-size: 16.5px; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-by { font-family: var(--hand); font-size: 17px; line-height: 1.15; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.card-foot { display: flex; align-items: center; gap: 6px; margin: 12px 16px 0; padding: 10px 0 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--soft); }
.card-foot .ico { width: 14px; height: 14px; }
.card mark { background: var(--ochre-tint); color: inherit; border-radius: 3px; padding: 0 1px; }

/* watercolor placeholder for recipes without a photo */
.wash {
  --x1: 30%; --y1: 35%; --x2: 72%; --y2: 70%;
  position: absolute; inset: 0; display: grid; place-items: center;
  background-color: hsl(var(--h) calc(var(--wash-s) - 10%) calc(var(--wash-l) + 6%));
  background-image:
    radial-gradient(55% 60% at var(--x1) var(--y1), hsl(var(--h) var(--wash-s) var(--wash-l) / .95), transparent 70%),
    radial-gradient(45% 55% at var(--x2) var(--y2), hsl(calc(var(--h) + 28) calc(var(--wash-s) - 6%) calc(var(--wash-l) - 6%) / .75), transparent 72%),
    radial-gradient(35% 35% at 80% 18%, hsl(208 28% calc(var(--wash-l) - 2%) / .55), transparent 70%),
    url(images/paper.svg);
}
.wash .ico {
  width: 46px; height: 46px; stroke-width: 1.15; color: hsl(var(--h) 30% var(--icon-ink)); opacity: .78;
  transform: rotate(var(--rot, -6deg)); filter: drop-shadow(0 1px 0 hsl(var(--h) 40% 95% / .4));
}
.wash.big .ico { width: 84px; height: 84px; stroke-width: 1; }

/* ── category tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.tile { position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 112px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.tile .wash { place-items: start end; padding: 12px 14px; }
.tile .wash .ico { width: 34px; height: 34px; }
.tile-label { position: relative; margin: 10px; padding: 7px 10px; border-radius: 10px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(2px); display: flex; align-items: center; gap: 8px; }
.tile-label b { font-family: var(--serif); font-weight: 600; font-size: 15px; line-height: 1.2; flex: 1; min-width: 0; }

/* ── category page tools ── */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--shadow); }
.seg button { border: 0; background: none; border-radius: 999px; padding: 6px 14px; font-size: 13.5px; font-weight: 700; color: var(--soft); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ochre-tint); color: var(--ochre-2); }
:root[data-theme="dark"] .seg button[aria-pressed="true"] { color: var(--ink); }
.letters { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.letters a { width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--soft); border-radius: 6px; }
.letters a:hover { background: var(--ochre-tint); color: var(--ochre-2); }
.letters span { width: 24px; height: 24px; display: grid; place-items: center; font-size: 12px; color: var(--line-2); }
.letter-head { grid-column: 1 / -1; font-family: var(--serif); font-size: 22px; color: var(--ochre); margin: 8px 0 -6px; scroll-margin-top: 90px; display: flex; align-items: center; gap: 12px; }
.letter-head::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.empty { text-align: center; color: var(--soft); background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px 20px; }
.empty b { display: block; font-family: var(--serif); font-size: 20px; color: var(--ink); margin-bottom: 4px; }
.loading { color: var(--soft); padding: 40px 0; text-align: center; font-family: var(--hand); font-size: 24px; }

/* ── recipe page ── */
.recipe { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 28px; align-items: start; }
.recipe-side { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 16px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .note { position: absolute; left: 12px; bottom: 10px; font-family: var(--hand); font-size: 16px; color: hsl(var(--h) 25% var(--icon-ink)); opacity: .8; }
.meta { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.meta-row { display: flex; flex-direction: column; gap: 2px; }
.meta-row small { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--soft); }
.meta-row .by { font-family: var(--hand); font-size: 22px; line-height: 1.15; color: var(--ink-2); }
.meta-row a:hover { color: var(--ochre-2); text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }

.notecard {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 40px 36px 58px;
  background-image: linear-gradient(to right, transparent 38px, color-mix(in srgb, var(--rust) 35%, transparent) 38px, color-mix(in srgb, var(--rust) 35%, transparent) 39px, transparent 39px);
}
.notecard h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; line-height: 1.15; margin: 0 0 4px; }
.notecard .by-line { font-family: var(--hand); font-size: 22px; color: var(--soft); margin-bottom: 18px; }
.notecard h3 { font-family: var(--sans); font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ochre-2); margin: 22px 0 8px; }
:root[data-theme="dark"] .notecard h3 { color: var(--ochre); }
.notecard p { margin: 0 0 10px; font-size: 16px; line-height: 1.65; color: var(--ink); }
.ing { list-style: none; margin: 4px 0 18px; padding: 0; display: grid; gap: 2px; }
.ing li label { display: flex; align-items: flex-start; gap: 12px; padding: 6px 10px; margin: 0 -10px; border-radius: 10px; cursor: pointer; font-size: 16px; line-height: 1.45; }
.ing li label:hover { background: var(--paper-2); }
.ing input { appearance: none; flex: none; width: 19px; height: 19px; margin-top: 2px; border: 1.6px solid var(--line-2); border-radius: 6px; background: var(--paper); cursor: pointer; display: grid; place-items: center; }
.ing input:checked { background: var(--ochre); border-color: var(--ochre); }
.ing input:checked::after { content: ''; width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.ing input:checked + span { color: var(--soft); text-decoration: line-through; text-decoration-color: var(--line-2); }
.needs-text { font-family: var(--hand); font-size: 22px; color: var(--soft); }
.versions { margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--line-2); }
.versions h3 { margin-top: 0; }
.versions a { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; }
.versions a b { font-weight: 700; }
.versions a span { font-family: var(--hand); font-size: 19px; color: var(--soft); }
.versions a:hover b { color: var(--ochre-2); text-decoration: underline; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.pager a { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 48%; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.pager a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager a:hover { color: var(--ochre-2); }

/* ── responsive ── */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; padding: 28px; }
  .hero-art { max-width: 460px; margin: 0 auto; order: -1; }
  .recipe { grid-template-columns: 1fr; }
  .recipe-side { position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 10px; }
  .layout { grid-template-columns: 1fr; padding: 16px 16px 48px; gap: 0; }
  .page-head { padding: 12px 16px 14px; }
  .page-head h1 { font-size: 24px; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); max-height: none; padding: 12px;
    background: var(--paper); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lift);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(20, 15, 10, .45); }
  .search-card { padding: 8px 8px 8px 14px; margin-bottom: 20px; gap: 8px; }
  .btn-primary .label { display: none; }
  .btn-primary { padding: 10px 12px; }
  .hero h2 { font-size: 30px; }
  .hero { padding: 22px; }
  /* rows scroll sideways on phones */
  .grid.row { grid-template-rows: none; grid-auto-rows: auto; grid-auto-flow: column; grid-auto-columns: 72%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 12px; gap: 14px; }
  .grid.row > * { scroll-snap-align: start; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-body { padding: 10px 12px 0; }
  .card-foot { margin: 10px 12px 0; }
  .card-title { font-size: 15px; }
  .recipe-side { grid-template-columns: 1fr; }
  .notecard { padding: 22px 18px 26px 30px; background-image: linear-gradient(to right, transparent 16px, color-mix(in srgb, var(--rust) 35%, transparent) 16px, color-mix(in srgb, var(--rust) 35%, transparent) 17px, transparent 17px); }
  .notecard h2 { font-size: 25px; }
  .letters { margin-left: 0; }
  .section-head h2 { font-size: 20px; }
}
@media (max-width: 420px) {
  .brand-text i { display: none; }
  .brand-text b { font-size: 17px; }
}

/* ── print: just the recipe card ── */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .page-head, .sidebar, .search-card, .recipe-side, .pager, .versions, .scrim { display: none !important; }
  .layout { display: block; padding: 0; }
  .recipe { display: block; }
  .notecard { box-shadow: none; border: 0; padding: 0; background: none; }
  .ing input { display: none; }
  .ing li label { padding: 1px 0; margin: 0; }
  .ing li label::before { content: '•'; }
}
