/* ==============================================
   PIÈCES À CONVICTION — Le Cabinet
   Design Tokens (Primitive → Semantic → Component)
   ============================================== */

/* --- PRIMITIVE TOKENS --- */
:root {
  /* Colors */
  --color-linen-100: #F2EDE6;
  --color-linen-200: #E8E1D8;
  --color-linen-300: #DDD6CC;
  --color-charcoal-900: #3A3632;
  --color-charcoal-850: #46423E;
  --color-charcoal-700: #524D49;
  --color-charcoal-950: #2D2926;
  --color-wine-600: #8E3448;
  --color-wine-700: #7A2C3D;
  --color-brass-400: #C0A878;
  --color-stone-600: #6B645C;
  --color-stone-400: #A89F96;

  /* Fonts */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-accent: 'Instrument Serif', Georgia, serif;

  /* --- SEMANTIC TOKENS --- */
  --surface-primary: var(--color-linen-100);
  --surface-dark: var(--color-charcoal-900);
  --surface-elevated: var(--color-charcoal-850);
  --text-primary: var(--color-charcoal-950);
  --text-light: var(--color-linen-100);
  --text-muted: var(--color-stone-600);
  --text-muted-on-dark: var(--color-stone-400);
  --accent-primary: var(--color-wine-600);
  --accent-decorative: var(--color-brass-400);
  --border-default: var(--color-linen-300);
  --border-dark: var(--color-charcoal-700);

  /* --- COMPONENT TOKENS --- */
  --btn-primary-bg: var(--accent-primary);
  --btn-primary-text: var(--text-light);
  --btn-primary-hover: var(--color-wine-700);
  --nav-bg: transparent;
  --nav-bg-scrolled: rgba(58, 54, 50, 0.92);
  --card-bg: var(--surface-elevated);
  --card-border: var(--border-dark);
  --gallery-gap: 12px;
  --botanical-color: var(--accent-decorative);
  --botanical-opacity-hero: 0.07;
  --botanical-opacity-gallery: 0.10;
}

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

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

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-primary);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

/* Initial state: light text over hero */
.site-header a,
.site-header .font-display,
.site-header .font-accent {
  color: var(--text-light);
}

.site-header a:hover {
  color: var(--accent-decorative);
}

.site-header .hamburger span {
  background-color: var(--text-light);
}

.site-header.scrolled {
  background-color: var(--nav-bg-scrolled);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}

/* --- HERO --- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(58, 54, 50, 0.95) 0%,
    rgba(58, 54, 50, 0.75) 30%,
    rgba(58, 54, 50, 0.45) 60%,
    rgba(58, 54, 50, 0.3) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2rem;
}

/* Botanical watermark — hero */
.botanical-hero {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  width: 320px;
  height: 420px;
  color: var(--botanical-color);
  opacity: var(--botanical-opacity-hero);
  pointer-events: none;
  z-index: 1;
  will-change: transform;
}

/* Botanical watermark — gallery */
.botanical-gallery {
  position: absolute;
  left: -5%;
  top: 10%;
  width: 400px;
  height: 520px;
  color: var(--botanical-color);
  opacity: var(--botanical-opacity-gallery);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* Letter animation */
.hero-title .letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: letterReveal 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.hero-title .letter-space {
  display: inline-block;
  width: 0.25em;
}

@keyframes letterReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- SERVICE CARDS --- */
.service-card {
  padding: 2rem;
  border: 1px solid var(--card-border);
  background-color: transparent;
  transition: background-color 0.4s ease, transform 0.4s ease, border-color 0.4s ease;
}

.service-card:hover {
  background-color: var(--card-bg);
  transform: translateY(-4px);
  border-color: var(--accent-decorative);
}

/* --- GALLERY --- */
.gallery-item {
  transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.5s ease;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(45, 41, 38, 0.15);
}

.gallery-img {
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* --- CTA BUTTON --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.875rem 1.75rem;
  border: none;
  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(142, 52, 72, 0.25);
}

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

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

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

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

/* Stagger children */
.stagger > * { transition-delay: calc(var(--i, 0) * 0.08s); }

/* --- MOBILE MENU --- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background-color: rgba(58, 54, 50, 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-display);
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* --- 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: 1.5px;
  width: 100%;
  background-color: var(--text-light);
  transition: transform 0.35s ease, opacity 0.35s ease, background-color 0.35s ease;
  transform-origin: center;
}

.hamburger[aria-expanded="true"] span {
  background-color: var(--text-light);
}

.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);
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .site-header { padding: 1rem 1.25rem; }
  .site-header.scrolled { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .hamburger { display: flex; }
  .nav-links { display: none !important; }

  .botanical-hero {
    width: 200px;
    height: 260px;
    right: -5%;
  }

  .botanical-gallery {
    width: 250px;
    height: 325px;
  }
}

/* --- 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-right {
    opacity: 1;
    transform: none;
  }

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

  .gallery-item:hover {
    transform: none;
  }

  .gallery-item:hover .gallery-img {
    transform: none;
  }

  .botanical-hero,
  .botanical-gallery {
    will-change: auto;
  }
}