/* Themes, language switcher and store badges. Loaded last; motion and layout stay in the files above. */
:root{--bg:#fff;--surface:#fff;--surface-elevated:#fff;--menu-shadow:0 14px 34px #17201e1f,0 2px 6px #17201e0f;color-scheme:light}
:root[data-theme="dark"]{--ink:#eef2f0;--muted:#a3ada9;--accent:#ff5f7c;--pink:#2a1519;--line:#27312f;--soft:#131918;--green:#45c08f;--bg:#0e1312;--surface:#161d1b;--surface-elevated:#18201e;--menu-shadow:0 18px 40px #0009,0 2px 8px #0006;color-scheme:dark}

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

/* Language switcher: flag, code and a menu that names each language in its own tongue. */
.lang-switch{position:relative}
.lang-trigger{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:0 10px 0 9px;border:1px solid transparent;border-radius:999px;background:transparent;color:var(--ink);font:650 12px/1 Manrope,Arial,sans-serif;transition:background .2s,border-color .2s}
.lang-trigger:hover,.lang-trigger[aria-expanded="true"]{background:var(--soft);border-color:var(--line)}
.lang-trigger:focus-visible{outline-offset:2px}
.flag{width:20px;height:14px;flex-shrink:0;border-radius:2.5px;box-shadow:0 0 0 1px #17201e24}
:root[data-theme="dark"] .flag{box-shadow:0 0 0 1px #ffffff2e}
.lang-chevron,.lang-check{fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round}
.lang-chevron{width:14px;height:14px;stroke-width:2;color:var(--muted);transition:transform .2s ease}
.lang-trigger[aria-expanded="true"] .lang-chevron{transform:rotate(180deg)}
.lang-menu{position:absolute;top:calc(100% + 8px);right:0;z-index:40;min-width:212px;margin:0;padding:6px;list-style:none;background:var(--surface-elevated);border:1px solid var(--line);border-radius:12px;box-shadow:var(--menu-shadow);transform-origin:top right;animation:lang-menu-in .16s ease-out}
.lang-menu button{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:0 12px;border:0;border-radius:8px;background:transparent;color:var(--ink);font:500 14px/1.2 Manrope,Arial,sans-serif;text-align:left;transition:background .15s}
.lang-menu button:hover{background:var(--soft)}
.lang-menu button:focus-visible{background:var(--soft);outline:2px solid var(--accent);outline-offset:-2px}
.lang-menu button>span{flex:1}
.lang-menu small{margin-left:4px;font-size:12px;color:var(--muted)}
.lang-menu [aria-checked="true"]{font-weight:700}
.lang-check{width:16px;height:16px;stroke-width:2.4;color:var(--accent);opacity:0}
.lang-menu [aria-checked="true"] .lang-check{opacity:1}
@keyframes lang-menu-in{from{opacity:0;transform:translateY(-4px) scale(.98)}to{opacity:1;transform:none}}

/* Theme toggle: the icon shows the theme a click leads to. */
.theme-toggle{position:relative;width:40px;height:40px;background:transparent;border-color:transparent;color:var(--ink);overflow:hidden}
.theme-toggle:hover{background:var(--soft);border-color:var(--line)}
.theme-toggle:focus-visible{outline-offset:2px}
.theme-icon{position:absolute;inset:0;display:grid;place-items:center;transition:opacity .25s ease,transform .4s cubic-bezier(.2,.8,.2,1)}
.theme-icon svg.lucide{width:18px;height:18px;stroke-width:1.8}
.theme-icon-sun{opacity:0;transform:rotate(-90deg) scale(.5)}
:root[data-theme="dark"] .theme-icon-moon{opacity:0;transform:rotate(90deg) scale(.5)}
:root[data-theme="dark"] .theme-icon-sun{opacity:1;transform:none}

/* Store badges: the stores' own black-badge convention, sized as secondary actions. */
.store-links{gap:12px;margin-top:32px}
.store-links a.store-badge{position:relative;min-width:150px;min-height:0;width:auto;height:48px;justify-content:center;gap:10px;padding:0 18px 0 14px;border:1px solid #000;border-radius:10px;background:#000;color:#fff;box-shadow:0 1px 2px #0000001f;transition:transform .2s,background .2s,box-shadow .2s}
.store-links a.store-badge:hover{background:#1d1d1f;border-color:#1d1d1f;transform:translateY(-1px);box-shadow:0 6px 14px #0000002e}
.store-links a.store-badge .store-logo{width:18px;height:20px}
.store-links a.store-badge .store-logo-apple{width:18px;height:22px;margin-top:-2px}
.store-links a.store-badge>span:not(.sr-only){display:block;font-size:10px;line-height:1.2;color:#ffffffd1}
.store-links a.store-badge strong{display:block;font-size:16px;font-weight:600;line-height:1.15;color:#fff}
:root[data-theme="dark"] .store-links a.store-badge{border-color:#ffffff47;box-shadow:none}
:root[data-theme="dark"] .store-links a.store-badge:hover{background:#111;border-color:#ffffff80}

/* Header density with the two new controls: below the width that fits every language, links move to the menu. */
.desktop-nav a{white-space:nowrap}
@media(max-width:1180px){.desktop-nav{display:none}.menu-toggle{display:flex}}
@media(min-width:1181px){.mobile-menu{display:none!important}}
@media(max-width:1100px){.lang-trigger{padding:0 8px}.nav-actions{gap:8px}.login{margin-left:4px}}
@media(max-width:800px){
  .nav-actions{gap:6px}
  .lang-trigger{min-height:36px;padding:0 7px;gap:5px}
  .theme-toggle{width:36px;height:36px}
  .lang-menu{position:fixed;top:calc(var(--header) - 6px);right:16px;left:auto}
}
.nav .brand{flex-shrink:0}
/* On phones the theme lives in the menu as a labelled switch, so the logo never gets squeezed. */
.menu-theme{display:none}
.menu-theme svg.lucide{width:18px;height:18px}
.menu-theme>span:not(.switch-track){flex:1}
.switch-track{position:relative;width:40px;height:24px;flex-shrink:0;border-radius:12px;background:#cfd6d3;transition:background .2s}
.switch-track:after{content:'';position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 3px #0003;transition:transform .2s}
.menu-theme[aria-checked="true"] .switch-track{background:var(--accent)}
.menu-theme[aria-checked="true"] .switch-track:after{transform:translateX(16px)}
.menu-theme:focus-visible{outline-offset:2px}
@media(max-width:420px){
  .lang-code{display:none}.lang-trigger{padding:0 6px}.nav .brand img{width:88px}
  .theme-toggle{display:none}
  .menu-theme{display:flex;align-items:center;gap:12px;width:100%;min-height:44px;margin-top:2px;padding:12px 0 0;border:0;border-top:1px solid var(--line);background:none;color:var(--ink);font:inherit;text-align:left}
}
@media(max-width:340px){.lang-chevron{display:none}.nav .brand img{width:80px}}

/* Hero card: transparent cut-out, so no crop box, radius or background of its own. */
.recipe-crop{aspect-ratio:840/622;overflow:visible;border-radius:0;background:none;box-shadow:none;filter:drop-shadow(0 12px 22px #18231e33)}
.recipe-crop img{position:static;width:100%;max-width:100%;height:auto}
/* The card starts beside the burger, not over it, and eases back as the stack narrows.
   Progress comes from the scale variables the hero already sets (desktop .82->1.25, phone 1.1->1.25). */
@media(min-width:801px){.hero-recipe{right:calc(10% + min(1, (var(--recipe-scale,.82) - .82) / .215) * 7%)}}
/* Phone: the burger scales with the screen height, the card does not; the start offset follows the height
   (calibrated at 375x560, 390x664, 390x750 and 430x830), never closer than 10% to the edge,
   and it always ends at the original 28%, where the zoomed card still fits on screen. */
@media(max-width:800px){.hero-recipe{--card-start:max(10%, 18% + (664px - 100svh) * .34);right:calc(var(--card-start) + min(1, (var(--mobile-recipe-scale,1.1) - 1.1) / .0825) * (28% - var(--card-start)))}}
@media(max-width:800px) and (min-height:741px){.hero{--mobile-actions-travel:20px}.hero-recipe{bottom:21%}}

/* Phone hero: more air above the title, a primary-size CTA, and the action group sitting lower. */
@media(max-width:800px){
  .hero-copy{top:44px}
  .hero-film{top:200px}
  .hero-actions{gap:14px}
  .hero-actions>.button{min-height:52px;min-width:232px;padding:0 28px;font-size:15px;gap:14px}
  .hero-validation p{font-size:12px}
  .hero-validation>svg{width:28px;height:28px}
}
@media(max-width:800px) and (max-height:740px){
  .hero-copy{top:34px}
  .hero-film{top:182px}
  .hero{--mobile-actions-travel:16px}
  .hero-actions{gap:12px}
  .hero-actions>.button{min-height:50px;font-size:15px}
  .hero-validation p{font-size:11px}
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] body{background:var(--bg)}
:root[data-theme="dark"] .skip{background:var(--surface);color:var(--ink)}
:root[data-theme="dark"] .header{background:#0e1312e6;border-bottom-color:var(--line);-webkit-backdrop-filter:saturate(140%) blur(10px);backdrop-filter:saturate(140%) blur(10px)}
:root[data-theme="dark"] .icon-button{background:var(--surface);border-color:var(--line)}
:root[data-theme="dark"] .icon-button:hover{background:#1e2725;border-color:#3a4643}
:root[data-theme="dark"] .theme-toggle,:root[data-theme="dark"] .menu-toggle{background:transparent;border-color:transparent}
:root[data-theme="dark"] .theme-toggle:hover,:root[data-theme="dark"] .menu-toggle:hover{background:var(--soft);border-color:var(--line)}

/* Hero: page, annotations and the product card. */
:root[data-theme="dark"] .hero{background:var(--bg)}
:root[data-theme="dark"] .hero-progress{background:var(--line)}
:root[data-theme="dark"] .hero-kicker>span{border-left-color:var(--line)}
:root[data-theme="dark"] .hero:not(.poster-ready) .hero-film video{visibility:hidden}
:root[data-theme="dark"] .ingredient-label path{stroke:#76817d}
:root[data-theme="dark"] .ingredient-label circle{stroke:#8e9995}
:root[data-theme="dark"] .ingredient-label text{fill:#eef2f0}
:root[data-theme="dark"] .ingredient-label .ingredient-value{fill:#b3bdb9}
:root[data-theme="dark"] .ingredient-disclaimer{fill:#8f9a96}
:root[data-theme="dark"] .recipe-crop{filter:drop-shadow(0 16px 26px #000000a6)}

/* Surfaces that were hard-coded light. */
:root[data-theme="dark"] .trust-band{background:#111716}
:root[data-theme="dark"] .receipt-section{background:var(--bg)}
:root[data-theme="dark"] .steps li span{border-color:#3a4542}
:root[data-theme="dark"] .workflow-image img,:root[data-theme="dark"] .nutrition-image img{filter:drop-shadow(0 22px 30px #00000080)}
:root[data-theme="dark"] .workflow-image:before,:root[data-theme="dark"] .nutrition-image:before{filter:blur(55px)}
:root[data-theme="dark"] .cost-equation article{border-bottom-color:var(--line)}
:root[data-theme="dark"] .cost-symbol{color:#9aa5a1}
:root[data-theme="dark"] .cost-equation article:nth-child(2) .cost-symbol{color:#ff6f88}
:root[data-theme="dark"] .cost-equation article:nth-child(3) .cost-symbol,:root[data-theme="dark"] .cost-total>svg{color:var(--green)}
:root[data-theme="dark"] .cost-equation .cost-step{color:#7f8a86}
:root[data-theme="dark"] .kitchen{background:var(--surface)}
:root[data-theme="dark"] .kitchen-burger{background:radial-gradient(120% 90% at 50% 38%,#2a211d 0%,#161c1b 62%)}
:root[data-theme="dark"] .kitchen-burger img{mix-blend-mode:normal}
:root[data-theme="dark"] .kitchen-chips li{background:#1c2522}

/* Calculator. */
:root[data-theme="dark"] .cost-results{background:#121a18}
:root[data-theme="dark"] .cost-results.negative{background:#221417}
:root[data-theme="dark"] .cost-results.negative #unit-result,:root[data-theme="dark"] #calc-error{color:#ff7b8b}
:root[data-theme="dark"] .number-input input{background:var(--surface);border-color:#34403d;color:var(--ink)}
:root[data-theme="dark"] .result-metrics .unit-result{border-top-color:var(--line)}
:root[data-theme="dark"] #bar-fixed,:root[data-theme="dark"] .fixed-dot{background:#8a9591}
:root[data-theme="dark"] #bar-profit,:root[data-theme="dark"] .contribution-dot{background:#3fb489}

@media(prefers-reduced-motion:reduce){.lang-menu{animation:none}.theme-icon,.lang-chevron,.store-links a.store-badge,.switch-track,.switch-track:after{transition:none}.store-links a.store-badge:hover{transform:none}}
