/* =====================================================================
   base.css  ·  reset, M3 type scale, and layout primitives
   ===================================================================== */

/* ---- Reset ---------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  position: relative;
  min-height: 100vh;
  font-family: var(--font-body);
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Soft "prism" aurora at the top of every page. A blurred set of green→teal→
   blue blobs drifts gently; a brighter mint highlight eases toward the cursor
   (--gx / --gi are set by layout.js). Sits above content, below the header. */
.top-glow {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 160px;               /* short band; the bloom marks the active page */
  z-index: 90;
  pointer-events: none;
  overflow: hidden;
  /* Fade the whole band out toward the bottom so it never cuts off hard. */
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 38%, transparent 100%);
}
/* Deep-green aurora that CONCENTRATES under the active nav button and fades to
   the sides. The gradients live HERE (not in tokens.css) on purpose: they read
   --gx / --gi, which layout.js sets on the .top-glow element at runtime. A
   :root custom property that references var(--gx) would resolve --gx in :root's
   scope (where it's unset → the 50% fallback) and bake a centred glow in before
   ever reaching this element — so the position must be substituted right here,
   where --gx actually inherits. Horizontal inset is 0 so --gx maps 1:1 to the
   viewport. */
.top-glow::before {
  content: "";
  position: absolute;
  inset: -45% 0 0 0;
  background:
    radial-gradient(520px 300px at var(--gx, 50%) -6%,
      color-mix(in srgb, #0a5e52 42%, transparent) 0%,
      color-mix(in srgb, #024d40 18%, transparent) 48%,
      transparent 78%);
  filter: blur(36px) saturate(1.05);
  animation: auroraDrift 22s ease-in-out infinite alternate;
}
/* Cursor / active-page bloom — the dominant bright point. Peak opacity rises
   with --gi (cursor proximity); sits at --gx (active button or pointer). */
.top-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(460px 290px at var(--gx, 50%) -6%,
      color-mix(in srgb, var(--brand-primary) calc(50% + 46% * var(--gi, 0)), transparent) 0%,
      transparent 62%);
  mix-blend-mode: multiply;
  filter: blur(26px);
}
@keyframes auroraDrift {
  0%   { transform: translate3d(-2.5%, 0, 0) scale(1.02); }
  50%  { transform: translate3d(2%, 1%, 0) scale(1.05); }
  100% { transform: translate3d(4.5%, 0, 0) scale(1.09); }
}
@media (prefers-reduced-motion: reduce) {
  .top-glow::before { animation: none; }
}

img, picture, svg, video, iframe {
  display: block;
  max-width: 100%;
}

input, button, textarea, select { font: inherit; color: inherit; }

a { color: var(--md-sys-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* ---- M3 Type scale --------------------------------------------------
   Display/headline/title sizes are multiplied by --title-scale (see
   tokens.css): 0.9 for Latin, 0.8 for the Georgian locale. */
.display-large   { font-family: var(--font-brand); font-weight: 400; font-size: calc(clamp(2.5rem, 6vw, 3.5rem) * var(--title-scale)); line-height: 1.12; letter-spacing: -0.02em; }
.display-medium  { font-family: var(--font-brand); font-weight: 400; font-size: calc(clamp(2.1rem, 5vw, 2.8rem) * var(--title-scale)); line-height: 1.15; }
.display-small   { font-family: var(--font-brand); font-weight: 400; font-size: calc(clamp(1.8rem, 4vw, 2.25rem) * var(--title-scale)); line-height: 1.2; }

.headline-large  { font-family: var(--font-brand); font-weight: 400; font-size: calc(2rem * var(--title-scale));    line-height: 1.25; }
.headline-medium { font-family: var(--font-brand); font-weight: 400; font-size: calc(1.75rem * var(--title-scale)); line-height: 1.28; }
.headline-small  { font-family: var(--font-brand); font-weight: 500; font-size: calc(1.5rem * var(--title-scale));  line-height: 1.33; }

.title-large     { font-family: var(--font-brand); font-weight: 500; font-size: calc(1.375rem * var(--title-scale)); line-height: 1.27; }
.title-medium    { font-family: var(--font-body);  font-weight: 500; font-size: 1rem;     line-height: 1.5; letter-spacing: 0.009em; }
.title-small     { font-family: var(--font-body);  font-weight: 500; font-size: 0.875rem; line-height: 1.43; letter-spacing: 0.007em; }

.body-large      { font-size: 1rem;     line-height: 1.5;  letter-spacing: 0.03em; }
.body-medium     { font-size: 0.875rem; line-height: 1.43; letter-spacing: 0.018em; }
.body-small      { font-size: 0.75rem;  line-height: 1.33; letter-spacing: 0.033em; }

.label-large     { font-weight: 500; font-size: 0.875rem; line-height: 1.43; letter-spacing: 0.007em; }
.label-medium    { font-weight: 500; font-size: 0.75rem;  line-height: 1.33; letter-spacing: 0.04em; }
.label-small     { font-weight: 500; font-size: 0.6875rem;line-height: 1.45; letter-spacing: 0.04em; }

/* Default heading sizing for plain markup */
h1 { font-family: var(--font-brand); font-weight: 400; font-size: calc(clamp(2.1rem, 5vw, 2.8rem) * var(--title-scale)); line-height: 1.15; }
h2 { font-family: var(--font-brand); font-weight: 400; font-size: calc(clamp(1.6rem, 3.5vw, 2rem) * var(--title-scale)); line-height: 1.25; }
h3 { font-family: var(--font-brand); font-weight: 500; font-size: calc(1.375rem * var(--title-scale)); line-height: 1.3; }
p  { line-height: 1.6; }

/* ---- Layout primitives --------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--layout-max-width);
  margin-inline: auto;
  padding-inline: var(--layout-gutter);
}

.section {
  padding-block: clamp(48px, 8vw, 96px);
}

.section--tint { background-color: var(--md-sys-color-surface-container-low); }

.section__head {
  max-width: 60ch;
  margin-bottom: clamp(24px, 4vw, 48px);
}
.section__head p { color: var(--md-sys-color-on-surface-variant); margin-top: 12px; }

.eyebrow {
  display: inline-block;
  color: var(--md-sys-color-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 12px;
}

.grid {
  display: grid;
  gap: clamp(16px, 3vw, 28px);
}
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid--5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) {
  .grid--5 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}

.stack > * + * { margin-top: 1rem; }

.text-muted { color: var(--md-sys-color-on-surface-variant); }

/* ---- Bolder display type (modern, still Roboto / M3) ---------------- */
.display-xl {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: calc(clamp(2.8rem, 7vw, 5rem) * var(--title-scale));
  line-height: 1.12;
  letter-spacing: -0.03em;
}
.headline-bold { font-weight: 700; letter-spacing: -0.02em; }

/* ---- Dark-green section (for contrast / drama) ---------------------- */
.section--dark {
  position: relative;
  overflow: hidden;
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}
.section--dark .eyebrow { color: var(--md-sys-color-primary-container); }
.section--dark h1, .section--dark h2, .section--dark h3 { color: var(--md-sys-color-on-primary); }
.section--dark .text-muted,
.section--dark p { color: color-mix(in srgb, var(--md-sys-color-on-primary) 82%, transparent); }
.section--dark .stat__num { color: var(--md-sys-color-primary-container); }
.section--dark .stat__label { color: color-mix(in srgb, var(--md-sys-color-on-primary) 78%, transparent); }

/* ---- Page hero (sits on the top green glow; dark-green readable text) ---- */
.page-hero {
  padding-top: clamp(150px, 19vh, 200px);
  background: transparent;
}
.page-hero .eyebrow { color: var(--brand-primary); }
.page-hero h1,
.page-hero h2,
.page-hero .display-xl { color: var(--brand-primary); }
.page-hero .display-xl {
  font-size: calc(clamp(2rem, 4.5vw, 3.2rem) * var(--title-scale));
}
.page-hero p { color: var(--md-sys-color-on-surface-variant); }

/* ---- Scroll-reveal motion (gated on .js so no-JS still shows) ------- */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s var(--md-sys-motion-easing-emphasized),
              transform .7s var(--md-sys-motion-easing-emphasized);
  will-change: opacity, transform;
}
.js .reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }
.reveal[data-delay="5"] { transition-delay: .40s; }
.reveal[data-delay="6"] { transition-delay: .48s; }

/* Utilities */
.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;
}
.flex { display: flex; }
.items-center { align-items: center; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.wrap { flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
}
