/* ===========================================================================
   BRAVO VALLEY — iOS Glass (iOS 26 / 27 style) — pure CSS, no JavaScript
   Fluent Snippets: CSS, site-wide header. Independent of Liquid Glass 1–5.
   Every class starts with `ios-`, so nothing on the site changes until you
   put one of these classes on a Bricks element. Bravo Valley is a light
   site, so <html> carries `ios-light` (added by Liquid Glass 5) and the
   dark tokens only apply where you add the class `ios-dark` yourself.

   Two layers, as Apple's Liquid Glass model asks:
   · content (text, lists, cards, photos): opaque, never glass
   · floating controls (tab bar, toolbar buttons, menus, sheets, toasts):
     glass = backdrop blur 22px + saturate 180% + a lit rim of inset shadows
   Under Reduce Transparency / Increase Contrast the glass turns opaque.

   Needs no JavaScript except the three small helpers in the guide (Part H):
   tab bar shrink on scroll, nav edge fade, toast.
   =========================================================================== */

/* ── tokens (light) ───────────────────────────────────────────────────── */
:root {
  --ios-bg: #F2F2F7;          /* grouped background */
  --ios-card: #FFFFFF;        /* rows, cards (content layer) */
  --ios-card-2: #F2F2F7;      /* inputs and wells inside a card */
  --ios-label: #1D1D1F;       /* 16.8:1 on white */
  --ios-label-2: #6E6E73;     /* 5.1:1 on white */
  --ios-label-3: #8E8E93;     /* placeholders, chevrons only */
  --ios-sep: rgba(60, 60, 67, .16);
  --ios-fill: rgba(120, 120, 128, .12);
  --ios-fill-2: rgba(120, 120, 128, .2);
  --ios-tint: #0066CC;        /* 5.6:1 on white */
  --ios-tint-fill: rgba(0, 102, 204, .1);
  --ios-on-tint: #FFFFFF;
  --ios-red: #D70015; --ios-green: #248A3D; --ios-orange: #C93400; --ios-purple: #8944AB;
  --ios-glass: rgba(250, 250, 252, .62);        /* bars, buttons */
  --ios-glass-strong: rgba(250, 250, 252, .82); /* menus, sheets */
  --ios-rl: 1;                /* rim light strength */
  --ios-rd: 1;                /* rim dark strength */
  --ios-r-card: 22px;
  --ios-r-ctl: 12px;
  --ios-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", system-ui, sans-serif;
  --ios-font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", system-ui, sans-serif;
  --ios-ease: cubic-bezier(.32, .72, 0, 1);
  --ios-shadow-float: 0 10px 30px -8px rgba(0, 0, 0, .18), 0 2px 6px rgba(0, 0, 0, .06);
}
/* ── tokens (dark): follows the system, or force with <body class="ios-dark"> */
@media (prefers-color-scheme: dark) {
  :root:not(.ios-light) {
    --ios-bg: #000000; --ios-card: #1C1C1E; --ios-card-2: #2C2C2E;
    --ios-label: #F5F5F7; --ios-label-2: #AEAEB2; --ios-label-3: #8E8E93;
    --ios-sep: rgba(84, 84, 88, .55); --ios-fill: rgba(120, 120, 128, .24); --ios-fill-2: rgba(120, 120, 128, .36);
    --ios-tint: #0A84FF; --ios-tint-fill: rgba(10, 132, 255, .18);
    --ios-red: #FF453A; --ios-green: #30D158; --ios-orange: #FF9F0A; --ios-purple: #BF5AF2;
    --ios-glass: rgba(40, 40, 44, .56); --ios-glass-strong: rgba(36, 36, 40, .8);
    --ios-rl: .35; --ios-rd: 2;
    --ios-shadow-float: 0 12px 34px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  }
}
.ios-dark {
  --ios-bg: #000000; --ios-card: #1C1C1E; --ios-card-2: #2C2C2E;
  --ios-label: #F5F5F7; --ios-label-2: #AEAEB2; --ios-label-3: #8E8E93;
  --ios-sep: rgba(84, 84, 88, .55); --ios-fill: rgba(120, 120, 128, .24); --ios-fill-2: rgba(120, 120, 128, .36);
  --ios-tint: #0A84FF; --ios-tint-fill: rgba(10, 132, 255, .18);
  --ios-red: #FF453A; --ios-green: #30D158; --ios-orange: #FF9F0A; --ios-purple: #BF5AF2;
  --ios-glass: rgba(40, 40, 44, .56); --ios-glass-strong: rgba(36, 36, 40, .8);
  --ios-rl: .35; --ios-rd: 2;
  --ios-shadow-float: 0 12px 34px -8px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
}

/* ── THE GLASS ────────────────────────────────────────────────────────── */
.ios-glass {
  background: var(--ios-glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
          backdrop-filter: blur(22px) saturate(180%);
  box-shadow:
    inset 0 0 0 .5px          color-mix(in srgb, #fff calc(var(--ios-rl) * 30%), transparent),
    inset 1.8px 3px 0 -2px    color-mix(in srgb, #fff calc(var(--ios-rl) * 90%), transparent),
    inset -2px -2px 0 -2px    color-mix(in srgb, #fff calc(var(--ios-rl) * 80%), transparent),
    inset -3px -8px 1px -6px  color-mix(in srgb, #fff calc(var(--ios-rl) * 55%), transparent),
    inset -.3px -1px 4px 0    color-mix(in srgb, #000 calc(var(--ios-rd) * 10%), transparent),
    inset -1.5px 2.5px 0 -2px color-mix(in srgb, #000 calc(var(--ios-rd) * 14%), transparent),
    inset 0 3px 4px -2px      color-mix(in srgb, #000 calc(var(--ios-rd) * 12%), transparent),
    var(--ios-shadow-float);
  color: var(--ios-label);
}
/* thicker glass for menus and sheets (more text on it) */
.ios-glass-thick { background: var(--ios-glass-strong); }
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .ios-glass, .ios-glass-thick {
    background: var(--ios-card);
    -webkit-backdrop-filter: none; backdrop-filter: none;
    box-shadow: 0 0 0 1px var(--ios-sep), var(--ios-shadow-float);
  }
}

/* ── floating glass buttons: circle for a symbol, capsule for a word ─── */
.ios-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 44px; min-width: 44px; padding: 0 14px;
  border: 0; border-radius: 999px; color: var(--ios-label);
  font: 500 16px/1 var(--ios-font); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: transform .2s var(--ios-ease), background .2s;
}
.ios-btn:hover { text-decoration: none; }
.ios-btn:active { transform: scale(.94); }
.ios-btn.ios-icon { width: 44px; padding: 0; }
.ios-btn .ios-ic { width: 22px; height: 22px; display: grid; place-items: center; }
.ios-btn.ios-back { padding: 0 14px 0 8px; }
/* the one prominent action of a screen (Save, Create) */
.ios-btn.ios-prominent {
  background: var(--ios-tint); color: var(--ios-on-tint); font-weight: 600;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--ios-tint) 60%, transparent);
}
.ios-btn[disabled] { opacity: .45; cursor: default; }
/* several buttons on one glass capsule */
.ios-btn-group { display: inline-flex; border-radius: 999px; }
.ios-btn-group .ios-btn { background: none; box-shadow: none; }
@media (min-width: 900px) { .ios-btn { height: 38px; min-width: 38px; font-size: 14px; } .ios-btn.ios-icon { width: 38px; } }

/* ── top of a page: no bar, glass buttons + a scroll edge fade ────────── */
.ios-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  min-height: 60px; padding: 10px 16px;
}
.ios-nav::before {
  content: ""; position: absolute; inset: 0 0 -18px; z-index: -1; pointer-events: none;
  background: linear-gradient(var(--ios-bg) 20%, color-mix(in srgb, var(--ios-bg) 70%, transparent) 60%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
  opacity: 0; transition: opacity .2s;
}
.ios-nav.ios-scrolled::before { opacity: 1; }
.ios-nav-title {
  flex: 1; min-width: 0; text-align: center; font: 600 17px/1.2 var(--ios-font); color: var(--ios-label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .2s;
}
.ios-nav.ios-scrolled .ios-nav-title { opacity: 1; }
.ios-nav-l, .ios-nav-r { display: flex; align-items: center; gap: 8px; flex: none; min-width: 44px; }
.ios-nav-r { justify-content: flex-end; }
.ios-large-title { padding: 4px 4px 14px; }
.ios-large-title h1 { margin: 0; font: 700 34px/1.12 var(--ios-font-display); letter-spacing: -.02em; color: var(--ios-label); }
.ios-large-title p { margin: 6px 0 0; color: var(--ios-label-2); font: 400 15px/1.4 var(--ios-font); }

/* ── phone tab bar: floating capsule + separate round search button ───── */
.ios-tabdock {
  position: fixed; z-index: 40; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); translate: -50% 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: min(430px, calc(100vw - 24px)); height: 64px;
  contain: layout; will-change: transform;
}
/* pinned to the small viewport, so a phone toolbar showing/hiding can't make it jump */
@supports (height: 100svh) {
  @media (max-width: 899px) { .ios-tabdock { bottom: auto; top: calc(100svh - 64px - 10px - env(safe-area-inset-bottom)); } }
}
.ios-tabbar {
  flex: 0 0 calc(100% - 72px); min-width: 0; height: 64px; padding: 5px;
  display: flex; flex-wrap: nowrap; gap: 2px; border-radius: 999px; overflow: hidden;
  transition: flex-basis .45s var(--ios-ease);
}
.ios-tabdock.ios-solo .ios-tabbar { flex-basis: 100%; }   /* no search button */
.ios-tabbar a {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border-radius: 999px; color: var(--ios-label); font: 600 10.5px/1.1 var(--ios-font);
  white-space: nowrap; overflow: hidden; text-decoration: none;
  transition: flex-grow .45s var(--ios-ease), opacity .25s, color .2s, background .25s var(--ios-ease);
}
.ios-tabbar a .ios-ic { width: 26px; height: 26px; display: grid; place-items: center; }
.ios-tabbar a .ios-ic svg { width: 24px; height: 24px; }
.ios-tabbar a[aria-current="page"] { color: var(--ios-tint); background: color-mix(in srgb, var(--ios-label) 8%, transparent); }
.ios-tabbar a:hover { text-decoration: none; }
/* iOS 26: scrolling down shrinks the bar to the current tab; up (or a tap) brings it back */
.ios-tabdock.ios-min .ios-tabbar { flex-basis: 64px; gap: 0; cursor: pointer; }
.ios-tabdock.ios-min .ios-tabbar a:not([aria-current]) { flex-grow: 0; flex-basis: 0; width: 0; opacity: 0; pointer-events: none; padding: 0; }
.ios-tabdock.ios-min .ios-tabbar a[aria-current] { font-size: 0; gap: 0; }
.ios-tabsearch {
  flex: none; width: 64px; height: 64px; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: var(--ios-label); cursor: pointer;
  transition: transform .2s var(--ios-ease);
}
.ios-tabsearch:active { transform: scale(.92); }
.ios-tabsearch svg { width: 26px; height: 26px; }
@media (prefers-reduced-motion: reduce) { .ios-tabbar, .ios-tabbar a { transition: none; } }

/* ── menu (glass popover) ─────────────────────────────────────────────── */
.ios-menu {
  min-width: 230px; max-width: calc(100vw - 24px); padding: 6px; border-radius: 22px;
  transform-origin: var(--ios-menu-origin, top right); animation: ios-menu-in .28s var(--ios-ease);
}
.ios-menu[hidden] { display: none; }
@keyframes ios-menu-in { from { opacity: 0; transform: scale(.86); } }
.ios-menu a, .ios-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: 14px; background: none; color: var(--ios-label);
  font: 400 16px/1.2 var(--ios-font); text-align: left; text-decoration: none; cursor: pointer;
}
.ios-menu a:hover, .ios-menu button:hover { background: color-mix(in srgb, var(--ios-label) 8%, transparent); text-decoration: none; }
.ios-menu .ios-ic { width: 20px; height: 20px; margin-left: auto; color: var(--ios-label-2); display: grid; place-items: center; }
.ios-menu .ios-danger, .ios-menu .ios-danger .ios-ic { color: var(--ios-red); }
.ios-menu hr { border: 0; border-top: .5px solid var(--ios-sep); margin: 4px 10px; }
.ios-menu-h { padding: 8px 12px 4px; font: 600 12px/1.2 var(--ios-font); color: var(--ios-label-2); }

/* ── sheet (bottom sheet on phones, centred card on wide screens) ─────── */
.ios-sheet-back {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .28); animation: ios-fade .2s;
}
.ios-sheet-back[hidden] { display: none; }
@keyframes ios-fade { from { opacity: 0; } }
.ios-sheet {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100svh - 40px);
  display: flex; flex-direction: column; overflow: hidden;
  margin: 0 8px calc(8px + env(safe-area-inset-bottom)); border-radius: 30px;
  animation: ios-sheet-in .42s var(--ios-ease);
}
@keyframes ios-sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) { .ios-sheet-back { align-items: center; } .ios-sheet { margin: 0; } }
.ios-sheet-grab { width: 36px; height: 5px; border-radius: 3px; background: var(--ios-fill-2); margin: 7px auto 0; flex: none; }
@media (min-width: 700px) { .ios-sheet-grab { display: none; } }
.ios-sheet-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px; flex: none; }
.ios-sheet-h h3 { flex: 1; margin: 0; text-align: center; font: 600 17px/1.2 var(--ios-font); color: var(--ios-label); }
.ios-sheet-b { flex: 1; overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; color: var(--ios-label); }
.ios-sheet-f { display: flex; align-items: center; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: .5px solid var(--ios-sep); flex: none; }

/* ── toast (a done action: "Saved", "Copied") ─────────────────────────── */
.ios-toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  translate: -50% 12px; opacity: 0; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 999px; font: 500 15px/1.2 var(--ios-font);
  pointer-events: none; transition: opacity .25s, translate .35s var(--ios-ease);
}
.ios-toast.ios-on { opacity: 1; translate: -50% 0; }

/* ── controls that sit ON glass or in content ─────────────────────────── */
/* switch: <label class="ios-switch"><input type="checkbox"><i></i></label> */
.ios-switch { position: relative; width: 51px; height: 31px; flex: none; display: inline-block; }
.ios-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.ios-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--ios-fill-2); transition: background .25s var(--ios-ease); }
.ios-switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .3s var(--ios-ease);
}
.ios-switch input:checked + i { background: #34C759; }
.ios-switch input:checked + i::after { transform: translateX(20px); }
.ios-switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--ios-tint) 60%, transparent); outline-offset: 2px; }
/* segmented control: buttons with aria-pressed */
.ios-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 10px; background: var(--ios-fill); }
.ios-seg button {
  min-height: 30px; padding: 4px 14px; border: 0; border-radius: 8px; background: none;
  color: var(--ios-label); font: 500 13px/1.2 var(--ios-font); cursor: pointer; transition: background .2s;
}
.ios-seg button[aria-pressed="true"] { background: var(--ios-card); box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not(.ios-light) .ios-seg button[aria-pressed="true"] { background: #636366; } }
.ios-dark .ios-seg button[aria-pressed="true"] { background: #636366; }
/* chip (status) */
.ios-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font: 600 12px/1.3 var(--ios-font); white-space: nowrap;
  background: color-mix(in srgb, var(--ios-green) 14%, transparent); color: var(--ios-green);
}
.ios-chip.ios-orange { background: color-mix(in srgb, var(--ios-orange) 14%, transparent); color: var(--ios-orange); }
.ios-chip.ios-red { background: color-mix(in srgb, var(--ios-red) 12%, transparent); color: var(--ios-red); }
.ios-chip.ios-gray { background: var(--ios-fill); color: var(--ios-label-2); }
.ios-chip.ios-tint { background: var(--ios-tint-fill); color: var(--ios-tint); }

/* ── content layer (opaque, never glass): grouped list ────────────────── */
.ios-group { margin: 22px 0; }
.ios-group-h { padding: 0 16px 7px; font: 600 13px/1.2 var(--ios-font); color: var(--ios-label-2); text-transform: uppercase; letter-spacing: .02em; }
.ios-group-f { padding: 7px 16px 0; font: 400 13px/1.4 var(--ios-font); color: var(--ios-label-2); }
.ios-list { background: var(--ios-card); border-radius: var(--ios-r-card); overflow: hidden; }
.ios-row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 16px;
  width: 100%; border: 0; background: none; text-align: left; color: var(--ios-label);
  font: 400 17px/1.3 var(--ios-font); text-decoration: none;
}
.ios-row + .ios-row::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--ios-sep); }
a.ios-row:hover, button.ios-row:hover { background: color-mix(in srgb, var(--ios-label) 4%, transparent); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .ios-menu, .ios-sheet, .ios-sheet-back { animation: none; }
  .ios-btn, .ios-toast, .ios-tabsearch { transition: none; }
}
