/* FitPal site chrome: header, full-screen mobile menu, footer.
   Loaded on the landing, privacy, cookie policy and 404 pages. Behaviour lives in site.js. */

@media (max-width: 900px) {
  :root { --header-h: 64px; }
}

/* ---------- Brand lockup ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 44px;
  flex: none;
  border-radius: var(--r-sm);
  color: var(--text);
}
.brand .brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
  transition: transform var(--dur-3) var(--ease-spring);
}
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.04); }
.wordmark {
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: 1.3125rem;
  letter-spacing: -0.02em;
  line-height: 1;
  transform: translateY(-1px);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--header-h);
  isolation: isolate;
}
/* Glass layer: invisible over the hero, fades in once the page scrolls (site.js sets .is-scrolled). */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 66%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease-out);
}
.site-header.is-scrolled::before { opacity: 1; }
.no-js .site-header::before { opacity: 1; }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.header-nav { margin-inline: auto; }
.header-nav ul { display: flex; align-items: center; gap: 0.125rem; }
.header-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 0.875rem;
  border-radius: var(--r-pill);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-2);
  transition: color var(--dur-2) ease, background-color var(--dur-2) ease;
}
.header-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.header-nav a.is-current { color: var(--text); }
.header-nav a.is-current::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--volt);
  box-shadow: 0 0 8px var(--volt-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: none;
}

/* Compact IT / EN switch: the whole pill links to the other language. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  transition: border-color var(--dur-2) ease;
}
.lang-opt {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 100%;
  padding: 0 0.375rem;
  border-radius: var(--r-pill);
  color: var(--text-3);
  transition: color var(--dur-2) ease, background-color var(--dur-2) ease;
}
.lang-opt.is-current { background: var(--surface-3); color: var(--text); }
.lang-switch:hover { border-color: var(--line-3); }
.lang-switch:hover .lang-opt:not(.is-current) { color: var(--text); }

.header-cta { padding: 0 1.125rem; }
.header-cta .arrow { width: 16px; height: 16px; }

/* Menu button (mobile) */
.menu-btn {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-2) ease, border-color var(--dur-2) ease;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--line-3); }
.menu-bars { position: relative; display: block; width: 18px; height: 10px; }
.menu-bars span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.75px;
  border-radius: 2px;
  background: currentColor;
}
.menu-bars span:first-child { top: 0; }
.menu-bars span:last-child { bottom: 0; width: 70%; left: 30%; }

@media (max-width: 1080px) {
  .header-nav a { padding: 0 0.625rem; }
}
@media (max-width: 900px) {
  .header-nav,
  .header-actions .lang-switch { display: none; }
  .header-actions { margin-left: auto; gap: 0.5rem; }
  .menu-btn { display: inline-grid; }
  .header-cta { --btn-h: 44px; padding: 0 1rem; font-size: 0.9375rem; }
  .no-js .menu-btn { display: none; }
}
@media (max-width: 359px) {
  .header-cta .arrow { display: none; }
}

/* ---------- Mobile menu (full-screen dialog) ---------- */
.site-menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-3) var(--ease-out), visibility 0s linear var(--dur-3);
}
.site-menu[hidden] { display: none; }
.site-menu.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--dur-3) var(--ease-out), visibility 0s;
}
.site-menu-glow {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 45% at 90% 0%, var(--violet-glow), transparent 70%),
    radial-gradient(60% 35% at 0% 100%, var(--volt-tint), transparent 70%);
}
.site-menu-top {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}
.menu-close {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.menu-close:hover { background: rgba(255, 255, 255, 0.08); }

.site-menu-nav { padding-top: clamp(1rem, 4vh, 2.5rem); }
.site-menu-nav ol { list-style: none; margin: 0; padding: 0; }
.site-menu-nav li {
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-4) var(--ease-out);
  transition-delay: calc(60ms + var(--i, 0) * 45ms);
}
.site-menu.is-open .site-menu-nav li { opacity: 1; transform: none; }
.site-menu-nav a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 0;
  font-size: clamp(2rem, 1.2rem + 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: var(--text);
  transition: color var(--dur-2) ease;
}
.site-menu-nav a:hover { color: var(--volt); }
.site-menu-num {
  flex: none;
  width: 2rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  color: var(--text-3);
  transform: translateY(-0.55em);
}

.site-menu-foot {
  display: grid;
  gap: 0.875rem;
  margin-top: auto;
  padding-top: 2.5rem;
}
.site-menu-meta {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.site-menu-lang {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.site-menu-lang-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.site-menu-lang-opts { display: inline-flex; gap: 0.375rem; }
.lang-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
}
.lang-pill.is-current { border-color: transparent; background: var(--surface-3); color: var(--text); }
a.lang-pill:hover { border-color: var(--line-3); color: var(--text); }

html.menu-open,
html.menu-open body { overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  overflow: hidden;
  padding-top: clamp(3.5rem, 2rem + 5vw, 6rem);
  border-top: 1px solid var(--line);
  background:
    radial-gradient(60% 50% at 85% 100%, color-mix(in srgb, var(--violet) 12%, transparent), transparent 70%),
    var(--bg);
  color: var(--text-2);
}
/* The quiz card's track never drops under 22rem, so its mono meta line stays on one line at 1024-1200. */
.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.7fr) minmax(0, 0.8fr) minmax(22rem, 1.45fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
.footer-brand { display: grid; gap: 1rem; justify-items: start; }
.footer-tagline { max-width: 30ch; font-size: 0.9375rem; color: var(--text-3); }

.site-footer .footer-social { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.site-footer .footer-social:not(:has(li)) { display: none; }
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0 0.875rem 0 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  font-size: 0.875rem;
  color: var(--text-2);
  transition: color var(--dur-2) ease, border-color var(--dur-2) ease, background-color var(--dur-2) ease;
}
.social-link svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.social-link:hover { color: var(--text); border-color: var(--line-3); background: rgba(255, 255, 255, 0.04); }

.footer-title {
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
  color: var(--text-3);
}
/* Each link is a full-width row of its column, 44px tall, stacked edge to edge: short words such as
   "FAQ" still get a 44 x 44 tap target (brief 5). */
.footer-col ul { display: grid; }
.footer-lang { margin-top: 1.75rem; }
.footer-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 0.9375rem;
  text-align: left;
  color: var(--text-2);
  transition: color var(--dur-2) ease;
}
.footer-link:hover { color: var(--text); }
.site-footer [hidden] { display: none !important; }
.footer-consent:has(> [hidden]) { display: none; }

.footer-cta {
  position: relative;
  display: grid;
  gap: 0.875rem;
  justify-items: start;
  padding: clamp(1.5rem, 1rem + 1.5vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    radial-gradient(90% 80% at 100% 0%, var(--volt-tint), transparent 60%),
    var(--grad-surface), var(--surface);
  box-shadow: var(--shadow-1);
}
.footer-cta-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text);
  text-wrap: balance;
}
.footer-cta-text { font-size: 0.9375rem; color: var(--text-2); }
.footer-cta .btn { margin-top: 0.5rem; }
.footer-cta-meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.footer-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem 3rem;
  margin-top: clamp(3rem, 2rem + 3vw, 4.5rem);
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-3);
}
.footer-medical { justify-self: end; max-width: 56ch; text-align: right; text-wrap: balance; }
.footer-line { display: block; }
.footer-sep { margin: 0 0.5em; color: var(--text-4); }
.footer-nowrap { white-space: nowrap; }

/* Giant outlined wordmark closing the page */
.footer-giant {
  position: relative;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  padding-inline: var(--gutter);
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.footer-giant span {
  display: block;
  font-family: var(--font-brand);
  font-weight: 600;
  font-size: clamp(5rem, 21vw, 20rem);
  line-height: 0.8;
  letter-spacing: -0.035em;
  text-align: center;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 82%);
  -webkit-background-clip: text;
  background-clip: text;
  transform: translateY(12%);
}

/* No quiz card (landing, 404: footer.hbs): brand on the left, the link columns pushed to the right edge. */
@media (min-width: 1024px) {
  .footer-top:not(:has(> .footer-cta)) {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: clamp(4rem, 7vw, 7rem);
  }
}
@media (max-width: 1023px) {
  .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; }
  .footer-cta { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .footer-bottom { grid-template-columns: 1fr; }
  .footer-medical { justify-self: start; text-align: left; }
}
