/* The Huntress Cookbook — Elegant Woodland Theme */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Dancing+Script:wght@400;500;600&display=swap');

:root {
  --forest-green: #1a3d2e;
  --deep-evergreen: #0f2a1f;
  --warm-gold: #c9a227;
  --gold-light: #e8d5a3;
  --cream: #f5f0e8;
  --ivory: #faf7f2;
  --soft-brown: #5c4a3a;
  --muted-text: #8a9a8e;
  --sidebar-muted: #a8b8a8;
  --tip-green: #e8f0e8;
  --heart-red: #c45c5c;
}

html {
  font-size: 18px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: #e8e4dc;
  color: var(--soft-brown);
  line-height: 1.6;
}

/* ── Page Shell ── */

.page {
  width: 100%;
  max-width: 297mm;
  min-height: 210mm;
  margin: 2rem auto;
  background: var(--cream);
  display: flex;
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}

@media print {
  body { background: white; }
  .page {
    margin: 0;
    box-shadow: none;
    width: 100%;
    min-height: auto;
    page-break-after: always;
  }
  .no-print { display: none !important; }
}

/* ── Top toolbar (screen only) ── */

.cookbook-toolbar {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--ivory);
  border-bottom: 1px solid var(--gold-light);
  box-shadow: 0 1px 8px rgba(26, 61, 46, 0.06);
}

.toolbar-inner {
  max-width: 297mm;
  margin: 0 auto;
  padding: 0.45rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-width: 0;
}

.toolbar-start,
.toolbar-end {
  display: contents;
}

.toolbar-menu {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--forest-green);
  border-radius: 50%;
  background: var(--cream);
  color: var(--forest-green);
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toolbar-btn:hover,
.toolbar-btn:focus-visible {
  background: var(--forest-green);
  color: var(--cream);
  outline: none;
}

.toolbar-btn svg {
  display: block;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Sidebar ── */

.sidebar {
  width: 25%;
  min-width: 220px;
  background: var(--forest-green);
  color: var(--sidebar-muted);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.35rem;
}

.sidebar-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.sidebar-logo img,
.sidebar-logo svg {
  width: 120px;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  margin-bottom: 0.65rem;
}

.sidebar-brand {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--warm-gold);
  font-weight: 600;
  line-height: 1.4;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
  font-size: 0.88rem;
  line-height: 2;
}

.sidebar-nav li {
  padding-left: 0.25rem;
}

.sidebar-nav li.active {
  color: var(--warm-gold);
  font-weight: 600;
}

.sidebar-nav a {
  color: inherit;
  text-decoration: none;
}

.sidebar-nav a:hover {
  color: var(--warm-gold);
}

.sidebar-apk {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(201, 162, 39, 0.35);
}

.sidebar-apk-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--warm-gold);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  padding: 0.35rem 0.25rem;
}

.sidebar-apk-link:hover {
  color: #fff;
}

.sidebar-apk-link svg {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
}

.sidebar-tagline {
  font-family: 'Dancing Script', cursive;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.85);
  text-align: center;
  margin: 1.5rem 0;
  line-height: 1.4;
}

.sidebar-tagline .heart {
  color: var(--warm-gold);
}

.sidebar-notes {
  border: 1px solid var(--warm-gold);
  border-radius: 4px;
  padding: 0.75rem;
  margin-top: auto;
}

.sidebar-notes-title {
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--warm-gold);
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-notes p {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--sidebar-muted);
}

/* ── Main Content ── */

.main {
  flex: 1;
  min-width: 0;
  padding: 2rem 2.75rem 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.chapter-header {
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
  padding-inline: 0.75rem;
  max-width: 100%;
}

.chapter-header h1 {
  font-size: clamp(1.2rem, 5vw, 2.8rem);
  font-weight: 400;
  letter-spacing: clamp(0.05em, 1.2vw, 0.35em);
  color: var(--forest-green);
  line-height: 1.15;
  max-width: 100%;
  margin-inline: auto;
  overflow-wrap: anywhere;
}

.chapter-divider {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
  color: var(--warm-gold);
}

.branch-illustration {
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  opacity: 0.7;
}

.chapter-intro {
  text-align: center;
  font-size: 1.05rem;
  color: var(--soft-brown);
  max-width: 90%;
  margin: 0 auto 1.5rem;
  line-height: 1.65;
}

/* ── Category Sections ── */

.categories {
  flex: 1;
}

.category {
  margin-bottom: 1.25rem;
  scroll-margin-top: 1.5rem;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.category-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--forest-green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--forest-green);
  flex-shrink: 0;
}

.category-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--forest-green);
  letter-spacing: 0.02em;
}

.category-desc {
  font-size: 0.88rem;
  color: var(--muted-text);
  margin-bottom: 0.4rem;
  padding-left: 2.25rem;
}

.category-content {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 1.25rem;
  padding-left: 0.5rem;
  align-items: start;
}

.recipe-list {
  list-style: none;
  font-size: 0.95rem;
  line-height: 1.9;
}

.recipe-list li::before {
  content: '♥';
  color: var(--heart-red);
  font-size: 0.72rem;
  margin-right: 0.45rem;
}

.recipe-list a {
  color: var(--soft-brown);
  text-decoration: none;
}

.recipe-list a:hover {
  color: var(--forest-green);
  text-decoration: underline;
}

.recipe-list .coming-soon {
  color: var(--muted-text);
  font-style: italic;
  list-style: none;
}

/* ── Pantry Essentials ── */

.pantry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pantry-item {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--gold-light);
}

.pantry-item:last-child {
  border-bottom: none;
}

.pantry-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pantry-item-name {
  font-size: 0.9rem;
  color: var(--soft-brown);
  font-weight: 600;
}

.pantry-item-detail {
  font-size: 0.78rem;
  color: var(--muted-text);
  margin-top: 0.2rem;
  line-height: 1.45;
}

.pantry-priority {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.pantry-priority-essential {
  background: #e8f3ea;
  color: var(--forest-green);
}

.pantry-priority-recommended {
  background: #f3efe4;
  color: #8a6d3b;
}

.pantry-priority-luxury {
  background: #f8ece8;
  color: #9c5c42;
}

.pantry-priority-avoid,
.pantry-priority-use-carefully {
  background: #fdecea;
  color: #a94442;
}

.future-recipe-list .future-recipe-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.35rem 0;
}

.future-recipe-name {
  flex: 1 1 auto;
}

.future-recipe-status {
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
}

.pantry-priority-high {
  background: #e8f4e8;
  color: var(--forest-green);
}

.pantry-priority-medium {
  background: #f0ebe0;
  color: #6b5b3d;
}

.dietary-notes li {
  list-style: none;
  margin-left: 0;
}

.conditional-ingredient {
  margin: 1rem 0 1.25rem;
}

.conditional-ingredient-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--deep-brown);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.conditional-status {
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--soft-brown);
}

.dietary-food-note {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.9rem;
  background: var(--tip-green);
  border-radius: 4px;
  font-size: 0.9rem;
  color: var(--soft-brown);
  line-height: 1.55;
}

.photo-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.photo-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  text-align: center;
}

.photo-item img,
.photo-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  display: block;
}

.photo-placeholder {
  background: linear-gradient(135deg, #d4c4a8 0%, #b8a88c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1.25;
  color: rgba(255,255,255,0.8);
  text-align: center;
  padding: 0.35rem;
  overflow: hidden;
}

.photo-caption {
  font-family: 'Dancing Script', cursive;
  font-size: 0.9rem;
  color: var(--soft-brown);
  margin-top: 0.35rem;
  min-height: 2.4em;
  line-height: 1.25;
}

/* ── Footer ── */

.chapter-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: end;
  margin-top: auto;
  padding-top: 1rem;
}

.huntress-tip {
  background: var(--tip-green);
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.6;
}

.huntress-tip strong {
  color: var(--forest-green);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.25rem;
}

.huntress-tip .heart {
  color: var(--forest-green);
}

.chapter-quote {
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  text-align: right;
  color: var(--soft-brown);
  line-height: 1.4;
}

.page-number {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--warm-gold);
  margin-top: 0.5rem;
}

.page-nav-link {
  color: var(--warm-gold);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0;
  transition: color 0.15s ease;
}

.page-nav-link:hover {
  color: var(--forest-green);
}

.page-nav-disabled {
  opacity: 0.25;
  cursor: default;
}

.page-nav-num {
  letter-spacing: 0.5em;
  min-width: 1.5rem;
}

/* ── Recipe Page ── */

.recipe-page .main {
  padding: 2.5rem 3rem;
}

.recipe-page .sidebar {
  padding: 2rem 1rem;
}

.recipe-header {
  border-bottom: 1px solid var(--gold-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.recipe-header h1 {
  font-size: 2rem;
  color: var(--forest-green);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.recipe-intro {
  font-size: 1.05rem;
  color: var(--soft-brown);
  line-height: 1.65;
  margin-bottom: 1rem;
  font-style: italic;
}

.photo-link {
  display: block;
  aspect-ratio: 1;
  width: 100%;
  position: relative;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  overflow: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.photo-link img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.2s ease;
}

.photo-link:hover {
  opacity: 0.9;
}

.photo-link:hover img {
  transform: scale(1.02);
}

.photo-caption a {
  color: var(--soft-brown);
  text-decoration: none;
}

.photo-caption a:hover {
  color: var(--forest-green);
  text-decoration: underline;
}

.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.95rem;
  color: var(--muted-text);
}

.recipe-meta span strong {
  color: var(--forest-green);
  font-weight: 600;
}

.recipe-status {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.status-approved {
  background: #d4edda;
  color: #1a5c2e;
}

.status-testing {
  background: #fff3cd;
  color: #856404;
}

.status-tweaking {
  background: #fde8d8;
  color: #8a4b12;
}

.status-untested {
  background: #e9ecef;
  color: #6c757d;
}

.recipe-body {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 2rem;
}

.recipe-body h2 {
  font-size: 0.9rem;
  color: var(--forest-green);
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.recipe-ingredients ul {
  list-style: none;
  font-size: 1rem;
  line-height: 1.95;
}

.recipe-ingredients li::before {
  content: '•';
  color: var(--warm-gold);
  margin-right: 0.5rem;
  font-weight: bold;
}

.recipe-method ol {
  padding-left: 1.25rem;
  font-size: 1rem;
  line-height: 1.9;
}

.recipe-method li {
  margin-bottom: 0.5rem;
}

.recipe-notes {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--gold-light);
}

.note-box {
  background: var(--ivory);
  border-left: 3px solid var(--warm-gold);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

.note-box.huntress {
  border-left-color: var(--forest-green);
}

.note-box h3 {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--forest-green);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.recipe-rating {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.2em;
  font-size: 1.2rem;
  color: var(--warm-gold);
}

.recipe-rating .star-btn {
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15em 0.1em;
  border: none;
  background: transparent;
  color: var(--warm-gold);
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.recipe-rating .star-btn.is-filled {
  opacity: 1;
}

.recipe-rating:hover .star-btn {
  opacity: 0.55;
}

.recipe-rating .star-btn.is-filled,
.recipe-rating:hover .star-btn.is-filled {
  opacity: 1;
}

.recipe-rating .star-btn:hover,
.recipe-rating .star-btn:focus-visible {
  transform: scale(1.12);
}

.recipe-rating .star-btn:focus-visible {
  outline: 2px solid var(--forest-green);
  outline-offset: 2px;
  border-radius: 2px;
}

.recipe-photo {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 0.5rem;
}

.recipe-photo img,
.recipe-photo .photo-placeholder {
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 4/3;
}

.recipe-nav {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--gold-light);
}

.recipe-nav-link {
  flex: 1;
  color: var(--forest-green);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.35;
  transition: color 0.15s ease;
}

.recipe-nav-link:hover {
  color: var(--warm-gold);
}

.recipe-nav-prev {
  text-align: left;
}

.recipe-nav-next {
  text-align: right;
}

.recipe-nav-spacer {
  flex: 1;
}

.recipe-nav-section {
  flex: 0 1 auto;
  font-family: 'Dancing Script', cursive;
  font-size: 1rem;
  color: var(--soft-brown);
  text-align: center;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease;
}

a.recipe-nav-section:hover {
  color: var(--forest-green);
}

@media (max-width: 640px) {
  .recipe-nav {
    flex-direction: column;
    text-align: center;
  }

  .recipe-nav-prev,
  .recipe-nav-next {
    text-align: center;
  }

  .recipe-nav-section {
    order: -1;
    white-space: normal;
  }
}

/* ── Index / Landing ── */

.landing {
  max-width: 800px;
  margin: 3rem auto;
  padding: 3rem;
  background: var(--cream);
  border: 3px solid var(--forest-green);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  text-align: center;
}

.landing-logo {
  width: 190px;
  height: auto;
  margin-bottom: 1.25rem;
}

.landing h1 {
  font-size: 1.8rem;
  color: var(--forest-green);
  letter-spacing: 0.2em;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.landing .subtitle {
  font-family: 'Dancing Script', cursive;
  font-size: 1.3rem;
  color: var(--warm-gold);
  margin-bottom: 1.25rem;
}

.landing-search-wrap {
  margin: 0 auto 1.75rem;
  max-width: 420px;
}

.landing-search {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--gold-light);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--soft-brown);
  background: var(--ivory);
  cursor: pointer;
}

.landing-search:focus {
  outline: none;
  border-color: var(--forest-green);
}

.landing-nav {
  list-style: none;
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}

.landing-nav li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--gold-light);
  font-size: 1rem;
}

.landing-nav a {
  color: var(--soft-brown);
  text-decoration: none;
  display: flex;
  justify-content: space-between;
}

.landing-nav a:hover {
  color: var(--forest-green);
}

.landing-nav .available {
  color: var(--forest-green);
  font-weight: 600;
}

.landing-nav .coming-soon {
  color: var(--muted-text);
  font-style: italic;
}

.landing-apk {
  max-width: 400px;
  margin: 1.25rem auto 0;
  padding-top: 1rem;
  border-top: 2px solid var(--gold-light);
}

.landing-apk-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  color: var(--forest-green);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.35rem 0;
}

.landing-apk-link:hover {
  color: var(--soft-brown);
}

.landing-apk-link svg {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
}

.landing-tagline {
  margin-top: 2rem;
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  color: var(--soft-brown);
}

.print-hint {
  margin-top: 2rem;
  font-size: 0.8rem;
  color: var(--muted-text);
}

.print-hint a {
  color: var(--forest-green);
}

/* ── Password Gate ── */

html:not(.auth-ok) body > :not(#auth-gate) {
  display: none;
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--forest-green);
  padding: 2rem;
}

.auth-gate-card {
  background: var(--cream);
  border-radius: 8px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--gold-light);
}

.auth-gate-logo {
  width: 150px;
  height: auto;
  max-height: 150px;
  object-fit: contain;
  margin-bottom: 1.15rem;
}

.auth-gate-title {
  font-size: 1.4rem;
  color: var(--forest-green);
  letter-spacing: 0.15em;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.auth-gate-subtitle {
  font-family: 'Dancing Script', cursive;
  font-size: 1.1rem;
  color: var(--warm-gold);
  margin-bottom: 1.5rem;
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-gate-input {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gold-light);
  border-radius: 4px;
  background: var(--ivory);
  color: var(--soft-brown);
  text-align: center;
}

.auth-gate-input:focus {
  outline: none;
  border-color: var(--warm-gold);
}

.auth-gate-error {
  font-size: 0.85rem;
  color: var(--heart-red);
  margin: 0;
}

.auth-gate-button {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.6rem 1.5rem;
  background: var(--forest-green);
  color: var(--cream);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.auth-gate-button:hover {
  background: var(--deep-evergreen);
}

/* ── Search (Ctrl+K) ── */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.search-modal[hidden] {
  display: none;
}

.search-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 42, 31, 0.55);
}

.search-modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: var(--ivory);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--gold-light);
}

.search-modal-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  border-bottom: 1px solid var(--gold-light);
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--soft-brown);
  background: var(--cream);
}

.search-modal-input:focus {
  outline: none;
  background: var(--ivory);
}

.search-modal-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.search-results {
  list-style: none;
}

.search-results a {
  display: block;
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s ease;
}

.search-results a:hover {
  background: var(--tip-green);
}

.search-result-title {
  display: block;
  font-weight: 600;
  color: var(--forest-green);
}

.search-result-meta {
  font-size: 0.85rem;
  color: var(--muted-text);
}

.search-hint,
.search-empty {
  padding: 1.25rem;
  color: var(--muted-text);
  font-size: 0.95rem;
}

.search-modal-footer {
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  color: var(--muted-text);
  background: var(--cream);
  border-top: 1px solid var(--gold-light);
}

/* ── Mobile layout (phones, tablets & narrow viewports) ── */

@media (max-width: 900px) {
  html {
    font-size: 16px;
  }

  body {
    overflow-x: hidden;
  }

  .page {
    flex-direction: column;
    margin: 0;
    max-width: none;
    min-height: 100vh;
    box-shadow: none;
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(15, 42, 31, 0.55);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    min-width: 0;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem 1rem;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .main {
    padding: 1.25rem 1rem 1.5rem;
    width: 100%;
  }

  .main img {
    max-width: 100%;
    height: auto;
  }

  .chapter-header h1 {
    font-size: clamp(1.1rem, 4.8vw, 1.75rem);
    letter-spacing: clamp(0.04em, 0.8vw, 0.1em);
    line-height: 1.2;
  }

  .chapter-intro {
    max-width: 100%;
    font-size: 1rem;
  }

  .category-content {
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .category-desc {
    padding-left: 0;
  }

  .chapter-footer {
    grid-template-columns: 1fr;
  }

  .chapter-quote {
    text-align: left;
  }

  .recipe-body {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .recipe-notes {
    grid-template-columns: 1fr;
  }

  .photo-row {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
  }

  .photo-item {
    flex: 0 0 auto;
    width: min(100%, 320px);
    margin-inline: auto;
  }

  .recipe-page .main {
    padding: 1.25rem 1rem;
  }

  .recipe-page .sidebar {
    padding: 1.5rem 1rem;
  }

  .recipe-header h1 {
    font-size: 1.5rem;
  }

  .toolbar-inner {
    justify-content: space-between;
    max-width: none;
    padding: 0.45rem 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .toolbar-inner::-webkit-scrollbar {
    display: none;
  }

  .toolbar-start,
  .toolbar-end {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
  }

  .toolbar-btn {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
  }

  .toolbar-menu {
    display: inline-flex;
  }

  .branch-illustration {
    width: 60px;
    opacity: 0.5;
  }

  .landing {
    margin: 0;
    padding: 2rem 1.25rem;
    border-width: 2px;
  }

  .landing h1 {
    font-size: 1.35rem;
    letter-spacing: 0.1em;
  }

  .landing-logo {
    width: 140px;
  }
}
