/* =====================
         Tokens & Base
         ===================== */
:root {
  /* Light */
  --bg: #f4f4f4; /* must match gradient end */
  --ink: #888;
  --grad: linear-gradient(to bottom, #ffffff 0%, #f4f4f4 100%);
  --title: #666;
  --tagline: #777;
  --intro: #888;
  --app-title: #000;
  --app-copy: #000;
  --footer: #000;

  --edge: clamp(11px, 2vw, 16px);
  --brain-amp: 32px;
  --brain-dur: 5s;
  --brain-1x: url("/assets/4/img/brain/webp/320.webp");

  /* General content sizing */
  --content-max: 640px;
  --content-pad: clamp(16px, 5vw, 32px);

  /* Grid-specific sizing (deterministic breakpoints) */
  --grid-max: 960px; /* cap for column area (≈3 columns) */
  --grid-gutter: clamp(16px, 5vw, 32px); /* side padding */
  --grid-gap: clamp(16px, 4vmin, 24px); /* gap between cards */

  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #212121;
    --ink: #fff;
    --grad: linear-gradient(to bottom, #4a4a4a 0%, #212121 100%);
    --title: #fff;
    --tagline: #999;
    --intro: #888;
    --app-title: #fff;
    --app-copy: #fff;
    --footer: #fff;
  }
}

/* Fonts */
@font-face {
  font-family: "Pally";
  src: url("/assets/4/fonts/pally/Pally-Variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/4/fonts/inter/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  font-optical-sizing: auto;
}
@font-face {
  font-family: "Inter";
  src: url("/assets/4/fonts/inter/InterVariable-Italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
  font-optical-sizing: auto;
}

/* Reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
}
a {
  text-underline-offset: 0.12em;
  text-decoration-thickness: from-font;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    Inter,
    sans-serif;
  font-size: 18px;
  font-synthesis: none;
}

/* Helpful media clamp (harmless even if not the root cause) */
img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

/* =====================
         Gradient wrapper (header + hero)
         ===================== */
.top-gradient {
  background: var(--grad);
}

/* =====================
         Header
         ===================== */
.site-header {
  padding: max(var(--edge), env(safe-area-inset-top))
    max(var(--edge), env(safe-area-inset-right)) 0
    max(var(--edge), env(safe-area-inset-left));
  display: flex;
  align-items: center;
}
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
.brand:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}
.brand-logo {
  width: clamp(48px, 13vw, 64px);
  height: auto;
  display: block;
}

/* Header page nav on the right; last link is CTA */
.page-nav {
  margin-left: auto;
}
.page-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: clamp(1rem, 4vmin, 2rem);
}
.page-nav a {
  color: inherit;
  text-decoration: none;
  opacity: 0.9;
  font-weight: 500;
}
.page-nav a:hover,
.page-nav a:focus-visible {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.page-nav .page-cta {
  font-weight: 700;
} /* emphasized, not a button */
.page-nav a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* =====================
         Hero
         ===================== */
.hero {
  padding: 0 0 0;
  text-align: center;
}
.hero-title {
  color: var(--title);
  position: relative;
  z-index: 3;
  font-family: "Pally", ui-rounded, "SF Pro Rounded", sans-serif;
  font-weight: 700;
  line-height: 0.7;
  font-size: clamp(60px, 26vmin, 140px);
  margin: 0.4em 0.2em 0;
  padding-bottom: 0.3em; /* reserve space for tight leading */
}
.hero-tagline {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  font-size: clamp(20px, 6vmin, 28px);
  font-weight: 300;
  line-height: 1.35;
  color: var(--tagline);
  padding: 0 1rem;
}
.cta {
  margin-top: 2rem;
  font-size: clamp(18px, 5vmin, 22px);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1;
  padding: 0.8em 1.6em;
  background: #000;
  color: #fff;
  border-radius: 0.5em;
  text-decoration: none;
}
@media (prefers-color-scheme: dark) {
  .cta {
    background: #fff;
    color: #000;
  }
}
.cta-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}
.cta:hover .cta-arrow {
  transform: translateY(2px);
}
@media (prefers-reduced-motion: reduce) {
  .cta:hover .cta-arrow {
    transform: none;
  }
}

/* Brain (decorative): WebP with PNG fallback */
.brain-wrap {
  position: relative;
  width: clamp(96px, 66vmin, 256px);
  margin: 0 auto;
  pointer-events: none;
  z-index: 1;
}
.brain-float {
  position: relative;
  animation: floatUp var(--brain-dur) ease-in-out infinite;
  will-change: transform;
}
.brain-main {
  display: block;
  position: relative;
  z-index: 1;
}
.brain-img {
  display: block;
  width: 100%;
  height: auto;
}
.brain-wrap::after {
  content: "";
  position: absolute;
  left: 0;
  top: 80%;
  width: 100%;
  height: 100%;
  background-image: var(--brain-1x);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: 50% 0%;
  filter: blur(32px);
  transform-origin: center;
  z-index: 0;
  animation: floatDown var(--brain-dur) ease-in-out infinite;
  opacity: 0.5;
}
@keyframes floatUp {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(calc(var(--brain-amp) * -1));
  }
}
@keyframes floatDown {
  0%,
  100% {
    transform: translateY(0) scaleY(-0.4);
    opacity: 0.9;
  }
  50% {
    transform: translateY(calc(var(--brain-amp) * 0.9)) scaleY(-0.4);
    opacity: 0.6;
  }
}
@media (prefers-reduced-motion: reduce) {
  .brain-float,
  .brain-wrap::after {
    animation: none;
  }
}

/* =====================
         Intro (OUTSIDE gradient)
         ===================== */
#about {
  scroll-margin-top: 12vh;
}
.intro {
  display: flex;
  justify-content: center;
}
.intro-copy {
  width: 100%;
  max-width: 920px;
  text-align: center;
  font-size: clamp(20px, 6vmin, 26px);
  font-weight: 600;
  margin: 0;
  color: var(--intro);
  padding: 2em 1em 1em;
}
.intro-emoji {
  font-size: 1em;
}

/* =====================
         Showcase (banners & grid)
         ===================== */
#intro {
  scroll-margin-top: 12vh;
}

/* ---- Banner theming system (per app, per mode) ---- */
.showcase--banner {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 32px;
  padding: 0; /* edge-to-edge */
}
.showcase-item.banner {
  /* Defaults — override per app via CSS vars */
  --ink-light: #000000;
  --ink-dark: #ffffff;

  /* Option A: two-stop tints (used if full gradients not provided) */
  --tint-30a-light: #5ac2e926;
  --tint-00a-light: #5ac2e900;
  --tint-30a-dark: #5ac2e940;
  --tint-00a-dark: #5ac2e900;

  /* Option B: full gradient overrides (win if defined)
           --gradient-light: radial-gradient(...);
           --gradient-dark:  radial-gradient(...);
        */

  position: relative;
  width: 100%;
  padding: 64px 32px; /* no radius, no border */
  color: var(--ink-light); /* corrected by media queries below */
}
@media (prefers-color-scheme: light) {
  .showcase-item.banner {
    color: var(--ink-light);
    background-image: var(
      --gradient-light,
      radial-gradient(
        circle farthest-corner at 50% 0%,
        var(--tint-30a-light) 0%,
        var(--tint-00a-light) 100%
      )
    );
    background-color: #fff;
    background-repeat: no-repeat;
  }
}
@media (prefers-color-scheme: dark) {
  .showcase-item.banner {
    color: var(--ink-dark);
    background-image: var(
      --gradient-dark,
      radial-gradient(
        circle farthest-corner at 50% 0%,
        var(--tint-30a-dark) 0%,
        var(--tint-00a-dark) 100%
      )
    );
    background-color: #000;
    background-repeat: no-repeat;
  }
}
.banner__inner {
  width: min(100%, 640px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}
.banner__icon {
  display: block;
  width: clamp(128px, 33vw, 160px);
  height: auto;
}
.banner__title {
  margin: 0;
  font-size: clamp(20px, 6vmin, 30px);
  font-weight: 600;
  color: currentColor;
}
.banner__blurb {
  margin: 0;
  font-size: clamp(20px, 5vmin, 24px);
  font-weight: 300;
  line-height: 1.4;
  opacity: 0.8;
}
.banner__cta {
  display: inline-block;
  font-size: clamp(16px, 4vmin, 20px);
  font-weight: 400;
  line-height: 1;
  color: currentColor;
  text-decoration: none;
  padding: 1em 1.6em;
  border: 1px solid currentColor;
  border-radius: 9999px;
}

/* HzHold theme example (stop-based) */
.banner--hzhold {
  --ink-light: #000;
  --ink-dark: #fff;
  --tint-30a-light: #5ac2e926;
  --tint-00a-light: #5ac2e900;
  --tint-30a-dark: #5ac2e940;
  --tint-00a-dark: #5ac2e900;

  /* Or full gradients:
        --gradient-light: radial-gradient(circle at 50% 0%, #E8F6FF 0%, #FFFFFF 100%);
        --gradient-dark:  radial-gradient(circle at 50% 0%, #0A2633 0%, #000000 100%);
        */
}

/* ---- Grid: mobile-first, deterministic 1→2→3 columns ---- */
.showcase--grid {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: clamp(32px, 4vmin, 64px);
}

/* The UL is the centered, padded container — FIXED for iOS Safari */
.grid {
  display: grid;

  /* Force one column on mobile (then bump up at breakpoints) */
  grid-template-columns: 1fr;

  /* Let the UL shrink to viewport (iOS first-paint quirk) */
  min-width: 0;

  /* Explicit sizing & centering */
  width: 100%;
  max-width: var(--grid-max);
  margin-inline: auto;

  /* Reset default UL padding; apply intentional side pads */
  padding-block: 0;
  padding-inline: var(--grid-gutter);

  /* Spacing between items */
  gap: var(--grid-gap);

  /* Remove bullets/margins */
  list-style: none;
  margin-top: 0;
  margin-bottom: 0;

  /* Avoid iOS widening when items are centered at first paint */
  justify-items: stretch;

  /* Local safety net: clip any stray horizontal overflow from this container only */
  overflow-x: clip;
}
@supports not (overflow-x: clip) {
  .grid {
    overflow-x: hidden;
  }
}

/* Two columns when there's room */
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Three columns on larger screens */
@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Card (anchor) — visual centering handled here */
.grid .showcase-item.card {
  width: 100%;
  max-width: 320px;
  padding: clamp(20px, 4vw, 32px) 16px;

  display: flex;
  flex-direction: column;
  text-align: left;
  text-decoration: none;
  color: inherit;

  /* Centers a lone card in its track (replaces justify-items:center) */
  margin-inline: auto;
}
.card__icon {
  display: block;
  width: clamp(50px, 15vmin, 64px);
  height: auto;
}
.card__title {
  margin: 10px 0 5px;
  font-size: 18px;
  font-weight: 600;
  color: var(--app-title);
}
.card__blurb {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--app-copy);
  opacity: 0.8;
}
.card__cta {
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  color: var(--app-copy);
}
.grid .showcase-item.card:hover .card__cta,
.grid .showcase-item.card:focus-visible .card__cta {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* =====================
         Footer
         ===================== */
.site-footer {
  font-size: clamp(18px, 5vmin, 21px);
  color: var(--footer);
  text-align: center;
  padding: 1em 1em 2em;
}
.footer-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(1.5em, 6vmin, 3em);
  margin: 3em 0 0;
}
.footer-nav a {
  color: inherit;
  text-decoration: none;
  opacity: 0.85;
}
.footer-nav a:hover {
  text-decoration: underline;
  opacity: 1;
  text-underline-offset: 2px;
}

.footer-brand,
.footer-brand * {
  color: inherit;
  text-decoration: none;
}
.footer-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  margin: 4em auto 0;
  opacity: 0.92;
  transition: none; /* no wiggle */
}
.footer-logo {
  display: block;
  width: 2.5em;
  height: auto; /* overflow:visible; prevent stroke clipping */
}
.footer-legal {
  margin: 0.5em 0 0;
  font-size: 16px;
}
.footer-brand:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}
/* .footer-brand:hover .brand-name{ text-decoration: underline; text-underline-offset: 2px; } */
.footer-brand {
  opacity: 0.85;
}
.footer-brand:hover {
  opacity: 1;
}