/* ============================================================
   Kainer GmbH — Layout (shared base layer)
   ------------------------------------------------------------
   Reset + base + container + section spacing + typography +
   reveal-on-scroll base. Brand-agnostic structure (mirrors the
   central site stack / obasolar.de #9280 reference); reads
   tokens.css. Component rules live in components.css. CC #9416.
   ============================================================ */

/* Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}

body {
  background: var(--neutral-50);
  color: var(--neutral-600);
  font-family: var(--font-sans);
  font-size: var(--type-body);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }

[x-cloak] { display: none !important; }

/* Typography ────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--midnight-600);
  font-weight: 400;
  line-height: 1.166;
  letter-spacing: -0.01em;
}

.text-hero       { font-size: var(--type-hero);       line-height: 1.125; letter-spacing: -0.02em; }
.text-page       { font-size: var(--type-page);       line-height: 1.166; }
.text-section    { font-size: var(--type-section);    line-height: 1.2;   font-weight: 400; }
.text-subsection { font-size: var(--type-subsection); line-height: 1.25;  }

.text-body-large { font-family: var(--font-sans); font-size: var(--type-body-l); line-height: 1.6;  font-weight: 400; }
.text-body       { font-family: var(--font-sans); font-size: var(--type-body);   line-height: 1.555; font-weight: 400; }
.text-body-small { font-family: var(--font-sans); font-size: var(--type-body-s); line-height: 1.5;  font-weight: 400; }
.text-caption    { font-family: var(--font-sans); font-size: var(--type-caption); line-height: 1.428; }

.text-overline {
  font-family: var(--font-sans);
  font-size: var(--type-overline);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-feature-settings: "tnum";
}

/* Container + section ────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-pad);
  padding-right: var(--container-pad);
}
.container--narrow { max-width: 880px; }
.container--reading { max-width: 720px; }

.section { padding-top: var(--space-3xl); padding-bottom: var(--space-3xl); }
.section--tight { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }

@media (max-width: 768px) {
  .section { padding-top: var(--space-2xl); padding-bottom: var(--space-2xl); }
}
@media (max-width: 480px) {
  .section { padding-top: var(--space-xl); padding-bottom: var(--space-xl); }
}

/* Surfaces ───────────────────────────────────────────────── */
.bg-warm     { background: var(--gradient-warm); }
.bg-surface  { background: var(--neutral-100); }
.bg-midnight { background: var(--gradient-midnight); color: var(--neutral-50); }
.bg-midnight h1, .bg-midnight h2, .bg-midnight h3 { color: var(--white); }

/* Visually hidden ────────────────────────────────────────── */
.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;
}

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--midnight-600); color: #fff;
  padding: var(--space-2xs) var(--space-md); border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* Reveal-on-scroll — PROGRESSIVE ENHANCEMENT (CC #9416).
   Content is visible by default; it is only hidden + animated when JS is
   active (html.js-anim, set synchronously in state.js). So a slow/failed
   JS load, a non-JS crawler, or a static screenshot never leaves a section
   invisible — IntersectionObserver merely adds .is-visible to animate it in. */
.reveal { opacity: 1; transform: none; }
html.js-anim .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
html.js-anim .reveal.is-visible { opacity: 1; transform: translateY(0); }
.delay-1 { transition-delay: 90ms; }
.delay-2 { transition-delay: 180ms; }
.delay-3 { transition-delay: 270ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js-anim .reveal { opacity: 1; transform: none; transition: none; }
}
