/* ============================================================
   VonBergner – Base Styles
   Reset, Typography, Global Elements
   ============================================================ */

/* ── Self-hosted Fonts (DSGVO-konform, zero CDN requests) ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/lora-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/lora-latin-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

html {
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  overflow-x: clip;
}

/* Lock scroll when mobile nav is open */
html.nav-open,
html.nav-open body {
  overflow: hidden;
  position: relative;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-regular);
  line-height: var(--leading-normal);
  color: var(--color-dark);
  background-color: var(--color-white);
  overflow-x: clip;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-black);
}

h1 {
  font-size: var(--text-5xl);
  font-weight: var(--fw-bold);
}

h2 {
  font-size: var(--text-4xl);
}

h3 {
  font-size: var(--text-3xl);
}

h4 {
  font-size: var(--text-2xl);
}

h5 {
  font-size: var(--text-xl);
}

h6 {
  font-size: var(--text-lg);
  font-weight: var(--fw-medium);
}

p {
  margin-bottom: var(--space-6);
  color: var(--color-gray-700);
  line-height: var(--leading-relaxed);
}

p:last-child {
  margin-bottom: 0;
}

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

a:hover {
  color: var(--color-accent-hover);
}

strong, b {
  font-weight: var(--fw-semibold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--text-sm);
}

blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-8) 0;
  background: var(--color-gray-100);
  font-style: italic;
  color: var(--color-gray-700);
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

code {
  background: var(--color-gray-100);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
}

pre {
  background: var(--color-dark);
  color: var(--color-gray-100);
  padding: var(--space-6);
  overflow-x: auto;
  border-radius: var(--radius-md);
  margin: var(--space-8) 0;
}

pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

/* ── Lists ── */
ul, ol {
  padding-left: var(--space-6);
  margin-bottom: var(--space-6);
  color: var(--color-gray-700);
}

li {
  margin-bottom: var(--space-2);
  line-height: var(--leading-relaxed);
}

li::marker {
  color: var(--color-accent);
}

/* ── Images & Media ── */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

figure {
  margin: var(--space-8) 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-gray-500);
  margin-top: var(--space-2);
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-8) 0;
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: var(--border-width) solid var(--border-color);
}

th {
  font-weight: var(--fw-semibold);
  color: var(--color-black);
  background: var(--color-gray-100);
}

/* ── Horizontal Rule ── */
hr {
  border: none;
  border-top: var(--border-width) solid var(--border-color);
  margin: var(--space-12) 0;
}

/* ── Selection ── */
::selection {
  background: var(--color-accent-light);
  color: var(--color-accent-active);
}

/* ── Focus styles ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ── Responsive Typography ── */
@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  body { font-size: var(--text-sm); }
}

/* ── Utility: Screen reader only ── */
.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;
}

/* ============================================================
   ANIMATION SYSTEM – Awwwards-Level
   Apple-inspired cubic-bezier easing, scroll-driven reveals
   ============================================================ */

/* ── Apple easing variable ── */
:root {
  --ease-apple: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-reveal: 0.9s;
}

/* ── Scroll Reveal Base ── */
.reveal,
.reveal-up,
.reveal-left,
.reveal-right,
.reveal-scale,
.fade-in {
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity var(--duration-reveal) var(--ease-apple),
    transform var(--duration-reveal) var(--ease-apple);
}

.reveal-up,
.fade-in {
  transform: translateY(40px);
}

.reveal-left {
  transform: translateX(-60px);
}

.reveal-right {
  transform: translateX(60px);
}

.reveal-scale {
  transform: scale(0.92);
}

/* Visible state */
.reveal.is-visible,
.reveal-up.is-visible,
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-scale.is-visible,
.fade-in.is-visible {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Legacy delay classes (backwards compatible) */
.fade-in-delay-1 { transition-delay: 100ms; }
.fade-in-delay-2 { transition-delay: 200ms; }
.fade-in-delay-3 { transition-delay: 300ms; }
.fade-in-delay-4 { transition-delay: 400ms; }
.fade-in-delay-5 { transition-delay: 500ms; }

/* ── Split-Text Headline ── */
.text-reveal {
  overflow: hidden;
}

.text-reveal-word {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.15em;  /* space for descenders (g, y, p, q, j) */
  margin-bottom: -0.15em;  /* compensate so layout stays tight */
}

.text-reveal-inner {
  display: inline-block;
  transform: translateY(105%);
  transition: transform 0.7s var(--ease-apple);
}

.text-reveal.is-revealed .text-reveal-inner {
  transform: translateY(0);
}

/* ── Image Reveal (clip-path wipe) ── */
.img-reveal {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.2s var(--ease-apple);
}

.img-reveal.is-revealed {
  clip-path: inset(0 0 0 0);
}

/* ── Scroll Progress Bar ── */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: var(--color-accent);
  z-index: 9999;
  transition: none;
  pointer-events: none;
}

/* ── Hero Scroll Indicator ── */
.hero-scroll-indicator {
  position: absolute;
  bottom: var(--space-10);
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: opacity 0.5s var(--ease-apple), transform 0.5s var(--ease-apple);
}

@media (max-width: 768px) {
  .hero-scroll-indicator {
    display: none;
  }
}

.hero-scroll-indicator .scroll-line {
  width: 1px;
  height: 48px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), transparent);
  position: relative;
  overflow: hidden;
}

.hero-scroll-indicator .scroll-line::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-white);
  animation: scrollPulse 2s var(--ease-apple) infinite;
}

@keyframes scrollPulse {
  0% { top: -100%; }
  50% { top: 100%; }
  100% { top: 100%; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal,
  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .fade-in,
  .text-reveal-inner,
  .img-reveal {
    transform: none !important;
    opacity: 1 !important;
    clip-path: none !important;
  }

  .text-reveal-word {
    opacity: 1 !important;
    transform: none !important;
  }

  .scroll-progress,
  .hero-scroll-indicator {
    display: none !important;
  }
}
