/* ==============================================
   RAUM DESIGN BIENNE — DER RAUM
   Design Tokens (Primitive → Semantic → Component)
   ============================================== */

/* --- PRIMITIVE TOKENS --- */
:root {
  --color-stone-50: #F2F0EB;
  --color-stone-100: #E6E3DC;
  --color-stone-800: #2B2926;
  --color-stone-900: #1D1B18;
  --color-verdigris-600: #3D5A4C;
  --color-verdigris-700: #34503F;
  --color-verdigris-50: #EDF2F0;
  --color-warm-gray-500: #6A6359;
  --color-white: #FFFFFF;

  --font-space: 'Space Grotesk', 'Inter', sans-serif;
  --font-dm: 'DM Sans', 'Inter', sans-serif;
  --font-instrument: 'Instrument Serif', Georgia, serif;

  --radius-sm: 2px;
  --radius-md: 4px;

  /* --- SEMANTIC TOKENS --- */
  --surface-base: var(--color-stone-50);
  --surface-elevated: var(--color-stone-100);
  --surface-inverse: var(--color-stone-800);
  --text-primary: var(--color-stone-900);
  --text-secondary: var(--color-warm-gray-500);
  --text-inverse: var(--color-stone-100);
  --accent: var(--color-verdigris-600);
  --accent-surface: var(--color-verdigris-50);
  --border-default: var(--color-stone-100);
  --border-accent: var(--color-verdigris-600);
  --font-heading: var(--font-space);
  --font-body: var(--font-dm);
  --font-accent: var(--font-instrument);

  /* --- COMPONENT TOKENS --- */
  --btn-primary-bg: var(--accent);
  --btn-primary-text: #FFFFFF;
  --btn-primary-hover: #34503F;
  --card-bg: var(--surface-elevated);
  --card-border: var(--border-default);
  --card-radius: var(--radius-md);
  --nav-bg: var(--surface-inverse);
  --nav-text: var(--text-inverse);
  --nav-accent: var(--accent);
  --module-dot-size: 6px;
  --module-dot-color: var(--accent);
  --module-dot-opacity: 0.25;
  --module-line-opacity: 0.12;
}

/* --- BASE RESET --- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background-color: var(--surface-base);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--surface-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--accent);
  color: var(--btn-primary-text);
}

img { display: block; max-width: 100%; }

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

/* --- TYPOGRAPHY --- */
.heading-upper {
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  line-height: 1.05;
}

.heading-mixed {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.font-accent {
  font-family: var(--font-accent);
}

/* --- HEADER / NAV --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.5rem 2.5rem;
  transition: background-color 0.5s ease, padding 0.5s ease, backdrop-filter 0.5s ease;
  background-color: transparent;
}

.site-header.scrolled {
  background-color: rgba(43, 41, 38, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-inverse);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
}

/* --- CTA BUTTONS --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 2rem;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-primary:hover {
  background-color: var(--btn-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(61, 90, 76, 0.25);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background-color: transparent;
  color: var(--text-inverse);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 2rem;
  border: 1px solid rgba(230, 227, 220, 0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn-outline-dark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background-color: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
}

.btn-outline-dark:hover {
  background-color: var(--accent);
  color: var(--btn-primary-text);
  transform: translateY(-2px);
}

/* --- HAMBURGER --- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  z-index: 201;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--text-inverse);
  transition: transform 0.35s ease, opacity 0.35s ease;
  transform-origin: center;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* --- MOBILE MENU --- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(43, 41, 38, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.mobile-menu[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-inverse);
  text-decoration: none;
  transition: color 0.3s ease;
}

.mobile-menu a:hover,
.mobile-menu a:focus-visible {
  color: var(--accent);
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background-color: var(--surface-inverse);
}

.hero-split {
  position: absolute;
  right: 0;
  top: 0;
  width: 45%;
  height: 100%;
  overflow: hidden;
}

.hero-split img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-split::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, var(--surface-inverse) 0%, rgba(43, 41, 38, 0.3) 40%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 8rem 3rem 4rem;
}

/* --- MODULE DOTS (signature USM) --- */
.module-dot {
  position: absolute;
  width: var(--module-dot-size);
  height: var(--module-dot-size);
  border-radius: 50%;
  background-color: var(--module-dot-color);
  opacity: var(--module-dot-opacity);
  pointer-events: none;
}

/* Section-level module dots via pseudo-elements */
.section-module {
  position: relative;
}

.section-module::before,
.section-module::after {
  content: '';
  position: absolute;
  width: var(--module-dot-size);
  height: var(--module-dot-size);
  border-radius: 50%;
  background-color: var(--module-dot-color);
  opacity: var(--module-dot-opacity);
  pointer-events: none;
  z-index: 5;
}

.section-module::before {
  top: 2rem;
  left: 2rem;
}

.section-module::after {
  bottom: 2rem;
  right: 2rem;
}

/* Extra dots via data attributes */
.section-module[data-dots="corners"]::before {
  top: 1.5rem;
  left: 1.5rem;
}
.section-module[data-dots="corners"]::after {
  bottom: 1.5rem;
  right: 1.5rem;
}

/* --- SERVICE CARDS --- */
.service-card {
  background-color: var(--surface-base);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 2.5rem 2rem;
  box-shadow: 0 2px 12px rgba(29, 27, 24, 0.06);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(29, 27, 24, 0.08);
}

/* --- BRAND MARQUEE --- */
.brand-marquee {
  overflow: hidden;
  width: 100%;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.brand-track {
  display: flex;
  align-items: center;
  gap: 4rem;
  width: max-content;
  animation: brandScroll 50s linear infinite;
}

.brand-track:hover {
  animation-play-state: paused;
}

@keyframes brandScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.125rem, 2vw, 1.5rem);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  opacity: 0.45;
  transition: opacity 0.4s ease, color 0.4s ease;
  white-space: nowrap;
  user-select: none;
  cursor: default;
}

.brand-name:hover {
  opacity: 1;
  color: var(--text-primary);
}

.brand-sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--accent);
  opacity: 0.3;
  flex-shrink: 0;
}

/* --- GALLERY --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-item:hover img {
  transform: scale(1.04);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.5rem 1.5rem 1.25rem;
  background: linear-gradient(to top, rgba(29, 27, 24, 0.85) 0%, transparent 100%);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-item:hover .gallery-caption,
.gallery-item:focus-within .gallery-caption {
  opacity: 1;
  transform: translateY(0);
}

/* --- SCROLL REVEAL --- */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.stagger > * {
  transition-delay: calc(var(--i, 0) * 0.12s);
}

/* --- MODULE SVG OVERLAY --- */
#module-svg {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

#module-svg line {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
}

#module-svg line.visible {
  opacity: var(--module-line-opacity);
}

/* --- PLACEHOLDER IMAGE --- */
.placeholder-img {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-elevated) 0%, var(--surface-base) 50%, var(--surface-elevated) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.placeholder-img::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(61, 90, 76, 0.03) 20px,
    rgba(61, 90, 76, 0.03) 40px
  );
}

.placeholder-img svg {
  opacity: 0.12;
  width: 48px;
  height: 48px;
  color: var(--text-secondary);
}

/* Hero placeholder (dark bg) */
.placeholder-img-dark {
  background: linear-gradient(135deg, rgba(43,41,38,0.9) 0%, rgba(29,27,24,0.7) 50%, rgba(43,41,38,0.9) 100%);
}

.placeholder-img-dark::before {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(230,227,220,0.03) 20px,
    rgba(230,227,220,0.03) 40px
  );
}

.placeholder-img-dark svg {
  color: var(--text-inverse);
  opacity: 0.15;
}

/* --- RESPONSIVE --- */
@media (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 1rem 1.25rem;
  }
  .site-header.scrolled {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .hamburger { display: flex; }

  .hero-split {
    width: 100%;
    opacity: 0.25;
  }

  .hero-split::after {
    background: linear-gradient(to top, var(--surface-inverse) 10%, rgba(43, 41, 38, 0.6) 50%, rgba(43, 41, 38, 0.4) 100%);
  }

  .hero-content {
    padding: 7rem 1.5rem 3rem;
  }

  .gallery-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2px;
  }

  .gallery-caption {
    opacity: 1;
    transform: translateY(0);
  }

  .section-module::before,
  .section-module::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

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

  html { scroll-behavior: auto; }

  .reveal, .reveal-left, .reveal-right {
    opacity: 1;
    transform: none;
  }

  .hero-title .letter {
    opacity: 1;
    transform: none;
  }

  #module-svg line {
    opacity: var(--module-line-opacity);
  }

  .brand-track {
    animation: none;
  }
}
