/* ==========================================================
   BASE.CSS — Design Tokens & Foundation
   Lagerhalle Landingpage | J+E Immobilien
   ========================================================== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* --- Typography Scale (fluid clamp) --- */
:root {
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.15vw, 0.75rem);    /* 11–12 */
  --text-sm:   clamp(0.8125rem, 0.77rem + 0.18vw, 0.875rem);   /* 13–14 */
  --text-base: clamp(1rem, 0.95rem + 0.22vw, 1.0625rem);       /* 16–17 */
  --text-lg:   clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem);     /* 18–20 */
  --text-xl:   clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);        /* 24–30 */
  --text-2xl:  clamp(2rem, 1.6rem + 1.6vw, 3rem);              /* 32–48 */
  --text-3xl:  clamp(2.5rem, 1.8rem + 2.8vw, 4.5rem);          /* 40–72 */
  --text-4xl:  clamp(3rem, 2rem + 4vw, 6rem);                   /* 48–96 */
  --text-5xl:  clamp(3.5rem, 2.2rem + 5.2vw, 8rem);            /* 56–128 */

  /* --- Spacing (4px base) --- */
  --space-1:  0.25rem;   /* 4 */
  --space-2:  0.5rem;    /* 8 */
  --space-3:  0.75rem;   /* 12 */
  --space-4:  1rem;      /* 16 */
  --space-5:  1.25rem;   /* 20 */
  --space-6:  1.5rem;    /* 24 */
  --space-8:  2rem;      /* 32 */
  --space-10: 2.5rem;    /* 40 */
  --space-12: 3rem;      /* 48 */
  --space-16: 4rem;      /* 64 */
  --space-20: 5rem;      /* 80 */
  --space-24: 6rem;      /* 96 */
  --space-32: 8rem;      /* 128 */
  --space-40: 10rem;     /* 160 */
  --space-48: 12rem;     /* 192 */

  /* --- Section spacing (generous, editorial) --- */
  --section-padding: clamp(var(--space-16), 10vw, var(--space-40));

  /* --- Content widths --- */
  --width-narrow: 42rem;   /* 672px — prose */
  --width-base:   64rem;   /* 1024px — content */
  --width-wide:   80rem;   /* 1280px — wide content */
  --width-max:    90rem;   /* 1440px — max container */

  /* --- Border radius --- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;

  /* --- Shadows --- */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.12);
  --shadow-xl:  0 24px 48px rgba(0,0,0,0.16);

  /* --- Transitions --- */
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Font families --- */
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body:    'Satoshi', system-ui, -apple-system, sans-serif;
}

/* ============================================================
   LIGHT MODE (default)
   ============================================================ */
:root, [data-theme="light"] {
  --color-bg:       #F5F3EF;
  --color-surface:  #EDEBE6;
  --color-text:     #1A1A18;
  --color-muted:    #7A7670;
  --color-accent:   #C8963E;
  --color-accent-hover: #B8862E;
  --color-border:   rgba(26, 26, 24, 0.1);
  --color-hero-text: #FFFFFF;
  --color-hero-sub:  rgba(255,255,255,0.8);
  
  color-scheme: light;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --color-bg:       #1A1A18;
  --color-surface:  #242420;
  --color-text:     #E8E6E1;
  --color-muted:    #8A8680;
  --color-accent:   #C8963E;
  --color-accent-hover: #D8A64E;
  --color-border:   rgba(232, 230, 225, 0.1);
  --color-hero-text: #FFFFFF;
  --color-hero-sub:  rgba(255,255,255,0.8);
  
  color-scheme: dark;
}

/* --- Base body --- */
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}

/* --- Typography base --- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

p {
  max-width: 65ch;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-interactive);
}

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

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

/* --- Selection --- */
::selection {
  background: var(--color-accent);
  color: #fff;
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
