/* =========================================================
   MAIN BAR (js/site-nav.js)
   Computers and iPads: tabs in the top header.
   Phones: five tabs along the bottom, like the app.
   ========================================================= */

body.has-site-nav .site-header .nav-toggle,
body.has-site-nav .site-header .nav-links {
  display: none;
}

/* The bar stays above the Sanctuary panel, which opens below it. */
body.has-site-nav .site-header {
  z-index: 10010;
}

body.has-site-nav .my-sanctuary-card {
  top: var(--site-header-h, 0px);
  height: calc(100% - var(--site-header-h, 0px));
}

.site-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.site-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s;
}

.site-tab:hover,
.site-tab:focus-visible {
  color: var(--cream);
  background: rgba(244, 236, 216, 0.06);
}

.site-tab[aria-current="page"] {
  color: var(--cream);
  border-color: rgba(185, 160, 93, 0.45);
  background: rgba(185, 160, 93, 0.12);
}

.site-tab-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: none;
  color: var(--gold);
}

/* The podcast page's own sections, under the bar. */
.site-subnav {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 1rem 0.6rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-subnav::-webkit-scrollbar {
  display: none;
}

.site-subnav a {
  flex: none;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.site-subnav a:hover,
.site-subnav a:focus-visible {
  color: var(--cream);
  border-color: rgba(185, 160, 93, 0.45);
}

.my-sanctuary-subheading {
  margin: 1.4rem 0 0.4rem;
  color: var(--gold);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Smaller computers and iPads in portrait: icons over labels to fit six. */
@media (max-width: 1020px) and (min-width: 701px) {
  .site-tab {
    flex-direction: column;
    gap: 0.15rem;
    min-height: 3.2rem;
    padding: 0.3rem 0.65rem;
    border-radius: 14px;
    font-size: 0.78rem;
  }

  body.has-site-nav .brand > span:not(.brand-mark) {
    display: none;
  }
}

/* Phones: the tabs move to the bottom of the screen. */
@media (max-width: 700px) {
  body.has-site-nav {
    padding-bottom: calc(4.4rem + env(safe-area-inset-bottom));
  }

  body.has-site-nav .nav {
    min-height: 3.6rem;
  }

  .site-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10005;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    margin: 0;
    padding: 0.35rem max(0.4rem, env(safe-area-inset-left)) max(0.45rem, env(safe-area-inset-bottom)) max(0.4rem, env(safe-area-inset-right));
    border-top: 1px solid var(--line);
    /* Nearly opaque, so a backdrop blur here showed nothing but cost a full
       re-blur of the page behind it on every frame of scrolling. */
    background: rgba(13, 17, 14, 0.96);
  }

  .site-tab[data-site-tab="podcast"] {
    display: none;
  }

  .site-tab {
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    min-height: 3.3rem;
    padding: 0.25rem 0;
    border-radius: 12px;
    font-size: 0.72rem;
  }

  .site-tab[aria-current="page"] {
    border-color: transparent;
  }

  .site-tab-icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .site-subnav {
    justify-content: flex-start;
  }

  /* Accessibility Options lives in More here, so it doesn't cover the page. */
  body.has-site-nav .accessibility-trigger {
    display: none;
  }

  /* The Sanctuary panel stops above the tabs, so they stay usable. */
  body.has-site-nav .my-sanctuary-card {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
  }
}

/* Older phone rules stretch every .button across the screen; this one floats. */
body.has-site-nav .accessibility-trigger {
  width: auto;
}

/* Practice: the Grimoire | Rituals switch at the top of their pages. The
   same pill switches tabs within a page (.seg-switch, js/segmented-switch.js):
   Today | Sky & Lore, My covens | Find a coven. */
.practice-switch,
.seg-switch {
  display: flex;
  gap: 4px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 14px auto 0;
  padding: 4px;
  border: 1px solid rgba(226, 195, 109, 0.35);
  border-radius: 999px;
  background: rgba(12, 21, 16, 0.6);
}
.practice-switch a {
  padding: 7px 18px;
  border-radius: 999px;
  color: var(--cream, #f4ecd8);
  text-decoration: none;
  font-size: 0.95rem;
}
.practice-switch a[aria-current="page"] {
  background: var(--gold, #e2c36d);
  color: var(--charcoal, #102118);
  font-weight: 600;
}
.practice-switch a:focus-visible { outline: 2px solid var(--gold, #e2c36d); outline-offset: 2px; }
.seg-switch {
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 auto 18px;
}
.seg-switch button {
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cream, #f4ecd8);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.seg-switch button:hover:not([aria-selected="true"]) { opacity: 0.8; }
.seg-switch button[aria-selected="true"] {
  background: var(--gold, #e2c36d);
  color: var(--charcoal, #102118);
  font-weight: 600;
}
.seg-switch button:focus-visible { outline: 2px solid var(--gold, #e2c36d); outline-offset: 2px; }

/* Back, under the header (js/site-nav.js). Pages with their own back link
   ("‹ Back to Today", "← All rituals") hide this one. */
.site-back-bar {
  width: min(1100px, calc(100% - 32px));
  margin: 12px auto 0;
}
.site-back {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px 6px 10px;
  border: 1px solid rgba(226, 195, 109, 0.35);
  border-radius: 999px;
  background: rgba(12, 21, 16, 0.6);
  color: var(--gold, #e2c36d);
  font-size: 0.95rem;
  text-decoration: none;
}
.site-back:hover { background: rgba(226, 195, 109, 0.12); }
.site-back:focus-visible { outline: 2px solid var(--gold, #e2c36d); outline-offset: 2px; }
body:has(a.sp-back) .site-back-bar { display: none; }
