/* ============================================================
   market.css — the "enamelware + spice market" layer.
   Loaded LAST on public pages, so it owns the shared look:
   colour families, enamel buttons, header, kickers, footer and
   scroll motion. Tokens live in ai-design-system.css.
   ============================================================ */

/* ---- Colour families: every cuisine / ingredient category maps to one ---- */
.fam-tomato    { --f: var(--tomato);    --f-soft: var(--tomato-soft);    --f-deep: var(--tomato-deep); }
.fam-chili     { --f: var(--chili);     --f-soft: var(--chili-soft);     --f-deep: var(--chili-deep); }
.fam-saffron   { --f: var(--saffron);   --f-soft: var(--saffron-soft);   --f-deep: var(--saffron-deep); }
.fam-leaf      { --f: var(--leaf);      --f-soft: var(--leaf-soft);      --f-deep: var(--leaf-deep); }
.fam-rose      { --f: var(--rose);      --f-soft: var(--rose-soft);      --f-deep: var(--rose-deep); }
.fam-blueberry { --f: var(--blueberry); --f-soft: var(--blueberry-soft); --f-deep: var(--blueberry-deep); }
.fam-aubergine { --f: var(--aubergine); --f-soft: var(--aubergine-soft); --f-deep: var(--aubergine-deep); }
.fam-teal      { --f: var(--teal);      --f-soft: var(--teal-soft);      --f-deep: var(--teal-deep); }

:root {
  --btn-tomato: #c93216;
  --btn-tomato-hover: #b22a10;
  --edge: var(--ink-deep);
  --line: rgba(15, 35, 39, .16);
  --lift: 0 1px 2px rgba(11, 27, 30, .06), 0 10px 26px -14px rgba(11, 27, 30, .28);
  --lift-2: 0 2px 4px rgba(11, 27, 30, .08), 0 18px 34px -16px rgba(11, 27, 30, .34);
  /* page background is its own token so sections can step in and out of it */
  --page: var(--bg-primary);
}

::selection { background: var(--saffron); color: var(--ink-deep); }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 16px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Cross-page transitions where supported (progressive enhancement only) */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

/* ============================================================
   BUTTONS — enamel stickers: solid fill, ink edge, hard offset shadow
   ============================================================ */
.btn,
.header-chat-link {
  position: relative;
  min-height: 46px;
  padding: .55rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: 0;
  box-shadow: var(--lift);
  transition: transform .18s var(--ease-spring), box-shadow .18s var(--ease-out), background-color .15s, color .15s;
}
.btn:hover,
.header-chat-link:hover { transform: translateY(-1px); box-shadow: var(--lift-2); }
.btn:active,
.header-chat-link:active { transform: translateY(1px); box-shadow: 0 0 0 var(--edge); }
.btn:focus-visible,
.header-chat-link:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }

.btn:not(.btn-outline):not(.btn-secondary),
.btn-primary,
.header-chat-link { background: var(--btn-tomato); color: #fff; }
.btn-primary:hover,
.header-chat-link:hover { background: var(--btn-tomato-hover); color: #fff; }

.btn-outline,
.btn-secondary { background: #fff; color: var(--text-primary); border-color: var(--edge); }
.btn-outline:hover,
.btn-secondary:hover { background: var(--saffron-soft); border-color: var(--edge); color: var(--text-primary); }

@media (prefers-reduced-motion: reduce) {
  .btn, .header-chat-link { transition: background-color .15s, color .15s; }
  .btn:hover, .header-chat-link:hover, .btn:active, .header-chat-link:active { transform: none; }
}

/* ============================================================
   HEADER — porcelain bar, ink-pill active state
   ============================================================ */
body.site-shell > header {
  background: rgba(246, 248, 247, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
body.site-shell .logo { color: var(--text-primary); font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.03em; font-stretch: 90%; }
body.site-shell .logo:hover { color: var(--text-primary); }
body.site-shell > header nav a {
  border-radius: 999px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: .9rem;
  padding-inline: .85rem;
  min-height: 40px;
  transition: background-color .15s, color .15s;
}
body.site-shell > header nav a:hover { background: var(--teal-soft); color: var(--teal-deep); }
body.site-shell > header nav a.active,
body.site-shell > header nav a[aria-current="page"] { background: var(--ink-deep); color: #fff; }
body.site-shell > header nav a.active::after { display: none; }
body.site-shell > header nav a:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.menu-toggle { border: 1px solid var(--line); border-radius: 12px; background: #fff; }

@media (max-width: 768px) {
  body.site-shell > header nav ul { background: var(--page); border-bottom: 1px solid var(--line); box-shadow: 0 18px 30px -20px rgba(11, 27, 30, .5); }
  body.site-shell > header nav ul li a { font-size: 1.05rem; padding-block: .5rem; border-radius: 12px; }
}

/* ============================================================
   KICKERS — a coloured dot + plain label (no tracked all-caps)
   ============================================================ */
body.site-shell .public-kicker,
body.site-shell .tools-kicker,
body.site-shell .public-section-kicker,
body.site-shell .kitchen-section-number,
body.site-shell .kitchen-intro,
body.site-shell .blog-kicker,
body.site-shell .choice-kicker {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--text-secondary);
  font: 700 .88rem/1.2 var(--font-body);
  letter-spacing: 0;
  text-transform: none;
  border: 0;
  background: none;
  padding: 0;
}
body.site-shell .public-kicker::before,
body.site-shell .tools-kicker::before,
body.site-shell .public-section-kicker::before,
body.site-shell .kitchen-section-number::before,
body.site-shell .kitchen-intro::before,
body.site-shell .blog-kicker::before,
body.site-shell .choice-kicker::before {
  content: "";
  width: .7rem;
  height: .7rem;
  flex: none;
  border-radius: 50%;
  background: var(--f, var(--tomato));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--f, var(--tomato)) 22%, transparent);
}
body.site-shell .public-kicker a { color: inherit; text-decoration: none; }
body.site-shell .public-kicker a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   HEADINGS on public pages
   ============================================================ */
body.site-shell .public-title,
body.site-shell .tools-title,
body.site-shell .download-hero h1,
body.site-shell .blog-title {
  font-family: var(--font-display);
  font-weight: 780;
  font-stretch: 94%;
  letter-spacing: -.026em;
  line-height: 1.02;
  word-spacing: .03em;
  color: var(--text-primary);
  max-width: 18ch;
}
body.site-shell .public-section-title,
body.site-shell h2 { font-family: var(--font-display); font-weight: 740; font-stretch: 95%; letter-spacing: -.022em; color: var(--text-primary); }

/* ============================================================
   SHARED SURFACES
   ============================================================ */
body.site-shell main { background: var(--page); }
body.site-shell .public-card,
body.site-shell .tool-card,
body.site-shell .pricing-card,
body.site-shell .download-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--lift-2);
  background: #fff;
}
body.site-shell .tool-card { transition: transform .2s var(--ease-spring), box-shadow .2s var(--ease-out); }
body.site-shell .tool-card:hover { transform: translate(-2px, -2px); box-shadow: var(--lift-2); border-color: var(--edge); }
body.site-shell .pricing-card--featured { background: var(--saffron-soft); }
body.site-shell .public-card--accent { background: var(--teal-soft); }

/* ============================================================
   FOOTER — ink block with a cuisine rail (real, linked)
   ============================================================ */
body.site-shell .site-footer {
  background: var(--ink-deep);
  color: #e8f0ee;
  padding-top: 0;
  border-top: 0;
}
.footer-cuisines {
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  padding: clamp(1.6rem, 3vw, 2.4rem) 0;
}
.footer-cuisines h2 {
  margin: 0 0 1rem;
  font: 750 clamp(1.4rem, 2.4vw, 2rem)/1.1 var(--font-display);
  font-stretch: 90%;
  letter-spacing: -.03em;
  color: #fff;
}
.footer-cuisines ul { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; }
.footer-cuisines a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 40px;
  padding: .3rem .9rem .3rem .7rem;
  border: 2px solid rgba(255, 255, 255, .28);
  border-radius: 999px;
  color: #fff;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .18s var(--ease-spring);
}
.footer-cuisines a::before { content: ""; width: .75rem; height: .75rem; border-radius: 50%; background: var(--f); border: 2px solid #fff; }
.footer-cuisines a:hover { background: var(--f); border-color: #fff; transform: translateY(-2px); }
.footer-cuisines a:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
body.site-shell .site-footer .footer-content { padding-top: clamp(2rem, 4vw, 3rem); }
body.site-shell .site-footer-copy { color: #fff; font-weight: 750; font-stretch: 90%; letter-spacing: -.03em; max-width: 16ch; }
body.site-shell .site-footer-chat { color: var(--saffron); }
body.site-shell .site-footer-chat:hover { color: #fff; }
body.site-shell .site-footer-group > span { color: var(--saffron); font-size: .82rem; letter-spacing: .04em; }
body.site-shell .site-footer-group a { color: #e8f0ee; font-size: .92rem; }
body.site-shell .site-footer-bottom { border-color: rgba(255, 255, 255, .14); }
body.site-shell .footer-copyright,
body.site-shell .footer-credit,
body.site-shell .footer-credit a { color: #a9bcb8; }

/* ============================================================
   SCROLL MOTION
   data-rv         reveal on scroll (CSS scroll timelines where supported;
                   an IntersectionObserver fallback adds .rv-in — see motion.js)
   data-rv-d="n"   stagger index
   .scroll-drift   gentle vertical parallax
   .scroll-spin    slow rotation tied to scroll (plates)
   ============================================================ */
.scroll-progress { height: 4px; background: var(--btn-tomato); }

@keyframes rv-up   { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: none; } }
@keyframes rv-drift{ from { transform: translateY(-5%); } to { transform: translateY(5%); } }
@keyframes rv-spin { from {  } to {  } }
@keyframes rv-zoom { from { transform: scale(1.14); } to { transform: scale(1); } }

@media (prefers-reduced-motion: no-preference) {
  /* Fallback path: JS marks below-the-fold targets .rv-wait, then .rv-in */
  html.rv-js [data-rv].rv-wait { opacity: 0; transform: translateY(26px); }
  html.rv-js [data-rv] { transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); transition-delay: calc(var(--rv-i, 0) * 70ms); }
  html.rv-js [data-rv].rv-in { opacity: 1; transform: none; }

  @supports (animation-timeline: view()) {
    html.rv-native [data-rv] {
      animation: rv-up linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
    html.rv-native .scroll-drift { animation: rv-drift linear both; animation-timeline: view(); animation-range: cover; }
    html.rv-native .scroll-spin  { animation: rv-spin linear both;  animation-timeline: view(); animation-range: cover; }
    html.rv-native .scroll-zoom  { animation: rv-zoom linear both;  animation-timeline: view(); animation-range: cover 0% cover 55%; }
  }
}

/* Detail pages start with a full-bleed colour band: no paper strip above it */
body.site-shell .public-page.rcp-detail { padding-top: 0; }

/* ============================================================
   TOOLS — each tool carries its own colour family
   ============================================================ */
body.site-shell .tools-grid .tool-card { position: relative; background: #fff; }
body.site-shell .tool-card .tool-card-icon {
  width: 58px; height: 58px; padding: 13px; margin-bottom: 1rem; stroke-width: 1.9;
  border: 1px solid var(--line); border-radius: 16px; background: var(--f, var(--teal)); color: #fff; box-shadow: var(--lift);
  transition: rotate .3s var(--ease-spring);
}
body.site-shell .tool-card.fam-saffron .tool-card-icon { color: var(--ink-deep); }
body.site-shell .tool-card:hover { background: var(--f-soft, #fff); }
body.site-shell .tool-card:hover .tool-card-icon {  }
body.site-shell .tool-card h2 { font-family: var(--font-display); font-weight: 760; font-stretch: 95%; letter-spacing: -.022em; color: var(--text-primary); }
body.site-shell .tool-card-badge { background: var(--saffron); color: var(--ink-deep); border: 1px solid var(--line); border-radius: 999px; font-weight: 800; }
body.site-shell .tool-card-meta { color: var(--f-deep, var(--text-secondary)); font-weight: 600; }
body.site-shell .tool-card-arrow { color: var(--f-deep, var(--text-primary)); font-weight: 800; }

body.site-shell .kitchen-example { background: var(--f, var(--leaf)); color: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift-2);  transition: transform .25s var(--ease-spring); }
body.site-shell .kitchen-example:hover { background: var(--f); transform: rotate(0deg) translateY(-3px); }
body.site-shell .example-label, body.site-shell .example-action { color: #fff; font-weight: 700; }
body.site-shell .example-ingredient { border-color: rgba(255,255,255,.55); color: #fff; }
body.site-shell .example-servings { font-family: var(--font-display); font-weight: 800; }

.tool-quick-paths { gap: .75rem !important; background: none !important; border: 0 !important; }
.tool-quick-paths a { border: 1px solid var(--line); border-radius: 16px; font-weight: 700; color: var(--text-primary) !important; box-shadow: var(--lift); transition: transform .2s var(--ease-spring); }
.tool-quick-paths a:nth-child(1) { background: var(--tomato-soft) !important; }
.tool-quick-paths a:nth-child(2) { background: var(--leaf-soft) !important; }
.tool-quick-paths a:nth-child(3) { background: var(--saffron-soft) !important; }
.tool-quick-paths a:hover { transform: translate(-2px, -2px); }

/* Tool pages share the enamel inputs */
body.site-shell .tool-page .tool-header h1 { font-weight: 780; font-stretch: 94%; letter-spacing: -.026em; color: var(--text-primary); }
body.site-shell .tool-page .tool-input-area { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift); background: #fff; }
body.site-shell .tool-page input:not([type="checkbox"]):not([type="radio"]),
body.site-shell .tool-page select,
body.site-shell .tool-page textarea { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
body.site-shell .tool-page input:focus-visible,
body.site-shell .tool-page select:focus-visible,
body.site-shell .tool-page textarea:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
body.site-shell .tool-back { font-weight: 700; color: var(--text-primary); }

/* ============================================================
   PASTA PERFETTA page chrome
   ============================================================ */
body.site-shell .psim-header { max-width: none; padding: clamp(1.2rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 18px; background: var(--blueberry); color: #fff; box-shadow: var(--lift-2); border-bottom: 1px solid var(--line); margin-bottom: 1.6rem; }
body.site-shell .psim-header h1 { color: #fff; max-width: none; font-size: clamp(2.6rem, 6vw, 5rem); font-weight: 800; letter-spacing: -.03em; margin-bottom: .5rem; }
body.site-shell .psim-header p { color: #fff; max-width: 58ch; }
body.site-shell .psim-kicker { color: #fff; font-weight: 700; font-size: .88rem; letter-spacing: 0; text-transform: none; }
body.site-shell .psim-kicker::before { background: var(--saffron); box-shadow: 0 0 0 2px var(--blueberry), 0 0 0 4px var(--saffron); }
body.site-shell .psim-header .psim-facts { color: var(--saffron); font-size: .9rem; font-weight: 800; }
body.site-shell .psim-stage { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift-2); overflow: hidden; }
body.site-shell .psim-modes { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: var(--lift); }
body.site-shell .psim-modes button[aria-pressed="true"] { background: var(--ink-deep); color: #fff; }
body.site-shell .psim-secondary { background: #fff; color: var(--text-primary); }
body.site-shell .psim-chip { border: 1px solid var(--line); background: var(--saffron); color: var(--ink-deep); font-weight: 800; }
body.site-shell .psim-chip { display: inline-block; width: fit-content; padding: .25rem .8rem; border-radius: 999px; }

/* footer heading must beat the generic public h2 colour */
body.site-shell .footer-cuisines h2 { color: #fff; }
/* journal topic label: plain, not tracked caps */
body.site-shell .blog-topics-title { text-transform: none; letter-spacing: 0; font-weight: 800; color: var(--text-primary); font-size: .9rem; }
body.site-shell .blog-topics a, body.site-shell .blog-topic { border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text-primary); font-weight: 600; }
body.site-shell .blog-topics a:hover { background: var(--saffron-soft); }

/* 404 */
body.site-shell .error-page-shell { text-align: center; padding-block: clamp(1.5rem, 4vw, 3rem); border: 0; background: none; box-shadow: none; }
.error-page-plate { display: block; margin: 0 auto 1.2rem; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--lift-2);  }
body.site-shell .error-page-code { display: block; font: 800 clamp(4.5rem, 14vw, 9rem)/1 var(--font-display); font-stretch: 90%; letter-spacing: -.05em; color: var(--btn-tomato); }
body.site-shell .error-page-title { margin-inline: auto; }
body.site-shell .error-page-actions { justify-content: center; }
body.site-shell .public-chip-link { display: inline-flex; align-items: center; min-height: 40px; padding: .2rem .95rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text-primary); font-weight: 700; text-decoration: none; transition: background-color .15s, transform .18s var(--ease-spring); }
body.site-shell .public-chip-link:hover { background: var(--saffron); transform: translateY(-2px); }
body.site-shell .tool-page .psim-header h1 { color: #fff; max-width: none; }
body.site-shell .psim-secondary.btn { background: #fff; color: var(--text-primary); }
body.site-shell .psim-secondary.btn:hover { background: var(--saffron-soft); }

/* ---- calmer finish: hairlines, soft lift, restrained buttons, bigger ink logo ---- */
.btn, .header-chat-link { border: 0; border-radius: 10px; box-shadow: 0 1px 2px rgba(11,27,30,.18); font-weight: 650; }
.btn:hover, .header-chat-link:hover { box-shadow: 0 6px 16px -8px rgba(11,27,30,.45); }
.btn-outline, .btn-secondary { border: 1px solid var(--line-strong, rgba(15,35,39,.3)); box-shadow: none; }
body.site-shell > header, body.auth-shell > header, body.app-shell > header { border-bottom: 1px solid var(--line); }
.logo img { width: 46px !important; height: 46px !important; filter: brightness(0) opacity(.88); }
.logo { gap: .7rem; font-size: 1.28rem !important; }
body.site-shell .site-footer-brand img, body.auth-shell .site-footer-brand img { filter: brightness(0) invert(1); width: 40px; height: 40px; }
body.site-shell .tool-card:hover, body.site-shell .tool-card { border-color: var(--line); }
.rcp-card-link:hover, .home-tool-row:hover { transform: translateY(-2px); }
body.site-shell:is(.segment-recipes, .segment-substitutes) main:has(.rcp-band) { padding-top: 0; }

/* ============ NAVBAR v2 — ink bar, saffron active pill ============ */
body.site-shell > header { background: var(--ink-deep); border-bottom: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
body.site-shell > header .container { width: min(1280px, 100% - 2 * var(--shell-pad, 24px)); max-width: none; padding-inline: 0; margin-inline: auto; }
body.site-shell > header .logo, body.site-shell > header .logo:hover { color: #fff; }
body.site-shell > header .logo img { filter: brightness(0) invert(1); }
body.site-shell > header nav a { color: rgba(255,255,255,.78); }
body.site-shell > header nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
body.site-shell > header nav a.active, body.site-shell > header nav a[aria-current="page"] { background: var(--saffron); color: var(--ink-deep); }
body.site-shell > header .menu-toggle { background: transparent; border: 1px solid rgba(255,255,255,.3); }
body.site-shell > header .menu-toggle span { background: #fff; }
body.site-shell > header nav a:focus-visible, body.site-shell > header .header-chat-link:focus-visible { outline: 3px solid var(--saffron); }
@media (max-width: 768px) {
  body.site-shell > header nav ul { background: var(--ink-deep); border-bottom: 0; }
  body.site-shell > header nav ul li a { color: #fff; }
}
/* no paper strip between the bar and a full-bleed hero */
body.site-shell main:has(.hm, .rcp-band) { padding-top: 0; }
body.site-shell .scroll-progress { background: var(--saffron); }
