/* =========================================================
   THE MENU (js/site-nav.js), drawn like the app's (components/TabBar.tsx).
   900px and wider: a side bar down the left, folding to a rail of icons.
   Narrower: five tabs along the bottom, with a grip to tuck them away.
   ========================================================= */

:root {
  --site-menu-night: var(--ss-night, #070a08);
  --site-menu-line: rgba(var(--ss-cream-rgb, 244, 236, 216), 0.14);
  --site-menu-ink: var(--ss-muted, #b4ad96);
  --site-menu-gold: var(--ss-gold, #e2c36d);
  --site-menu-cream: var(--ss-cream, #f4ecd8);
  --site-menu-w: 208px;
}

html.site-menu-rail {
  --site-menu-w: 64px;
}

.site-menu {
  position: fixed;
  z-index: 10010;
  box-sizing: border-box;
  background: var(--site-menu-night);
  color: var(--site-menu-ink);
  font-family: "Source Serif 4", Georgia, serif;
}

.site-menu a,
.site-menu button {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.site-menu button {
  border: 0;
  background: none;
  cursor: pointer;
}

.site-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-tab,
.site-menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--site-menu-ink);
  font-size: 16px;
  line-height: 1.2;
  text-align: left;
  transition: background-color 0.15s, color 0.15s;
}

.site-tab-icon {
  width: 22px;
  height: 22px;
  flex: none;
}

.site-tab[aria-current="page"],
.site-menu-link[aria-current="page"] {
  color: var(--site-menu-gold);
}

.site-tab:hover,
.site-menu-link:hover,
.site-menu-fold:hover {
  background: rgba(var(--ss-cream-rgb, 244, 236, 216), 0.06);
}

.site-menu :focus-visible,
.site-menu-restore:focus-visible {
  outline: 2px solid var(--site-menu-gold);
  outline-offset: 2px;
}

.site-menu-brand {
  display: block;
  margin-bottom: 20px;
  padding: 0 12px;
  color: var(--site-menu-cream);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-menu-mark {
  display: none;
  color: var(--site-menu-gold);
  font-size: 18px;
}

.site-menu-site {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.site-menu-divider {
  height: 1px;
  margin: 0 12px 10px;
  background: rgba(var(--ss-cream-rgb, 244, 236, 216), 0.18);
}

.site-menu-heading {
  margin: 0 0 4px;
  padding: 0 12px;
  color: var(--site-menu-ink);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.site-menu-link {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.site-menu-icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.site-menu-grow {
  flex-grow: 1;
  min-height: 16px;
}

.site-menu-fold {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 20px !important;
  text-align: left;
}

.site-menu-small {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 8px 12px;
  font-size: 11px;
}

.site-menu-small a {
  text-decoration: underline;
}

.site-menu-grip,
.site-menu-restore {
  display: none;
}

/* Search: the magnifying glass in the top right corner, as in the app. */
.site-search {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 10004;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(var(--ss-gold-rgb, 226, 195, 109), 0.28);
  border-radius: 50%;
  background: var(--site-menu-night);
  color: var(--site-menu-gold);
}

.site-search .site-tab-icon {
  width: 20px;
  height: 20px;
}

.site-search:focus-visible {
  outline: 2px solid var(--site-menu-gold);
  outline-offset: 2px;
}

/* A computer: the side bar. */
@media (min-width: 900px) {
  body.has-site-nav {
    padding-left: var(--site-menu-w);
  }

  .site-menu {
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: var(--site-menu-w);
    padding: 28px 8px 8px;
    border-right: 1px solid var(--site-menu-line);
    overflow-y: auto;
    scrollbar-width: none;
  }

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

  /* Folded to a rail: icons only, their names on hover. */
  html.site-menu-rail .site-menu-name,
  html.site-menu-rail .site-tab-label,
  html.site-menu-rail .site-menu-heading,
  html.site-menu-rail .site-menu-small {
    display: none;
  }

  html.site-menu-rail .site-menu-mark {
    display: block;
    text-align: center;
  }

  html.site-menu-rail .site-menu-brand {
    padding: 0;
  }

  html.site-menu-rail .site-tab,
  html.site-menu-rail .site-menu-link,
  html.site-menu-rail .site-menu-fold {
    justify-content: center;
    padding: 0;
    text-align: center;
  }

  /* The Sanctuary panel opens beside the side bar, which stays in reach. */
  body.has-site-nav .button.accessibility-trigger {
    left: calc(var(--site-menu-w) + 0.75rem);
  }
}

/* A phone or a narrow window: five tabs along the bottom. */
@media (max-width: 899px) {
  body.has-site-nav {
    padding-bottom: calc(4.9rem + env(safe-area-inset-bottom));
  }

  .site-menu {
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10005;
    padding: 2px max(8px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
    border-top: 1px solid var(--site-menu-line);
  }

  .site-menu-brand,
  .site-menu-site,
  .site-menu-grow,
  .site-menu-fold,
  .site-menu-small {
    display: none;
  }

  .site-menu-grip {
    display: block;
    margin: 0 auto;
    padding: 2px 16px 4px;
  }

  .site-menu-grip span {
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(var(--ss-cream-rgb, 244, 236, 216), 0.28);
  }

  .site-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
  }

  .site-tab {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-height: 48px;
    padding: 0;
    font-size: 11px;
    text-align: center;
  }

  .site-tab:hover {
    background: none;
  }

  /* Tucked away: a round button in the corner brings it back. */
  html.site-menu-tucked body.has-site-nav {
    padding-bottom: 0;
  }

  html.site-menu-tucked .site-menu {
    display: none;
  }

  html.site-menu-tucked .site-menu-restore {
    position: fixed;
    right: calc(16px + env(safe-area-inset-right));
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 6px);
    z-index: 10005;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(var(--ss-gold-rgb, 226, 195, 109), 0.28);
    border-radius: 50%;
    background: var(--site-menu-night);
    color: var(--site-menu-gold);
    cursor: pointer;
  }

  .site-menu-restore .site-tab-icon {
    width: 20px;
    height: 20px;
  }

  /* 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(6rem + env(safe-area-inset-bottom));
  }

  /* So does the sign-in window: its buttons never sit under the tabs (Nov 22). */
  body.has-site-nav .sanctuary-modal {
    padding-bottom: calc(5.4rem + env(safe-area-inset-bottom));
  }

  body.has-site-nav .sanctuary-modal-card {
    max-height: min(760px, calc(100dvh - 6.4rem - env(safe-area-inset-bottom)));
  }
}

/* The full-screen altar and ritual mode use the whole screen; so does print. */
body.altar-full-screen .site-menu,
body.altar-full-screen .site-menu-restore,
body.altar-full-screen .site-search,
body.altar-ritual-mode .site-search,
body.altar-ritual-mode .site-menu,
body.altar-ritual-mode .site-menu-restore {
  display: none !important;
}

body.altar-full-screen.has-site-nav,
body.altar-ritual-mode.has-site-nav {
  padding-left: 0;
  padding-bottom: 0;
}

@media print {
  .site-menu,
  .site-search,
  .site-menu-restore {
    display: none !important;
  }

  body.has-site-nav {
    padding: 0 !important;
  }
}

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

/* 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(var(--ss-gold-rgb, 226, 195, 109), 0.35);
  border-radius: 999px;
  background: rgba(var(--ss-ground-rgb, 12, 21, 16), 0.6);
}
.practice-switch a {
  padding: 7px 18px;
  border-radius: 999px;
  color: var(--cream, var(--ss-cream, #f4ecd8));
  text-decoration: none;
  font-size: 0.95rem;
}
.practice-switch a[aria-current="page"] {
  background: var(--gold, var(--ss-gold, #e2c36d));
  color: var(--charcoal, var(--ss-forestInk, #102118));
  font-weight: 600;
}
.practice-switch a:focus-visible { outline: 2px solid var(--gold, var(--ss-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, var(--ss-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, var(--ss-gold, #e2c36d));
  color: var(--charcoal, var(--ss-forestInk, #102118));
  font-weight: 600;
}
.seg-switch button:focus-visible { outline: 2px solid var(--gold, var(--ss-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(var(--ss-gold-rgb, 226, 195, 109), 0.35);
  border-radius: 999px;
  background: rgba(var(--ss-ground-rgb, 12, 21, 16), 0.6);
  color: var(--gold, var(--ss-gold, #e2c36d));
  font-size: 0.95rem;
  text-decoration: none;
}
.site-back:hover { background: rgba(var(--ss-gold-rgb, 226, 195, 109), 0.12); }
.site-back:focus-visible { outline: 2px solid var(--gold, var(--ss-gold, #e2c36d)); outline-offset: 2px; }
body:has(a.sp-back) .site-back-bar { display: none; }

/* Mysteries (18+), the website-only section for adults: never shown in mundane mode. */
html[data-mundane-mode="true"] [data-site-link="mysteries"],
body.mundane-mode [data-site-link="mysteries"] {
  display: none;
}

/* Choosing how a printed page looks (js/print-look.js). */
.print-look { border: 1px solid rgba(var(--ss-gold-rgb, 201, 169, 97), 0.35); border-radius: 12px; padding: 0.75rem 1rem 0.5rem; margin: 0.75rem 0; display: grid; gap: 0.6rem; min-width: 0; }
.print-look legend { padding: 0 0.35rem; font-weight: 600; }
.print-look__field { display: grid; gap: 0.25rem; }
.print-look__field select { max-width: 100%; font: inherit; padding: 0.45rem 0.6rem; border-radius: 8px; }
.print-look__check { display: flex; align-items: center; gap: 0.5rem; }
.print-look__hint { margin: 0; opacity: 0.75; font-size: 0.9em; }
.print-look-more summary { cursor: pointer; margin: 0.5rem 0; }
@media (min-width: 640px) { .print-look { grid-template-columns: 1fr 1fr; } .print-look legend, .print-look__check, .print-look__hint { grid-column: 1 / -1; } }
@media print { .print-look, .print-look-more { display: none !important; } }
