/* ==========================================================================
   Menuz layout families: shared layer (loaded after themes/_base.css, before families/{family}.css and the theme CSS).
   Tokens: everything from _base.css (--bg, --surface, --surface-2, --ink, --muted, --line, --accent, --on-accent,
   --accent-ink, --font-h, --font-b, --radius ...) plus the family tokens below. Spec: .dev/FAMILIES.md
   ========================================================================== */
:root {
  --fm-display: var(--font-h);           /* giant / display type */
  --fm-display-weight: var(--h-weight);
  --fm-display-case: none;
  --fm-display-track: -.02em;
  --fm-paper: var(--surface);            /* paper / card fill */
  --fm-ink-soft: color-mix(in srgb, var(--ink) 72%, var(--bg));
  --fm-cut-shadow: drop-shadow(0 22px 18px rgba(0, 0, 0, .28)) drop-shadow(0 6px 6px rgba(0, 0, 0, .18));
  --fm-glass: color-mix(in srgb, var(--surface) 62%, transparent);
  --fm-glass-line: color-mix(in srgb, var(--ink) 14%, transparent);
  --fm-tex-o: .085;                      /* texture strength */
  --fm-ease: cubic-bezier(.2, .8, .2, 1);
  --fm-spring: cubic-bezier(.34, 1.56, .64, 1);
  --fm-dur: .7s;
  --fm-gap: 10px;
  --fm-sheet: 58;
  --fm-pop1: var(--accent); --fm-pop1-ink: var(--on-accent);
  --fm-pop2: var(--ink); --fm-pop2-ink: var(--bg);
  --fm-pop3: var(--surface-2); --fm-pop3-ink: var(--ink);
  --fm-pop4: var(--accent); --fm-pop4-ink: var(--on-accent);
}
body.fm { overflow-x: clip; }
.fm-app { overflow-x: clip; }
html.fm-lock, html.fm-lock body { overflow: hidden; }
.fm-hide { display: none !important; }

/* ---------- type presets (fx type) ---------- */
.fx-type-condensed { --fm-display-case: uppercase; --fm-display-track: -.005em; }
.fx-type-grotesk { --fm-display-track: -.045em; }
.fx-type-serif { --fm-display-track: -.025em; }
.fx-type-mono { --fm-display-track: -.02em; }
.fx-type-caps { --fm-display-case: uppercase; --fm-display-track: .08em; }

/* ---------- textures (fx texture): a fixed overlay above the page, never catches taps ---------- */
body.fm[class*="fx-tex-"]:not(.fx-tex-none)::after { content: ""; position: fixed; inset: 0; z-index: 80; pointer-events: none; opacity: var(--fm-tex-o); background-size: 180px 180px; }
body.fx-tex-grain::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
body.fx-tex-paper::after { --fm-tex-o: .5; background-size: 320px 320px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035 .6' numOctaves='4' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .25 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"); mix-blend-mode: multiply; }
body.fx-tex-linen::after { --fm-tex-o: .06; background-size: 6px 6px; background-image: repeating-linear-gradient(0deg, var(--ink) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 3px); }
body.fx-tex-noise::after { --fm-tex-o: .14; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); mix-blend-mode: overlay; }
body.fx-tex-image::after { --fm-tex-o: .35; background-image: var(--fm-pattern); background-size: 420px auto; mix-blend-mode: multiply; }
:root[data-mode="dark"] body.fx-tex-grain::after, :root[data-mode="dark"] body.fx-tex-paper::after { mix-blend-mode: screen; opacity: calc(var(--fm-tex-o) * .55); }

/* ---------- cut-outs and photo fallbacks ---------- */
.fm-cut, .fm-photo, .fm-noimg { position: relative; display: block; }
.fm-cut img { width: 100%; height: 100%; }
.fm-cut.is-real { filter: var(--fm-cut-shadow); }
.fm-cut.is-real img { object-fit: contain; }
.fm-cut.is-masked { filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .28)); aspect-ratio: 1; }
.fm-cut.is-masked img { aspect-ratio: 1; object-fit: cover; border-radius: 50%; -webkit-mask-image: radial-gradient(closest-side, #000 86%, rgba(0,0,0,.6) 94%, transparent 100%); mask-image: radial-gradient(closest-side, #000 86%, rgba(0,0,0,.6) 94%, transparent 100%); }
.fx-mask-circle .fm-cut.is-masked img { -webkit-mask-image: none; mask-image: none; }
.fx-mask-blob .fm-cut.is-masked img { border-radius: 58% 42% 52% 48% / 46% 56% 44% 54%; -webkit-mask-image: none; mask-image: none; }
.fx-mask-arch .fm-cut.is-masked { aspect-ratio: 4 / 5; }
.fx-mask-arch .fm-cut.is-masked img { aspect-ratio: 4 / 5; border-radius: 999px 999px 18px 18px; -webkit-mask-image: none; mask-image: none; }
.fx-mask-rounded .fm-cut.is-masked img { border-radius: 28%; -webkit-mask-image: none; mask-image: none; }
.fm-photo img { width: 100%; height: 100%; object-fit: cover; }
.fm-noimg { display: grid; place-items: center; color: color-mix(in srgb, var(--ink) 55%, transparent); background: var(--surface-2); }
.fm-noimg .icon { width: 34%; height: 34%; stroke-width: 1.4; }

/* ---------- tools: TR/EN, light/dark, search ---------- */
.fm-tools { display: flex; align-items: center; gap: 8px; }
.fm-round { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 82%, transparent); color: var(--ink); font-size: 19px; box-shadow: 0 0 0 1px var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .3s var(--fm-spring); }
.fm-round:active { transform: scale(.9); }
.fm-lang.mz-lang { display: inline-flex; height: 44px; align-items: center; padding: 4px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: 0 0 0 1px var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.fm-lang.mz-lang a { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 8px; border-radius: 999px; color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-decoration: none; }
.fm-lang.mz-lang a.is-on { background: var(--ink); color: var(--bg); }
.fm-on-photo .fm-round, .fm-on-photo .fm-lang.mz-lang { background: rgba(0, 0, 0, .32); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .22); }
.fm-on-photo .fm-lang.mz-lang a { color: rgba(255, 255, 255, .8); }
.fm-on-photo .fm-lang.mz-lang a.is-on { background: #fff; color: #111; }
.mz-mode .mz-mode__light { display: none; }
:root[data-mode="dark"] .mz-mode .mz-mode__light { display: inline; }
:root[data-mode="dark"] .mz-mode .mz-mode__dark { display: none; }

/* ---------- search overlay ---------- */
.fm-search { position: fixed; inset: 0; z-index: 85; display: flex; flex-direction: column; max-width: var(--maxw); margin: 0 auto; background: color-mix(in srgb, var(--fm-search-bg, var(--surface)) 96%, transparent); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); color: var(--fm-search-ink, var(--ink)); opacity: 0; transform: translateY(12px); transition: opacity .24s ease, transform .3s var(--fm-ease); }
.fm-search.is-open { opacity: 1; transform: none; }
.fm-search__bar { display: flex; align-items: center; gap: 10px; margin: max(14px, env(safe-area-inset-top)) 14px 8px; padding: 0 6px 0 16px; height: 56px; border-radius: 999px; background: var(--fm-search-bar, var(--surface)); box-shadow: 0 0 0 1px var(--line), 0 14px 30px -18px rgba(0, 0, 0, .4); }
.fm-search__bar > .icon { font-size: 20px; color: var(--muted); }
.fm-search__input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: 17px; outline: none; }
.fm-search__input::-webkit-search-cancel-button { display: none; }
.fm-search__x { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); font-size: 18px; }
.fm-search__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 14px 40px; }
.fm-sr { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; min-height: 64px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; animation: fmPop .3s var(--fm-ease) both; }
.fm-sr__img { display: grid; place-items: center; width: 52px; height: 52px; overflow: hidden; border-radius: 14px; background: var(--surface-2); color: var(--muted); font-size: 20px; }
.fm-sr__img img { width: 100%; height: 100%; object-fit: cover; }
.fm-sr__tx { min-width: 0; display: grid; }
.fm-sr .mz-item__name { margin: 0; font-family: var(--font-b); font-size: 15.5px; font-weight: 650; line-height: 1.25; }
.fm-sr__tx small { color: var(--muted); font-size: 12.5px; }
.fm-sr .mz-item__price { font-weight: 700; color: var(--fm-search-price, var(--price)); white-space: nowrap; display: grid; justify-items: end; }
.fm-search__none { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 40px 10px; color: var(--muted); }
@keyframes fmPop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- price parts shared by all families ---------- */
.mz-item__price .mz-item__old, .fm .mz-item__old { opacity: .6; font-size: .78em; font-weight: 500; text-decoration-thickness: 1px; margin-right: 6px; }
.mz-badge--out { background: color-mix(in srgb, var(--ink) 86%, transparent) !important; color: var(--bg) !important; }
[data-item-id] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.fm .mz-item__name { flex: 0 1 auto; }
.fm-out { opacity: .55; }

/* ---------- extras (owner components) ---------- */
.fm-extras { display: grid; gap: 14px; }
.fm-blk { display: block; min-width: 0; }
.fm-blk > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.fm-made { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 12px; text-decoration: none; opacity: .85; }
.fm-empty { display: grid; justify-items: center; gap: 10px; padding: 70px 24px 40px; text-align: center; }
.fm-empty__name { margin: 0; font-family: var(--fm-display); font-size: 34px; }
.fm-empty .fm-extras { width: 100%; margin-top: 20px; text-align: left; }

/* ---------- reveal motion: [data-fx] (+ variants) get .is-in when they enter the viewport ---------- */
html.fm-js [data-fx] { opacity: 0; transform: translateY(22px); transition: opacity var(--fm-dur) var(--fm-ease), transform var(--fm-dur) var(--fm-ease); transition-delay: calc(var(--i, 0) * 55ms); }
html.fm-js [data-fx="left"] { transform: translateX(-26px); }
html.fm-js [data-fx="right"] { transform: translateX(26px); }
html.fm-js [data-fx="pop"] { transform: scale(.82) rotate(var(--rot, 0deg)); transition-timing-function: var(--fm-spring); }
html.fm-js [data-fx="mask"] { opacity: 1; transform: none; clip-path: inset(0 0 100% 0); transition: clip-path 1s var(--fm-ease); }
html.fm-js [data-fx="wipe"] { opacity: 1; transform: none; clip-path: inset(0 100% 0 0); transition: clip-path .9s var(--fm-ease); }
html.fm-js [data-fx="fade"] { transform: none; }
html.fm-js [data-fx].is-in { opacity: 1; transform: none; }
html.fm-js [data-fx="pop"].is-in { transform: rotate(var(--rot, 0deg)); }
html.fm-js [data-fx="mask"].is-in, html.fm-js [data-fx="wipe"].is-in { clip-path: none; }
.fx-motion-calm { --fm-dur: .45s; }
[data-px] { transform: translate3d(0, var(--px, 0), 0); will-change: transform; }
html.fm-still [data-fx] { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }
html.fm-still [data-px] { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  html.fm-js [data-fx] { opacity: 1 !important; transform: none !important; clip-path: none !important; transition: none !important; }
  [data-px] { transform: none !important; }
  .fm-search { transition: opacity .2s ease; transform: none; }
  .fm-sr { animation: none; }
}

/* ---------- item sheet: cut-out media on a colour field ---------- */
.mz-sheet__media.is-cut { display: grid; place-items: center; aspect-ratio: 5 / 4; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--accent) 55%, #fff) 0, var(--accent) 70%); }
.mz-sheet__media.is-cut img { width: 78%; height: 86%; object-fit: contain; filter: var(--fm-cut-shadow); animation: fmCutIn .6s var(--fm-spring) both; }
@keyframes fmCutIn { from { transform: translateY(18px) scale(.86) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mz-sheet__media.is-cut img { animation: none; } }

/* ---------- builder card style switch (mzd-card-*) on family cards (.fm-card) ---------- */
.mzd-card-outline .fm-card { box-shadow: 0 0 0 1px var(--line) !important; }
.mzd-card-flat .fm-card { box-shadow: none !important; }
.mzd-card-raised .fm-card { box-shadow: var(--shadow) !important; }

/* landing phone frames (?hero=1) */
html.mz-hero-embed .fm-app { min-height: 100%; }
html.mz-hero-embed :is(.fmp-hero__top, .fms-top, .fmc-hero, .fmn-hero__top, .fmz-head, .fmt-hero__tools, .fmw-mast, .fmw-bar, .fmm-mast, .fmk-toc, .fmb-top, .fmb-bar, .fmg-head, .fmr-head, .fmr-rail) { padding-top: 48px; }
html.mz-hero-embed .fm-app:not(.is-cover) ~ .mz-statusbar, html.mz-hero-embed body:not(:has(.fmp-hero, .fms-cover, .fmn-hero)) .mz-statusbar { color: var(--ink); }
