/* =============================================================================
 * styles.css — TopSport Hub (the same on every club's site; the club's colours: css/theme.css)
 * =============================================================================
 * Design intent: calm, editorial, in the spirit of the Claude platform. A warm
 * paper canvas, near-black ink, hairline borders and generous whitespace; a
 * serif (Newsreader) carries headlines, the system sans-serif stack carries
 * navigation, controls and body text. The theme colour (--brand) is a quiet
 * accent: markers, focus, play buttons. The one loud element is the homepage
 * photo; cards open a gallery from a small mosaic ("bento") of their media.
 *
 *   1. Fonts                         7. Home hero + footer
 *   2. Tokens + 6 themes             8. Language menu
 *   3. Base / utilities              9. Gallery viewer
 *   4. Buttons & form controls      10. Password overlay
 *   5. Header / navigation          11. Meal planner
 *   6. Page hero + cards + bento    12. Responsive / RTL / motion / print
 * The Periodization page has its own file, css/periodization.css (like css/fuel-calculator.css).
 *
 * RTL: logical properties (inline-start/end, margin-inline …) mirror the whole
 * layout when <html dir="rtl"> is set — no separate stylesheet.
 * THEMES: app.js sets <html data-theme="…"> from data/content.js › site.theme; only the tokens in section 2 change.
 * "club" (the default) is the club's own primary and secondary colour, in css/theme.css, which build.js makes from
 * club-configs/<club>.json. --brand-2 (the secondary colour) is only ever a fill: the stripe above the header.
 * ========================================================================== */

/* ------------------------------------------------------------------ 1. FONTS */
@font-face { font-family: "Newsreader"; src: url("../assets/fonts/newsreader-latin.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; src: url("../assets/fonts/newsreader-italic-latin.woff2") format("woff2"); font-weight: 400 600; font-style: italic; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Noto Sans Arabic"; src: url("../assets/fonts/noto-sans-arabic.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }

/* ------------------------------------------------- 2. DESIGN TOKENS & THEMES */
:root {
  /* Warm neutrals */
  --paper: #faf9f5;      /* page canvas */
  --white: #ffffff;      /* raised surfaces: cards, inputs, menus */
  --mist: #f0eee6;       /* quiet fills, hover */
  --line: #e6e3d8;
  --grey-300: #cfccbf;
  --grey-500: #8a877c;
  --grey-700: #5c5a53;
  --ink: #141413;
  --stage: #1f1e1d;      /* gallery viewer */

  /* Theme tokens — overwritten per theme below and by css/theme.css (the club's colours). Default: ink, no colour. */
  --brand: #141413;
  --brand-dark: #000000; /* hover */
  --on-brand: #ffffff;   /* text on --brand */
  --brand-ink: #141413;  /* brand colour as text / marker on paper (needs contrast) */
  --brand-soft: #e6e3d8; /* pale tint */
  --brand-2: var(--brand);       /* the club's second colour: a fill only (it may be too light for text) */
  --on-brand-2: var(--on-brand); /* text on --brand-2 */

  /* Type: serif for headlines, the system sans-serif stack for everything you read or press */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  --font-display: "Newsreader", "Noto Sans Arabic", Georgia, "Times New Roman", serif;
  --step--1: clamp(.8125rem, .79rem + .1vw, .875rem);
  --step-0:  clamp(.9375rem, .91rem + .15vw, 1.0625rem);
  --step-1:  clamp(1.125rem, 1.05rem + .4vw, 1.375rem);
  --step-2:  clamp(1.375rem, 1.15rem + .9vw, 2rem);
  --step-5:  clamp(2.5rem, 1.6rem + 4.2vw, 4.75rem);    /* page title */
  --step-6:  clamp(2.75rem, 1.5rem + 6.2vw, 6.25rem);   /* home title */

  /* Space (4px grid) */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem;
  --s6: 2rem; --s7: 3rem; --s8: 4.5rem; --s9: 7rem;

  --radius-card: 22px;
  --radius-ctl: 12px;
  --container: 1240px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme="red"]    { --brand: #c60c30; --brand-dark: #9c0f06; --on-brand: #fff;    --brand-ink: #c60c30; --brand-soft: #f7dfe3; }
:root[data-theme="yellow"] { --brand: #ffc800; --brand-dark: #d9a900; --on-brand: #141413; --brand-ink: #7a5c00; --brand-soft: #fff0b8; }
:root[data-theme="black"]  { --brand: #141413; --brand-dark: #000;    --on-brand: #fff;    --brand-ink: #141413; --brand-soft: #e6e3d8; }
:root[data-theme="navy"]   { --brand: #0b2a5b; --brand-dark: #071c3e; --on-brand: #fff;    --brand-ink: #0b2a5b; --brand-soft: #dde6f6; }
:root[data-theme="orange"] { --brand: #d9480f; --brand-dark: #a93608; --on-brand: #fff;    --brand-ink: #b53a08; --brand-soft: #fbe2d5; }
:root[data-theme="olive"]  { --brand: #4a5d23; --brand-dark: #33411a; --on-brand: #fff;    --brand-ink: #4a5d23; --brand-soft: #e4ebd0; }

/* ------------------------------------------------------------ 3. BASE/UTILS */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}
img, svg { max-width: 100%; display: block; }
button, a { -webkit-tap-highlight-color: transparent; }
button, .card.is-openable { touch-action: manipulation; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 500; line-height: 1.1; letter-spacing: -.02em; font-optical-sizing: auto; margin: 0 0 .5em; text-wrap: balance; }
h1, h2 { overflow-wrap: break-word; hyphens: auto; }
h3, h4 { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
p { margin: 0 0 1em; text-wrap: pretty; }
a { color: inherit; text-underline-offset: .2em; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* Texts may contain "\n" (line breaks) — show them. */
[data-i18n] { white-space: pre-line; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.hero-pitch :focus-visible { outline-color: var(--paper); }
#main:focus { outline: none; }  /* <main> is focused programmatically after navigation (screen readers) */
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.noscript { margin: 0; padding: 1rem; background: #fff3cd; text-align: center; }

/* ------------------------------------------------- 4. BUTTONS & FORM CONTROLS */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

/* Outlined pill used on coloured/dark heroes */
.btn-ring {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 11rem; min-height: 50px; padding: .5rem 1.5rem;
  font: 600 .9375rem/1.2 var(--font-body); color: var(--ink);
  border: 1.5px solid var(--grey-300); border-radius: var(--radius-ctl); background: transparent;
  text-decoration: none; cursor: pointer;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.btn-ring:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.hero-pitch .btn-ring { color: var(--paper); border-color: rgb(250 249 245 / .55); }
.hero-pitch .btn-ring:hover { background: var(--paper); border-color: var(--paper); color: var(--ink); }

input[type="text"], input[type="password"] {
  width: 100%; min-height: 44px; padding: .55rem .8rem;
  font: inherit; font-size: .9375rem; color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--radius-ctl);
  transition: border-color .15s;
}
input:hover { border-color: var(--grey-300); }
input:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgb(29 29 29 / .08); }
.field-error { min-height: 1.4em; margin: .4rem 0 .6rem; color: #b00020; font-weight: 600; font-size: .875rem; }

/* --------------------------------------------------- 5. HEADER / NAVIGATION */
.site-header {
  position: sticky; inset-block-start: 0; z-index: 50; box-shadow: inset 0 4px 0 var(--brand-2);
  background: rgb(250 249 245 / .92); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.header-inner {
  width: min(100%, var(--container)); margin-inline: auto; padding: .625rem var(--gutter);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s5);
}
.brand { display: block; line-height: 0; }
.brand-logo { width: 44px; height: 44px; object-fit: contain; }
.nav-list { display: flex; gap: .25rem; }
.nav-link {
  display: inline-flex; align-items: center; min-height: 40px; padding: .35rem .9rem;
  font-size: .9375rem; color: var(--grey-700); text-decoration: none; border-radius: 10px;
  transition: background-color .15s, color .15s;
}
.nav-link:hover { background: var(--mist); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--mist); color: var(--ink); font-weight: 600; }

/* ------------------------------------------ 6. PAGE HERO + CARDS + BENTO */
.page-hero {
  width: min(100%, var(--container)); margin-inline: auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) var(--gutter) clamp(1.75rem, 4vw, 3.25rem);
}
.page-title { max-width: 14ch; font-size: var(--step-5); font-weight: 400; line-height: 1.02; letter-spacing: -.03em; margin-bottom: var(--s5); }
.page-sub { max-width: 52ch; margin: 0; font-size: var(--step-1); line-height: 1.5; color: var(--grey-700); }
.page-body { padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem); }

/* Education: the page title and a tab per section (Præstation, Dagligt, Brændstof), then the section's own heading */
.edu-hero { padding-bottom: 0; }
.edu-tabs { display: flex; gap: clamp(1.25rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.edu-tabs::-webkit-scrollbar { display: none; }
.edu-tab {
  position: relative; flex: none; display: inline-flex; align-items: center; min-height: 48px; padding: .5rem 0 .7rem;
  font: 600 clamp(1rem, .95rem + .2vw, 1.125rem)/1.2 var(--font-body); color: var(--grey-700); text-decoration: none; white-space: nowrap;
  transition: color .15s;
}
.edu-tab::after { content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 3px; background: transparent; border-radius: 3px 3px 0 0; transition: background-color .15s; }
.edu-tab:hover { color: var(--ink); }
.edu-tab:hover::after { background: var(--grey-300); }
.edu-tab[aria-current="page"] { color: var(--ink); }
.edu-tab[aria-current="page"]::after { background: var(--ink); }
.edu-section {
  width: min(100%, var(--container)); margin-inline: auto;
  padding: clamp(1.75rem, 4vw, 3rem) var(--gutter) clamp(1.5rem, 3vw, 2.5rem);
}
.edu-section-title { margin: 0 0 var(--s3); font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem); font-weight: 400; line-height: 1.1; letter-spacing: -.02em; }

.card-grid {
  width: min(100%, var(--container)); margin-inline: auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4);
  align-items: stretch;
}
.card-grid[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-grid[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.page-sub.content-error { padding: var(--s4) var(--s5); color: #4d3b00; background: #fff6d6; border: 1px solid #e8c24a; border-radius: var(--radius-ctl); }

.card {
  position: relative; display: flex; flex-direction: column; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease);
}
.card.is-openable { cursor: pointer; -webkit-user-select: none; user-select: none; }
.card.is-openable:hover { border-color: var(--grey-300); box-shadow: 0 14px 36px -18px rgb(20 20 19 / .22); }
.card.is-openable:active { border-color: var(--ink); }
.card:has(.card-open:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; }
.card-body { flex: 1; padding: var(--s5) var(--s5) var(--s4); -webkit-user-select: text; user-select: text; }
.card-title { font-size: clamp(1.375rem, 1.2rem + .5vw, 1.625rem); font-weight: 500; line-height: 1.12; margin-bottom: var(--s3); }
.card-open {
  display: block; width: 100%; margin: 0; padding: 0; font: inherit; letter-spacing: inherit; color: inherit;
  text-align: start; background: none; border: 0; cursor: pointer;
}
.card-open:focus-visible { outline: none; }          /* the whole card shows the focus ring */
.card-text { font-size: var(--step-0); line-height: 1.65; color: var(--grey-700); margin-bottom: var(--s4); }
.card-lead { font-weight: 600; color: var(--ink); margin-bottom: var(--s4); }
.card-list { font-size: var(--step-0); line-height: 1.6; color: var(--ink); margin-bottom: var(--s4); }
.card-list li { position: relative; padding-inline-start: 1.25rem; margin-bottom: .45rem; }
.card-list li::before { content: ""; position: absolute; inset-inline-start: 0; top: .78em; width: .55rem; height: 1.5px; background: var(--brand-ink); }
.card-list + .card-list { margin-top: var(--s5); }

.card-foot {
  display: flex; align-items: center; gap: .6rem; margin-inline: var(--s5); padding: .9rem 0 1.1rem;
  border-top: 1px solid var(--line); font-size: .875rem; font-weight: 600;
}
.card-foot-count {
  display: grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding-inline: .4rem;
  font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--grey-700); background: var(--mist); border-radius: 999px;
}
.card-foot svg { margin-inline-start: auto; color: var(--grey-700); transition: transform .25s var(--ease), color .2s; }
.card.is-openable:hover .card-foot svg { color: var(--brand-ink); transform: translateX(3px); }
[dir="rtl"] .card-foot svg { transform: scaleX(-1); }
[dir="rtl"] .card.is-openable:hover .card-foot svg { transform: scaleX(-1) translateX(3px); }

/* Bento: a small mosaic of the card's photos and videos, in place of one main photo */
.bento { display: grid; gap: .3125rem; margin: .5rem .5rem 0; aspect-ratio: 4 / 3; }
.bento.b1 { grid-template: 1fr / 1fr; }
.bento.b2 { grid-template: 1fr / 1fr 1fr; }
.bento.b3 { grid-template: 1fr 1fr / 1.4fr 1fr; }
.bento.b3 > :first-child { grid-row: 1 / span 2; }
.bento.b4 { grid-template: 1fr 1fr / 1.35fr 1fr 1fr; }
.bento.b4 > :nth-child(1) { grid-row: 1 / span 2; }
.bento.b4 > :nth-child(2) { grid-column: 2 / span 2; }
.bento-tile { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--mist); border-radius: 13px; }
.bento-tile > img, .bento-tile > video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transition: transform .6s var(--ease); }
.card.is-openable:hover .bento-tile > img, .card.is-openable:hover .bento-tile > video { transform: scale(1.04); }
.bento-tile.is-plain, .g-thumb.is-plain { background: #2b2a28; }
.bento-tile .play-badge { position: absolute; inset: 0; margin: auto; }
.bento-more {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 clamp(1.1rem, 1rem + .4vw, 1.4rem) var(--font-display); color: var(--paper); background: rgb(20 20 19 / .55);
}
.bento.b0 {
  place-content: center; justify-items: center; gap: .5rem; padding: 1rem; text-align: center;
  font-size: .875rem; color: var(--grey-500); background: var(--mist); border-radius: 14px;
}
.bento.b0 svg { width: 2.4rem; height: 2.4rem; }

.play-badge {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; color: var(--brand-ink);
  background: rgb(250 249 245 / .95); border-radius: 50%; box-shadow: 0 4px 16px rgb(20 20 19 / .3); pointer-events: none;
}
.play-badge svg { width: .85rem; height: .85rem; margin-inline-start: .1rem; }
[dir="rtl"] .play-badge svg { margin-inline-start: 0; margin-inline-end: -.1rem; margin-left: .1rem; margin-right: 0; }   /* play stays pointing right in every language */

/* ------------------------------------- 7. HOME HERO + SITE FOOTER */
.hero-pitch {
  position: relative; isolation: isolate; display: flex; align-items: flex-end; overflow: hidden; color: var(--paper);
  width: min(calc(100% - 2 * var(--gutter)), var(--container)); margin: var(--s4) auto 0;
  min-height: min(74vh, 700px); min-height: min(74svh, 700px);
  padding: clamp(1.5rem, 5vw, 4rem); border-radius: 28px;
  background-color: #2f3b2e;
  background-image: var(--hero-img, url("../assets/img/pitch.svg"));
  background-size: cover; background-position: center; background-repeat: no-repeat;
}
.hero-pitch::before {   /* a scrim keeps type legible on any photo; tinted with the club's colour where the browser can */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgb(20 20 19 / .42);
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 30%, rgb(20 20 19 / .2)), color-mix(in srgb, var(--brand) 82%, transparent));
}
.hero-pitch-logo { width: clamp(64px, 9vw, 88px); height: auto; margin-bottom: var(--s5); filter: drop-shadow(0 4px 14px rgb(0 0 0 / .35)); }
.hero-pitch-inner { max-width: 44rem; }
.hero-pitch-title { font-size: var(--step-6); font-weight: 400; line-height: .98; letter-spacing: -.035em; margin-bottom: var(--s3); }
.hero-pitch-sub { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: var(--step-2); letter-spacing: -.01em; margin-bottom: var(--s5); }
.hero-pitch-tagline { max-width: 36ch; margin-bottom: var(--s6); font-size: var(--step-1); line-height: 1.5; opacity: .92; }
.hero-pitch-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, max-content)); gap: var(--s3); }   /* the three pages side by side when they fit */

.site-footer {
  width: min(100%, var(--container)); margin: var(--s8) auto 0;
  padding: var(--s5) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); color: var(--grey-700); font-size: var(--step--1); text-align: center;
}
.footer-credit { margin: 0; }
.footer-credit a { color: var(--ink); }
.footer-credit a:hover { color: var(--brand-ink); }

/* ------------------------------------------ 8. LANGUAGE MENU (FLAG DROPDOWN) */
.lang-menu { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 40px; padding: .3rem .55rem; cursor: pointer;
  background: transparent; border: 0; border-radius: 8px; color: var(--ink);
  transition: background-color .15s;
}
.lang-btn:hover { background: var(--mist); }
.lang-caret { width: 9px; height: 6px; opacity: .7; }
.flag { width: 22px; height: 15px; flex-shrink: 0; }
.flag svg { width: 100%; height: 100%; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / .15); }
.lang-list {
  position: absolute; inset-block-start: calc(100% + 6px); inset-inline-end: 0; z-index: 60;
  min-width: 11rem; padding: 6px; background: var(--white);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgb(0 0 0 / .14);
}
.lang-option { display: flex; align-items: center; gap: .8rem; padding: .55rem .75rem; border-radius: 9px; cursor: pointer; font-size: .9375rem; }
.lang-option:hover, .lang-option:focus { background: var(--mist); outline: none; }
.lang-option[aria-selected="true"] { font-weight: 600; }
.lang-option .flag { width: 24px; height: 17px; }

/* --------------------------------------------------------- 9. GALLERY VIEWER */
.gallery {
  width: min(96vw, 1120px); height: min(92vh, 780px); height: min(92dvh, 780px); max-width: none; max-height: none;
  padding: 0; border: 0; border-radius: 26px; overflow: hidden; color: var(--paper); background: var(--stage);
  box-shadow: 0 30px 90px rgb(0 0 0 / .5);
}
.gallery[open] { display: flex; flex-direction: column; animation: gallery-in .3s var(--ease); }
.gallery::backdrop { background: rgb(20 20 19 / .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes gallery-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.gallery :focus-visible { outline-color: var(--paper); }
.gallery-head { display: flex; align-items: center; gap: var(--s4); padding: 1rem 1rem .5rem var(--s5); }
[dir="rtl"] .gallery-head { padding: 1rem var(--s5) .5rem 1rem; }
.gallery-title { flex: 1; min-width: 0; margin: 0; font-size: var(--step-1); font-weight: 500; color: var(--paper); }
.gallery-count { margin: 0; font-size: .875rem; color: rgb(250 249 245 / .65); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gallery-close, .g-btn {
  flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: var(--paper);
  background: rgb(250 249 245 / .1); border: 0; border-radius: 50%; cursor: pointer; transition: background-color .15s, opacity .15s;
}
.gallery-close:hover, .g-btn:hover:not(:disabled) { background: rgb(250 249 245 / .2); }
.g-btn:disabled { opacity: .3; cursor: default; }
.g-btn.is-next svg { transform: scaleX(-1); }            /* chevron is drawn pointing "back"; mirror it for next */
[dir="rtl"] .g-btn.is-prev svg { transform: scaleX(-1); }
[dir="rtl"] .g-btn.is-next svg { transform: none; }

.gallery-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.g-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.g-stage { flex: 1; min-height: 0; container-type: size; }
.g-track {
  height: 100%; display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.g-track::-webkit-scrollbar { display: none; }
.g-track:focus-visible { outline-offset: -3px; }
.g-slide { flex: 0 0 100%; min-width: 0; height: 100%; display: grid; place-items: center; scroll-snap-align: center; scroll-snap-stop: always; }
.g-frame { position: relative; width: calc(100cqw - 2rem); height: calc(100cqh - .5rem); }
.g-frame > img { display: block; width: 100%; height: 100%; object-fit: contain; }      /* photos fill the stage, never cropped */
.g-frame.is-video {
  width: min(calc(100cqw - 2rem), calc((100cqh - .5rem) * 16 / 9)); height: auto; aspect-ratio: 16 / 9;
  overflow: hidden; background: #000; border-radius: 14px;
}
.g-frame iframe, .g-frame > video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.g-poster {
  position: absolute; inset: 0; display: grid; place-items: center; width: 100%; height: 100%; padding: 0;
  background: #2b2a28; border: 0; cursor: pointer;
}
.g-poster > img, .g-poster > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.g-poster .play-badge { position: relative; width: 4rem; height: 4rem; transition: transform .2s var(--ease); }
.g-poster .play-badge svg { width: 1.3rem; height: 1.3rem; }
.g-poster:hover .play-badge { transform: scale(1.08); }

.g-langs { display: flex; flex-wrap: wrap; justify-content: center; gap: .375rem; padding: .625rem var(--s4) 0; }
.g-lang {
  min-width: 2.75rem; min-height: 34px; padding: .3rem .6rem; cursor: pointer;
  font: 600 .75rem/1 var(--font-body); letter-spacing: .05em; color: rgb(250 249 245 / .78);
  background: transparent; border: 1px solid rgb(250 249 245 / .28); border-radius: 999px;
  transition: color .15s, background-color .15s, border-color .15s;
}
.g-lang:hover { color: var(--paper); border-color: rgb(250 249 245 / .65); }
.g-lang[aria-pressed="true"] { color: var(--ink); background: var(--paper); border-color: var(--paper); }
.g-caption { margin: 0; padding: .25rem var(--s5) 0; text-align: center; font-size: .9375rem; color: rgb(250 249 245 / .85); }
.g-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s3); padding: .5rem 1rem 1rem; }
.g-thumbs { display: flex; gap: .5rem; padding: 5px; overflow-x: auto; justify-content: safe center; scrollbar-width: none; }
.g-thumbs::-webkit-scrollbar { display: none; }
.g-thumb {
  position: relative; flex: 0 0 auto; width: 64px; height: 48px; padding: 0; overflow: hidden; cursor: pointer;
  background: #3a3937; border: 0; border-radius: 10px; opacity: .55; transition: opacity .2s, box-shadow .2s;
}
.g-thumb:hover { opacity: .85; }
.g-thumb[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--stage), 0 0 0 4px var(--paper); }
.g-thumb > img, .g-thumb > video { width: 100%; height: 100%; object-fit: cover; }
.g-thumb .play-badge { position: absolute; inset: 0; margin: auto; width: 1.5rem; height: 1.5rem; box-shadow: none; }
.g-thumb .play-badge svg { width: .55rem; height: .55rem; }

/* ------------------------------------------------------ 10. PASSWORD OVERLAY */
.lock {
  position: fixed; inset: 0; z-index: 1000; overflow-y: auto;
  display: grid; place-items: center; padding: var(--s4);
  color: var(--ink); background: var(--paper);
}
.lock .lock-lang { position: absolute; inset-block-start: var(--s4); inset-inline-end: var(--s4); }
.lock-card {
  width: min(100%, 560px); padding: clamp(2.25rem, 7vw, 3.75rem) clamp(1.25rem, 6vw, 3rem) clamp(2rem, 6vw, 3.25rem);
  background: var(--white); border: 1px solid var(--line); border-radius: 28px; text-align: center;
}
.lock-logo { width: 72px; height: 72px; object-fit: contain; margin: 0 auto var(--s4); }
.lock-title { font-weight: 400; letter-spacing: -.025em; font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.75rem); line-height: 1.08; max-width: 18ch; margin: 0 auto var(--s3); }
.lock-text { font-size: .9375rem; color: var(--grey-700); margin-bottom: var(--s6); }
.lock-form { width: min(100%, 340px); margin-inline: auto; text-align: start; }
.password-field { position: relative; }
.password-field input { min-height: 52px; padding-inline: .95rem 4.4rem; font-size: 1rem; }
.password-toggle {
  position: absolute; inset-block: 0; inset-inline-end: 0; min-width: 44px; padding-inline: .8rem;
  background: none; border: 0; font: 600 .8125rem var(--font-body); color: var(--grey-700); cursor: pointer;
}
.password-toggle:hover { color: var(--ink); }
.btn-dark {
  display: block; width: 100%; min-height: 52px; margin-top: .6rem;
  font: 600 1rem var(--font-body); color: var(--paper);
  background: var(--ink); border: 0; border-radius: var(--radius-ctl); cursor: pointer; transition: background-color .15s;
}
.btn-dark:hover:not(:disabled) { background: #000; }
.btn-dark:disabled { opacity: .5; cursor: not-allowed; }
.lock-cancel { display: block; text-align: center; margin-top: var(--s4); font-size: .875rem; }
/* The other way in: a person's own login. A small, quiet button under the form swaps the two. */
.lock-login label { display: block; margin: var(--s3) 0 var(--s2); font-size: .8125rem; font-weight: 600; color: var(--grey-700); }
.lock-login label:first-child { margin-top: 0; }
.lock-login input[type="text"] { min-height: 52px; font-size: 1rem; }
.lock-switch {
  display: block; margin: var(--s5) auto 0; padding: .4rem .6rem; min-height: 36px;
  font: 500 .8125rem/1.3 var(--font-body); color: var(--grey-700); background: none; border: 0; border-radius: 8px;
  text-decoration: underline; text-underline-offset: .2em; cursor: pointer;
}
.lock-switch:hover { color: var(--ink); background: var(--mist); }
.lock .field-error { margin: .5rem 0 .4rem; }
.lock.is-shake .lock-card { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* --------------------------------------------------------- 11. MEAL PLANNER */
/* js/meal-planner.js: the allergies & diet bar, a progress bar, one question at a time, then meal cards.
   Phone first: one column, a compact sticky bar, progress steps stacked. From 760 px (tablet up) the three
   day / time cards sit side by side; meal cards fill as many columns of at least 18.5rem as fit.
   Text never spills out of a cell: words wrap (and hyphenate where the browser knows the language);
   nothing is cut off with an ellipsis.
   Day cards carry fixed tones (they must stay apart whatever site.theme is); the macro bars use three
   validated categorical hues and always show their number next to the bar. */
.planner {
  --tone: var(--ink); --tone-soft: var(--mist);
  --macro-carbs: #2a78d6; --macro-protein: #eb6834; --macro-fat: #1baf7a;
  --have: #33411a; --have-soft: #e4ebd0;
  width: min(100%, var(--container)); margin-inline: auto; scroll-margin-top: 5.5rem;
  overflow-wrap: break-word;
}
.planner-body { overflow-x: clip; }        /* a step sliding in never makes the page scroll sideways (clip keeps the sticky bar working) */
.planner :where(.choice-title, .choice-text, .pp-label, .pp-value, .pantry-label, .diet-chip-label, .diet-toggle-label, .swap-item, .meal-uses li, .macro-label, .btn-primary, .btn-ghost) {
  -webkit-hyphens: auto; hyphens: auto;
}
.tone-match    { --tone: #c60c30; --tone-soft: #f7dfe3; }
.tone-daily    { --tone: #4a5d23; --tone-soft: #e4ebd0; }
.tone-recovery { --tone: #0b2a5b; --tone-soft: #dde6f6; }

.planner-status { margin: 0; padding: var(--s6) 0; color: var(--grey-700); }
.planner-status.is-error { padding: var(--s4) var(--s5); color: #4d3b00; background: #fff6d6; border: 1px solid #e8c24a; border-radius: var(--radius-ctl); }
.planner-empty {
  display: grid; justify-items: start; gap: var(--s3); padding: var(--s5);
  background: var(--white); border: 1px dashed var(--grey-300); border-radius: var(--radius-card);
}
.planner-empty p { max-width: 56ch; margin: 0; }
.choice-grid + .planner-empty { margin-top: var(--s4); }

/* Allergies & diet: a pill at the top, the active ones as removable tags, the full list in a panel */
.planner-top { margin-bottom: var(--s5); scroll-margin-top: 5.5rem; }   /* scrolled to below the sticky header */
.diet-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.diet-toggle {
  display: inline-flex; align-items: center; gap: .55rem; max-width: 100%; min-height: 44px; padding: .45rem .9rem .45rem .75rem;
  font: 600 .9375rem/1.25 var(--font-body); color: var(--ink); text-align: start; cursor: pointer;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 999px; transition: border-color .15s, background-color .15s;
}
.diet-toggle:hover, .diet-toggle[aria-expanded="true"] { border-color: var(--ink); }
.diet-toggle[aria-expanded="true"] { background: var(--mist); }
.diet-toggle-icon { display: grid; color: var(--brand-ink); }
.diet-toggle-icon svg { width: 1.25rem; height: 1.25rem; }
.diet-toggle-label { min-width: 0; }
.diet-count { flex-shrink: 0; padding: .1rem .5rem; font-size: .75rem; font-weight: 600; color: var(--paper); white-space: nowrap; background: var(--ink); border-radius: 999px; }
.diet-chevron { display: grid; flex-shrink: 0; }
.diet-chevron svg { width: 1rem; height: 1rem; transition: transform .25s var(--ease); }
.diet-toggle[aria-expanded="true"] .diet-chevron svg { transform: rotate(180deg); }
.diet-active { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 0; }
.diet-tag {
  display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; min-height: 36px; padding: .25rem .4rem .25rem .75rem;
  font: 600 .8125rem/1.2 var(--font-body); color: var(--brand-ink); text-align: start; cursor: pointer;
  background: var(--brand-soft); border: 0; border-radius: 999px;
}
.diet-tag-x { flex-shrink: 0; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; transition: background-color .15s, color .15s; }
.diet-tag-x svg { width: .7rem; height: .7rem; }
.diet-tag:hover .diet-tag-x { color: var(--on-brand); background: var(--brand); }

.diet-panel {
  margin-top: var(--s3); padding: clamp(1rem, 3vw, 1.5rem);
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: 0 18px 50px -30px rgb(20 20 19 / .35); animation: diet-in .25s var(--ease);
}
@keyframes diet-in { from { opacity: 0; transform: translateY(-6px); } }
.diet-title { margin-bottom: var(--s2); font-size: var(--step-2); font-weight: 400; }
.diet-note {
  max-width: 64ch; margin-bottom: var(--s5); padding-inline-start: .75rem;
  font-size: .875rem; line-height: 1.5; color: var(--grey-700); border-inline-start: 3px solid var(--brand);
}
.diet-group + .diet-group { margin-top: var(--s5); }
.diet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr)); gap: var(--s2); }
.diet-chip {
  display: flex; align-items: center; gap: .6rem; min-width: 0; min-height: 48px; padding: .45rem .75rem;
  font: 500 .9375rem/1.25 var(--font-body); color: var(--ink); text-align: start; cursor: pointer;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px;
  transition: background-color .15s, border-color .15s;
}
.diet-chip:hover { border-color: var(--grey-300); }
.diet-chip-box {
  flex-shrink: 0; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; color: transparent;
  border: 1.5px solid var(--grey-300); border-radius: 6px; transition: background-color .15s, border-color .15s, color .15s;
}
.diet-chip-box svg { width: .75rem; height: .75rem; }
.diet-chip-label { min-width: 0; }
.diet-chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-ink); }
.diet-chip[aria-pressed="true"] .diet-chip-box { color: var(--on-brand); background: var(--brand); border-color: var(--brand); }
.diet-actions { display: flex; justify-content: flex-end; margin-top: var(--s5); }

/* Progress: a hairline that fills, and the three steps with their answers */
.planner-nav { margin-bottom: clamp(1.75rem, 4vw, 2.75rem); }
.pp-bar { position: relative; height: 3px; margin-bottom: var(--s3); overflow: hidden; background: var(--line); border-radius: 3px; }
.pp-fill { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--progress, 0%); background: var(--ink); border-radius: inherit; transition: width .6s var(--ease); }
.planner-progress { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.pp-item { min-width: 0; }
.pp-step {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; padding: 0;
  font: inherit; color: var(--grey-500); text-align: start; background: none; border: 0;
}
button.pp-step { cursor: pointer; }
button.pp-step:hover .pp-label { text-decoration: underline; text-underline-offset: .2em; }
.pp-item.is-current .pp-step, .pp-item.is-done .pp-step { color: var(--ink); }
.pp-num {
  flex-shrink: 0; display: grid; place-items: center; width: 1.75rem; height: 1.75rem;
  font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--grey-300); border-radius: 50%; transition: background-color .25s, border-color .25s, color .25s;
}
.pp-num svg { width: .8rem; height: .8rem; }
.is-current .pp-num { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.is-done .pp-num { color: var(--ink); background: var(--mist); border-color: var(--ink); }
.pp-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pp-label { font-size: .875rem; font-weight: 600; }
.pp-value { font-size: .8125rem; color: var(--grey-700); }

/* One question */
.planner-stage { position: relative; }
.planner-kicker { margin: 0 0 var(--s2); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.planner-q { max-width: 22ch; margin-bottom: var(--s3); font-size: clamp(1.75rem, 1.25rem + 2.2vw, 2.75rem); font-weight: 400; letter-spacing: -.025em; line-height: 1.08; }
.planner-q:focus { outline: none; }          /* focused by script so screen readers read the new question */
.planner-hint { max-width: 56ch; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); color: var(--grey-700); }

/* Steps 1 and 3: large cards, one per choice */
.choice-grid { display: grid; gap: var(--s3); }
.choice {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s4);
  width: 100%; min-width: 0; padding: var(--s4); font: inherit; color: var(--ink); text-align: start; cursor: pointer;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-card);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease), opacity .2s;
}
.choice:hover:not(:disabled) { border-color: var(--grey-300); box-shadow: 0 16px 40px -22px rgb(20 20 19 / .3); transform: translateY(-2px); }
.choice:active:not(:disabled) { transform: translateY(0) scale(.99); }
.choice[aria-pressed="true"] { border-color: var(--tone); box-shadow: 0 0 0 1.5px var(--tone), 0 16px 40px -22px rgb(20 20 19 / .3); }
.choice:disabled { cursor: not-allowed; opacity: .5; }
.choice-icon {
  display: grid; place-items: center; width: 3.5rem; height: 3.5rem; color: var(--tone); background: var(--tone-soft); border-radius: 16px;
  transition: transform .35s var(--ease);
}
.choice-icon svg { width: 1.75rem; height: 1.75rem; }
.choice:hover:not(:disabled) .choice-icon, .choice[aria-pressed="true"] .choice-icon { transform: scale(1.06) rotate(-4deg); }
.choice-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.choice-title { max-width: 100%; font-family: var(--font-display); font-size: clamp(1.3rem, 1.15rem + .6vw, 1.625rem); font-weight: 500; line-height: 1.15; letter-spacing: -.015em; }
.choice-text { max-width: 100%; margin-top: .25rem; font-size: .9375rem; line-height: 1.45; color: var(--grey-700); }
.choice-meta {
  max-width: 100%; margin-top: .65rem; padding: .15rem .6rem; font-size: .8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--tone); background: var(--tone-soft); border-radius: 999px;
}
.choice.is-empty .choice-meta { color: var(--grey-500); background: var(--mist); }
.choice-arrow { display: grid; color: var(--grey-500); transition: transform .25s var(--ease), color .2s; }
.choice-arrow svg { width: 1.25rem; height: 1.25rem; }
.choice:hover:not(:disabled) .choice-arrow { color: var(--ink); transform: translateX(3px); }
[dir="rtl"] .choice-arrow svg, [dir="rtl"] .btn-icon svg, [dir="rtl"] .swap-arrow svg { transform: scaleX(-1); }
[dir="rtl"] .choice:hover:not(:disabled) .choice-arrow { transform: translateX(-3px); }

/* Step 2: ingredient toggles */
.pantry { display: grid; gap: var(--s5); }
.pantry-title { margin-bottom: var(--s3); font-family: var(--font-body); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey-700); }
.pantry-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.75rem), 1fr)); gap: var(--s2); }
.pantry-chip {
  display: flex; align-items: center; gap: .6rem; min-width: 0; min-height: 56px; padding: .5rem .7rem .5rem .5rem;
  font: inherit; font-size: .9375rem; font-weight: 500; line-height: 1.2; color: var(--ink); text-align: start; cursor: pointer;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 14px;
  transition: background-color .2s var(--ease), border-color .2s, color .2s, transform .15s;
}
.pantry-chip:hover { border-color: var(--grey-300); }
.pantry-chip:active { transform: scale(.97); }
.pantry-icon { flex-shrink: 0; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; color: var(--ink); background: var(--mist); border-radius: 10px; transition: background-color .2s, color .2s; }
.pantry-icon svg { width: 1.45rem; height: 1.45rem; }
.pantry-label { flex: 1; min-width: 0; }
.pantry-check {
  flex-shrink: 0; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; color: transparent;
  border: 1.5px solid var(--grey-300); border-radius: 50%; transition: background-color .2s, border-color .2s, color .2s;
}
.pantry-check svg { width: .75rem; height: .75rem; }
.pantry-chip[aria-pressed="true"] { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.pantry-chip[aria-pressed="true"]:hover { background: #000; }
.pantry-chip[aria-pressed="true"] .pantry-icon { color: var(--paper); background: rgb(250 249 245 / .14); }
.pantry-chip[aria-pressed="true"] .pantry-check { color: var(--on-brand); background: var(--brand); border-color: var(--brand); animation: planner-pop .3s var(--ease); }
@keyframes planner-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } }

/* The bar under a question: live count + buttons. On step 2 it stays at the bottom of the screen,
   on a solid background, so the toggles slide under it instead of showing through it. */
.planner-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4);
  margin-top: clamp(1.5rem, 3vw, 2.25rem); padding-block: var(--s4); border-top: 1px solid var(--line);
}
.planner-bar.is-sticky {
  position: sticky; inset-block-end: 0; z-index: 5; padding-bottom: max(var(--s4), env(safe-area-inset-bottom));
  background: var(--paper); box-shadow: 0 -14px 24px -20px rgb(20 20 19 / .45);
}
.planner-live { flex: 1 1 16rem; min-width: 0; margin: 0; font-size: .9375rem; color: var(--grey-700); }
.planner-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; margin-inline-start: auto; }
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-width: 0; min-height: 48px; padding: .5rem 1.25rem;
  font: 600 .9375rem/1.2 var(--font-body); text-align: center; text-decoration: none; cursor: pointer;
  border-radius: var(--radius-ctl); transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { color: var(--paper); background: var(--ink); border: 1.5px solid var(--ink); }
.btn-primary:hover { background: #000; }
.btn-ghost { color: var(--ink); background: transparent; border: 1.5px solid var(--grey-300); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-text { min-height: 48px; padding: 0 .6rem; font: 600 .9375rem var(--font-body); color: var(--grey-700); background: none; border: 0; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.btn-text:hover { color: var(--ink); }
.btn-icon { display: grid; flex-shrink: 0; }
.btn-icon svg { width: 1.1rem; height: 1.1rem; transition: transform .2s var(--ease); }
.btn-primary:hover .btn-icon:not(.is-back) svg { transform: translateX(2px); }

/* Results */
.results-head { margin-bottom: var(--s5); }
.results-count { margin-bottom: var(--s1); font-size: var(--step-1); line-height: 1.45; color: var(--grey-700); }
.results-note { display: flex; align-items: flex-start; gap: .45rem; margin: var(--s2) 0; font-size: .875rem; color: var(--grey-700); }
.results-note-icon { display: grid; flex-shrink: 0; color: var(--brand-ink); }
.results-note-icon svg { width: 1.1rem; height: 1.1rem; }
.results-lang { margin: 0; font-size: .875rem; color: var(--grey-500); }
:root[lang="en"] .results-lang { display: none; }
.results-sub { margin: var(--s7) 0 var(--s4); }
.results-sub-title { margin-bottom: var(--s1); font-size: var(--step-2); font-weight: 400; }
.results-sub-note { margin: 0; color: var(--grey-700); }
.results-page { flex: 1 1 auto; margin: 0; font-size: .9375rem; color: var(--grey-700); font-variant-numeric: tabular-nums; }

/* Meal cards: photo or video on top, then time, title, match, macros, swaps, components, "why", YouTube */
.meal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr)); gap: var(--s4); }
.meal-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card);
  animation: meal-in .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease);
}
.meal-card:hover { border-color: var(--grey-300); box-shadow: 0 14px 36px -18px rgb(20 20 19 / .22); }
.meal-card.is-staple { border-color: color-mix(in srgb, var(--tone) 35%, var(--line)); }
@keyframes meal-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }

.meal-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--tone-soft); }
.meal-media > img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.meal-card:hover .meal-media > img { transform: scale(1.04); }
.meal-media.is-playing { background: #000; }
.meal-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.meal-play {
  position: absolute; inset: 0; display: grid; place-items: center; width: 100%; padding: 0; cursor: pointer;
  background: linear-gradient(to top, rgb(20 20 19 / .4), transparent 60%); border: 0;
}
.meal-play:focus-visible { outline: 3px solid var(--paper); outline-offset: -6px; }
.meal-play-badge {
  display: grid; place-items: center; width: 3.5rem; height: 2.5rem; color: #fff; background: #ff0033;
  border-radius: 12px; box-shadow: 0 8px 22px rgb(20 20 19 / .35); transition: transform .2s var(--ease);
}
.meal-play:hover .meal-play-badge { transform: scale(1.08); }
.meal-play-badge svg { width: 1.1rem; height: 1.1rem; margin-left: .15rem; }      /* play points right in every language */
.meal-badge {
  position: absolute; inset-block-start: .75rem; inset-inline-start: .75rem; z-index: 1; display: inline-flex; align-items: center; gap: .35rem;
  max-width: calc(100% - 1.5rem); padding: .3rem .75rem .3rem .55rem; font-size: .8125rem; font-weight: 600; line-height: 1.2; color: #fff;
  background: var(--tone); border-radius: 999px; box-shadow: 0 6px 18px -6px rgb(20 20 19 / .45); pointer-events: none;
}
.meal-badge-icon { display: grid; flex-shrink: 0; }
.meal-badge-icon svg { width: .9rem; height: .9rem; fill: currentColor; }
/* Until a meal has a photo: its main ingredients on a plate */
.meal-art {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 25% 15%, rgb(255 255 255 / .75), transparent 55%), var(--tone-soft);
}
.meal-plate {
  position: relative; height: 82%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 57%, #f4f2ec 58% 100%);
  box-shadow: 0 18px 40px -18px rgb(20 20 19 / .35), inset 0 0 0 1px rgb(20 20 19 / .05);
}
.meal-art-icon { position: absolute; display: grid; color: var(--tone); }
.meal-art-icon svg { width: 100%; height: 100%; }
.meal-art-icon.is-0 { inset: 0; width: 42%; height: 42%; margin: auto; }
.meal-art-icon.is-1 { inset-block-start: 14%; inset-inline-end: 12%; width: 24%; height: 24%; opacity: .8; }
.meal-art-icon.is-2 { inset-block-end: 13%; inset-inline-start: 13%; width: 24%; height: 24%; opacity: .8; }

.meal-body { display: flex; flex: 1; flex-direction: column; gap: var(--s4); min-width: 0; padding: var(--s5); }
.meal-time { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .65rem; margin: 0 0 var(--s3); font-size: .8125rem; color: var(--grey-700); }
.meal-total {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem .2rem .45rem;
  font-size: .875rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; background: var(--mist); border-radius: 999px;
}
.meal-over { padding: .15rem .55rem; font-weight: 600; color: #7a4a00; background: #fff0c2; border-radius: 999px; }
.meal-total-icon { display: grid; }
.meal-total-icon svg { width: 1rem; height: 1rem; }
.meal-title { margin: 0; font-size: clamp(1.25rem, 1.12rem + .5vw, 1.5rem); line-height: 1.15; }

.meal-match { display: grid; gap: .45rem; }
.meal-score { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; margin: 0; font-size: .8125rem; font-weight: 600; }
.meal-score-dots { display: inline-flex; gap: 3px; }
.meal-score-dots span { width: .55rem; height: .55rem; background: var(--line); border-radius: 50%; }
.meal-score-dots span.is-on { background: var(--brand); }
.meal-uses { display: flex; flex-wrap: wrap; gap: .35rem; }
.meal-uses li {
  display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .2rem .65rem .2rem .45rem;
  font-size: .8125rem; font-weight: 600; color: var(--brand-ink); background: var(--brand-soft); border-radius: 999px;
}
.meal-uses-icon { display: grid; flex-shrink: 0; }
.meal-uses-icon svg { width: .8rem; height: .8rem; }

.macro-title, .meal-part dt { margin: 0 0 .4rem; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--grey-500); }
.macro-list { display: grid; gap: .55rem; }
.macro-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .75rem; font-size: .875rem; }
.macro-row.is-carbs { --macro: var(--macro-carbs); }
.macro-row.is-protein { --macro: var(--macro-protein); }
.macro-row.is-fat { --macro: var(--macro-fat); }
.macro-label { min-width: 0; }
.macro-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.macro-track { grid-column: 1 / -1; height: 8px; overflow: hidden; background: var(--mist); background: color-mix(in srgb, var(--macro) 14%, var(--white)); border-radius: 4px; }
.macro-fill {
  display: block; width: var(--v); height: 100%; background: var(--macro); border-radius: 4px;
  animation: macro-grow .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + 250ms);
}
@keyframes macro-grow { from { width: 0; } }

.swap-list { display: grid; gap: .4rem; }
.swap-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .45rem; min-width: 0; padding: .5rem .7rem;
  font-size: .875rem; line-height: 1.35; background: var(--paper); border: 1px dashed var(--grey-300); border-radius: 12px;
}
.swap-item.is-have { border-style: solid; border-color: #c9d6a8; }
.swap-from { color: var(--grey-700); }
.swap-arrow { display: grid; flex-shrink: 0; color: var(--grey-500); }
.swap-arrow svg { width: .95rem; height: .95rem; }
.swap-to { font-weight: 600; }
.swap-have {
  display: inline-flex; align-items: center; gap: .25rem; margin-inline-start: auto; padding: .1rem .5rem;
  font-size: .75rem; font-weight: 600; color: var(--have); white-space: nowrap; background: var(--have-soft); border-radius: 999px;
}
.swap-have-icon { display: grid; }
.swap-have-icon svg { width: .7rem; height: .7rem; }

.meal-parts { display: grid; gap: .7rem; margin: 0; padding-top: var(--s4); border-top: 1px solid var(--line); }
.meal-part dt { margin-bottom: .1rem; }
.meal-part dd { margin: 0; font-size: .9375rem; line-height: 1.45; }

.meal-why { border-top: 1px solid var(--line); }
.meal-why summary {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; padding-top: var(--s2);
  font-size: .9375rem; font-weight: 600; list-style: none; cursor: pointer;
}
.meal-why summary::-webkit-details-marker { display: none; }
.meal-why summary::after {
  content: ""; flex-shrink: 0; width: .55rem; height: .55rem; margin-inline-end: .2rem;
  border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor; transform: rotate(45deg); transition: transform .25s var(--ease);
}
.meal-why[open] summary::after { transform: rotate(-135deg); }
.meal-why p { margin: 0 0 var(--s2); font-size: .9375rem; line-height: 1.55; color: var(--grey-700); }

.meal-cta {
  display: flex; align-items: center; justify-content: center; gap: .55rem; min-height: 48px; margin-top: auto; padding: .6rem 1rem;
  font-size: .9375rem; font-weight: 600; line-height: 1.25; color: var(--paper); text-align: center; text-decoration: none;
  background: var(--ink); border-radius: var(--radius-ctl); transition: background-color .15s;
}
.meal-cta:hover { background: #000; }
.meal-cta-icon { display: grid; flex-shrink: 0; color: #ff0033; }
.meal-cta-icon svg { width: 1.4rem; height: 1.4rem; }

[lang="ar"] .planner-kicker, [lang="ar"] .pantry-title, [lang="ar"] .macro-title, [lang="ar"] .meal-part dt { letter-spacing: 0; }
/* The meals' own English texts carry dir="ltr" (punctuation stays in place) but follow the card's right edge in Arabic. */
:root[dir="rtl"] .planner [lang="en"][dir="ltr"] { text-align: right; }

/* ---- Tablet and up: the three choices side by side */
@media (min-width: 760px) {
  .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
  .choice { grid-template-columns: minmax(0, 1fr); align-content: start; align-items: start; min-height: 16rem; padding: var(--s5); }
  .choice-icon { width: 4.5rem; height: 4.5rem; margin-bottom: var(--s5); border-radius: 22px; }
  .choice-icon svg { width: 2.25rem; height: 2.25rem; }
  .choice-arrow { position: absolute; inset-block-start: var(--s5); inset-inline-end: var(--s5); }
  .pantry { gap: var(--s6); }
}

/* ---- Phones */
@media (max-width: 640px) {
  .planner-top { margin-bottom: var(--s4); }
  .diet-panel .diet-actions .btn-primary { flex: 1; }
  /* The bar under step 2: the count on one line, then Back (icon only), Clear and the main button in one row */
  .planner-bar.is-sticky { gap: var(--s2); padding-top: var(--s3); padding-bottom: max(var(--s3), env(safe-area-inset-bottom)); }
  .planner-bar.is-sticky .planner-live { flex-basis: 100%; font-size: .875rem; }
  .planner-bar.is-sticky .planner-actions { flex: 1 1 100%; flex-wrap: nowrap; margin-inline-start: 0; }
  .planner-bar.is-sticky .btn-primary { flex: 1; padding-inline: .9rem; }
  .planner-bar.is-sticky .btn-back { flex-shrink: 0; min-width: 48px; padding-inline: .75rem; }
  .planner-bar.is-sticky .btn-back-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .planner-bar.is-sticky .btn-text { flex-shrink: 0; }
  .results-actions .planner-actions { flex: 1 1 100%; margin-inline-start: 0; }
  .results-actions .planner-actions > * { flex: 1 1 12rem; }
  .meal-body { padding: var(--s4); }
}

/* Progress steps stacked (number above, answer below) where three side by side would be cramped */
@media (max-width: 560px) {
  .planner-progress { gap: var(--s2); }
  .pp-step { flex-direction: column; justify-content: flex-start; gap: .3rem; text-align: center; }
  .pp-text { align-items: center; }
  .pp-label { font-size: .8125rem; }
  .pp-value { font-size: .75rem; }
}

/* Small phones: the day / time cards drop their arrow; ingredient toggles stay two to a row */
@media (max-width: 420px) {
  .choice { grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); padding: var(--s3) var(--s4); }
  .choice-arrow { display: none; }
  .choice-icon { width: 3rem; height: 3rem; border-radius: 14px; }
  .choice-icon svg { width: 1.5rem; height: 1.5rem; }
  .choice-title { font-size: 1.25rem; }
}
@media (max-width: 360px) {
  .pantry-chip { gap: .45rem; padding-inline: .35rem .5rem; font-size: .875rem; }
  .pantry-icon { width: 2rem; height: 2rem; }
  .pantry-icon svg { width: 1.25rem; height: 1.25rem; }
  .pantry-check { display: none; }             /* the dark fill alone marks a pick */
  .diet-chip { gap: .45rem; padding-inline: .55rem; font-size: .875rem; }
}

/* Touch screens: no sticky hover after a tap, 44 px targets */
@media (pointer: coarse) {
  .choice:hover:not(:disabled), .meal-card:hover { box-shadow: none; transform: none; }
  .choice[aria-pressed="true"] { box-shadow: 0 0 0 1.5px var(--tone); }
  .meal-card:hover .meal-media > img { transform: none; }
  .pantry-chip:hover, .diet-chip:hover { border-color: var(--line); }
  .pantry-chip[aria-pressed="true"]:hover { background: var(--ink); border-color: var(--ink); }
  .diet-chip[aria-pressed="true"]:hover { border-color: var(--brand-ink); }
  .diet-tag { min-height: 44px; }
}

/* --------------------------------------------- 12. RESPONSIVE / RTL / MOTION */
@media (max-width: 1180px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  /* Tablets: the pages still fit on one row beside the logo */
  .header-inner { gap: var(--s3); }
  .nav-list { gap: 0; }
  .nav-link { padding-inline: .5rem; font-size: .875rem; }
}

/* ---- Phones */
@media (max-width: 640px) {
  /* 16 px inputs stop iOS Safari from zooming the page on focus */
  input { font-size: 16px; }

  /* Header: logo and language on one row, the four pages as a segmented control below it, two above two */
  .site-header { position: static; -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--paper); }
  .header-inner { grid-template: "brand lang" auto "nav nav" auto / 1fr auto; gap: var(--s3) var(--s3); padding-block: .5rem .75rem; }
  .brand { grid-area: brand; }
  .nav-tools { grid-area: lang; }
  .site-nav { grid-area: nav; }
  .brand-logo { width: 40px; height: 40px; }
  .nav-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; padding: 3px; background: var(--mist); border-radius: 14px; }
  .nav-list li { display: flex; grid-column: span 3; }
  .nav-link { flex: 1; justify-content: center; min-height: 42px; padding: .3rem .4rem; text-align: center; line-height: 1.15; font-size: .875rem; border-radius: 11px; }
  .nav-link:hover { background: transparent; }
  .nav-link[aria-current="page"] { background: var(--white); box-shadow: 0 1px 2px rgb(20 20 19 / .12); }

  .page-hero { padding-top: 2rem; padding-bottom: 1.5rem; }
  .page-title { max-width: none; }
  .page-sub { font-size: 1.0625rem; }
  .card-grid, .card-grid[data-cols="2"], .card-grid[data-cols="3"] { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .bento { aspect-ratio: 16 / 11; }
  .card-body { padding: var(--s4) var(--s4) var(--s3); }
  .card-foot { margin-inline: var(--s4); }

  .hero-pitch { width: calc(100% - 1.5rem); min-height: min(78svh, 620px); margin-top: .5rem; padding: 1.25rem; border-radius: 22px; }
  .hero-pitch-sub { margin-bottom: var(--s4); }
  .hero-pitch-tagline { margin-bottom: var(--s5); }
  .hero-pitch-actions { grid-template-columns: minmax(0, 1fr); }

  .lock-card { border-radius: 24px; }

  /* Gallery: a full-screen sheet; photos use the whole width */
  .gallery { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
  .gallery-head { padding: max(.75rem, env(safe-area-inset-top)) .75rem .25rem 1.1rem; }
  [dir="rtl"] .gallery-head { padding: max(.75rem, env(safe-area-inset-top)) 1.1rem .25rem .75rem; }
  .g-frame { width: calc(100cqw - 1rem); }
  .g-frame.is-video { width: min(calc(100cqw - 1rem), calc((100cqh - .5rem) * 16 / 9)); }
  .g-bar { gap: var(--s2); padding: .25rem .5rem max(.75rem, env(safe-area-inset-bottom)); }
  .g-thumb { width: 56px; height: 42px; }
}

/* ---- Touch devices: comfortable hit areas (44 px) */
@media (pointer: coarse) {
  .lang-option { min-height: 44px; }
  .lang-btn { min-height: 44px; min-width: 44px; }
  .nav-link { min-height: 44px; }
  .social a { width: 44px; height: 44px; }
  .password-toggle { min-width: 44px; }
  .card.is-openable:hover { box-shadow: none; }          /* no sticky hover after a tap */
  .card.is-openable:hover .bento-tile > img, .card.is-openable:hover .bento-tile > video { transform: none; }
}

/* ---- Very narrow phones (320 px) */
@media (max-width: 360px) {
  .nav-link { font-size: .8125rem; padding-inline: .2rem; }
  .lock-card { padding-inline: var(--s4); }
  .g-thumb { width: 48px; height: 36px; }
}

/* Landscape phones: keep windows within the short viewport */
@media (max-height: 480px) and (min-width: 641px) {
  .gallery { height: 100dvh; width: 100vw; border-radius: 0; }
  .site-header { position: static; }
  .hero-pitch { min-height: 420px; }
}

/* Arabic: more generous leading, no negative tracking (joined letterforms). */
[lang="ar"] body { line-height: 1.8; }
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4, [lang="ar"] .hero-pitch-title, [lang="ar"] .page-title { letter-spacing: 0; line-height: 1.3; font-weight: 600; font-style: normal; }
[lang="ar"] .hero-pitch-sub { font-style: normal; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .lock, .nav-lang, .gallery, .site-header { display: none !important; }
  .planner-top, .planner-nav, .planner-bar, .meal-cta, .meal-play { display: none !important; }
  .meal-card { break-inside: avoid; animation: none; }
}
