@font-face {
  font-family: Inter;
  src: url("assets/inter.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #121714;
  --muted: #526056;
  --green: #0e8144;
  --green-dark: #064b2a;
  --mint: #e1eddc;
  --line: #d8dfd3;
  --cream: #f6edce;
  --white: #fff;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
img { display: block; width: 100%; object-fit: cover; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { letter-spacing: -.045em; line-height: 1.04; }
h1 { font-size: clamp(46px, 8vw, 104px); }
h2 { font-size: clamp(28px, 4vw, 44px); }
h3 { font-size: clamp(18px, 2vw, 24px); }
:focus-visible { outline: 3px solid #176fbe; outline-offset: 4px; }
[hidden] { display: none !important; }

.frame { width: min(1360px, calc(100% - clamp(36px, 8vw, 128px))); margin-inline: auto; }
.skip-link { position: absolute; top: 8px; left: 8px; z-index: 3; background: var(--white); padding: 10px 14px; transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }
.masthead { background: var(--paper); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 78px; display: flex; align-items: center; gap: clamp(16px, 5vw, 70px); }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 22px; font-weight: 800; text-decoration: none; letter-spacing: -.06em; }
.brand img { width: 37px; height: 37px; border-radius: 8px; }
.brand-books { color: var(--green); }
.main-nav { display: flex; gap: clamp(18px, 4vw, 42px); align-items: center; }
.main-nav a { display: inline-flex; align-items: center; gap: 7px; min-height: 45px; text-decoration: none; color: var(--muted); white-space: nowrap; font-size: 15px; font-weight: 700; }
.main-nav a[aria-current] { color: var(--green-dark); text-decoration: underline; text-underline-offset: 7px; text-decoration-thickness: 2px; }
.nav-count { background: var(--mint); border-radius: 50%; color: var(--green-dark); min-width: 21px; padding: 2px 5px; text-align: center; font-size: 12px; }
.app-link { margin-left: auto; color: var(--green-dark); font-size: 14px; font-weight: 750; text-underline-offset: 4px; white-space: nowrap; }

.main { min-height: 72vh; padding-block: 36px 70px; }
.page-head { margin-bottom: 28px; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 22px 38px; }
.page-head h1 { font-size: clamp(42px, 6vw, 75px); }
.page-head p { margin-top: 9px; color: var(--muted); font-size: clamp(15px, 2vw, 18px); line-height: 1.5; }
.search { flex: 0 1 520px; min-width: min(100%, 280px); }
.search input { width: 100%; }
.control { min-height: 47px; padding: 11px 14px; color: var(--ink); background: var(--white); border: 1px solid #b7c5b8; border-radius: 10px; }
.control::placeholder { color: var(--muted); }
.search-shell { display: flex; align-items: center; position: relative; }
.search-shell svg { position: absolute; left: 15px; width: 20px; color: var(--muted); pointer-events: none; }
.search-shell input { padding-left: 45px; }
.search-shell input { background: #f4f3f0; border-color: transparent; border-radius: 999px; }
.field-label { display: block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 7px; }

.shelf { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; }
.book-card { overflow: hidden; display: grid; grid-template-rows: 1fr auto; min-width: 0; min-height: 300px; border: 1px solid var(--line); border-radius: 17px; background: var(--mint); text-decoration: none; }
.book-card:nth-child(3n+2) { background: var(--cream); }
.book-card:nth-child(3n+3) { background: #ece7de; }
.book-card:hover .book-cover img { transform: scale(1.035); }
.book-cover { margin: 12px 12px 0; aspect-ratio: 2 / 1.13; overflow: hidden; border-radius: 10px; background: #c7c9b2; }
.book-cover img { height: 100%; transition: transform .22s ease; }
.book-card-copy { padding: 16px 19px 19px; display: flex; align-items: end; gap: 13px; justify-content: space-between; }
.book-card-copy h2 { max-width: 270px; font-size: clamp(23px, 3vw, 42px); overflow-wrap: anywhere; }
.book-card-copy p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.3; }
.book-arrow { flex: none; align-self: center; display: grid; place-items: center; width: 35px; height: 35px; background: #ffffff9c; color: var(--green-dark); border-radius: 50%; font-size: 22px; font-weight: 600; }

.recipe-area { margin-top: clamp(38px, 6vw, 66px); }
#book-shelf[hidden] + .recipe-area { margin-top: 24px; }
.section-head { min-height: 52px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 13px; margin-bottom: 15px; }
.section-filter { display: flex; align-items: center; gap: 8px; }
.section-filter .field-label { margin: 0; }
.recipe-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 25px 18px; }
.recipe-card { position: relative; min-width: 0; }
.recipe-link { display: block; text-decoration: none; }
.recipe-link:hover h3 { color: var(--green-dark); text-decoration: underline; text-underline-offset: 3px; }
.recipe-image { height: auto; aspect-ratio: 4 / 3; border-radius: 13px; background: #d5d7cd; }
.recipe-card h3 { margin-top: 11px; line-height: 1.14; }
.recipe-card p { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.heart { position: absolute; top: 8px; right: 8px; width: 43px; height: 43px; display: grid; place-items: center; color: var(--green-dark); background: var(--white); border: 0; border-radius: 50%; }
.heart[aria-pressed="true"] { background: var(--mint); }
.heart svg, .save-button svg { width: 20px; height: 20px; }
[aria-pressed="true"] .heart-icon { fill: currentColor; }

.breadcrumb { display: inline-block; color: var(--green-dark); text-underline-offset: 4px; font-size: 14px; font-weight: 700; margin-bottom: 22px; }
.book-feature { display: grid; grid-template-columns: 1fr 1.08fr; min-height: 340px; border-radius: 18px; overflow: hidden; background: var(--mint); }
.book-feature-copy { padding: clamp(24px, 5vw, 62px); align-self: center; }
.book-feature h1 { font-size: clamp(42px, 6.5vw, 84px); }
.book-feature p { max-width: 42ch; font-size: clamp(15px, 2vw, 19px); color: var(--muted); line-height: 1.55; margin-top: 16px; }
.book-feature img { height: 100%; min-height: 260px; max-height: 490px; }

.recipe-feature { display: grid; grid-template-columns: 1.1fr .9fr; align-items: stretch; border: 1px solid var(--line); background: var(--white); border-radius: 18px; overflow: hidden; }
.recipe-feature img { height: 100%; min-height: 350px; max-height: 500px; }
.recipe-feature-copy { padding: clamp(22px, 5vw, 62px); align-self: center; }
.recipe-feature h1 { font-size: clamp(37px, 5.5vw, 68px); overflow-wrap: anywhere; }
.recipe-feature-copy p { color: var(--muted); margin-block: 16px 0; line-height: 1.55; }
.recipe-feature-copy .servings { display: block; margin-top: 13px; color: var(--green-dark); font-weight: 750; }
.recipe-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px; min-height: 44px; background: var(--green); border: 1px solid var(--green); color: var(--white); text-decoration: none; font-size: 14px; font-weight: 750; border-radius: 999px; }
.button:hover { background: var(--green-dark); }
.button.secondary, .button[aria-pressed="true"] { background: var(--white); color: var(--green-dark); border-color: #a8bdac; }
.button.secondary:hover, .button[aria-pressed="true"]:hover { background: var(--mint); }
.recipe-body { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(28px, 6vw, 100px); margin-top: 46px; }
.recipe-body h2 { margin-bottom: 19px; }
.ingredients, .directions { padding: 0; margin: 0; list-style: none; }
.ingredients li + li, .directions li + li { border-top: 1px solid var(--line); }
.ingredients label { display: flex; align-items: start; gap: 11px; padding: 12px 0; cursor: pointer; line-height: 1.45; }
.ingredients input { margin: 2px 0 0; width: 19px; height: 19px; accent-color: var(--green); flex: none; }
.ingredients input:checked + span { color: var(--muted); text-decoration: line-through; }
.directions { counter-reset: step; }
.directions li { display: flex; align-items: start; gap: 12px; padding: 12px 0 17px; line-height: 1.6; counter-increment: step; }
.directions li::before { content: counter(step); flex: none; border-radius: 100%; width: 30px; height: 30px; background: var(--mint); color: var(--green-dark); display: grid; place-items: center; font-size: 14px; font-weight: 750; }
.source { margin-top: 30px; color: var(--muted); font-size: 14px; text-underline-offset: 4px; }
.utility-button { border: 0; padding: 0; background: transparent; color: var(--green-dark); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; }
.utility-button:hover { color: var(--green); }

.collection-list { display: flex; flex-wrap: wrap; gap: 10px; margin-block: 15px 20px; }
.collection-list a { border: 1px solid #afc2b0; color: var(--green-dark); background: var(--mint); text-decoration: none; padding: 10px 15px; border-radius: 900px; font-weight: 700; }
.collection-list a:hover { text-decoration: underline; }
.collection-form { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.collection-form select { flex: 1; min-width: 140px; max-width: 240px; }
.collection-form .control { min-width: min(100%, 210px); }
.collection-manage { margin: 0 0 24px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; }
.collection-manage summary { width: fit-content; cursor: pointer; padding-block: 5px; font-weight: 750; color: var(--green-dark); }
.collection-manage .collection-form { align-items: end; margin-top: 12px; }
.collection-delete { margin-block: 13px 4px; color: #8b2a1a; }
.delete-confirmation { margin-top: 11px; padding: 14px; background: #fff4ed; border: 1px solid #ebcbb9; border-radius: 10px; }
.delete-confirmation h2 { font-size: 21px; }
.delete-confirmation p { color: var(--muted); margin-block: 6px 11px; }
.button.danger { background: #8b2a1a; border-color: #8b2a1a; }
.button.danger:hover { background: #6d1e11; }
.recipe-card .collection-form, .recipe-feature-copy .collection-form { margin-top: 14px; }
.recipe-card .collection-form .control { min-width: 0; min-height: 39px; font-size: 13px; padding: 7px; }
.recipe-card .collection-form .button { min-height: 39px; padding: 7px 10px; }
.library-panel { padding: clamp(20px, 4vw, 37px); border-radius: 16px; background: var(--mint); }
.library-panel h2 { font-size: clamp(25px, 3vw, 36px); }
.library-panel .field-label { margin-top: 14px; }
.empty { background: var(--white); border: 1px dashed #a8b8ac; padding: 26px; border-radius: 12px; color: var(--muted); line-height: 1.5; }
.empty .button { margin-top: 12px; }
.app-panel { max-width: 760px; margin: 32px auto; padding: clamp(26px, 8vw, 72px); border-radius: 22px; background: var(--mint); }
.app-panel h1 { font-size: clamp(45px, 8vw, 80px); }
.app-panel p { margin-top: 14px; max-width: 45ch; color: var(--muted); line-height: 1.6; }
.store-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.store-wait { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; }
.footer { display: flex; gap: 20px; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-block: 22px 32px; color: var(--muted); font-size: 14px; }
.notice { position: fixed; z-index: 2; bottom: 16px; inset-inline: 16px; width: max-content; max-width: calc(100vw - 32px); margin-inline: auto; background: #172e20; color: var(--white); border-radius: 10px; padding: 11px 16px; font-size: 14px; }
.notice:empty { background: transparent; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 920px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book-card { min-height: 0; }
  .book-card-copy { padding: 13px; }
  .book-arrow { width: 28px; height: 28px; }
}
@media (max-width: 640px) {
  .masthead-inner { flex-wrap: wrap; gap: 2px 16px; padding-top: 11px; }
  .brand img { width: 33px; height: 33px; }
  .main-nav { order: 1; width: 100%; }
  .main { padding-block: 24px 45px; }
  .search { flex-basis: 100%; }
  .shelf { grid-template-columns: 1fr; gap: 10px; }
  .book-card { grid-template-columns: 115px 1fr; grid-template-rows: auto; }
  .book-cover { margin: 7px 0 7px 7px; aspect-ratio: 1.2; }
  .book-card-copy { align-items: center; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .heart { top: 5px; right: 5px; }
  .book-feature, .recipe-feature, .recipe-body { grid-template-columns: 1fr; }
  .book-feature img { min-height: 0; aspect-ratio: 16 / 9; }
  .recipe-feature img { min-height: 0; aspect-ratio: 16 / 10; }
  .recipe-body { gap: 27px; margin-top: 30px; }
  .recipe-card .collection-form .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}

.footer-books { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 20px; }
.book-page-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.book-feature-copy .book-local-note { font-size: 14px; }
@media (max-width: 640px) {
  .footer-books { justify-content: flex-start; }
  .book-page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
