/* Base — resets, typography defaults, global helpers. Ported from the
   <helmet> block repeated in every design-source page. */

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* WebP wrapper added at build time: no box of its own, so img selectors and layout are unchanged. */
picture { display: contents; }

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-focus);
}

::selection {
  background: var(--accent-tint);
}

button {
  font: inherit;
  cursor: pointer;
}

input, select, textarea, button {
  font-family: inherit;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

h1, h2, h3 { text-wrap: balance; }

.hero__title, .paths__title, .tests__title, .elt__title, .why__title,
.hm-school__title, .progress-section__title, .cta-band h2,
.programs-hero__title, .school-hero__title, .about-hero__title,
.contact-hero__title, .resources-hero__title, .program-hero__title,
.stories__title, .brochures__title, .home-resources__title, .boards-grid__title,
.subjects-grid__title, .faq-title, .legal-page__title, .not-found__title,
.stories__quote {
  font-family: var(--font-display);
}

/* ---- Glass surface + grain utilities (premium overlays) ---- */

.glass-dark {
  background: var(--glass-light-bg);
  border: 1px solid var(--glass-light-border);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
}

.spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s ease;
  background: radial-gradient(480px circle at var(--spot-x, 50%) var(--spot-y, 50%), rgba(192, 149, 67, .16), transparent 70%);
}
.spotlight.is-active { opacity: 1; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Chalk-doodle background decorations (hand-drawn line-art, animated) ---- */

.doodle {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  opacity: .7;
  filter: drop-shadow(0 2px 6px rgba(11, 31, 63, .06));
}
.doodle svg { display: block; width: 100%; height: 100%; }

@keyframes doodle-bob {
  0%, 100% { transform: translateY(0) rotate(var(--doodle-rot, 0deg)); }
  50%      { transform: translateY(-16px) rotate(calc(var(--doodle-rot, 0deg) + 4deg)); }
}
@keyframes doodle-sway {
  0%, 100% { transform: translateX(0) rotate(var(--doodle-rot, 0deg)); }
  50%      { transform: translateX(14px) rotate(calc(var(--doodle-rot, 0deg) - 5deg)); }
}
@keyframes doodle-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.doodle--bob  { animation: doodle-bob 6s ease-in-out infinite; }
.doodle--sway { animation: doodle-sway 7.5s ease-in-out infinite; }
.doodle--spin { animation: doodle-spin 44s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .doodle--bob, .doodle--sway, .doodle--spin { animation: none; }
}

@media (max-width: 760px) {
  .doodle { display: none; }
}

/* ---- Entrance / reveal animation system ---- */

@keyframes ang-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

@keyframes ang-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(4%, -3%, 0) scale(1.12); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

@keyframes ang-glow {
  0%   { opacity: .45; transform: translate3d(-6%, 0, 0) scale(1); }
  50%  { opacity: .8;  transform: translate3d(6%, -4%, 0) scale(1.15); }
  100% { opacity: .45; transform: translate3d(-6%, 0, 0) scale(1); }
}

[data-anim] {
  animation: ang-rise .9s var(--ease) both;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease), transform .9s var(--ease);
}

[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *, [data-anim] {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ---- Shared responsive hooks (attribute selectors, mirrors design-source) ---- */

@media (max-width: 900px) {
  [data-stack] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {
  [data-split] {
    grid-template-columns: 1fr !important;
  }
}

/* ---- Print baseline (carried over from the dc-runtime; previously invisible) ---- */

@media print {
  * {
    print-color-adjust: exact !important;
    -webkit-print-color-adjust: exact !important;
    animation: none !important;
    transition: none !important;
  }
  [style*="backdrop-filter"], .glass {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* ---- Scroller hiding (used by horizontal segmented selectors) ---- */

[data-scroller] {
  scrollbar-width: none;
}

[data-scroller]::-webkit-scrollbar {
  display: none;
}
