/* ==========================================================================
   Whitehead Wellness — Chrome: header, nav, hero, footer.
   Mobile first. Verify at 375px before touching a min-width query.
   ==========================================================================

   THE NAV.

   Every fantasy label pairs with a plain-language one — "The Sanctuary / Meet
   the Dragons" (CLAUDE.md §3). The immersive world must never cost a visitor
   clarity.

   The way that first shipped, the plain label was a block element inside an
   inline flex link with no width control, so six two-line items wrapped into
   each other and the header read as a jumble. The pairing was right; the layout
   was missing.

   So now: each item is a deliberate two-line stack. The fantasy word leads, the
   plain word sits under it, small and quiet. It reads as a designed nav rather
   than a mistake — and on a phone the drawer gives every pairing room to
   breathe, which is where it helps most anyway.
   ========================================================================== */

/* --- Header --------------------------------------------------------------- */

.site-header,
.portal-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(8px);
}

/* The rule under the header stops where the gold lining does.

   As a plain `border-bottom` it ran the full width of the viewport and crossed
   straight through the gold frame on both sides — a line escaping the page it is
   supposed to be drawn on. The lining sits at inset var(--space-2), so this does
   too, and the two now agree on where the page ends. */
.site-header::after,
.portal-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: var(--space-2);
  right: var(--space-2);
  height: 1px;
  background: var(--color-line);
}

@media (max-width: 639px) {
  /* The lining is hidden on a phone, so the rule goes edge to edge again. */
  .site-header::after,
  .portal-header::after {
    left: 0;
    right: 0;
  }
}

.site-nav,
.portal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 68px;
}

.site-logo {
  display: grid;
  gap: 1px;
  line-height: 1.15;
  text-decoration: none;
  flex: 0 0 auto;
}

.site-logo strong {
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.site-logo .accent-script {
  font-size: var(--text-base);
  color: var(--color-text-faint);
}

/* --- The toggle ----------------------------------------------------------- */

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-target);
  height: var(--tap-target);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-text);
  border-radius: var(--radius-full);
  transition: transform var(--duration-fast) var(--ease);
}

.nav-toggle__bars {
  position: relative;
}

.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle__bars::before {
  top: -6px;
}
.nav-toggle__bars::after {
  top: 6px;
}

/* Open: the bars become an X. aria-expanded is the single source of truth, so
   the visual state and the screen-reader state can never disagree. */
.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
  top: 0;
  transform: rotate(-45deg);
}

/* --- The menu ------------------------------------------------------------- */

/* Mobile: a drawer under the header. Closed by default. */
.site-menu,
.portal-menu {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  padding: var(--space-4) var(--gutter) var(--space-6);
  background: var(--color-bg);
  border-bottom: var(--border-hairline);
  box-shadow: var(--shadow-lg);
}

.nav-toggle[aria-expanded="true"] + .site-menu,
.nav-toggle[aria-expanded="true"] + .portal-menu {
  display: grid;
  gap: var(--space-1);
}

.site-menu a,
.portal-menu a {
  display: grid;
  gap: 1px;
  align-content: center;
  min-height: var(--tap-target);
  padding: var(--space-2) var(--space-2);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-base);
}

.site-menu a:hover,
.portal-menu a:hover {
  background: var(--color-gold-wash);
}

.site-menu a[aria-current="page"],
.portal-menu a[aria-current="page"] {
  color: var(--color-text);
}

.site-menu a[aria-current="page"]::after,
.portal-menu a[aria-current="page"]::after {
  content: "";
  display: block;
  width: 20px;
  height: 2px;
  margin-top: var(--space-1);
  border-radius: var(--radius-full);
  background: var(--color-gold);
}

/* The plain-language half of every fantasy label. The fantasy word carries the
   world; this carries the meaning. Never delete it to tidy the nav up
   (CLAUDE.md §3). */
.nav__plain {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-text-faint);
  letter-spacing: 0;
  text-transform: none;
}

/* The CTA inside the menu keeps its button shape and its subtitle. */
.site-menu .btn,
.portal-menu .btn {
  margin-top: var(--space-3);
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  padding-block: var(--space-3);
}

.site-menu .btn .nav__plain,
.portal-menu .btn .nav__plain {
  color: inherit;
  opacity: 0.8;
}

.site-menu .btn:hover,
.portal-menu .btn:hover {
  background: var(--color-gold-deep);
}

/* Desktop: a row. The two-line stacks stay — they are the point — but they get
   space, alignment, and a sane size. */
@media (min-width: 1024px) {
  .nav-toggle {
    display: none;
  }

  .site-menu,
  .portal-menu {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    position: static;
    padding: 0;
    background: none;
    border: 0;
    box-shadow: none;
  }

  .site-menu a,
  .portal-menu a {
    padding-inline: var(--space-2);
    font-size: var(--text-sm);
    text-align: left;
    white-space: nowrap;
  }

  /* The member nav carries eight two-line links plus the bell — all mandatory
     (the plain-language subtitles are a rule, §3). Tighten the row so the bell,
     the last item, is never the one that spills past the 1120px container and
     disappears. Trimming each link's inline padding (space-3 -> space-2 above)
     reclaims ~64px — comfortably more than the bell's width. The bell holds its
     size and sits flush right. */
  .portal-nav {
    gap: var(--space-3);
  }
  .portal-menu__bell {
    flex: 0 0 auto;
    margin-left: var(--space-1);
  }

  .site-menu a[aria-current="page"]::after,
  .portal-menu a[aria-current="page"]::after {
    display: none;
  }

  .site-menu a[aria-current="page"],
  .portal-menu a[aria-current="page"] {
    background: var(--color-gold-wash);
  }

  /* In the bar, the CTA is a single-line pill.

     The two-line stack is right for the five nav LINKS — that is the fantasy word
     paired with the plain one, and it is a rule (CLAUDE.md §3). It is wrong for a
     button: a filled gold pill wrapping two lines of text is twice the height of
     everything beside it, so it stops reading as one item in a bar and starts
     reading as a banner that has landed in the nav.

     So the subtitle is dropped HERE and only here. It is still there in the mobile
     drawer, where there is room for it — and the free-to-begin promise is on the
     page it leads to, four times over. */
  .site-menu .btn,
  .portal-menu .btn {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    margin-left: var(--space-4);
    min-height: 38px;
    padding: 0 var(--space-5);
    font-size: var(--text-sm);
    line-height: 1;
    white-space: nowrap;
  }

  .site-menu .btn .nav__plain,
  .portal-menu .btn .nav__plain {
    display: none;
  }
}

/* --- Hero (Zone 1) --------------------------------------------------------
   The value proposition wins the first screen. That is a named Launch Readiness
   Must Have, and the roster is what tends to eat the viewport (CLAUDE.md §9).
   Both can exist. When they compete, the words go first.
   -------------------------------------------------------------------------- */

.hero {
  padding-block: var(--space-12) var(--space-10);
}

.hero__tagline {
  margin-bottom: var(--space-3);
}

.hero__headline {
  max-width: 15ch;
  margin-bottom: var(--space-5);
}

.hero__lede {
  margin-bottom: var(--space-8);
}

/* Stacked and full width on a phone: the primary action should be the obvious
   thing on the screen, not one of two things competing at half width. */
.hero__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
}

.hero__note {
  margin-top: var(--space-5);
}

@media (min-width: 640px) {
  .hero__actions {
    flex-direction: row;
    align-items: center;
  }

  .hero__actions .btn {
    width: auto;
  }
}

@media (min-width: 768px) {
  .hero {
    padding-block: var(--space-20) var(--space-16);
  }
}

/* --- Dragon grid ---------------------------------------------------------- */

.dragon-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

/* There are SEVEN guardians, and seven divides into neither two columns nor four.
   A grid leaves the last row hanging against the left edge — three cards and a
   hole where a fourth should be, which reads as a page that failed to load rather
   than a roster that happens to be odd.

   So above phone width this becomes a centred flex wrap. The basis is the exact
   width a grid track would have been, so the cards line up in columns as before;
   the only difference is that a short final row sits in the middle of the page
   instead of shoved to one side. */
@media (min-width: 640px) {
  .dragon-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }

  .dragon-grid > * {
    flex: 0 1 calc((100% - var(--space-4)) / 2);
    min-width: 0;
  }
}

@media (min-width: 1024px) {
  .dragon-grid > * {
    flex: 0 1 calc((100% - 3 * var(--space-4)) / 4);
  }
}

.dragon-grid > li > .card,
.dragon-grid > .card {
  height: 100%;
}

/* --- Closing -------------------------------------------------------------- */

.closing {
  padding-block: var(--section-gap);
  text-align: center;
  border-top: 1px solid var(--color-gold-soft);
}

.closing__vow {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-6);
}

/* --- Footer --------------------------------------------------------------- */

.site-footer,
.portal-footer {
  margin-top: var(--section-gap);
  border-top: var(--border-hairline);
  padding-block: var(--space-10);
}

.footer-menu {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  margin-block: var(--space-6);
}

.footer-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--color-text-soft);
}

.footer-menu a:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: var(--color-gold);
}

.footer-note {
  max-width: var(--width-prose);
  font-size: var(--text-sm);
  color: var(--color-text-faint);
}

@media (min-width: 768px) {
  .site-footer,
  .portal-footer {
    text-align: left;
  }
}

/* --- Messages ------------------------------------------------------------- */

.messages {
  padding-top: var(--space-4);
}

.message {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-line-strong);
  border-left-width: 3px;
  background: var(--color-surface);
  font-size: var(--text-base);
}

.message + .message {
  margin-top: var(--space-2);
}

.message--success {
  border-left-color: var(--color-success);
}
.message--info {
  border-left-color: var(--color-gold);
}
.message--warning {
  border-left-color: var(--color-warning);
}
.message--error {
  border-left-color: var(--color-error);
}

/* The closing line, where the vow used to be. Centred, and the buttons sit under
   it rather than beside it. */
.closing__line {
  max-width: 34ch;
  margin-inline: auto;
  margin-bottom: var(--space-6);
  color: var(--color-text);
}

.closing__actions {
  justify-content: center;
}
