/* ============================================================
   YAMAS HUB — Liquid Glass system (three tiers)
   Companion to glass-tokens.css (load tokens first) and
   lg-detect.js (injects the #lg-glass SVG filter and sets
   `html.lg-refract` only where backdrop-filter:url() works).

   Tier 0 — layered glassmorphism, ALL browsers (Safari-primary).
   Tier 1 — SVG displacement refraction, Chromium only, additive.
   Tier 2 — (not used on the hub; no image-backed hero moments.)

   Usage discipline (docs/brief-yamas-hub-web.md): glass on CHROME
   only — bars, tab bar/rail, FABs, sheet headers. Data surfaces
   (schedules, tables, checklists, threads) stay solid. Never stack
   glass on glass. ≤5 glass elements per viewport.
   ============================================================ */

/* ---- Tier 0: base glass (matches the app's GlassCard recipe:
        material + tint wash + top-bright rim + drop shadow) ---- */
.glass {
  position: relative;
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border: 1px solid var(--glass-hairline);
  border-top-color: var(--glass-rim-hi);
  border-radius: var(--r-card);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-rim-lo);
  contain: layout paint;
}

/* Accent-tinted glass: set `--tint` on the element (the app's diagonal
   wash — tint 45% top-left fading to 14% — bleeding through the glass). */
.glass--tint {
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--tint, var(--ym-gold)) calc(var(--glass-wash-hi) * 100%), transparent),
    color-mix(in srgb, var(--tint, var(--ym-gold)) calc(var(--glass-wash-lo) * 100%), transparent));
}

.glass--pill { border-radius: var(--r-pill); }
.glass--sheet { border-radius: var(--r-sheet); }

/* iOS PressableCard: squish in, spring back (response .3, damping .55) */
.glass--pressable {
  cursor: pointer;
  transition: transform var(--press-spring);
}
.glass--pressable:active { transform: scale(var(--press-scale)); }
.glass--pressable:focus-visible {
  outline: 2px solid var(--ym-gold);
  outline-offset: 2px;
}

/* ---- Tier 1: refraction (Chromium; lg-detect.js gates the class).
        Separate rule so an unsupported url() can never nuke Tier 0. ---- */
.lg-refract .glass,
.lg-refract .lg-chrome {
  backdrop-filter: url(#lg-glass) blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

/* `.lg-chrome` marks existing chrome surfaces (appbar, tabbar) that keep
   their own Tier 0 styling but should pick up Tier 1 refraction. */

/* ---- Buttons (WelcomeView / .borderedProminent .tint(ymGold)) ----
   The app's prominent button: gold fill, navy-deep content, radius 14,
   headline type, soft drop shadow, spring press. Secondary = ymPanel. */
.glass-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--ym-font);
  font-size: var(--fs-headline);
  font-weight: 600;
  color: var(--ym-navy-deep);
  background: var(--ym-gold);
  border: none;
  border-radius: var(--r-panel);
  padding: 14px 20px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 8px 12px rgb(0 0 0 / 0.30);
  transition: transform var(--press-spring), filter 140ms ease;
}
.glass-btn:hover { filter: brightness(1.06); }
.glass-btn:active { transform: scale(var(--press-scale)); }
.glass-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.glass-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.glass-btn--block { display: flex; width: 100%; }
.glass-btn--quiet {          /* .bordered / ymPanel secondary */
  color: #fff;
  background: var(--ym-panel);
  border: 1px solid rgb(255 255 255 / 0.18);
  box-shadow: none;
}
.glass-btn--bare {           /* toolbar-style text button, gold tint */
  color: var(--ym-gold);
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 8px 10px;
}

/* ---- Fields (ymPanel: white 8%, radius 9–11, white text) ---- */
.glass-field {
  width: 100%;
  box-sizing: border-box;
  font-family: var(--ym-font);
  font-size: var(--fs-subheadline);
  color: #EAF1F8;
  background: var(--ym-panel);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: var(--r-field);
  padding: 11px 13px;
}
.glass-field::placeholder { color: rgb(255 255 255 / 0.45); }
.glass-field:focus { outline: none; border-color: var(--ym-sent); }
select.glass-field option { color: var(--ym-navy); }

/* ---- Sheet scaffold (app sheets: NavyCanvas body, glass nav chrome,
        solid content; bottom sheet <700px, centered card above) ---- */
.glass-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgb(2 10 20 / 0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.glass-sheet {
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  background: var(--ym-canvas);
  box-shadow: 0 -12px 40px rgb(0 0 0 / 0.45);
}
.glass-sheet__bar {          /* the ONE glass element of a sheet */
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: rgb(13 43 74 / 0.72);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  border-bottom: 1px solid rgb(255 255 255 / 0.10);
}
.glass-sheet__title {
  font-size: var(--fs-headline);
  font-weight: 600;
  color: #fff;
  text-align: center;
  flex: 1;
}
.glass-sheet__body { overflow-y: auto; padding: 16px; }
@media (min-width: 700px) {
  .glass-sheet-scrim { align-items: center; }
  .glass-sheet { max-width: 560px; border-radius: var(--r-sheet); }
}
.lg-refract .glass-sheet__bar {
  backdrop-filter: url(#lg-glass) blur(var(--glass-blur)) saturate(var(--glass-saturate));
}

/* ---- Gold callout (WelcomeView: gold 12% fill, gold 40% stroke, r14) ---- */
.glass-callout {
  font-size: var(--fs-callout);
  color: var(--ym-gold);
  background: rgb(201 169 97 / 0.12);
  border: 1px solid rgb(201 169 97 / 0.40);
  border-radius: var(--r-panel);
  padding: 16px;
  line-height: 1.5;
}

/* ---- Accessibility floor ---- */
@media (prefers-reduced-transparency: reduce) {
  .glass, .lg-refract .glass,
  .lg-chrome, .lg-refract .lg-chrome,
  .glass-sheet__bar, .lg-refract .glass-sheet__bar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgb(13 36 62 / 0.97);
  }
  .glass-sheet-scrim { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .glass--pressable, .glass-btn { transition: none; }
  .glass--pressable:active, .glass-btn:active { transform: none; }
}
