/* Shared components: header, footer, buttons, typography helpers, section scaffolding. */

/* ---------- header ---------- */
:root { --tools-w: 300px; } /* width of the header tools column; the footer reserves the same column so both menus line up */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  transition: transform .3s ease; will-change: transform;
  background: rgba(var(--bg-rgb), .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(var(--ink-rgb), .07);
  padding-inline: var(--pad-x);
}
.site-header.is-hidden { transform: translateY(calc(-100% - 2px)); }
.site-header__inner {
  padding-block: 16px;
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; }
.brand img { height: 21px; width: auto; }
.logo--color { display: var(--logo-color-display); }
.logo--white { display: var(--logo-white-display); }
.brand-section { font-size: 15px; letter-spacing: .01em; color: var(--ink-2); padding-left: 16px; border-left: 1px solid rgba(var(--ink-rgb), .22); line-height: 21px; }
.nav { display: flex; gap: 26px; flex-wrap: wrap; font-size: 15px; letter-spacing: .01em; }
.nav a { color: var(--ink-2); }
.nav a:hover { color: var(--ink); }
.nav a[aria-current], .site-footer__nav a[aria-current] {
  color: var(--accent2); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px;
}
.menu { display: flex; align-items: center; gap: 28px; margin-left: auto; min-width: 0; }
.menu-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.menu-cta { display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.menu-cta .author-link { text-align: center; }
html:not(.is-compact) .menu-end { min-width: var(--tools-w); }
.menu-end:has(.menu-cta) { display: grid; grid-template-columns: 72px 72px max-content; align-items: center; gap: 12px; }
.menu-end:has(.header-session:not([hidden])) { display: grid; grid-template-columns: 72px 72px max-content; align-items: center; gap: 12px; }
.header-session { display: flex; align-items: center; justify-content: flex-end; justify-self: end; gap: 12px; }
.header-session[hidden] { display: none; }
.header-session span { color: var(--ink-2); font-size: 14px; white-space: nowrap; text-align: right; }
.header-session .btn { flex: none; }
@media (min-width: 901px) and (max-width: 1100px) {
  .site-header:has(.menu-cta) .site-header__inner, .site-header:has(.menu-cta) .menu { gap: 12px; }
  .site-header:has(.menu-cta) .site-header__inner, .site-header:has(.menu-cta) .nav, .site-header:has(.menu-cta) .menu-cta { flex-wrap: nowrap; }
  .site-header:has(.menu-cta) .nav { gap: 12px; font-size: 14px; }
  .site-header:has(.menu-cta) .menu-end, .site-header:has(.menu-cta) .menu-cta { gap: 6px; }
  .site-header:has(.menu-cta) .menu-cta .btn--sm { padding-inline: 12px; }
}
.burger { display: none; align-items: center; justify-content: center; width: 36px; height: 28px; padding: 0; cursor: pointer; border: 0; border-radius: 8px; background: rgba(var(--ink-rgb), .06); color: var(--ink-2); transition: background .15s ease; }
.burger:hover { background: rgba(var(--ink-rgb), .1); }
.burger svg { display: block; }
.burger path { transform-origin: 12px 12px; }
.site-header.is-anim .burger path { transition: transform .2s ease, opacity .2s ease; }
.site-header.is-open .burger__l1 { transform: rotate(45deg) translateY(6px); }
.site-header.is-open .burger__l2 { opacity: 0; }
.site-header.is-open .burger__l3 { transform: rotate(-45deg) translateY(-6px); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; font-size: 16px; padding: 16px 30px;
  border: 1px solid transparent; background: none; color: var(--ink); letter-spacing: .01em;
}
.btn--primary { background: var(--brand); border-color: var(--brand); color: var(--white); font-weight: 500; }
.btn--primary:hover { background: var(--brand-hi); border-color: var(--brand-hi); color: var(--white); }
.btn--ghost { border-color: rgba(var(--ink-rgb), .24); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--sm { font-size: 14px; padding: 10px 20px; letter-spacing: .02em; white-space: nowrap; border-color: rgba(var(--ink-rgb), .22); }
.btn--sm:hover { background: var(--brand); border-color: var(--brand); color: var(--white); }
.btn--outline { font-size: 15px; padding: 12px 22px; border-color: rgba(var(--ink-rgb), .25); }
.btn--outline:hover { border-color: var(--ink); }

/* ---------- language / mode toggles ---------- */
.toggle {
  display: flex; align-items: stretch; gap: 0; height: 28px; padding: 0; cursor: pointer;
  background: rgba(var(--ink-rgb), .06); border: 0; border-radius: 8px; color: var(--ink-2);
  transition: background .15s ease;
}
.toggle:hover { background: rgba(var(--ink-rgb), .1); }
.toggle .cell {
  display: flex; align-items: center; justify-content: center; height: 28px; width: 36px; border-radius: 8px;
  color: var(--ink-3); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  transition: background .15s ease, color .15s ease;
}
.toggle .cell.on { background: rgba(var(--ink-rgb), .14); color: var(--ink); }
.toggle .cell svg { display: block; }
.toggle--lang .cell { color: rgba(var(--ink-rgb), .45); }
.toggle--lang .cell.on { color: var(--ink); }
/* idle icon (monochrome) when the language is not selected, coloured one when it is */
.toggle--lang .cell svg.ico--active, .toggle--lang .cell.on svg.ico--idle { display: none; }
.toggle--lang .cell.on svg.ico--active { display: block; }
.toggle--lang .cell svg.ico--flag { display: block; }
.toggle--lang .cell:not(.on) svg.ico--flag { filter: grayscale(1); opacity: .5; }

/* ---------- typography helpers ---------- */
.eyebrow { font-size: 13px; letter-spacing: .26em; text-transform: uppercase; color: var(--accent2); margin: 0; }
.eyebrow--pale { color: var(--accent-pale); }
.eyebrow--muted { color: var(--ink-3); }
.h2 {
  margin: 0; font-weight: 400; letter-spacing: -.02em;
  font-size: var(--h2-size, clamp(32px, 4.4cqw, 62px)); line-height: var(--h2-lh, 1.05);
}
em.soft { font-style: italic; color: var(--ink-3); }
.lede { margin: 0; font-size: clamp(16px, 1.6cqw, 20px); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }

/* ---------- section scaffolding ---------- */
.section { padding: var(--pad-y) var(--pad-x); position: relative; }
.container { display: flex; flex-direction: column; gap: var(--gap, clamp(36px, 4.5cqw, 60px)); }
.section-head { display: flex; flex-direction: column; gap: 16px; max-width: var(--head-w, 720px); }

.site-header__inner, .site-footer__inner, .container, .subpage-inner { width: 100%; max-width: var(--maxw); margin-inline: auto; }

/* Shared frame and heading for Client, legal pages, and the Next admin. */
.subpage-main { min-height: 70vh; padding: 48px var(--pad-x) 72px; background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%); }
.subpage-heading { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.subpage-title { margin: 0; font-size: clamp(28px, 6vw, 40px); font-weight: 500; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }

/* grid of bordered cells (1px gap + outline trick) */
.cell-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--cell-min, 240px)), 1fr)); gap: 1px; }
.cell-card {
  background: var(--cell-bg, var(--bg2)); box-shadow: 0 0 0 1px rgba(var(--ink-rgb), .1);
  padding: var(--cell-pad, clamp(24px, 2.6cqw, 36px)); display: flex; flex-direction: column; gap: var(--cell-gap, 12px);
}
.cell-card__num { font-size: 12px; letter-spacing: .22em; color: var(--ink-4); }
.cell-card__title { font-size: clamp(19px, 1.9cqw, 24px); font-weight: 500; line-height: 1.2; }
.cell-card__text { font-size: 16px; line-height: 1.5; color: var(--ink-2); }

/* ---------- footer ---------- */
.site-footer { padding: clamp(44px, 5cqw, 72px) var(--pad-x); background: var(--bg); border-top: 1px solid rgba(var(--ink-rgb), .08); }
.site-footer__inner { display: flex; flex-direction: column; gap: 36px; }
.site-footer__top { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.site-footer__logo { height: 21px; width: auto; }
.site-footer__nav { display: flex; gap: 26px; flex-wrap: wrap; font-size: 15px; letter-spacing: .01em; margin-left: auto; }
.site-footer__nav a { color: var(--ink-2); }
.site-footer__nav a:hover { color: var(--ink); }
.site-footer__legal {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px;
  border-top: 1px solid rgba(var(--ink-rgb), .08); padding-top: 28px;
}
.site-footer__disclaimer { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-4); max-width: 640px; }
@media (min-width: 901px) { .site-footer__legal { grid-template-columns: 1fr 1fr; } .site-footer__meta { text-align: right; } }
@media (max-width: 900px) { .site-footer__legal { grid-template-columns: 1fr; } }
.site-footer__meta { font-size: 13px; line-height: 1.6; color: var(--ink-4); letter-spacing: .06em; }

@media (max-width: 560px) {
  .site-header__inner { padding-block: 12px; gap: 14px; }
  .site-footer__nav { margin-left: 0; gap: 18px; }
}

/* hamburger menu: when <html> has .is-compact (set by site.js)
   nav, buttons and toggles fold into a panel that slides over the content. The transition exists only after the viewer used the menu (.is-anim),
   so crossing the breakpoint while resizing never animates. */
.is-compact .burger { display: flex; margin-left: auto; }
.is-compact .menu {
  position: absolute; top: 100%; left: 0; right: 0; margin: 0;
  flex-direction: column; align-items: flex-start; gap: 20px; padding: 12px 28px 24px;
  background: var(--bg); border-bottom: 1px solid rgba(var(--ink-rgb), .07);
  opacity: 0; transform: translateY(-10px); visibility: hidden; pointer-events: none;
}
.is-compact .site-header.is-anim .menu { transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s; }
.is-compact .site-header.is-open .menu { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.is-compact .nav { flex-direction: column; gap: 14px; font-size: 16px; }
.is-compact .menu-end { flex-wrap: wrap; justify-content: flex-start; gap: 20px 12px; }
.is-compact .menu-end:has(.header-session:not([hidden])) { width: 100%; grid-template-columns: 72px 72px minmax(0, 1fr); }
.is-compact .header-session { grid-column: 1 / -1; justify-self: stretch; flex-wrap: wrap; justify-content: flex-start; }
.is-compact .header-session span { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.is-compact .menu-end:has(.menu-cta) { width: 100%; grid-template-columns: 72px 72px minmax(0, 1fr); }
.is-compact .menu-cta { width: 100%; flex-wrap: nowrap; }
@media (max-width: 480px) {
  .is-compact .menu-end:has(.menu-cta .author-link, .menu-cta [data-portal-admin-link]) { grid-template-columns: 72px 72px; }
  .is-compact .menu-cta:has(.author-link, [data-portal-admin-link]) { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 340px) {
  .is-compact .menu-end:has(.menu-cta) { grid-template-columns: 72px 72px; }
  .is-compact .menu-cta { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 560px) { .is-compact .menu { padding-inline: 16px; } }
@media (prefers-reduced-motion: reduce) { .site-header.is-anim .menu, .burger path { transition: none !important; } }

/* ---------- phones: smaller base type and headings ---------- */
@media (max-width: 560px) {
  body { font-size: 15px; }
  .h2 { font-size: clamp(24px, 7.2vw, 28px); line-height: 1.1; }
  .lede { font-size: 15px; line-height: 1.5; }
  .eyebrow { font-size: 12px; letter-spacing: .22em; }
  .subpage-title { font-size: clamp(22px, 6.4vw, 26px); }
  .cell-card__title { font-size: 17px; }
  .cell-card__text { font-size: 14px; line-height: 1.5; }
  .btn { font-size: 15px; padding: 14px 24px; }
}
