/* v2 foundation: reset, type, layout, the site header and footer.
 *
 * Colours are never written here. The page head prints the edition's tokens from the zygote
 * as --c-* custom properties (app/app/Utils/ThemeTokens.php); this file only uses them.
 * Components live in components.css. Docs: docs/WebRedesign, docs/Development/Phase014.md. */

:root {
  --font-ui: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: Literata, Georgia, "Times New Roman", serif;
  --r-s: 8px;
  --r-m: 14px;
  --r-l: 20px;
  --r-xl: 28px;
  --gutter: clamp(16px, 5.5vw, 80px);
  --maxw: 1280px;
  --header-h: 76px;
  --shadow-1: 0 4px 14px rgb(20 29 25 / .10);
  --shadow-2: 0 18px 44px rgb(20 29 25 / .20);
  --focus: 0 0 0 3px color-mix(in srgb, var(--c-primary) 35%, transparent);
  color-scheme: light;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
[hidden] { display: none !important; }
.icon { flex-shrink: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--c-primary); color: var(--c-on-primary);
  padding: 10px 16px; border-radius: var(--r-s);
}
.skip-link:focus { top: 12px; color: var(--c-on-primary); }

/* ---- type ---- */
.serif { font-family: var(--font-serif); }
.h1 { font: 600 clamp(32px, 4vw, 48px)/1.1 var(--font-serif); letter-spacing: -.01em; }
.h2 { font: 600 clamp(28px, 3vw, 40px)/1.15 var(--font-serif); }
.h3 { font: 600 clamp(22px, 2vw, 26px)/1.2 var(--font-serif); }
.eyebrow {
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-on-accent-container);
}
.lead { font-size: 18px; color: var(--c-text-2); }
.muted { color: var(--c-text-2); }
.small { font-size: 14px; }
.prose { font-family: var(--font-serif); font-size: 18px; line-height: 1.7; color: color-mix(in srgb, var(--c-text) 88%, var(--c-bg)); }
.prose p + p { margin-top: 1em; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

/* ---- layout ---- */
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-wide { width: 100%; padding-inline: var(--gutter); }
.site-main { flex-grow: 1; }
.section { padding-block: clamp(56px, 7vw, 96px) 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.section-head > div { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; align-items: center; gap: var(--gap, 12px); flex-wrap: wrap; }
.grid { display: grid; gap: var(--gap, 24px); grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid { --cols: 3; } .grid.g2 { --cols: 2; } }
@media (max-width: 860px) { .grid { --cols: 2; } }
@media (max-width: 560px) { .grid { --cols: 1; } .grid.keep2 { --cols: 2; --gap: 10px; } }
.page-head { padding-block: 40px 28px; display: flex; flex-direction: column; gap: 10px; }
.breadcrumb { font-size: 14px; color: var(--c-text-2); display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--c-text-2); }
.breadcrumb a:hover { color: var(--c-primary); }

/* ---- site header ---- */
.top-banner { text-align: center; background: var(--c-surface); }
.top-banner img { margin-inline: auto; max-height: 120px; width: auto; }

.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--c-bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.site-header.is-solid, .site-header.is-scrolled { background: color-mix(in srgb, var(--c-surface) 94%, transparent); box-shadow: 0 1px 0 var(--c-outline); }
.site-header .wrap, .site-header .wrap-wide { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--c-text); flex-shrink: 0; }
.brand:hover { color: var(--c-text); }
.brand img { width: 42px; height: 42px; }
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.05; letter-spacing: .06em; text-transform: uppercase; }
.main-nav { display: flex; gap: 2px; align-items: center; }
.main-nav > a, .main-nav > .menu > summary {
  display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 14px;
  border-radius: 12px; color: var(--c-text); font-weight: 500; font-size: 15px; white-space: nowrap;
}
.main-nav > a:hover, .main-nav > .menu > summary:hover { background: var(--c-surface-2); color: var(--c-text); }
.main-nav > a[aria-current="page"], .main-nav > .menu.is-current > summary { background: var(--c-primary-container); color: var(--c-primary-dark); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.header-tools .btn { height: 44px; }
.header-tools .nav-toggle { display: none; }
@media (max-width: 1080px) {
  .main-nav { display: none; }
  .header-tools .nav-toggle { display: inline-flex; }
  .header-tools .hide-narrow { display: none; }
}
@media (max-width: 560px) {
  :root { --header-h: 64px; }
  .brand img { width: 36px; height: 36px; }
  .brand-name { font-size: 13px; }
}

/* dropdown menus: <details class="menu"><summary>…</summary><div class="menu-panel">…</div></details> */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary .chev { transition: transform .15s; }
.menu[open] > summary .chev { transform: rotate(180deg); }
.menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 230px;
  background: var(--c-surface); border: 1px solid var(--c-outline); border-radius: var(--r-m);
  box-shadow: var(--shadow-2); padding: 8px; display: flex; flex-direction: column;
}
.menu-panel.end { left: auto; right: 0; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 8px 12px;
  border-radius: 10px; color: var(--c-text); font-size: 15px; text-align: left;
  background: none; border: 0; width: 100%;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--c-surface-2); color: var(--c-text); }
.menu-panel a[aria-current="page"] { color: var(--c-primary); font-weight: 600; }
.menu-panel hr { border: 0; border-top: 1px solid var(--c-outline); margin: 6px 4px; }
.menu-panel .menu-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-2); padding: 8px 12px 4px; }
.flag { width: 20px; height: 20px; border-radius: 50%; }

/* the phone menu: a <dialog> sliding in from the right */
.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(380px, 92vw); max-width: none;
  border: 0; padding: 0; background: var(--c-surface); color: var(--c-text);
  box-shadow: var(--shadow-2);
}
.drawer::backdrop { background: rgb(8 20 14 / .45); }
.drawer[open] { animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--c-outline); position: sticky; top: 0; background: var(--c-surface); }
.drawer-body { padding: 12px 12px 32px; display: flex; flex-direction: column; gap: 2px; }
.drawer-body a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; color: var(--c-text); font-size: 16px; font-weight: 500; }
.drawer-body a:hover, .drawer-body a[aria-current="page"] { background: var(--c-primary-container); color: var(--c-primary-dark); }
.drawer-body .menu-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-text-2); padding: 18px 12px 6px; }
.drawer-langs { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }

/* ---- page messages (the old $MESSAGE alert) ---- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-m); background: var(--c-info-bg); color: var(--c-info-fg); margin-block: 16px; }
.notice.success { background: var(--c-lvl1-bg); color: var(--c-lvl1-fg); }
.notice.warning { background: var(--c-lvl2-bg); color: var(--c-lvl2-fg); }
.notice.danger, .notice.error { background: var(--c-lvl3-bg); color: var(--c-lvl3-fg); }
.notice .grow { flex-grow: 1; }
.notice button { background: none; border: 0; color: inherit; padding: 0; }

/* ---- site footer ---- */
.ad-slot { padding-block: 32px 0; max-width: 100%; overflow: hidden; text-align: center; }
.ad-slot:empty { display: none; }
.site-footer { margin-top: clamp(64px, 8vw, 96px); background: var(--c-primary-dark); color: rgb(255 255 255 / .78); }
.site-footer a { color: rgb(255 255 255 / .78); }
.site-footer a:hover { color: #fff; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr); gap: 48px; padding-block: 56px 40px; }
.footer-brand { display: flex; flex-direction: column; gap: 16px; max-width: 340px; }
.footer-brand .brand { color: #fff; }
.footer-brand p { font-size: 14px; line-height: 1.55; }
.footer-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; font-size: 14px; }
.footer-cols h2 { font: 700 14px/1.3 var(--font-ui); color: #fff; margin-bottom: 12px; }
.footer-cols ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-social { display: flex; gap: 8px; }
.footer-social a { width: 40px; height: 40px; border-radius: 12px; background: rgb(255 255 255 / .1); display: flex; align-items: center; justify-content: center; }
.footer-social a:hover { background: rgb(255 255 255 / .2); }
.footer-bottom { border-top: 1px solid rgb(255 255 255 / .14); padding-block: 20px 28px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.footer-bottom .row { gap: 16px; }
.footer-bottom button { background: none; border: 1px solid rgb(255 255 255 / .25); color: inherit; border-radius: 10px; height: 34px; padding: 0 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.footer-search { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: rgb(255 255 255 / .08); border-radius: 12px; border: 1px solid rgb(255 255 255 / .16); }
.footer-search input { background: none; border: 0; outline: 0; color: #fff; width: 100%; font-size: 14px; }
.footer-search input::placeholder { color: rgb(255 255 255 / .6); }
@media (max-width: 860px) {
  .footer-top { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 560px) {
  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* the editor toolbar that editors see above the footer */
.editor-bar { display: flex; gap: 8px; align-items: center; padding: 10px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
