/* Light catches the rim. The middle of each control shows its actual backdrop. */
:root {
  --glass-wash: rgb(215 235 255 / .045);
  --glass-hover: rgb(212 235 255 / .14);
  --glass-selected: rgb(171 205 246 / .20);
  --glass-solid: #28435d;
  --glass-solid-selected: #44617e;
  --glass-glint: linear-gradient(143deg, #6299e1 0%, rgb(135 177 236 / .62) 24%,
    rgb(200 220 244 / .18) 47%, rgb(239 248 255 / .70) 76%, #f2f8ff);
  --glass-depth: inset 1px 1px 2.5px rgb(83 139 211 / .20),
    inset -1px -1px 2.5px rgb(244 250 255 / .30), 0 2px 4px -2px rgb(10 30 51 / .35);
}
.site-header, .audio-player, .page-contact, .launch-card, .theotopia-section, #privacy-dialog,
body[data-reading-theme=light] {
  --glass-wash: rgb(242 249 255 / .09);
  --glass-hover: rgb(245 250 255 / .28);
  --glass-selected: rgb(114 165 227 / .26);
  --glass-solid: #dce8f3;
  --glass-solid-selected: #bad1e7;
}
.site-header {
  --glass-glint: linear-gradient(142deg, #4078cf, rgb(105 148 220 / .83) 25%, rgb(167 197 238 / .21) 47%, rgb(255 255 255 / .93) 78%);
  --glass-depth: inset 2px 2px 4px rgb(46 87 155 / .23), inset -2px -2px 4px rgb(255 255 255 / .76), 1px 3px 6px -2px rgb(16 40 70 / .34);
}
.reader-banner, .audio-stage, .site-footer, .support-section, .share-dialog {
  --glass-solid: #28435d;
  --glass-solid-selected: #44617e;
}

:root :is(button:not(.discover-toggle, .resume-help, .reader-text-link), #reader-resume-go, .button, .support-glass, .header-install, .header-reader-shortcut, .hero-scroll, .card-arrow,
  a.streaming-logo, a.follow-platform, .social-link, .reader-action, .plan-part-nav a,
  .share-options a, .audio-links a, .queue-play, .site-appearance label, .reader-theme-options label,
  select, summary:not(.mobile-discover > summary, .reader-navigation > summary)) {
  --glass-fill: var(--glass-wash);
  position: relative;
  border: 1px solid rgb(184 208 236 / .40);
  background: linear-gradient(150deg, rgb(239 248 255 / .075), transparent 34% 72%, rgb(236 247 255 / .095)), var(--glass-fill);
  box-shadow: var(--glass-depth);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  text-shadow: none;
  filter: none;

  &:is(.hero-scroll, .dialog-close) { position: absolute; }

  /* A masked hairline leaves both the ink and the landscape undistorted. */
  @supports (mask-composite: exclude) or (-webkit-mask-composite: xor) {
    &:not(select) { border-color: transparent; }
    &:not(select)::before {
      content: "";
      position: absolute;
      inset: -1px;
      padding: 1px;
      border-radius: inherit;
      pointer-events: none;
      background: var(--glass-glint);
      -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
      mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
      -webkit-mask-composite: xor;
      mask-composite: exclude;
    }
  }
  &:is([aria-current], [aria-pressed=true], [aria-selected=true], .active, :has(input:checked)) {
    --glass-fill: var(--glass-selected);
    box-shadow: var(--glass-depth), inset 0 0 0 1px rgb(145 184 229 / .47);
  }
  &:is(.support-glass, .hero-actions .button, .play-button, .audio-play)::before {
    padding: 1.5px;
    -webkit-backdrop-filter: blur(1.5px) saturate(120%);
    backdrop-filter: blur(1.5px) saturate(120%);
  }
  @media (hover: hover) {
    &:hover:not(:disabled) { background-color: var(--glass-hover); }
  }
  &:active:not(:disabled) { background-color: var(--glass-selected); }
  &:focus-visible, &:has(input:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
  &:disabled { opacity: .44; cursor: default; }
  @media (prefers-reduced-transparency: reduce) {
    background: var(--glass-solid);
    box-shadow: none;
    border-color: currentColor;
    &::before { display: none; }
    &:is([aria-current], [aria-pressed=true], [aria-selected=true], :has(input:checked)) { background: var(--glass-solid-selected); }
  }
  @media (forced-colors: active) {
    background: ButtonFace;
    color: ButtonText;
    border-color: ButtonText;
    box-shadow: none;
    &::before { display: none; }
    &:is([aria-current], [aria-pressed=true], [aria-selected=true], :has(input:checked)) { border-color: Highlight; }
  }
}

/* Positioned controls keep their native anchoring and each group keeps its shape. */
.site-header .support-glass { border-radius: 999px; color: #102e4a; }
.hero-actions .button, .about-copy .episode-one, .project-actions .button { color: inherit; }
.button-navy, .button-clear, .audio-player :is(.play-button, .icon-button, .speed), .site-header .menu-toggle { color: #102e4a; }
.hero .hero-scroll, .testament-card .card-arrow, .share-link-row button { color: #f6faff; }
.testament-card .card-arrow { border-radius: 50%; }
.share-options :is(a,button), .paragraph-options button { border-radius: 50%; }
.share-options :is(.icon,img) { width: 26px; height: 26px; }
.share-options #share-x img { width: 25px; height: 25px; }
.share-method-name { display: none; }
@media (max-width: 700px), (pointer: coarse) {
  .share-dialog .share-options { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .share-options > :is(a, button) { grid-column: span 2; justify-self: center; }
  .share-options :is(#share-email, #share-whatsapp) {
    grid-column: span 3;
    width: 100%;
    border-radius: 24px;
    gap: 8px;
    color: inherit;
  }
  .share-method-name { display: inline; font: 600 .87rem/1.2 var(--reader, sans-serif); }
}
.footer-bottom button, .paragraph-reference,
.rss-copy-row .rss-link { border-radius: 18px; padding: 4px 10px; text-decoration: none; }
.reader-theme-options { border: 0; }
.audio-description > summary, .episode-queue > summary { border-radius: 13px; padding-inline: 12px; }
.reader-action, .reader-round, .reading-modes a, .reader-level-tabs button, .reader-part-tabs button { color: var(--read-ink, #edf4fc); }
.reader-level-tabs button[aria-selected=true], .reader-part-tabs button[aria-pressed=true] { color: var(--read-ink, #edf4fc); font-weight: 650; }
.reading-plan-dialog .reading-plan-close { color: var(--read-ink, #edf4fc); }
.plan-episode, .plan-group summary, .paragraph-reference, .paragraph-options, .toc-row {
  --glass-depth: inset 0 1px 1px rgb(138 181 228 / .10), inset 0 -1px 1px rgb(240 249 255 / .13), 0 1px 2px rgb(7 24 42 / .08);
  --glass-glint: linear-gradient(143deg, rgb(120 172 231 / .41), rgb(164 200 236 / .15) 42%, rgb(222 237 252 / .38));
}
.plan-episode { --glass-wash: hsl(var(--part-hue) 42% 62% / .085); }
.plan-episode[aria-current=location] { --glass-selected: hsl(var(--part-hue) 54% 63% / .23); }
.plan-part-nav a::after {
  content: ""; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  order: -1; background: hsl(var(--part-hue) 62% 66%);
}
.reading-page[data-reading-theme=light] :is(.reader-part-tabs button[aria-pressed=true], .reader-level-tabs button[aria-selected=true]) { color: var(--jaune-charte); }
.reading-page[data-reading-theme=light] .share-dialog { --glass-solid: #dce8f3; }
