/* A food reference desk: warm photography, clear controls, meaningful motion. */
.library-shell{--tile-apricot:var(--brand-apricot);--tile-butter:var(--brand-butter);--tile-rose:var(--brand-rose)}
.library-shell .library-intro{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(260px,.65fr);align-items:center;gap:48px;padding:48px 0 36px}
.library-intro-copy{min-width:0}
.library-shell .library-intro h1{font-size:clamp(42px,4.7vw,68px);max-width:720px;text-wrap:balance;line-height:1.1;letter-spacing:-2.5px}
html[lang^=zh] .library-shell .library-intro h1{line-height:1.25;letter-spacing:-2px}
.library-shell .library-intro .lede{max-width:570px;margin:20px 0;font-size:16px}
.library-shell .library-summary{gap:10px 20px;margin:24px 0 0;font-size:12px}
.library-summary a{color:var(--link);text-decoration:underline;text-underline-offset:4px}
.library-art{position:relative;height:240px;isolation:isolate}
.library-art::before{content:'';position:absolute;inset:12% 4%;border-radius:50%;background:var(--tile-butter);transform:rotate(-12deg)}
.library-art a{position:absolute;display:block;overflow:hidden;width:60%;aspect-ratio:1;border:6px solid var(--white);box-shadow:0 18px 30px #2c1d1616;transition:transform .5s cubic-bezier(.2,.8,.2,1);border-radius:50%}
.library-art a:first-child{left:0;top:2%;transform:rotate(-12deg)}
.library-art a:last-child{right:0;bottom:0;width:49%;border-color:var(--tile-apricot);transform:rotate(12deg)}
.library-art a:hover,.library-art a:focus-visible{transform:translateY(-8px) rotate(0deg)}
.library-art img{width:100%;height:100%;object-fit:cover;transition:scale .6s}
.library-art a:hover img{scale:1.07}
.cuisine-shelf{margin:0 0 26px;position:relative}
.cuisine-shelf-head{display:flex;justify-content:space-between;align-items:baseline;gap:16px;margin-bottom:12px}
.cuisine-shelf h2{font-size:14px;font-weight:600;margin:0}
.cuisine-shelf-head p{font-size:12px;color:var(--muted);margin:0}
.cuisine-rail{display:flex;gap:9px;overflow-x:auto;padding:4px 3px 10px;scrollbar-width:thin;scroll-snap-type:x proximity}
.cuisine-tile{position:relative;flex:1 0 106px;min-height:64px;border:1px solid transparent;border-radius:14px;padding:10px 12px;display:flex;flex-direction:column;justify-content:center;gap:3px;background:var(--brand-butter);color:var(--ink);scroll-snap-align:start;transition:background .25s,color .25s,transform .3s;line-height:1.4}
.cuisine-tile:nth-child(3n+1){background:var(--tile-rose)}
.cuisine-tile:nth-child(3n+2){background:var(--tile-butter)}
.cuisine-tile:nth-child(3n){background:var(--tile-apricot)}
.cuisine-tile strong{font-size:15px;font-weight:600;white-space:nowrap}
.cuisine-tile small{font-size:11px;opacity:.74;white-space:nowrap}
.cuisine-tile:hover{transform:translateY(-3px);border-color:var(--brand-brown)}
.cuisine-tile[aria-current=true]{background:var(--brand-cocoa);color:var(--brand-cream);border-color:var(--brand-cocoa);box-shadow:0 4px 0 var(--brand-orange)}
.library-shell .browse-tools{border-radius:18px;background:var(--brand-cream);border-color:var(--line);padding:20px;margin:0}
.library-shell .search-wrap,.library-shell select{background-color:var(--paper);border-color:var(--control-border);border-radius:10px}
.library-shell .search-wrap:focus-within{background:#fff;outline:2px solid var(--link)}
.library-shell .result-meta{padding:8px 0 0;margin:20px 0 14px}
.library-shell .food-grid{gap:12px;align-items:stretch}
.library-shell .result-group{display:flex;align-items:center;gap:18px;font-size:18px;margin:18px 0 0}
.library-shell .result-group::after{content:'';height:1px;background:var(--line);flex:1}
.library-shell .food-card{display:block;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--white);overflow:hidden;contain:paint;transition:box-shadow .2s,border-color .2s}
.library-shell .food-card:hover{transform:none;border-color:var(--brand-brown);box-shadow:0 4px 14px #2c1d1610}
.food-card[data-category=staple],.food-card[data-category=breakfast]{--food-tone:var(--brand-butter);--food-color:var(--link)}
.food-card[data-category=meat],.food-card[data-category=snack]{--food-tone:var(--brand-apricot);--food-color:var(--link)}
.food-card[data-category=seafood],.food-card[data-category=soup]{--food-tone:var(--brand-butter);--food-color:var(--link)}
.food-card[data-category=veg],.food-card[data-category=fruit]{--food-tone:var(--brand-butter);--food-color:var(--link)}
.food-card[data-category=dessert],.food-card[data-category=dairy]{--food-tone:var(--brand-rose);--food-color:var(--link)}
.food-main-link{display:block;padding:21px 22px 18px;min-height:218px;background:linear-gradient(135deg,var(--food-tone,var(--brand-butter)),var(--white) 72%);position:relative}
.library-shell .food-main-link:focus-visible{outline:none}
.library-shell .food-main-link:focus-visible::after{content:'';position:absolute;inset:5px;border:2px solid var(--brand-cocoa);outline:2px solid var(--brand-cream);border-radius:14px;pointer-events:none;z-index:2}
.food-card .tag{display:block;padding-right:10px;font-size:11px}
.food-card .card-arrow{position:static;display:inline-block;font-size:17px;margin-left:10px;transition:transform .25s}
.food-card:hover .card-arrow{transform:translateX(3px)}
.library-shell .food-card h3{font-size:18px;line-height:1.4;margin:6px 0 4px;font-weight:650;max-width:100%;letter-spacing:-.25px}
.library-shell .alternate{font-size:11px;margin-bottom:8px;min-height:0}
.library-shell .nutrition{gap:8px}
.library-shell .nutrition b{font-family:'Avenir Next',-apple-system,sans-serif;font-weight:650;font-size:30px;letter-spacing:-1px;color:var(--food-color,var(--link));font-variant-numeric:tabular-nums}
.food-card-bottom{padding:0 14px 10px}
.library-shell .macro-line{margin:0;padding:8px 0 4px;gap:4px 10px;font-size:11px;border-color:#2c1d1616}
.library-shell .macro-line span::before{content:'';display:inline-block;width:5px;height:5px;border-radius:50%;background:var(--brand-orange-deep);margin:0 5px 1px 0}
.library-shell .macro-line span:nth-child(2)::before{background:#a96b14}
.library-shell .macro-line span:nth-child(3)::before{background:var(--brand-brown)}
.food-card-footer{display:flex;align-items:center;justify-content:space-between;gap:8px}
.food-card-footer .source-tag{min-width:0;overflow-wrap:anywhere}
.library-shell .source-tag{margin:0;font-size:10px}
.quick-view{min-height:32px;border:0;border-radius:6px;padding:4px 0 4px 8px;background:none;color:var(--link);white-space:nowrap;font-size:11px;text-decoration:underline;text-underline-offset:4px;transition:color .2s}
.quick-view:hover{color:var(--brand-cocoa)}
.library-shell .pager{gap:16px;margin:24px 0}.library-shell .pager button{min-width:80px;min-height:44px;padding:6px 12px;transition:background .2s,scale .2s;border-color:var(--control-border)}
.library-shell .pager button:not(:disabled):hover{background:var(--brand-apricot);scale:1.03}
.library-shell .empty-results{background:var(--brand-butter);border:0;padding:50px 24px}
/* A compact nutrition glance; native dialog retains focus trapping and inertness. */
.food-dialog{position:fixed;inset:0;margin:auto;width:min(480px,calc(100% - 24px));max-width:calc(100% - 24px);max-height:calc(100dvh - 24px);overflow-y:auto;padding:0;border:1px solid var(--line);border-radius:20px;background:var(--brand-cream);color:var(--ink);box-shadow:0 24px 80px #2c1d1638;overscroll-behavior:contain;scrollbar-width:thin}
.food-dialog::backdrop{background:#2c1d167a;backdrop-filter:blur(5px)}
.dialog-header{position:sticky;top:0;z-index:2;display:grid;grid-template-columns:80px minmax(0,1fr) 36px;gap:12px;align-items:start;padding:20px 20px 16px;background:var(--brand-cream);border-bottom:1px solid var(--line)}
.dialog-identity{min-width:0}
.food-dialog--text .dialog-header{grid-template-columns:minmax(0,1fr) 36px}
.dialog-header .preview-photo{width:80px;height:80px;border-radius:12px;overflow:hidden}
.dialog-header .preview-photo img{display:block;width:100%;height:100%;aspect-ratio:1;object-fit:contain;transform:none;transition:none}
.dialog-close{display:grid;place-items:center;border:1px solid var(--line);background:transparent;border-radius:50%;width:36px;height:36px;padding:0;font-size:23px;line-height:1;color:var(--brand-brown)}
.dialog-close:hover{background:var(--brand-apricot)}
.dialog-cuisine{color:var(--muted);font-size:11px;line-height:1.45;margin:0 0 5px}
.food-dialog h2{font-size:22px;line-height:1.35;font-weight:650;letter-spacing:-.4px;margin:0 0 4px;overflow-wrap:anywhere}
.dialog-alternate{font-size:11px;line-height:1.45;color:var(--muted);margin:0;overflow-wrap:anywhere}
.food-dialog-content{padding:16px 20px 20px}
.portion-picker{display:flex;align-items:center;gap:4px;margin:0 0 14px}
.portion-picker>span{font-size:12px;color:var(--muted);flex:1;padding-right:8px}
.portion-picker button{min-height:40px;min-width:56px;border:1px solid transparent;border-radius:8px;padding:6px 10px;background:transparent;color:var(--brand-brown);font-size:12px;transition:background .2s,color .2s}
.portion-picker button:hover{background:var(--brand-butter)}
.portion-picker button[aria-pressed=true]{background:var(--brand-cocoa);color:var(--brand-cream)}
.dialog-nutrition{border:1px solid var(--line);border-radius:14px;background:var(--white);overflow:hidden}
.dialog-energy{padding:10px 12px;display:flex;align-items:baseline;gap:8px;background:var(--brand-apricot)}
.dialog-energy strong{font-size:42px;line-height:1.1;font-weight:600;letter-spacing:-1.5px;font-variant-numeric:tabular-nums}
.dialog-energy span{font-size:13px;color:var(--brand-brown)}
.dialog-macros{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));padding:14px 0;margin:0}
.dialog-macros div{display:flex;flex-direction:column;align-items:center;gap:4px;padding:0 8px;min-width:0}
.dialog-macros div+div{border-left:1px solid var(--line)}
.dialog-macros b{font-size:18px;line-height:1.2;font-weight:600;font-variant-numeric:tabular-nums}
.dialog-macros span{font-size:11px;color:var(--muted)}
.dialog-note{font-size:11px;color:var(--muted);margin:10px 0 12px;line-height:1.5}
.dialog-source{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;font-size:10px;line-height:1.5;color:var(--muted);margin-bottom:14px}
.dialog-credit{display:flex;flex-wrap:wrap;gap:5px;margin:0}
.dialog-credit a{text-decoration:underline;text-underline-offset:3px}
.dialog-full-link{display:flex;align-items:center;justify-content:center;gap:10px;min-height:44px;padding:8px 14px;border:1px solid var(--brand-brown);border-radius:10px;font-size:13px;font-weight:600;color:var(--brand-brown);transition:background .2s}
.dialog-full-link::after{content:'↗';font-size:16px}
.dialog-full-link:hover{background:var(--brand-butter)}
@media(pointer:coarse){.dialog-close{width:44px;height:44px}.dialog-header{grid-template-columns:80px minmax(0,1fr) 44px}.food-dialog--text .dialog-header{grid-template-columns:minmax(0,1fr) 44px}.portion-picker button{min-height:44px}}
@media(max-width:420px){.dialog-header{grid-template-columns:60px minmax(0,1fr) 44px;padding:16px 14px 14px;gap:8px}.dialog-header .preview-photo{width:60px;height:60px;border-radius:10px}.food-dialog h2{font-size:18px;letter-spacing:-.2px}.dialog-cuisine{font-size:10px}.dialog-alternate{font-size:10px}.food-dialog-content{padding:14px}.dialog-energy strong{font-size:38px}.dialog-macros b{font-size:17px}.portion-picker>span{font-size:11px;padding-right:0}.portion-picker button{min-width:50px;padding:6px 8px}.dialog-close{width:44px;height:44px}.portion-picker button{min-height:44px}}
@media(min-width:761px){.library-shell .food-card{display:flex;flex-direction:column}.food-main-link{flex:1}.food-card-bottom{margin-top:auto}}
@media(max-width:1050px){.library-shell .library-intro{gap:24px;grid-template-columns:minmax(0,1fr) 250px}.library-art{height:210px}.cuisine-tile{flex-basis:108px}.library-shell .browse-tools{padding:18px}}
@media(max-width:760px){.library-shell .library-intro{display:block;padding:32px 0 26px}.library-art{display:none}.library-shell .library-intro h1{font-size:38px;letter-spacing:-1.5px;max-width:540px}.library-shell .library-intro .lede{font-size:14px;margin:16px 0}.library-shell .library-summary{margin-top:18px;gap:8px 16px}.cuisine-shelf-head p{display:none}.cuisine-rail{margin-right:-10px;padding-right:10px}.cuisine-tile{min-height:60px;flex:0 0 102px;padding:11px 13px}.cuisine-tile strong{font-size:14px}.cuisine-tile small{font-size:10px}.cuisine-shelf{margin-bottom:18px}.library-shell .browse-tools{padding:14px}.library-shell .food-grid{gap:12px}.library-shell .macro-line{font-size:10px;gap:6px 8px}.food-card-footer{align-items:flex-end}}
@media(max-width:420px){.library-shell .library-intro h1{font-size:34px}.library-shell .macro-line{font-size:11px}.library-shell .result-meta{font-size:11px}}
@media(prefers-reduced-motion:reduce){.library-art a:hover,.library-art a:focus-visible,.cuisine-tile:hover,.food-card:hover .card-arrow,.library-shell .pager button:not(:disabled):hover{transform:none;scale:1}.library-art a:hover img{scale:1}}
/* Cuisine selection lives in the rail; the hidden select preserves old deep links. */
.library-shell .tool-cuisine{display:none}
.library-shell .browse-tools{grid-template-columns:minmax(240px,1fr) 230px 220px}
.library-shell .tool-search{grid-column:auto}
@media(max-width:1050px){.library-shell .browse-tools{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.library-shell .tool-search{grid-column:1/-1}.library-shell .tool-sort{grid-column:auto}}
html:has(.food-dialog[open]){overflow:hidden}
.cuisine-rail{scrollbar-width:none}
.cuisine-rail::-webkit-scrollbar{display:none}
.cuisine-tile{flex-basis:100px;padding-left:12px;padding-right:12px}
.cuisine-tile strong{font-size:14px}
.library-shell a.food-card{padding:0}
/* Photography carries the visual variety; nutrition stays readable below it. */
.library-shell .food-main-link{display:flex;flex-direction:column;padding:0;min-height:0;background:transparent}
.food-card-copy{padding:12px 14px 10px;display:flex;flex:1;flex-direction:column;min-width:0;transition:background .2s}
.food-card-copy .nutrition{margin-top:8px;flex-wrap:wrap;gap:2px 8px}
.library-shell .food-card--text{border-top:3px solid var(--brand-orange);background:linear-gradient(145deg,var(--brand-butter),var(--brand-cream) 60%)}
.library-shell .food-card--text .food-card-copy{min-height:260px;padding:32px 28px;justify-content:center}
.library-shell .food-card--text h3{font-size:30px;line-height:1.35;margin-top:20px}
.library-shell .food-card--text .nutrition{margin-top:0;padding-top:28px}
.library-shell .food-card--text .nutrition b{font-size:54px}
.library-shell .food-main-link .food-photo{flex-shrink:0}
.library-shell .food-card .alternate{margin-bottom:0;min-height:0;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
@media(max-width:420px){.library-shell .browse-tools{grid-template-columns:minmax(0,1fr)}.library-shell .tool-search{grid-column:auto}}

/* Compact cards: fixed photo bounds, direct links and a separate accessible preview. */
.library-shell .food-card .food-photo{aspect-ratio:16/10;overflow:hidden;position:relative;min-width:0}
.library-shell .food-card .food-photo img{display:block;width:100%;height:100%;aspect-ratio:auto;object-fit:contain;transform:none;transition:none}
.library-shell .food-card .food-photo figcaption{position:absolute;inset:auto auto 6px 6px;padding:3px 6px;border-radius:5px;background:#fff9eeed;color:var(--brand-brown);font-size:9px;line-height:1.4;pointer-events:none}
.library-shell .food-card .nutrition>span{font-size:10px}
.library-shell .food-card--text .food-card-copy{min-height:0;padding:14px;justify-content:flex-start}
.library-shell .food-card--text h3{font-size:18px;margin-top:6px}
.library-shell .food-card--text .nutrition{padding-top:0;margin-top:8px}
.library-shell .food-card--text .nutrition b{font-size:30px}
.library-shell .food-card-footer{align-items:center}
.library-shell .quick-view{min-height:32px;padding:4px 0 4px 8px}
@media(pointer:coarse){.library-shell .quick-view{min-height:44px}}
.library-shell .food-main-link:active .food-card-copy{background:var(--brand-butter)}
.catalog-fallback-index{columns:3;margin-top:16px;font-size:12px;line-height:2}
@media(hover:hover) and (pointer:fine){.library-shell .food-card:hover .food-card-copy{background:var(--brand-cream)}}
/* A small thumbnail and a shared content row also keep mixed photo/text
   results compact, without reserving an empty photo-sized area. */
@media(min-width:761px){
 .library-shell .food-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .library-shell .food-main-link{display:grid;grid-template-columns:96px minmax(0,1fr);align-items:start;padding:12px 12px 0;gap:12px}
 .library-shell .food-card .food-photo{aspect-ratio:1;border-radius:10px}
 .library-shell .food-card-copy{padding:0 0 8px}
 .library-shell .food-card-bottom{padding:0 12px 8px}
 .library-shell .food-card--text .food-main-link{grid-template-columns:1fr}
 .library-shell .food-card--text .food-card-copy{padding:0 0 8px}
 .library-shell .food-card h3{font-size:17px;line-height:1.4}
 .library-shell .food-card .tag{font-size:10px}
 .library-shell .food-card .alternate{font-size:11px}
 .library-shell .nutrition b{font-size:30px}
}
@media(min-width:1280px){.library-shell .food-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){
 .library-shell .food-grid{grid-template-columns:1fr;gap:10px}
 .library-shell .food-main-link{display:grid;grid-template-columns:112px minmax(0,1fr);align-items:start;padding:12px 12px 0;gap:12px}
 .library-shell .food-card .food-photo{aspect-ratio:1;border-radius:10px}
 .library-shell .food-card-copy{padding:0 0 8px}
 .library-shell .food-card h3{font-size:17px;margin:4px 0;line-height:1.4}
 .library-shell .food-card .tag{font-size:10px;padding-right:0}
 .library-shell .food-card .alternate{font-size:10px;line-height:1.45}
 .library-shell .nutrition b{font-size:27px;letter-spacing:-.7px}
 .library-shell .food-card-bottom{padding:0 12px 6px}
 .library-shell .quick-view{min-height:44px}
 .library-shell .macro-line{padding:7px 0 0;font-size:10px;gap:4px 10px}
 .library-shell .food-card--text .food-main-link{grid-template-columns:1fr}
 .library-shell .food-card--text .food-card-copy{padding:0 0 8px;min-height:0}
 .catalog-fallback-index{columns:2}
}
@media(max-width:359px){
 .library-shell .food-main-link{grid-template-columns:88px minmax(0,1fr);gap:10px;padding:10px 10px 0}
 .library-shell .food-card h3{font-size:15px}
 .library-shell .food-card .card-arrow{font-size:14px;margin-left:5px}
 .library-shell .food-card-bottom{padding:0 10px 6px}
 .library-shell .food-card .food-photo figcaption{font-size:8px;inset:auto auto 4px 4px}
 .catalog-fallback-index{columns:1}
}
