/* ==========================================================================
   Site chrome: header, navigation, footer
   ========================================================================== */

:root { --header-h: 4.5rem; }

/* ------------------------------------------------------------------ header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
}
/* The hairline only appears once the page has scrolled, so the header sits
   flush against the hero at rest instead of drawing a line across it. */
.site-header[data-scrolled="true"] {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: var(--header-h);
}

/* ---------------------------------------------------------------- wordmark
   A type-set interpretation of the existing logo: serif capitals, "PEARLY" in
   gold, "LOCUS" in crimson, "MEDICAL" letterspaced beneath in navy. This is a
   faithful stand-in, not a replacement. When the client supplies the logo
   files, the <svg> in the markup takes over and these rules are deleted. */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.wordmark:hover { color: var(--ink); }

/* Height-driven with the width left to follow. The artwork is 334x353, so a
   square box would squash it; sizing by height also keeps the mark aligned to
   the wordmark's cap height whatever the source dimensions become. */
.wordmark__mark { height: 2.1rem; width: auto; flex-shrink: 0; object-fit: contain; }

.wordmark__text { display: grid; line-height: 1; }

.wordmark__name {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.wordmark__name .is-pearly { color: var(--brand-gold-deep); }
.wordmark__name .is-locus  { color: var(--brand-crimson); }

.wordmark__qualifier {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin-top: 0.45em;
}

/* -------------------------------------------------------------- navigation */

.nav { display: flex; align-items: center; gap: var(--space-5); }

.nav__link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  padding-block: var(--space-2);
  position: relative;
}
.nav__link:hover { color: var(--ink); }
.nav__link[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: var(--radius-pill);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-btn svg { width: 1.25rem; height: 1.25rem; }

.icon-btn__count {
  position: absolute;
  top: 0.25rem; right: 0.25rem;
  min-width: 1.1rem; height: 1.1rem;
  padding-inline: 0.25em;
  display: grid; place-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius-pill);
}
.icon-btn__count:empty, .icon-btn__count[hidden] { display: none; }

/* ------------------------------------------------------- mobile navigation */

.nav-toggle { display: none; }

@media (max-width: 60rem) {
  .nav-toggle { display: inline-grid; }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-4) var(--gutter) var(--space-6);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--duration) var(--ease),
                transform var(--duration) var(--ease),
                visibility var(--duration);
  }
  .nav[data-open="true"] { opacity: 1; visibility: visible; transform: none; }

  .nav__link {
    padding: var(--space-4) 0;
    font-size: var(--text-md);
    border-bottom: 1px solid var(--line);
  }
  .nav__link[aria-current="page"]::after { display: none; }
}

/* ------------------------------------------------------------------ footer */

.site-footer {
  background: var(--surface-brand);
  color: var(--on-brand-muted);
  padding-block: var(--space-8) var(--space-6);
  font-size: var(--text-sm);
}
.site-footer h3 {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--on-brand-subtle);
  margin-bottom: var(--space-4);
}
.site-footer a { color: var(--on-brand-strong); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer .wordmark { color: #fff; }
.site-footer .wordmark__name .is-pearly { color: var(--on-brand-gold); }
.site-footer .wordmark__name .is-locus  { color: #fff; }
.site-footer .wordmark__qualifier { color: var(--on-brand-subtle); }

.site-footer__grid {
  display: grid;
  gap: var(--space-7) var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr));
}
/* Five columns once they fit: the brand, three link lists, and the contacts,
   which carry the two long email addresses and so get the most room. */
@media (min-width: 64rem) {
  .site-footer__grid {
    grid-template-columns: minmax(14rem, 1.3fr) repeat(3, minmax(0, 0.8fr)) minmax(16rem, 1.2fr);
  }
}

/* One column on a phone.
   
   The track minimums above add up to more than a narrow screen has: 15rem for
   the first, 9rem for the one auto-fit always produces, and auto-fit cannot
   produce none. min(…, 100%) does not rescue it either, because 100% of a
   343px container is still wider than 15rem. The footer was therefore pushing
   every page into a horizontal scroll at 375px. Below the width where two
   tracks genuinely fit, there is one. */
@media (max-width: 30rem) {
  .site-footer__grid { grid-template-columns: 1fr; gap: var(--space-6); }
}

.site-footer__links { list-style: none; padding: 0; display: grid; gap: var(--space-3); }

.site-footer__base {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--on-brand-line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--on-brand-subtle);
}

/* --------------------------------------------------- small-screen header
   At 375 px the wordmark plus four actions overflowed the viewport and pushed
   the menu button off-screen entirely. The account link lives in the nav panel
   on mobile, so it is the one that gives way; search and cart stay, because
   they are the two things a customer reaches for on a phone. */
@media (max-width: 30rem) {
  .site-header__inner { gap: var(--space-3); }

  .wordmark { gap: var(--space-2); }
  .wordmark__mark { height: 1.75rem; width: auto; }
  .wordmark__name { font-size: 0.98rem; letter-spacing: 0.03em; }
  .wordmark__qualifier { font-size: 0.5rem; letter-spacing: 0.24em; }

  .site-header__actions { gap: 0; }
  .site-header__actions .icon-btn { width: 2.25rem; }
  .site-header__actions [href="/account"] { display: none; }
}

/* ------------------------------------------------------------- build credit
   The polyhedron is the KSE Labs mark, inlined from their own asset and
   stroked with currentColor so it picks up the footer's text colour rather
   than fighting it. */
.powered-by {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}
.powered-by a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--on-brand-muted);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
.powered-by a:hover { color: #fff; text-decoration: none; }
.powered-by__mark {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity var(--duration) var(--ease);
}
/* The mark is drawn on a 31 unit grid with a 1 unit stroke, so at 18 px it
   would render at roughly half a pixel and go grey and blurry. Holding the
   stroke at its authored width keeps the wireframe crisp at any size. */
.powered-by__mark path { vector-effect: non-scaling-stroke; }
.powered-by a:hover .powered-by__mark { opacity: 1; }

/* ==========================================================================
   Prose pages: policies, contact, about, VITALA
   ========================================================================== */

/* Long legal text is read in one pass, so it gets a narrower measure and more
   air between sections than the marketing pages, which are scanned. */
.prose { display: grid; gap: var(--space-5); }
.prose__head { display: grid; gap: var(--space-3); margin-bottom: var(--space-4); }
.prose__head h1 { font-size: var(--text-2xl); }
.prose__meta { font-size: var(--text-sm); color: var(--ink-subtle); }

.prose h2 {
  font-size: var(--text-lg);
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}
.prose h3 { font-size: var(--text-md); margin-top: var(--space-4); }
.prose p { max-width: 68ch; }
.prose ul { max-width: 68ch; margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.prose li { color: var(--ink-muted); }
.prose ol { max-width: 68ch; margin: 0; padding-left: var(--space-5); display: grid; gap: var(--space-2); }
.vitala-signoff {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--ink);
}
.prose a { color: var(--accent); }

/* Definition pairs on the contact and about pages. */
.contact-list { display: grid; gap: var(--space-4); margin: 0; }
.contact-list dt {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-subtle);
}
.contact-list dd { margin: 0; }

@media (min-width: 40rem) {
  .contact-list { grid-template-columns: 12rem 1fr; gap: var(--space-4) var(--space-5); }
  .contact-list dt { padding-top: 0.2rem; }
}

/* The lockup on the VITALA page, sized for a page rather than a heading. */
.vitala-lockup-wrap { margin: 0; }
.vitala-lockup-img { height: clamp(6rem, 14vw, 9rem); width: auto; }

/* Contacts and social links in the footer (and the links on /contact). */
.site-footer__contact { font-style: normal; display: grid; gap: var(--space-3); }
.site-footer__contact a { overflow-wrap: anywhere; }
.site-footer__label {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--on-brand-subtle);
}
.social-links { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: flex; gap: var(--space-2); }
.social-links a {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
.social-links a:hover { color: var(--accent); border-color: var(--accent); }
.social-links svg { width: 1.15rem; height: 1.15rem; }
.site-footer .social-links a { border-color: var(--on-brand-line); color: var(--on-brand-strong); }
.site-footer .social-links a:hover { background: var(--on-brand); color: var(--surface-brand); border-color: var(--on-brand); text-decoration: none; }
/* The prose styles lay lists out as bulleted columns; this one is a row. */
.prose ul.social-links { display: flex; list-style: none; margin: var(--space-3) 0 var(--space-6); padding: 0; }
.prose ul.social-links li { margin: 0; padding: 0; }
.prose ul.social-links li::before { content: none; }
.prose ul.social-links a { text-decoration: none; background-image: none; }

/* ------------------------------------------------------- WhatsApp button */

.wa-float {
  position: fixed;
  right: max(var(--space-5), env(safe-area-inset-right));
  bottom: max(var(--space-5), env(safe-area-inset-bottom));
  z-index: 40;                       /* under the header (50) and its menu */
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 3.5rem;
  min-width: 3.5rem;
  padding: 0 var(--space-4);
  justify-content: center;
  border-radius: 999px;
  background: var(--whatsapp);
  color: #fff;
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  transition: background var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.wa-float:hover { background: var(--whatsapp-hover); color: #fff; transform: translateY(-2px); }
.wa-float:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.wa-float svg { width: 1.6rem; height: 1.6rem; flex-shrink: 0; }

/* A round icon on a phone, where width is scarce; the label joins it on a
   wider screen. The accessible name comes from aria-label either way. */
.wa-float__label { display: none; }
@media (min-width: 48rem) {
  .wa-float__label { display: inline; }
}
@media print { .wa-float { display: none; } }
@media (prefers-reduced-motion: reduce) { .wa-float:hover { transform: none; } }
/* Room under the footer, so the button never sits on its last line. */
.site-footer { padding-bottom: calc(var(--space-6) + 4.5rem); }

/* ------------------------------------------------------------------ toast */

/* Under the header, top right: the bottom-right corner holds the WhatsApp
   button. Full width (less the gutter) on a phone. */
.toast-region {
  position: fixed;
  top: calc(var(--header-h) + var(--space-3));
  right: max(var(--space-4), env(safe-area-inset-right));
  left: max(var(--space-4), env(safe-area-inset-left));
  z-index: 45;                       /* over the page and the WhatsApp button, under the header (50) */
  display: grid;
  justify-items: end;
  pointer-events: none;              /* the empty region must not block clicks */
}
.toast {
  pointer-events: auto;
  width: min(24rem, 100%);
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-0.75rem);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.is-shown { opacity: 1; transform: none; }

.toast__image {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.toast__tick {
  width: 3.5rem;
  height: 3.5rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
}
.toast__tick svg { width: 1.5rem; height: 1.5rem; }

.toast__body { display: grid; gap: var(--space-1); min-width: 0; }
.toast__body p { margin: 0; }
.toast__title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--ink);
}
.toast__title::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--whatsapp, #1da851);
  flex-shrink: 0;
  margin-top: 0.45em;                /* beside the first line, if the title wraps */
}
.toast__text {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.toast__meta { font-size: var(--text-xs); color: var(--ink-subtle); }
.toast__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
.toast__view { min-height: 2.25rem; padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
.toast__keep {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.toast__keep:hover { color: var(--ink); }
.toast__close {
  width: 1.75rem;
  height: 1.75rem;
  margin: calc(-1 * var(--space-1));
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--ink-subtle);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.toast__close:hover { background: var(--surface-sunken); color: var(--ink); }
:is(.toast__keep, .toast__close):focus-visible { outline: none; box-shadow: var(--ring); }

/* The header's count gives a small bump when something is added. */
.icon-btn__count.is-bumped { animation: count-bump 420ms var(--ease); }
@keyframes count-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; transform: none; }
  .icon-btn__count.is-bumped { animation: none; }
}
