/* ==========================================================================
   Baseline Sitewide UI (STRUCTURAL ONLY)
   - Shared safety utilities (layout + motion)
   - Removes floating "Back to recipe" / "Back to top" buttons sitewide
   - Intentionally DOES NOT set colours, theme variables, or backgrounds.
   ========================================================================== */

/* Layout safety */
html, body{
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: auto; /* disables native smooth scrolling */
}

/* --------------------------------------------------------------------------
   Themed scrollbars (sitewide)
   - Uses per-page tokens from baseline-themes.css (mirrored to :root by JS).
   - Removes default white/grey scrollbar chrome.
   -------------------------------------------------------------------------- */
html{
  scrollbar-width: auto; /* Firefox */
  scrollbar-color: var(--scroll-thumb, rgba(0,0,0,.5)) var(--scroll-track, transparent);
}

/* When using the fixed banner layout, the page scrolls inside .bl-scroll.
   Apply the same theming so there is no default white/grey chrome. */
.bl-scroll{
  scrollbar-width: auto;
  scrollbar-color: var(--scroll-thumb, rgba(0,0,0,.5)) var(--scroll-track, transparent);
}

/* WebKit/Blink */
::-webkit-scrollbar{ width: 12px; height: 12px; }
::-webkit-scrollbar-track{ background: var(--scroll-track, transparent); }
::-webkit-scrollbar-thumb{
  background: var(--scroll-thumb, rgba(0,0,0,.5));
  border-radius: 999px;
  border: 3px solid var(--scroll-track, transparent);
}
::-webkit-scrollbar-thumb:hover{
  background: var(--scroll-thumb-hover, var(--scroll-thumb, rgba(0,0,0,.65)));
}

/* --------------------------------------------------------------------------
   REMOVE FLOATING BUTTONS SITEWIDE
   (These are the bottom corner "Back to recipe" / "Back to top" buttons.)
   -------------------------------------------------------------------------- */
.back-fab,
.top-fab,
#backFab,
#topFab{
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* If any page reserved space for FABs, remove it */
body{ padding-bottom: 0 !important; }

/* Consistent box sizing */
*{ box-sizing: border-box; }

/* Ingredient Library: force “← View recipe …” link to its own line */
#ingredientRecipeLink{
  display:block !important;
  width:100% !important;
  margin-left:0 !important;
  margin-top:10px !important;
}


/* Strong override: disable card hover lift even if later CSS reintroduces it */
body .card,
body .card:hover,
body .card:focus-within,
body .card:focus-visible{
  transform: none !important;
  filter: none !important;
  transition: none !important;
}


@media print{
  body{ background:#fff !important; color:#000 !important; }
  .card{ background:transparent !important; box-shadow:none !important; border:none !important; }
  .card::before, .card::after{ content:none !important; display:none !important; }
}

/* --------------------------------------------------------------------------
   Themed custom dropdown (select) — makes the OPEN dropdown list match site UI.
   - We keep native <select> in the DOM for compatibility.
   - JS wraps selects in .bl-select and renders an overlay button + menu.
   -------------------------------------------------------------------------- */
.bl-select{ position:relative; display:inline-block; flex:0 1 auto; }

/*
  IMPORTANT (mobile + fail-safe):
  - Only hide the native <select> when JS has fully enhanced it.
  - If JS fails partway through, the select remains usable.
*/
.bl-select[data-bl-enhanced="1"] select{ opacity:0; pointer-events:none; }

.bl-select-btn{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  cursor:pointer;
  text-align:left;
}

.bl-select-menu{
  position:absolute;
  top: calc(100% + 8px);
  left:0;
  min-width:100%;
  max-width:min(92vw, 520px);
  z-index: 12000;
  padding: 8px;
  border-radius: 16px;

  /* Theme-linked surface (matches the recipe card palette for the current system) */
  border: 1px solid var(--border, rgba(0,0,0,.14));
  background: var(--showall-bg, var(--card-bg, rgba(255,255,255,.92)));
  color: var(--ink, #111);

  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: var(--shadow, 0 22px 56px -38px rgba(0,0,0,.55));

  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(55vh, 360px);

  /* Mobile/touch scrolling reliability */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;

  /* Themed scrollbar (dropdown menu)
     - Keeps scroll available for long lists.
     - Uses per-page variables when available.
  */
  scrollbar-width: auto; /* Firefox */
  scrollbar-color: var(--accent, #7a4a3a) rgba(255,255,255,.35);
}

/* Prefer a softer, theme-mixed scrollbar when supported */
@supports (color: color-mix(in srgb, black 50%, white)){
  .bl-select-menu{
    scrollbar-color:
      color-mix(in srgb, var(--accent, #7a4a3a) 58%, transparent)
      color-mix(in srgb, var(--card, rgba(255,255,255,.70)) 72%, transparent);
  }
}

/* WebKit scrollbar styling (Chrome, Edge, Safari) */
.bl-select-menu::-webkit-scrollbar{ width: 11px; height: 11px; }
.bl-select-menu::-webkit-scrollbar-track{
  background: rgba(255,255,255,.28);
  background: color-mix(in srgb, var(--card, rgba(255,255,255,.72)) 65%, transparent);
  border-radius: 999px;
}
.bl-select-menu::-webkit-scrollbar-thumb{
  background: linear-gradient(180deg, var(--accent, #7a4a3a), var(--accent-3, #d7a86c));
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,.30);
  border: 3px solid color-mix(in srgb, var(--card, rgba(255,255,255,.72)) 75%, transparent);
}
.bl-select-menu::-webkit-scrollbar-thumb:hover{
  background: linear-gradient(180deg, var(--accent-2, #6f3526), var(--accent, #ef7f59));
}

/* On very small screens, cap the menu more tightly so it never traps the UI */
@media (max-width: 520px){
  .bl-select-menu{ max-height: min(42vh, 300px); }
}

/* --------------------------------------------------------------------------
   Themed number steppers (replaces unthemed native spinners)
   - Works consistently across mobile/desktop
   - Uses page variables (no hard-coded palette)
   -------------------------------------------------------------------------- */

/* Hide native number spinners (we use plain numeric inputs for consistency) */
input[type="number"]{
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.bl-number{ position:relative; display:inline-block; }

/* Hide native spinners (we provide themed controls instead) */
.bl-number input[type="number"]{
  -moz-appearance: textfield;
  appearance: textfield;
  padding-right: 42px; /* room for stepper */
}
.bl-number input[type="number"]::-webkit-outer-spin-button,
.bl-number input[type="number"]::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

.bl-number-stepper{
  position:absolute;
  right:6px;
  top:50%;
  transform: translateY(-50%);
  display:flex;
  flex-direction:column;
  gap:4px;
}

.bl-number-stepper .bl-step{
  width:28px;
  height:18px;
  padding:0;
  border-radius:10px;
  border: 1px solid var(--border, rgba(0,0,0,.14));
  background: var(--card-bg, rgba(255,255,255,.70));
  color: var(--ink, #111);
  font-weight: 900;
  line-height: 1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}

.bl-number-stepper .bl-step:hover{ filter: brightness(1.03); }
.bl-number-stepper .bl-step:active{ transform: translateY(0.5px); }
.bl-number-stepper .bl-step:focus-visible{
  outline:none;
  box-shadow: 0 0 0 4px var(--ring, rgba(0,0,0,.16));
}

.bl-select-menu [role="option"]{
  display:block;
  width:100%;
  text-align:left;
  border:none;
  background:transparent;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 850;
  color: var(--ink, #1b0b09);
  cursor:pointer;
}

.bl-select-menu [role="option"]:hover,
.bl-select-menu [role="option"][aria-selected="true"]{
  background: color-mix(in srgb, var(--accent-soft, rgba(255,255,255,.38)) 65%, transparent);
  background: rgba(255,255,255,.30);
}

.bl-select-menu [role="option"]:focus-visible{
  outline:none;
  box-shadow: 0 0 0 4px var(--ring, rgba(0,0,0,.16));
}

/* Segmented control — used for “Type of oats” in Hearty Oat Porridge */
.oat-toggle{
  display:inline-flex;
  align-items:center;
  border:1px solid rgba(122,74,58,0.18);
  background:rgba(255,255,255,0.18);
  border-radius:999px;
  overflow:hidden;
  max-width:100%;
}
.oat-toggle .oat-option{
  appearance:none;
  -webkit-appearance:none;
  border:0;
  background:transparent;
  color:var(--ink);
  font-weight:850;
  font-size:16px;
  padding:9px 12px;
  cursor:pointer;
  line-height:1;
  white-space:nowrap;
}
.oat-toggle .oat-option + .oat-option{
  border-left:1px solid rgba(122,74,58,0.16);
}
.oat-toggle .oat-option.is-active{
  background:rgba(255,255,255,0.34);
}
.oat-toggle .oat-option:focus-visible{
  outline:none;
  box-shadow:0 0 0 4px var(--ring);
  position:relative;
  z-index:1;
}
@media (max-width: 520px){
  .oat-toggle{ width:100%; }
  .oat-toggle .oat-option{ flex:1 1 50%; text-align:center; }
}

/* Optional row: Type of oats (used by the oat porridge recipe in Recipe Overview) */
#recipes:not(.recipe-open-mode) .recipes .multiplier.recipe-controls .oat-label{ grid-column:1; grid-row:3; }
#recipes:not(.recipe-open-mode) .recipes .multiplier.recipe-controls .oat-toggle{ grid-column:2; grid-row:3; }

/* --------------------------------------------------------------------------
   Theme fidelity fixes
   - Ensure HTML backdrop matches system gradient (prevents solid fallback bleed)
   - Keep long dropdowns readable while matching each page's surface token
   -------------------------------------------------------------------------- */
html{
  background: var(--page-bg, var(--bg, #fff));
}
body{
  min-height: 100vh;
}
body[data-app="food"],
body[data-app="skin"]{
  background: var(--page-bg) !important;
}


/* Notes bullet lists inside ingredient cards */
.notes-list{
  margin: 8px 0 0 0;
  padding-left: 18px;
}
.notes-list li{
  margin: 6px 0;
  line-height: 1.35;
}

/* Prevent fixed header from obscuring deep-linked sections/cards */
.section[id],
.card[id]{
  scroll-margin-top: calc(var(--bl-homebar-h, 56px) + 18px);
}

/* Support library intro text should match the main site’s readable body sizing */
.support-intro{
  font-size: 1em;
  line-height: 1.45;
  color: var(--muted);
  margin: 10px 0 0;
}

