/* Shared dark palette for the private and public cookbook. */
body:has(#app-shell:not(.hidden)), body.legal-page {
  background: #262e27;
  color-scheme: dark;
}
:is(#app-shell,.legal-page) {
  --paper: #262e27;
  --ink: #f2ecdd;
  --muted: #c0c8b9;
  --line: #505c4e;
  --cream: #364033;
  --white: #303a30;
  --green: #c7d6ba;
  --green-dark: #e1ead7;
  --nav-forest: #c7d6ba;
  --nav-deep: #f2ecdd;
  --book-clay: #e8b795;
  --book-line: #505c4e;
  --shelf-field: #303a30;
  --shelf-raised: #364233;
  --shelf-control: #899485;
  --shelf-action: #c7d6ba;
  --shelf-action-ink: #25382c;
  --shelf-error: #ffb8a4;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
}
#app-shell .app-sidebar { background: #234634; }
#app-shell .site-topbar {
  background: rgba(38,46,39,.96);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--line);
}
#app-shell :is(.hamburger-button,.header-account,.header-search,.account-popover,.search-suggestions) {
  background: var(--shelf-field);
  border-color: var(--line);
  color: var(--ink);
}
#app-shell :is(.header-brand,.header-brand em,.account-popover a,.account-popover button,.suggest-item,.suggest-all) { color: var(--ink); }
#app-shell :is(.brand-accent,.eyebrow,.suggest-head,.tiny-spark,.collection-empty > span) { color: var(--book-clay); }
body[data-page-kind="category"] #app-shell #browse-heading .eyebrow { color: var(--book-clay); }
#app-shell :is(.account-email,.suggest-item small,.suggest-empty,.header-search kbd) { color: var(--muted); }
#app-shell .header-search input { background: transparent; color: var(--ink); }
#app-shell :is(.account-popover a,.account-popover button,.suggest-all) { border-color: var(--line); }
#app-shell :is(.suggest-item,.suggest-all):is(:hover,:focus-visible,[aria-selected="true"]) { background: var(--shelf-raised); }
#app-shell :is(.header-search input,input,textarea)::placeholder { color: #aab5a6; }
#app-shell .button-primary {
  background: var(--shelf-action);
  border-color: var(--shelf-action);
  color: var(--shelf-action-ink);
}
#app-shell .button-primary:hover:not(:disabled) { background: #d8e4ce; }
#app-shell .button-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--shelf-control);
}
#app-shell .button-outline:hover:not(:disabled) { background: var(--shelf-raised); }
#app-shell :is(.button,.shelf-link,.area-tabs a,.text-button,.inspiration-filters button):focus-visible {
  outline: 2px solid var(--book-clay);
  outline-offset: 3px;
}
#app-shell :is(footer,.legal-footer) { background: var(--paper); border-color: var(--line); color: var(--muted); }
#app-shell .legal-links a { color: var(--muted); }
#app-shell .legal-links a:focus-visible { outline-color: var(--book-clay); }

/* Capture and empty states on the cookbook pages. */
#app-shell :is(.home-capture,#collection-status,#empty,.recipe-page) {
  background: var(--shelf-field);
  color: var(--ink);
  border-color: var(--line);
}
#app-shell .home-capture h2 { color: var(--ink); }
#app-shell .home-capture .capture-status { color: var(--muted); }
#app-shell #collection-content > .recipe-discovery { border-color: var(--line); }
#app-shell .collection-book-1 { background: #7c4736; }

/* Today: three equal suggestions with titles beneath the images. */
#collection-content > .recipe-discovery { margin: clamp(28px,5vw,64px) 0 42px; }
#discovery-heading { max-width: 19ch; font-size: clamp(35px,4.8vw,64px); }
#app-shell .discovery-caption { color: var(--muted); }
#app-shell .discovery-refresh { background: transparent; border-color: var(--line); color: var(--ink); }
#app-shell .discovery-refresh:hover:not(:disabled) { background: var(--shelf-raised); }
#app-shell .inspiration-filters button { color: var(--muted); border-color: var(--line); }
#app-shell .inspiration-filters button[aria-pressed="true"] {
  background: var(--shelf-action);
  border-color: var(--shelf-action);
  color: var(--shelf-action-ink);
}
#discovery-list {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: clamp(12px,2vw,26px);
  padding: 0;
  overflow: visible;
}
.shelf-tile { min-width: 0; position: relative; }
.shelf-link { display: block; color: var(--ink); text-decoration: none; border-radius: 11px; }
.shelf-picture {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 11px;
  overflow: hidden;
  background: var(--shelf-raised);
}
.shelf-picture img, .shelf-picture-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.shelf-picture img { object-fit: cover; }
.shelf-picture .shelf-image-error { display: none; }
.shelf-picture-fallback { display: grid; place-items: center; color: var(--muted); font-size: 28px; }
.shelf-category-image {
  position: absolute;
  bottom: 7px;
  left: 7px;
  color: #fbf5e9;
  background: #1c3327ee;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
}
.shelf-picture.has-photo .shelf-category-image { display: none; }
.shelf-copy { display: grid; gap: 5px; margin-top: 10px; overflow-wrap: anywhere; }
.shelf-meta { color: var(--muted); font-size: 12px; }
.shelf-copy strong { font: 400 clamp(20px,2.1vw,29px)/1.14 'DM Serif Display',Georgia,serif; }
.shelf-link:hover strong { text-decoration: underline; text-underline-offset: 4px; }
#app-shell .shelf-tile .favorite-on-discovery { box-shadow: none; }
@media(max-width:620px) {
  #discovery-list { grid-template-columns: 1fr; gap: 0; }
  .shelf-tile { border-top: 1px solid var(--line); }
  .shelf-link { display: grid; grid-template-columns: 85px minmax(0,1fr); align-items: center; gap: 11px; padding: 10px 49px 10px 0; }
  .shelf-picture { aspect-ratio: 1.16; border-radius: 7px; }
  .shelf-copy { margin: 0; }
  .shelf-copy strong { font-size: 21px; }
  .shelf-category-image { font-size: 9px; bottom: 3px; left: 3px; padding: 2px 4px; }
  #app-shell .shelf-tile .favorite-on-discovery { top: 50%; transform: translateY(-50%); right: 0; width: 44px; height: 44px; }
}

/* Cookbook, collections and recipe dialogs share the same surfaces. */
#app-shell :is(.simple-page-hero h1,.collection-empty h2,.results-heading h2,.card-title,.text-button,.collection-back) { color: var(--ink); }
#app-shell :is(#simple-hero-subtitle,.collection-heading p,.collection-empty p,.recipe-entry-actions p,.recipe-reading-muted,.recipe-ingredient-count,#recipe-grid .card-preview) { color: var(--muted); }
#app-shell .area-tabs a { color: var(--muted); }
#app-shell .area-tabs a[aria-current="page"] { color: var(--ink); border-color: var(--shelf-action); }
#app-shell .tab-count { background: var(--shelf-raised); color: var(--ink); }
#app-shell :is(.recipe-card,.browse-search-context,#browse-controls .filter-row,#notice,#collection-content .empty-state,.collection-message,.collection-empty,.favorites-page-hero) {
  background: var(--shelf-field);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}
#app-shell #recipe-grid .card-bottom { border-color: var(--line); }
#app-shell :is(dialog,.recipe-cook-panel) { color: var(--ink); background: var(--paper); border-color: var(--line); }
#app-shell dialog::backdrop { background: #101c16bb; }
#app-shell :is(.recipe-reading-panel,#recipe-dialog.is-cooking .recipe-step-nav,.recipe-detail-hero) {
  background: var(--shelf-field);
  border-color: var(--line);
}
#app-shell :is(.dialog-close,.collection-dialog-heading > button,.review-banner,.approval-note,.food-photo-editor,.food-photo-preview,.food-photo-optional,.recipe-cook-bar,.recipe-cook-actions,.recipe-ingredient:has(input:checked),.collection-check:has(input:checked),.recipe-page-controls button,.recipe-page img) {
  background: var(--shelf-raised);
  color: var(--ink);
  border-color: var(--line);
}
#app-shell :is(.recipe-detail-header h2,.recipe-reading-panel h3,.review-banner strong,.food-photo-editor-heading strong,.recipe-cook-label,.recipe-ingredient input:checked + span) { color: var(--ink); }
#app-shell :is(.review-banner span,.food-photo-editor-heading p,.food-photo-status,.field small,.admin-small) { color: var(--muted); }
#app-shell :is(.field input:not([type="checkbox"]),.field textarea,select,.kitchen-add input,.kitchen-dialog input:not([type="checkbox"])) {
  background: var(--shelf-field);
  color: var(--ink);
  border-color: var(--shelf-control);
}
#app-shell :is(.recipe-ingredient-list li,.collection-picker,.recipe-ingredient,.recipe-step,.recipe-detail-tools,.category-checks label) { border-color: var(--line); }
#app-shell :is(.collection-error,.collection-delete,.food-photo-remove,.food-photo-status.error,.small-status.error,#recipe-dialog #delete-personal-recipe) { color: var(--shelf-error); }
#app-shell :is(input[type="checkbox"],input[type="radio"],progress) { accent-color: var(--shelf-action); }
#app-shell :is(.recipe-dialog,.kitchen-dialog) :focus-visible, #app-shell .meal-recipe-link:focus-visible {
  outline-color: var(--book-clay);
}
#app-shell .favorite-toggle {
  background: var(--shelf-field);
  border-color: var(--shelf-control);
  color: var(--muted);
}
#app-shell .favorite-toggle:is(.is-favorite,:hover:not(:disabled)) { color: #f6c543; }
#app-shell .favorite-toggle.is-favorite svg { stroke: currentColor; }

/* Planning and the shopping list. */
#app-shell .kitchen-main, #app-shell .kitchen-dialog {
  --kitchen-ink: var(--ink);
  --kitchen-muted: var(--muted);
  --kitchen-border: var(--line);
  --kitchen-paper: var(--shelf-field);
  --kitchen-green: var(--shelf-raised);
}
#app-shell :is(.week-overview,.week-shopping,.picker-header,.picker-footer,.picker-selection,.picker-recipe,.day-add,.kitchen-meal,.kitchen-icon) {
  background: var(--shelf-raised);
  color: var(--ink);
  border-color: var(--line);
}
#app-shell :is(.kitchen-icon,.kitchen-text,.picker-recipe,.day-add,.kitchen-meal,.meal-recipe-link):hover { background: #465445; }
#app-shell :is(.kitchen-text,.today .day-date span,.meal-listed,.meal-arrow,.meal-recipe-link,.picker-add) { color: var(--shelf-action); }
#app-shell :is(.picker-label,.picker-recipe-text small,.kitchen-hint,.kitchen-shopping .done strong) { color: var(--muted); }
#app-shell .picker-favorite { color: #f6c543; }
#app-shell :is(.picker-options,.kitchen-shopping li) { border-color: var(--line); }
#app-shell :is(#kitchen-status.error,#plan-error,.kitchen-text.danger) { color: var(--shelf-error); }
#app-shell .header-add { text-decoration: none; }
#app-shell .site-topbar { border-color: var(--line); }
#app-shell .recipe-card .category-chip { background: #e9e5d0; color: #25382c; }
#app-shell .kitchen-main { padding-top: clamp(24px,4vw,44px); }
#app-shell .week-shopping { margin-top: 12px; }
#app-shell .meal-row { background: var(--shelf-field); border-color: var(--line); }
