/**
 * Fleet header CSS: the row, search, dropdowns, item panels and the drawer.
 *
 * Split out of fleet.css on 2026-10-26 so a site that cannot load fleet.css
 * can still draw the fleet header: the Institute's retained PHP views dequeue
 * fleet.css because its body and :root rules restyle them. Enqueued as
 * samye-fleet-header, straight after fleet.css and with NO dependency, since
 * a dependency would pull fleet.css back onto exactly those pages. The rules
 * moved verbatim; no class in here is styled anywhere in fleet.css, so
 * printing them after it changes no cascade outcome.
 *
 * Reads --samye-container, which fleet.css defines; a page without fleet.css
 * must define it too. NOTE: rem values assume the fleet's ACSS 62.5% root.
 *
 * @package samye-base
 */

/* Donate renders as a highlighted pill in the header nav. Convention:
   give the menu item the `samye-donate` class (Appearance → Menus, or
   `wp menu item ... --classes=samye-donate`). Scoped to the header — the
   footer menu shows the same item as a plain link. */
#brx-header li.samye-donate > a {
  background: var(--samye-crimson, #B83029);
  color: #fff;
  border-radius: var(--samye-radius, 4px);
  padding: 0.9rem 1.8rem;
}

#brx-header li.samye-donate > a:hover,
#brx-header li.samye-donate > a:focus-visible {
  background: var(--samye-crimson-deep, #93261F);
  color: #fff;
}

/* ----- Fleet header ------------------------------------------------- */
/* Rendered by inc/header.php on Bricks' `render_header` hook. Same deal as
   the footer: identical markup on every centre site, per-site difference
   comes from the Site Logo and the `samye_header` menu.

   Keys on ACSS's --gutter/--content-width so the header column sits exactly
   on the Bricks content column — the same fix the footer needed when a fixed
   gutter made it read 20px/side wider than the site at 1280. */
.samye-header {
  background: var(--samye-parchment, #F5F3F3);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-family: var(--samye-t-body, sans-serif);
  font-size: 1.5rem;
  padding: 1.6rem var(--gutter, 2.4rem);
}


.samye-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3.2rem;
  max-width: var(--samye-container);
  margin-inline: auto;
}

.samye-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Constrain the mark by HEIGHT, not width.

   A width cap only works if every centre's logo shares one aspect ratio, and
   they do not: the fleet ships both a horizontal lockup (~3.4:1) and a square
   one. At a 140px width cap the horizontal mark renders ~41px tall — too small
   to read — while the square mark renders 140px tall and blows the header open.
   Height-capping normalises optical size across both, which is exactly what the
   theme's flex-width/flex-height custom-logo support exists to allow.

   NO max-width (Matt, 2026-08-18): height alone sets the mark's optical size,
   and a width cap can only fight it — on a wide lockup the width would win and
   silently shrink the logo below the intended height. The flex row already
   stops the brand crowding the nav.

   Height is per-site: Samye -> Settings -> Header publishes it as
   --samye-logo-height. This stylesheet is one static file shared by every
   centre, so it cannot carry a per-site number — the fallback below is the
   fleet default (40px, Matt 2026-08-18, against a ~60px norm on mandala and
   malaysia) and covers a site whose plugin is inactive.

   One value at every breakpoint: the old mobile step-down was 44px, which at a
   40px desktop cap would have made the mark LARGER on phones than on desktop.
   At 40px the 4.32:1 wordmark reads 173px wide; a stacked three-line lockup
   would put each name line at ~10px, which is why the height is a setting and
   not a constant. */
.samye-header__logo,
.samye-header__brand img {
  display: block;
  width: auto;
  height: auto;
  max-height: var(--samye-logo-height, 4rem);
}

.samye-header__menu {
  display: flex;
  align-items: center;
  gap: 3.2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.samye-header__menu a {
  transition: color 150ms ease;
  color: var(--samye-ink, #111);
  text-decoration: none;
}

/* :focus-visible, not :focus, matching the Woo buttons and social links:
   a mouse click focuses the link too, and plain :focus left the crimson
   stuck on the clicked item after the pointer moved away. Keyboard focus
   keeps the affordance — that is exactly what :focus-visible means. */
.samye-header__menu a:hover,
.samye-header__menu a:focus-visible {
  color: var(--samye-crimson, #B83029);
}

/* The language switch, drawn only when the plugin offers a second language
   -- see plugin inc/lang.php for when that is. It sits OUTSIDE the drawer
   so the visitor who cannot read the page never has to find the burger
   first: end of the row on desktop, beside the burger on a phone. The auto
   margin on the nav keeps today's layout identical on sites with no switch
   -- space-between already put the nav at the row's end -- and gathers
   nav-then-switch at the end when one renders. */
.samye-header__nav {
  margin-inline-start: auto;
}

/* The language dropdown (Matt, 2026-08-28; 0.45.69 shipped a direct toggle
   and this replaces it). A <details> disclosure, so the panel opens with no
   JavaScript at all — same mechanism as the mobile drawer below.

   The BUTTON is an outlined pill, not a nav link: measured on live taiwan,
   the first build computed to 15px/400/#111, the menu links exactly, and so
   read as a third menu item rather than as a control. The quiet outline
   separates the two families without adding a second loud one — the crimson
   donate pill stays the header's only filled button — and crimson arrives on
   hover, the promise every other header link makes. */
.samye-lang {
  position: relative;
  flex: 0 0 auto;
}

.samye-lang__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--samye-ink-soft, #4A4A4A);
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--samye-silver-soft, #E5E3E0);
  /* Fully round, where donate is a rounded rectangle: at a glance the two
     controls are never mistaken for each other, even out of colour. */
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

/* Both prefixes needed: WebKit still ships its own marker pseudo-element. */
.samye-lang__toggle::-webkit-details-marker {
  display: none;
}

.samye-lang__toggle::marker {
  content: "";
}

.samye-lang__toggle:hover,
.samye-lang__toggle:focus-visible,
.samye-lang[open] > .samye-lang__toggle {
  color: var(--samye-crimson, #B83029);
  border-color: var(--samye-crimson, #B83029);
}

.samye-lang__glyph {
  flex: 0 0 auto;
  width: 1.6rem;
  height: 1.6rem;
}

/* The same caret the drawer's disclosures use, at the size this button wants
   — one affordance vocabulary for "this opens", not two. */
.samye-lang__caret {
  flex: 0 0 auto;
  width: 0.5em;
  height: 0.5em;
  margin-inline-start: 0.2rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-0.1em, -0.1em);
  transform-origin: center;
  transition: transform 0.15s ease;
}

.samye-lang[open] > .samye-lang__toggle .samye-lang__caret {
  transform: rotate(-135deg);
}

/* The panel hangs from the button's end edge rather than its start: the
   control sits at the end of the header row on every site, so aligning the
   other way would push the panel off-screen on a phone. */
.samye-lang__panel {
  position: absolute;
  z-index: 103;
  inset-inline-end: 0;
  margin-block-start: 0.6rem;
  min-width: 100%;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  background: var(--samye-white, #FFFFFF);
  border: 1px solid var(--samye-silver-soft, #E5E3E0);
  border-radius: var(--samye-radius, 4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.samye-lang__option {
  padding: 0.8rem 1.2rem;
  font-size: 1.4rem;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--samye-ink, #111);
  text-decoration: none;
  border-radius: var(--samye-radius, 4px);
}

.samye-lang__option:hover,
.samye-lang__option:focus-visible {
  color: var(--samye-crimson, #B83029);
  background: var(--samye-parchment, #F5F3F3);
}

/* The language being read is marked, not merely coloured — aria-current
   carries it to a screen reader and this carries it to everyone else. */
.samye-lang__option[aria-current="true"] {
  font-weight: 600;
  color: var(--samye-crimson, #B83029);
}

@media (prefers-reduced-motion: reduce) {
  .samye-lang__toggle,
  .samye-lang__caret {
    transition: none;
  }
}

/* On a phone the button shares the row with the mark and the burger, and the
   label is the one part that cannot be dropped -- a visitor who cannot read
   the page needs to SEE the name of their language, not guess a glyph. So
   the chrome gives way instead: tighter box, slightly smaller text. Sized
   against "Bahasa Indonesia", the longest endonym in fleet reach, not 中文. */
@media (max-width: 767px) {
  .samye-lang__toggle {
    padding: 0.5rem 1rem;
    font-size: 1.3rem;
  }
}

/* THE SAME CONTROL, INSIDE THE OPEN DRAWER. It appears twice on a phone on
   purpose: the header-row copy is what a visitor who cannot read the page
   finds without first learning that our three lines mean "menu", and this
   copy is what someone already reading the menu finds where they are
   looking. Neither is redundant to the person who needs it.

   The panel opens INLINE here rather than floating. An absolutely positioned
   panel inside a scrolling 82vw drawer either clips at the panel's edge or
   floats over the menu items it was opened from; pushing the drawer's own
   content down is both simpler and what a phone expects. */
.samye-header__drawer-lang {
  margin-block-start: 2.4rem;
  padding-block-start: 2rem;
  border-top: 1px solid var(--samye-silver-soft, #E5E3E0);
}

.samye-header__drawer-lang .samye-lang {
  position: static;
}

.samye-header__drawer-lang .samye-lang__panel {
  position: static;
  margin-block-start: 0.8rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.samye-header__drawer-lang .samye-lang__option {
  padding-inline: 0;
  font-size: 1.6rem;
}

/* AND THE SEARCH FIELD, at the top of the same panel (Matt, 2026-08-31).
   The argument is the language control's, one block up: the glass in the
   header row is what a visitor finds without first learning that three lines
   mean "menu", and this is what someone already reading the menu finds where
   they are looking.

   The form draws itself — it is the same form, from the same function — so
   the only work here is the shadow. The row's copy floats over a dimmed page
   and needs one; this copy sits on the drawer's parchment, where a 28px drop
   shadow reads as a card that came loose. The border stays, because without
   it a field is not a field. Focus keeps the crimson ring and drops the
   float, matching what the language panel does two rules up. */
.samye-header__drawer-search {
  margin-block-end: 2.4rem;
}

.samye-header__drawer-search .samye-header__search-form {
  box-shadow: none;
}

.samye-header__drawer-search .samye-header__search-form:focus-within {
  box-shadow: 0 0 0 3px rgba(184, 48, 41, 0.14);
}

/* The mobile disclosure. <details> rather than a button + script: keyboard
   and screen-reader support come free, and it works with JS off. */
.samye-header__drawer {
  display: none;
}

.samye-header__toggle {
  cursor: pointer;
  list-style: none;
  /* A 44px tap target (it measured 40x18: an inline summary ignores its
     vertical padding). The negative block margin keeps the row 73px tall. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.4rem;
  min-height: 4.4rem;
  padding: 0;
  margin-block: -0.4rem;
}

/* Both prefixes needed: WebKit still ships its own marker pseudo-element. */
.samye-header__toggle::-webkit-details-marker {
  display: none;
}

.samye-header__toggle::marker {
  content: "";
}

/* Three bars from one element: the box is the middle bar, the two
   pseudo-elements are the outer ones. No extra markup, no icon font. */
.samye-header__bars,
.samye-header__bars::before,
.samye-header__bars::after {
  background: var(--samye-ink, #111);
  border-radius: 2px;
  display: block;
  height: 2px;
  width: 24px;
}

.samye-header__bars {
  position: relative;
}

.samye-header__bars::before,
.samye-header__bars::after {
  content: "";
  position: absolute;
}

.samye-header__bars::before {
  top: -7px;
}

.samye-header__bars::after {
  top: 7px;
}

/* The open drawer is a slide-in panel with a backdrop, matching
   samyemandala.org's offcanvas (it uses Bricks' brxe-offcanvas,
   data-direction="left"). Done in CSS on details[open] rather than with a
   script, so the theme's asset chain stays at one stylesheet and zero JS.

   The panel is POSITION:FIXED, deliberately. The previous attempt put
   flex-basis:100% on the nav, but the flex item is the <details> element, not
   the nav inside it — so the details stayed ~83px wide and the links stacked in
   a narrow column beside the logo. Taking the panel out of flow entirely means
   the header row's geometry cannot constrain it at all. */
.samye-header__menu--drawer {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  font-size: 1.8rem;
}

/* ----- Header search (chrome: header_search, off by default) ---------
   The same species as the drawer: a <details> disclosure, all states in
   CSS, zero scripts. The glass is drawn here rather than shipped as an
   asset for the same reason the burger's bars are. */
.samye-header__search {
  position: relative;
}

.samye-header__search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  cursor: pointer;
  list-style: none;
  border-radius: 999px;
  transition: background-color 0.15s ease;
}

/* Both prefixes needed: WebKit still ships its own marker pseudo-element. */
.samye-header__search-toggle::-webkit-details-marker {
  display: none;
}

.samye-header__search[open] > .samye-header__search-toggle {
  background: var(--samye-mist, #F5F3F0);
}

/* The glass: a ring with a handle, same technique as the burger's bars. */
.samye-header__search-glass {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--samye-ink-soft, #4A4A4A);
  border-radius: 50%;
}

.samye-header__search-glass::after {
  content: "";
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 100%;
  width: 7px;
  height: 2px;
  margin: -3px 0 0 -1px;
  background: var(--samye-ink-soft, #4A4A4A);
  transform: rotate(45deg);
  transform-origin: 0 50%;
}

/* The open panel hangs below the row from the END edge, exactly like the
   language panel. Opaque for the same reason: it overlays the page, never
   shows it through. On a phone it stops hanging from the toggle entirely —
   see the media query below, and the claim it corrects. */
/* The panel above does the positioning now; the form is just the row of
   controls inside it — and the form IS the field (2026-08-30). The input
   used to carry its own border inside the panel's border: two nested boxes
   six pixels apart, which read as a widget, not as a place to type. The
   panel keeps the one border and the input goes naked inside it, so the
   glass, the words and the button sit in a single drawn box — the
   Institute's shape, still zero scripts. */
.samye-header__search-form {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.5rem 0.5rem 0.6rem;
  background: var(--samye-white, #FFFFFF);
  border: 1px solid var(--samye-silver-soft, #E5E3E0);
  border-radius: var(--samye-radius, 4px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  transition: border-color 0.15s ease;
}

/* Focus lives on the box, not on the input: the input's own outline is off
   below precisely because this answers for it, visibly. The same quiet
   crimson the results page's chips answer hover with. */
.samye-header__search-form:focus-within {
  border-color: var(--samye-crimson, #B83029);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 0 0 3px rgba(184, 48, 41, 0.14);
}

/* 32rem, not the 18rem this shipped with. 18rem was the width of the OLD
   small panel, and it survived the overlay rewrite untouched: the field then
   could not hold its own placeholder — "Search Posts, Pages and Books…" cut
   off at "Pages a…" on samyetranslations — and the panel read as the same
   cramped box it had always been. The mock this was approved from used 32rem
   and nobody compared the two. The phone rule below drops the floor to 0, so
   a narrow screen still shrinks it. */
/* 1.6rem, not the 1.4rem this shipped with: it matches the results page's
   field, it reads like something meant to hold a sentence, and under 16px
   iOS zooms the whole page the moment the field takes focus. Colour and
   placeholder are STATED, not inherited — the panel declares its white,
   so the words on it declare their ink, in both schemes. */
.samye-header__search-form input[type="search"] {
  min-width: 32rem;
  padding: 0.8rem 0.4rem;
  font-size: 1.6rem;
  color: var(--samye-ink, #111);
  caret-color: var(--samye-crimson, #B83029);
  background: transparent;
  border: 0;
  outline: none; /* the box's focus-within above is the visible indicator */
  -webkit-appearance: none;
  appearance: none; /* Safari's own search-field chrome would redraw the box we just removed */
}

.samye-header__search-form input[type="search"]::placeholder {
  color: var(--samye-ink-muted, #6B6B6B);
  opacity: 1; /* Firefox dims placeholders by itself; one grey everywhere */
}

/* .samye-btn states font-size: 1rem against a 62.5% root — corrected here
   exactly as the 404 and hero buttons correct it, at the size the results
   page submit already uses. */
.samye-header__search-submit {
  font-size: var(--text-m, 1.6rem);
}

/* ----- The overlay (Matt, 2026-08-30: "more like the Samye Institute
   version") --------------------------------------------------------------
   Theirs is a role=dialog with a scrim, opened and closed by 552 lines of
   JavaScript. This is the same shape with none of it: the disclosure still
   does the opening, the summary's own ::after is the full-viewport HIT
   TARGET — a pseudo-element belongs to its host for hit-testing, so a click
   anywhere on the dimmed page lands on the summary and toggles the panel
   shut — and the wash itself is a body-level element, two rules down.

   Not a negative z-index, which is the trap the drawer's backdrop documents
   one screen up: a negative-z child paints above its own parent's background,
   so the wash would sit on the panel. Positive layers, panel above scrim. */
/* TWO ELEMENTS, ONE SCRIM, and the split is not tidiness — it is what the
   browsers actually do here. Measured on live New York and samyetranslations,
   0.50.2: this pseudo-element covers the viewport for HIT-TESTING (clicking
   anywhere returns the summary, which is what closes the panel) and never
   PAINTS. An identical div attached to <body> paints; the same div inside the
   header does not. So the wash is drawn at body level below, and this stays
   as the invisible hit target it was always really doing the work as.

   Transparent on purpose: if a browser ever does paint it, two washes would
   stack into a much darker page than either intends. */
.samye-header__search[open] .samye-header__search-toggle::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 102;
  background: transparent;
}

/* The wash itself: a REAL element — inc/header.php emits it on wp_footer,
   a direct child of <body> — because pseudo-elements have now failed to
   paint this exact box TWICE. 0.50.2: the summary's ::after hit-tests and
   never paints. 0.50.3 moved the wash to body::after and called it painted;
   re-measured 2026-08-30 on live New York AND samyetranslations, in the
   Chromium pane and a signed-in Chrome, it computes everything — fixed,
   inset 0, rgba .45, opacity 1, z 102 — and paints nothing, while an
   identical div attached to <body> paints everywhere it has been tried.
   The div is the version that cannot be clever.

   `:has()` because the open state still lives on the disclosure — a browser
   without it simply gets no dimming, which is the 0.50.0 behaviour and not
   a broken page. pointer-events: none so every click still reaches the hit
   target above and closes the panel. */
.samye-header__search-scrim {
  display: none;
}

body:has(.samye-header__search[open]) .samye-header__search-scrim {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 102;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  animation: samye-search-scrim-in 0.16s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  body:has(.samye-header__search[open]) .samye-header__search-scrim {
    animation: none;
  }
}

@keyframes samye-search-scrim-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* The glass becomes a close mark while open, exactly as the burger becomes
   an X — the toggle stays the way out, and it stays above its own scrim. */
.samye-header__search[open] .samye-header__search-toggle {
  position: relative;
  z-index: 103;
}

/* Two strokes, because an X needs two. The burger has ::before and ::after
   to cross; the glass ships with one pseudo-element (its handle), so the
   first attempt rotated that single bar and drew a lone diagonal slash — a
   control that looks broken rather than closed. The ring gives up its border
   and both pseudo-elements become the strokes. */
.samye-header__search-glass::before {
  content: "";
  position: absolute;
}

.samye-header__search[open] .samye-header__search-glass {
  border-color: transparent;
}

.samye-header__search[open] .samye-header__search-glass::before,
.samye-header__search[open] .samye-header__search-glass::after {
  inset-block-start: 50%;
  inset-inline-start: -25%;
  width: 150%;
  height: 2px;
  margin: 0;
  border-radius: 1px;
  background: var(--samye-ink, #111);
  transform-origin: 50% 50%;
}

.samye-header__search[open] .samye-header__search-glass::before {
  transform: rotate(45deg);
}

.samye-header__search[open] .samye-header__search-glass::after {
  transform: rotate(-45deg);
}

.samye-header__search-panel {
  position: absolute;
  z-index: 104;
  inset-inline-end: 0;
  margin-block-start: 0.6rem;
}

/* The field, sized like something you are meant to type a sentence into
   rather than a word — the one place the institute's version is plainly
   better than what we had. */
.samye-header__search-field-glass {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-inline-start: 0.6rem;
  border: 2px solid var(--samye-ink-soft, #4A4A4A);
  border-radius: 50%;
}

.samye-header__search-field-glass::after {
  content: "";
  position: absolute;
  inset-block-start: 100%;
  inset-inline-start: 100%;
  width: 7px;
  height: 2px;
  margin: -3px 0 0 -1px;
  background: var(--samye-ink-soft, #4A4A4A);
  transform: rotate(45deg);
  transform-origin: 0 50%;
}

/* ----- Live results, when a site switches them on ---------------------- */
.samye-header__search-results {
  margin: 0.6rem 0 0;
  padding: 0.4rem 0;
  background: var(--samye-white, #FFFFFF);
  border: 1px solid var(--samye-silver-soft, #E5E3E0);
  border-radius: var(--samye-radius, 4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  max-height: 60vh;
  overflow-y: auto;
}

.samye-header__search-results:empty {
  display: none;
}

/* One group per kind of content, biggest first — the dropdown answers "what
   did I find" before "what is the first thing I found".

   Box AND layout stated, for the second time in this stylesheet and for the
   same reason: this is a <section>, Bricks and ACSS style the bare element,
   and on New York that arrived as display:flex with a 67.5px gap. The rows
   stood a finger apart. Anything built on a semantic element states what that
   element's box and layout are — see .samye-search__group below. */
.samye-header__search-group {
  display: block;
  gap: 0;
  margin: 0;
  padding: 0;
}

.samye-header__search-group + .samye-header__search-group {
  margin-block-start: 0.4rem;
  border-block-start: 1px solid var(--samye-silver-soft, #E5E3E0);
  padding-block-start: 0.4rem;
}

.samye-header__search-group-head {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin: 0;
  padding: 0.8rem 1.2rem 0.4rem;
}

.samye-header__search-group-label {
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--samye-ink-muted, #6B6B6B);
}

/* Pushed to the end edge, so the eye reads kind, then the way to all of it. */
.samye-header__search-group-more {
  margin-inline-start: auto;
  font-size: 1.3rem;
  color: var(--samye-crimson, #B83029);
}

.samye-header__search-result {
  display: block;
  padding: 0.7rem 1.2rem;
  color: var(--samye-ink, #111);
  text-decoration: none;
}

.samye-header__search-result:hover,
.samye-header__search-result:focus-visible,
.samye-header__search-result[aria-selected="true"] {
  background: var(--samye-parchment, #F5F3F3);
  color: var(--samye-crimson, #B83029);
}

/* ON A PHONE THERE IS NO GLASS IN THE ROW AT ALL (Matt, 2026-09-01: "it
   looks strange in its current position. Keep it only on mobile drawer").
   The drawer carries the field now, so the row's copy is desktop-only and
   the overlay it opens never renders below 768px.

   This replaces the panel geometry that lived here — position: static on the
   disclosure and a gutter-to-gutter panel, the fix for a panel measured 108px
   off the screen at 375 on live New York. That measurement was not wrong, it
   is moot: nothing anchors to the glass on a phone any more. It is in the
   history if the glass ever comes back.

   The scrim goes with it. Open the overlay on a wide window, narrow the
   window, and [open] is still on a now-hidden disclosure — the wash keys off
   that attribute, so without this rule a phone dims under an overlay it can
   neither show nor close. */
/* The row's glass and its wash are hidden wherever the drawer shows — the
   drawer carries its own field — and that switch lives with the drawer
   floors further down, because it is the same switch. What stays here is
   the drawer copy's own geometry, scoped to the copy so no media query is
   needed: the row's glass never carries these. */

/* The drawer's copy takes the width the drawer gives it. min-width: 0 is
   the half that matters: without it the 32rem floor survives the flex and
   the field overflows an 82vw panel on a 320 phone. */
.samye-header__drawer-search .samye-header__search-form input[type="search"] {
  min-width: 0;
  flex: 1 1 auto;
}

/* The submit grew to 1.6rem with the field, and its 1.6em side padding
   grew with it — on a 320 phone that is ~16px the input no longer has.
   Tuck the button's sides in; the field keeps the room to show a word. */
.samye-header__drawer-search .samye-header__search-submit {
  padding-inline: 1.1em;
}

/* ----- Desktop dropdowns -------------------------------------------- */
/* inc/header.php has always asked wp_nav_menu for depth 2, so WordPress has
   always emitted .sub-menu markup for child items — but the ONLY .sub-menu
   rule was the drawer's. A child item therefore rendered on desktop as an
   unstyled nested <ul> inside a flex row: the worst of the three options,
   half-supported in a way nobody notices until a centre adds a child page.

   NOT scoped by a media query: the desktop nav is already display:none below
   768px and the drawer has its own rules below. It IS scoped away from
   .samye-header__menu--drawer, because both menus share the base class and a
   bare `.samye-header__menu .sub-menu` would fight the drawer's styling.

   :hover AND :focus-within, which is what keeps this keyboard-usable with
   zero JS — tabbing into the parent link opens the panel, tabbing out closes
   it. That pairing is the whole reason no script is needed here. */
.samye-header__menu:not(.samye-header__menu--drawer) > li {
  position: relative;
}

/* Keep a navigation label and its caret on one line. The drawer takes over
   before the menu could crowd the shared logo — inc/header.php measures the
   menu and prints the width where that happens. */
.samye-header__menu:not(.samye-header__menu--drawer) > li > a {
  white-space: nowrap;
}

/* The label type (Matt, 2026-10-26, style B of three previewed on live
   sites: "Merriweather nav, 32px spacing, lighter chevron, current-page
   underline"). The nav face is the token the plugin has always declared,
   --samye-t-nav (the heading serif), which this header never used before.
   Merriweather at 15px measured 8.0px per character across the ten sites'
   labels, so the estimate's 8.5 still errs wide. The Donate pill is left out:
   it carries its own type and padding. */
.samye-header__menu:not(.samye-header__menu--drawer) > li:not(.samye-donate) > a {
  display: inline-flex;
  align-items: center;
  padding: 0.8rem 0;
  font-family: var(--samye-t-nav, var(--samye-t-heading, Georgia, serif));
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.2;
}

/* Laptop windows (Matt, 2026-10-26, option P1 of two previewed): below
   1280px the gaps close from 32px to 20px, so the full menu holds down to
   about 1024px on the longest menus instead of giving way to the burger.
   The side margins stay, so the logo keeps its line with the page below.
   inc/header.php estimates the row at these gaps, since every site's
   burger point falls below 1280. */
@media (max-width: 1279px) {
  .samye-header__inner {
    gap: 2rem;
  }

  .samye-header__menu:not(.samye-header__menu--drawer) {
    gap: 2rem;
  }

  .samye-header__search + .samye-header__actions {
    margin-inline-start: -2rem;
  }
}

/* A parent gets a caret so its children are discoverable before hover.
   WordPress adds .menu-item-has-children itself. A light chevron, centred on
   the label, that turns over while its menu is open. */
.samye-header__menu:not(.samye-header__menu--drawer) > li.menu-item-has-children > a::after {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-inline-start: 0.8rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.75;
  transform: translateY(-0.2rem) rotate(45deg);
  transition: transform 150ms ease, opacity 150ms ease;
}

.samye-header__menu:not(.samye-header__menu--drawer) > li.menu-item-has-children:hover > a::after,
.samye-header__menu:not(.samye-header__menu--drawer) > li.menu-item-has-children:focus-within > a::after {
  opacity: 1;
  transform: translateY(0.1rem) rotate(225deg);
}

/* Where you are: a crimson rule under the current page's item, or under the
   parent whose menu holds it. A shadow, not a border, so no label moves. */
.samye-header__menu:not(.samye-header__menu--drawer) > li.current-menu-item > a,
.samye-header__menu:not(.samye-header__menu--drawer) > li.current-menu-ancestor > a {
  box-shadow: inset 0 -2px 0 var(--samye-crimson, #B83029);
}

@media (prefers-reduced-motion: reduce) {
  .samye-header__menu:not(.samye-header__menu--drawer) > li.menu-item-has-children > a::after {
    transition: none;
  }
}

.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu {
  position: absolute;
  top: 100%;
  inset-inline-start: 0;
  z-index: 101;
  min-width: 20rem;
  /* The panel sizes to its longest label and stops. Without the cap it sized
     to its longest label and kept going: newyork's Summer Immersion menu
     carries "Week Six: Noble Living, Noble Caring, Noble Dying: Healing
     Practices in Buddhism", which on one line is 633px of panel hanging off
     the right of the viewport. Because the panel is hidden with visibility
     rather than display (see below), it is still LAID OUT — so that overhang
     made every page on the site draggable sideways: 140px at 1440, 236px at
     768, and nobody had to open the menu to get it.

     `width: max-content` with a cap rather than a fixed width, so a short
     menu stays as narrow as it reads. 100vw minus both gutters is the second
     limit, for a viewport too narrow for even 32rem. */
  width: max-content;
  max-width: min(32rem, calc(100vw - 2 * var(--gutter, 2.4rem)));
  margin: 0;
  /* A white card on the parchment header, hung from a crimson rule (Matt,
     2026-11-03: "more interesting and polished"). It used to be parchment on
     parchment, so only the shadow said where the panel was. The rows are
     inset by the padding, so each hover fill is a rounded pill. */
  padding: 0.8rem;
  list-style: none;
  background: var(--samye-white, #FFFFFF);
  border: 1px solid var(--samye-silver-soft, #E5E3E0);
  border-top: 2px solid var(--samye-crimson, #B83029);
  border-radius: 0 0 var(--samye-radius, 5px) var(--samye-radius, 5px);
  box-shadow: 0 18px 40px -16px rgba(17, 17, 17, 0.22), 0 2px 6px rgba(17, 17, 17, 0.04);
  /* visibility + opacity, never display:none — display cannot be transitioned
     AND it drops the panel out of the accessibility tree even while a child
     link holds focus, which would make the keyboard path above a lie. It
     waits 6px low and settles as it fades in. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.6rem);
  transition: opacity 0.16s ease-out, transform 0.16s ease-out, visibility 0.16s;
}

/* The settle opens a 6px gap under the label for 160ms, and a pointer heading
   down through it would drop the hover and close the panel. This invisible
   strip is part of the panel, so the hover holds. */
.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: 100%;
  height: 1.2rem;
}

.samye-header__menu:not(.samye-header__menu--drawer) > li:hover > .sub-menu,
.samye-header__menu:not(.samye-header__menu--drawer) > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

/* A panel opening from one of the last two items would run off the right even
   at 32rem, so those open leftwards from the item's right edge. Position in
   the menu rather than a per-site list of item ids: it holds for any centre,
   and the two-item reach covers a trailing Donate pill sitting after the last
   parent. Harmless where it does not apply — a panel that had room simply
   aligns its other edge. */
.samye-header__menu:not(.samye-header__menu--drawer) > li:nth-last-child(-n+2) > .sub-menu {
  inset-inline-start: auto;
  inset-inline-end: 0;
}

/* Line height 1.4 rather than the body's 1.9, so an eleven-item menu fits a
   laptop screen. */
.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu a {
  display: block;
  padding: 0.8rem 1.2rem;
  border-radius: calc(var(--samye-radius, 5px) - 1px);
  font-size: 1.45rem;
  line-height: 1.4;
  color: var(--samye-ink, #111);
  text-decoration: none;
  transition: background-color 0.12s ease-out, color 0.12s ease-out;
  /* No `white-space: nowrap` here. It is what let one long label set the
     panel's width, and the cap above cannot bind a line that refuses to
     break. Nothing between <body> and this link sets nowrap, so deleting the
     declaration is the whole fix — an override restating `normal` would be a
     second place to keep true. */
}

.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu a:hover,
.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu a:focus-visible {
  background: var(--samye-parchment, #F5F3F3);
  color: var(--samye-crimson, #B83029);
}

.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu .current-menu-item > a {
  color: var(--samye-crimson, #B83029);
  font-weight: 500;
}

/* The item's Description field, from inc/header.php. It stays muted on hover:
   only the name turns crimson. */
.samye-header__desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--samye-ink-muted, #6E6E6E);
}

/* Groups inside one dropdown: give an item the CSS class samye-menu-divider
   (Appearance > Menus, under Screen Options) and a rule opens a new group
   above it. */
.samye-header__menu:not(.samye-header__menu--drawer) .sub-menu > li.samye-menu-divider {
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--samye-silver-soft, #E5E3E0);
}

@media (prefers-reduced-motion: reduce) {
  .samye-header__menu:not(.samye-header__menu--drawer) .sub-menu,
  .samye-header__menu:not(.samye-header__menu--drawer) .sub-menu a {
    transition: none;
  }

  .samye-header__menu:not(.samye-header__menu--drawer) .sub-menu {
    transform: none;
  }
}

/* Nested items (the markup allows depth 2) read as a group under their
   parent: indented, one step smaller, a rail instead of bullets. */
.samye-header__menu--drawer .sub-menu {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0 0 0 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 1.6rem;
  border-inline-start: 2px solid var(--samye-silver-soft, #E5E3E0);
}

/* Each child is a 44px row to tap (they were 23px lines 16px apart), with
   a little padding so two consecutive two-line titles stay apart. */
.samye-header__menu--drawer .sub-menu a {
  display: flex;
  align-items: center;
  min-height: 4.4rem;
  padding-block: 0.6rem;
  box-sizing: border-box;
  line-height: 1.35;
}

/* ----- Drawer disclosures ------------------------------------------- */
/* Children used to render inline and always open, which is fine for a flat
   menu and unusable for a real one: two parents with ten children between
   them pushed Contact and Donate off the bottom. Samye_Drawer_Walker wraps
   each parent in its own <details>, so the browser does the toggling and no
   script enters the header.

   Only the drawer gets this. The desktop nav opens the same children on
   hover, and a <details> there would fight it. */
.samye-header__disclosure {
  width: 100%;
}

.samye-header__disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  cursor: pointer;
  list-style: none; /* Firefox draws its own marker; the caret replaces it. */
}

.samye-header__disclosure-summary::-webkit-details-marker {
  display: none;
}

.samye-header__disclosure-summary::marker {
  content: "";
}

/* The caret is the only affordance that the row opens, so it must not be
   mistaken for the link: it sits at the far end, and the link keeps its own
   hit area. Tapping the label navigates, tapping the rest of the row opens. */

/* ...UNLESS the label has nowhere to go. A parent added as a custom menu
   item carries href="#", and a nested <a> inside <summary> swallows the
   click, so tapping it neither navigated nor opened — it did nothing at
   all. On samyehealing.org that anchor covered 56% of the row and BOTH
   parents were href="#", so the obvious target was dead and the menu read
   as broken. (Reported from the live site; the markup and the CSS were both
   fine, which is why nothing failed.)

   Matched on the attribute so the design above survives wherever it makes
   sense: a parent that really is a page keeps its link and its own hit
   area, and only a link to nowhere hands the whole row to the disclosure.
   `href="#anchor"` is a real destination and is deliberately NOT matched. */
.samye-header__disclosure-summary > a[href="#"],
.samye-header__disclosure-summary > a[href=""] {
  pointer-events: none;
}
.samye-header__disclosure-caret {
  flex: 0 0 auto;
  width: 0.6em;
  height: 0.6em;
  margin-inline-end: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  /* The chevron is two sides of a rotated square, so it sits off the box's
     centre: low when it points down, high when it points up (6px off the
     label, measured 2026-10-29). Each state moves it back by a quarter of
     the diagonal. */
  transform: translateY(-0.2em) rotate(45deg);
  transform-origin: center;
  transition: transform 0.15s ease;
}

.samye-header__disclosure[open] > .samye-header__disclosure-summary .samye-header__disclosure-caret {
  transform: translateY(0.2em) rotate(-135deg);
}

@media (prefers-reduced-motion: reduce) {
  .samye-header__disclosure-caret {
    transition: none;
  }
}

/* ----- The drawer floor --------------------------------------------- */
/* Below some width the desktop menu gives way to the drawer, and that width
   is the site's own: inc/header.php works out the row its menu needs from
   the labels, solves for the viewport where the row stops fitting, and
   prints the switch as one inline media query after this file (New York
   900, Mandala 1128, a three-item menu 767; the arithmetic is in
   samye_header_drawer_floor()). Until 0.57.13 every site switched at
   1100px, a value tuned to Mandala's six items, and a 13-inch laptop with
   the window not quite full width got a hamburger on menus needing 500px.

   What is here is the fallback: a phone always gets the drawer, so if the
   inline floor ever fails to print the header degrades to that rather
   than to a menu overflowing 375px. Never higher than 767, because the
   inline floor is never lower and the two must not fight.

   Everything the drawer is — the panel, its masthead, the close control,
   the X — is written once below, outside any query: a display:none drawer
   renders nothing, so those rules act only where a floor has shown it.
   The row's search glass goes when the drawer arrives, since the drawer
   carries a field of its own, and its wash goes with it. */
@media (max-width: 767px) {
  .samye-header__nav,
  .samye-header__search {
    display: none;
  }

  body:has(.samye-header__search[open]) .samye-header__search-scrim {
    display: none;
  }

  .samye-header__drawer {
    display: block;
  }
}

/* ----- The drawer itself -------------------------------------------- */
/* Keep the hamburger above the panel it opens. */
.samye-header__toggle {
  position: relative;
  z-index: 102;
}

.samye-header__drawer[open] .samye-header__drawer-nav {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 101;
  /* Keep panel and close-control geometry on the same width. */
  box-sizing: border-box;
  width: min(90vw, 38rem);
  padding: 2.4rem 2.4rem max(3.2rem, env(safe-area-inset-bottom));
  background: var(--samye-parchment, #F5F3F3);
  /* The 100vmax spread IS the backdrop. The previous build drew it on a
     z-index:-1 ::before covering the viewport — but a negative-z child
     paints ABOVE its own parent's background (backgrounds come first in
     the stacking context), so the 45% wash sat on the panel too and the
     parchment never showed: links floated on grey. A shadow cannot paint
     over its own element, which makes it the one JS-free backdrop that
     keeps the panel opaque. Still not click-to-close — the X is the way
     out. */
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  /* Scroll the menu to its end and the page underneath used to start
     moving with it — the giveaway that a drawer is a div and not a panel.
     `contain` keeps the scroll chain inside this box without locking the
     body, which is the version that needs no script and no scroll
     position to restore. */
  overscroll-behavior: contain;
  animation: samye-drawer-in 0.22s ease-out;
}

/* The panel's masthead — the same brand cascade the header row uses, so
   the mark stays visible while the panel overlays it. The div reuses
   .samye-header__brand ON PURPOSE: a Cloudflare-stale fleet.css still
   caps the logo at the header height instead of rendering it full-size. */
.samye-header__brand--drawer {
  padding-block-end: 2rem;
  margin-block-end: 1.2rem;
  padding-inline-end: 4.4rem;
  border-bottom: 1px solid var(--samye-silver-soft, #E5E3E0);
}

/* The close X is fixed while the panel scrolls, so once the menu scrolled,
   rows slid under it (2026-10-29). The masthead stays at the top as a solid
   band and the X keeps sitting on it. Chrome measures a sticky top from
   inside the panel's padding, so top is minus that padding, and the band
   reaches up over the padding so nothing shows above it. */
.samye-header__drawer[open] .samye-header__brand--drawer {
  position: sticky;
  top: -2.4rem;
  z-index: 1;
  margin-block-start: -2.4rem;
  padding-block-start: 2.4rem;
  background: var(--samye-parchment, #F5F3F3);
}

/* The native summary remains the close control, inside the panel. */
.samye-header__drawer[open] .samye-header__toggle {
  position: fixed;
  inset-block-start: 2rem;
  inset-inline-start: calc(min(90vw, 38rem) - 6.4rem);
  width: 4.4rem;
  height: 4.4rem;
  display: grid;
  place-items: center;
  color: var(--samye-ink, #111);
}

body.admin-bar .samye-header__drawer[open] .samye-header__drawer-nav {
  inset-block-start: 32px;
}

body.admin-bar .samye-header__drawer[open] .samye-header__toggle {
  inset-block-start: calc(2rem + 32px);
}

@media (max-width: 782px) {
  body.admin-bar .samye-header__drawer[open] .samye-header__drawer-nav {
    inset-block-start: 46px;
  }

  body.admin-bar .samye-header__drawer[open] .samye-header__toggle {
    inset-block-start: calc(2rem + 46px);
  }
}

.samye-header__menu--drawer > li > a,
.samye-header__disclosure-summary {
  min-height: 5.2rem;
  display: flex;
  align-items: center;
}

.samye-header__disclosure-summary > a {
  padding-block: 1.2rem;
}

.samye-header__menu--drawer > .samye-donate {
  margin-block-start: 2.4rem;
}

.samye-header__menu--drawer > .samye-donate > a {
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.samye-header__drawer[open] .samye-header__bars {
  background: transparent;
}
.samye-header__drawer[open] .samye-header__bars::before,
.samye-header__drawer[open] .samye-header__bars::after {
  top: 0;
  background: currentColor;
}
.samye-header__drawer[open] .samye-header__bars::before {
  transform: rotate(45deg);
}
.samye-header__drawer[open] .samye-header__bars::after {
  transform: rotate(-45deg);
}

@keyframes samye-drawer-in {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .samye-header__drawer[open] .samye-header__drawer-nav {
    animation: none;
  }
}


/* ----- Members-only results in live search (samye_search_gated_label) -- */
/* A small padlock after the title, drawn from one SVG mask so it takes the
   row's colour, hover included. Only a site that marks results draws it. */
.samye-header__search-lock {
  display: inline-block;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  margin-inline-start: 0.6rem;
  vertical-align: -0.1rem;
  background: currentColor;
  opacity: 0.55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Crect x='4' y='10' width='16' height='11' rx='2'/%3E%3Cpath d='M8 10V7a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ----- Item panels (samye_header_item_panel) -------------------------- */
/* A site can hang a rich panel from a top-level item (inc/header.php). It
   opens on the same hover and focus as a dropdown. Where an item has both, the
   panel wins on a wide screen and the dropdown is left to the drawer, which
   lists the same links as plain rows. Layout inside the panel is the site's;
   here only whether it shows. [data-panel-closed] lets a site's script shut
   it on Escape while the pointer is still over the item. */
.samye-header__panel {
  display: none;
}

.samye-header__menu > li:hover > .samye-header__panel,
.samye-header__menu > li:focus-within > .samye-header__panel,
.samye-header__menu > li[data-panel-open] > .samye-header__panel {
  display: block;
}

.samye-header__menu > li[data-panel-closed] > .samye-header__panel,
.samye-header__menu > li:has(> .samye-header__panel) > .sub-menu {
  display: none;
}

/* ----- Site actions (samye_header_actions) ---------------------------- */
.samye-header__actions {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  flex-shrink: 0;
}

/* The glass and a site's own controls are one group of tools (Matt,
   2026-10-26): no row gap between them, the glass's own padding is the space.
   Only a site that fills the slot has the sibling, so no centre site moves.
   The 1279px query and the compact tier repeat this at their gaps. */
.samye-header__search + .samye-header__actions {
  margin-inline-start: -3.2rem;
}
