@import './tokens.css';

/* == RESET & BASE == */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  font-size: 1rem;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); }
a:hover { text-decoration: underline; }

/* == TYPOGRAPHY == */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  color: var(--color-primary);
}
h1 { font-size: clamp(1.6rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.05rem, 2.5vw, 1.35rem); margin-bottom: .5rem; }
p { margin-bottom: .875rem; }
p:last-child { margin-bottom: 0; }
address { font-style: normal; }

/* == LAYOUT == */
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.section { padding: 3rem 0; }
.section-sm { padding: 1.5rem 0; }
.section-cream { background: var(--color-secondary); }
.section-dark { background: #111827; color: #D1D5DB; }
.section-dark h2 { color: var(--color-secondary); }
.section-center { text-align: center; }

/* == SKIP LINK (a11y) == */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: .6rem 1.25rem;
  z-index: 999;
  border-radius: 0 0 4px 0;
  font-weight: 600;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* == BUTTONS == */
.btn-primary,
.btn-secondary,
.btn-accent {
  display: inline-block;
  padding: .75rem 1.5rem;
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: background .2s, color .2s, border-color .2s;
  cursor: pointer;
  line-height: 1;
  border: 2px solid transparent;
}
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover { background: #92400E; border-color: #92400E; text-decoration: none; color: #fff; }
.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover { background: var(--color-primary); color: #fff; text-decoration: none; }
.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-accent:hover { background: #044434; border-color: #044434; text-decoration: none; color: #fff; }
.btn-white {
  background: #fff;
  color: var(--color-primary);
  border: 2px solid #fff;
}
.btn-white:hover { background: var(--color-secondary); border-color: var(--color-secondary); color: var(--color-primary); text-decoration: none; }

/* == HEADER == */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-secondary);
  transition: box-shadow .25s;
}
.site-header.scrolled { box-shadow: 0 2px 16px rgba(0,0,0,.12); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: .75rem;
  padding-bottom: .75rem;
  gap: 1rem;
}
.logo-link { flex-shrink: 0; display: block; }
.logo-link img { height: 48px; width: auto; }

/* == HAMBURGER == */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* == NAV == */
#main-nav {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-secondary);
  padding: 1rem 1.25rem 1.5rem;
  z-index: 99;
}
#main-nav.nav-open { display: block; }
#main-nav ul { list-style: none; display: flex; flex-direction: column; gap: 0; }
#main-nav li { border-bottom: 1px solid var(--color-secondary); }
#main-nav li:last-child { border-bottom: none; }
#main-nav a {
  display: block;
  padding: .75rem 0;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 600;
  font-size: 1rem;
  transition: color .15s;
}
#main-nav a[aria-current="page"] { color: var(--color-primary); }
#main-nav a:hover { color: var(--color-primary); }

/* == HERO == */
.section-hero {
  background: var(--color-secondary);
  padding: 2.5rem 0 0;
}
.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}
.hero-text { padding-bottom: 1.5rem; }
.hero-text h1 { margin-bottom: 1rem; }
.hero-tagline {
  font-size: 1.15rem;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}

/* == RATING STRIP == */
.section-rating {
  background: var(--color-primary);
  color: #fff;
  padding: 1rem 0;
}
.rating-bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.rating-badge {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255,255,255,.12);
  padding: .5rem 1rem;
  border-radius: 4px;
  white-space: nowrap;
}
.rating-stars { color: #FEF3C7; font-size: 1.1rem; letter-spacing: -.05rem; }
.rating-badge strong { font-size: 1.25rem; font-family: var(--font-display); }
.rating-count { font-size: .85rem; opacity: .85; }
.rating-text { font-size: .9rem; color: rgba(255,255,255,.88); }

/* == QUOTE CRÉOLE == */
.quote-creole {
  border-left: 4px solid var(--color-primary);
  padding: .875rem 1.25rem;
  margin: 1.5rem 0 0;
  background: rgba(180,83,9,.06);
  border-radius: 0 6px 6px 0;
}
.quote-creole p {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-style: italic;
  color: var(--color-primary);
  margin-bottom: .3rem;
}
.quote-creole cite { font-size: .875rem; color: #4B5563; font-style: normal; line-height: 1.45; display: block; }

/* == MOMENTS GRID == */
.moments-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.moment-card {
  background: var(--color-secondary);
  padding: 1.25rem;
  border-radius: 6px;
  border-left: 4px solid var(--color-primary);
}
.moment-card h3 { color: var(--color-primary); font-size: 1rem; margin-bottom: .4rem; }
.moment-card p { font-size: .925rem; }

/* == PHONE CTA SECTION == */
.section-phone-cta {
  background: var(--color-accent);
  padding: 2.5rem 0;
  color: #fff;
}
.section-phone-cta h2 { color: #fff; margin-bottom: .5rem; }
.phone-cta-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: flex-start;
}
.phone-link {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  color: var(--color-secondary);
  text-decoration: none;
  display: block;
}
.phone-link:hover { text-decoration: underline; color: #fff; }
.phone-address { font-size: .9rem; opacity: .85; }

/* == PAGE HERO (non-home) == */
.page-hero {
  background: var(--color-secondary);
  padding: 2.5rem 0 2rem;
  border-bottom: 3px solid var(--color-primary);
}
.page-hero .breadcrumb {
  font-size: .8rem;
  color: #6B7280;
  margin-bottom: .6rem;
}
.page-hero .breadcrumb a { color: var(--color-accent); text-decoration: none; }
.page-hero .breadcrumb a:hover { text-decoration: underline; }
.page-hero h1 { font-size: clamp(1.45rem, 3.5vw, 2.4rem); }
.page-hero .page-intro {
  margin-top: .75rem;
  font-size: 1.05rem;
  color: #374151;
}

/* == PRODUCT SECTIONS == */
.products-wrapper { padding: 1rem 0; }
.product-block {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--color-secondary);
}
.product-block:last-child { border-bottom: none; }
.product-visual { width: 100%; }
.product-text h2 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); margin-bottom: .75rem; }
.product-features {
  list-style: none;
  margin-top: .875rem;
}
.product-features li {
  padding: .35rem 0 .35rem 1.5rem;
  position: relative;
  font-size: .925rem;
}
.product-features li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-weight: 600;
}

/* == ABOUT PAGE == */
.about-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.about-visual { width: 100%; max-width: 320px; }
.about-text p {
  font-size: 1.025rem;
  line-height: 1.75;
  margin-bottom: 1rem;
}
.about-text p:last-child { margin-bottom: 0; }
.about-highlight {
  background: var(--color-secondary);
  border-left: 4px solid var(--color-primary);
  padding: 1.25rem 1.5rem;
  border-radius: 0 6px 6px 0;
  margin: 1.5rem 0;
}
.about-highlight strong { color: var(--color-primary); }

/* == CONTACT PAGE == */
.contact-layout {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}
.contact-detail {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.contact-detail-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--color-primary);
  margin-top: .15rem;
}
.contact-detail strong { display: block; font-size: .8rem; text-transform: uppercase; letter-spacing: .05rem; color: #6B7280; margin-bottom: .2rem; }
.contact-detail a { color: var(--color-accent); text-decoration: none; font-weight: 600; }
.contact-detail a:hover { text-decoration: underline; }
.map-container {
  border: 2px solid var(--color-secondary);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 1rem;
}
.map-container iframe {
  display: block;
  width: 100%;
  height: 280px;
  border: none;
}

/* == FORM == */
.contact-form { background: var(--color-secondary); padding: 2rem; border-radius: 8px; }
.contact-form h2 { margin-bottom: 1.5rem; font-size: 1.35rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .4rem;
  color: var(--color-text);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: .7rem .9rem;
  border: 2px solid #D1D5DB;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color .2s;
  appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(180,83,9,.15);
}
.form-group textarea { min-height: 120px; resize: vertical; }
.form-submit { display: flex; justify-content: flex-start; gap: 1rem; align-items: center; }
.form-rgpd {
  font-size: .78rem;
  color: #6B7280;
  margin-top: 1.25rem;
  line-height: 1.55;
}

/* == FOOTER == */
.site-footer {
  background: #111827;
  color: #D1D5DB;
  padding: 3rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.footer-brand .footer-logo { height: 40px; width: auto; filter: brightness(0) invert(1); opacity: .82; }
.footer-brand p { font-size: .875rem; color: #9CA3AF; margin-top: .75rem; font-style: italic; }
.footer-nav h3, .footer-contact h3 {
  font-family: var(--font-body);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1rem;
  color: var(--color-secondary);
  margin-bottom: .875rem;
  font-weight: 600;
}
.footer-nav ul { list-style: none; }
.footer-nav li { margin-bottom: .45rem; }
.footer-nav a { color: #9CA3AF; text-decoration: none; font-size: .9rem; transition: color .15s; }
.footer-nav a:hover { color: var(--color-secondary); }
.footer-contact address { font-size: .875rem; color: #9CA3AF; }
.footer-contact p { margin-bottom: .45rem; }
.footer-contact a { color: var(--color-secondary); text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid #1F2937;
  padding-top: 1.25rem;
  font-size: .78rem;
  color: #6B7280;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  align-items: center;
}
.footer-bottom a { color: #6B7280; text-decoration: none; }
.footer-bottom a:hover { color: #D1D5DB; }

/* == VISUAL PLACEHOLDERS == */
.visual-placeholder {
  display: block;
  width: 100%;
  border-radius: 8px;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--color-primary) 22%, var(--color-bg)) 0%,
      color-mix(in srgb, var(--color-primary) 10%, var(--color-bg)) 55%,
      color-mix(in srgb, var(--color-secondary) 18%, var(--color-bg)) 100%
    );
}
.visual-placeholder[data-aspect="4:3"]  { aspect-ratio: 4 / 3;  }
.visual-placeholder[data-aspect="1:1"]  { aspect-ratio: 1 / 1;  }
.visual-placeholder[data-aspect="3:4"]  { aspect-ratio: 3 / 4;  }
.visual-placeholder[data-aspect="21:9"] { aspect-ratio: 21 / 9; }

.visual-placeholder[data-tone="secondary"] {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--color-secondary) 22%, var(--color-bg)) 0%,
      color-mix(in srgb, var(--color-secondary) 10%, var(--color-bg)) 55%,
      color-mix(in srgb, var(--color-primary) 16%, var(--color-bg)) 100%
    );
}
.visual-placeholder[data-tone="accent"] {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--color-accent, var(--color-primary)) 22%, var(--color-bg)) 0%,
      color-mix(in srgb, var(--color-primary) 12%, var(--color-bg)) 60%,
      color-mix(in srgb, var(--color-secondary) 16%, var(--color-bg)) 100%
    );
}
.visual-placeholder[data-tone="muted"] {
  background: color-mix(in srgb, var(--color-text) 8%, var(--color-bg));
}

/* == LEGAL PAGE == */
.legal-content { padding: 2rem 0 3rem; }
.legal-content h2 { font-size: 1.15rem; margin-top: 2rem; margin-bottom: .5rem; }
.legal-content p { font-size: .925rem; }

/* ============================================================
   ANIMATION PASS — L'Atelier du Blé — WEB-2434
   Template B artisan / boulangerie
   GPU-friendly, tout encapsulé dans prefers-reduced-motion
   ============================================================ */

/* 1. Hero entrance — staggered fade + slide */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hero-in {
    from { opacity: 0; translate: 0 20px; }
    to   { opacity: 1; translate: 0 0; }
  }
  .hero-text h1 {
    animation: hero-in .7s cubic-bezier(.22,.61,.36,1) both;
  }
  .hero-tagline {
    animation: hero-in .65s cubic-bezier(.22,.61,.36,1) .14s both;
  }
  .hero-cta {
    animation: hero-in .6s cubic-bezier(.22,.61,.36,1) .28s both;
  }
  .hero-visual .visual-placeholder {
    animation: hero-in .8s cubic-bezier(.22,.61,.36,1) .08s both;
  }
}

/* 2a. Scroll reveal — CSS scroll-driven (Chromium 115+) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    @keyframes reveal-up {
      from { opacity: 0; translate: 0 20px; }
      to   { opacity: 1; translate: 0 0; }
    }
    @keyframes reveal-left {
      from { opacity: 0; translate: -20px 0; }
      to   { opacity: 1; translate: 0 0; }
    }
    .moment-card {
      animation: reveal-up .6s ease both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
    .quote-creole {
      animation: reveal-left .6s ease both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
  }
}

/* 2b. Scroll reveal — fallback IntersectionObserver (navigateurs sans animation-timeline) */
@supports not (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .moment-card:not(.revealed),
    .quote-creole:not(.revealed) {
      opacity: 0;
      translate: 0 20px;
      transition: opacity .6s ease, translate .6s ease;
    }
    .quote-creole:not(.revealed) { translate: -20px 0; }
    .moment-card.revealed,
    .quote-creole.revealed {
      opacity: 1;
      translate: 0 0;
    }
  }
}

/* 3. Moment card hover lift */
@media (prefers-reduced-motion: no-preference) {
  .moment-card {
    transition: transform .2s ease, box-shadow .2s ease, border-left-color .2s ease;
  }
  .moment-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(180,83,9,.13);
    border-left-color: var(--color-accent);
  }
}

/* 4. Visual placeholder — gradient drift */
@media (prefers-reduced-motion: no-preference) {
  @keyframes placeholder-drift {
    from { background-position: 0% 0%; }
    to   { background-position: 100% 100%; }
  }
  .visual-placeholder {
    background-size: 200% 200%;
    animation: placeholder-drift 10s ease-in-out infinite alternate;
  }
}

/* 5a. Boutons — lift au survol */
@media (prefers-reduced-motion: no-preference) {
  .btn-primary,
  .btn-secondary,
  .btn-accent,
  .btn-white {
    transition: background .2s, color .2s, border-color .2s, transform .15s;
  }
  .btn-primary:hover,
  .btn-secondary:hover,
  .btn-accent:hover,
  .btn-white:hover {
    transform: translateY(-2px);
  }
}

/* 5b. Numéro de téléphone — scale discret */
@media (prefers-reduced-motion: no-preference) {
  .phone-link {
    display: inline-block;
    transition: color .2s, transform .2s;
  }
  .phone-link:hover { transform: scale(1.03); }
}

/* 6. Focus-visible — ring élégant (a11y, hors motion) */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: 3px;
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-accent:focus-visible,
.btn-white:focus-visible,
.phone-link:focus-visible {
  outline-offset: 4px;
}

/* Filet de sécurité reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* == UTILITY == */
.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;
}
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.cta-group { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.5rem; }

/* == RESPONSIVE: TABLET (640px+) == */
@media (min-width: 640px) {
  .moments-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .map-container iframe { height: 350px; }
}

/* == RESPONSIVE: DESKTOP (1024px+) == */
@media (min-width: 1024px) {
  /* Header: show nav, hide hamburger */
  .hamburger { display: none; }
  #main-nav {
    display: flex !important;
    position: static;
    background: transparent;
    border: none;
    padding: 0;
  }
  #main-nav ul { flex-direction: row; gap: .125rem; }
  #main-nav li { border-bottom: none; }
  #main-nav a {
    padding: .45rem .875rem;
    border-radius: 4px;
    font-size: .9rem;
  }
  #main-nav a:hover { background: var(--color-secondary); }
  #main-nav a[aria-current="page"] {
    color: var(--color-primary);
    background: var(--color-secondary);
  }

  /* Hero two-column */
  .hero-inner {
    flex-direction: row;
    align-items: center;
    gap: 3rem;
  }
  .hero-text { flex: 1; padding-bottom: 2.5rem; }
  .hero-visual { flex: 1; max-width: 500px; }

  /* Moments */
  .moments-grid { grid-template-columns: repeat(4, 1fr); }

  /* Phone CTA */
  .phone-cta-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
  }

  /* Products */
  .product-block {
    flex-direction: row;
    gap: 3rem;
    align-items: flex-start;
  }
  .product-block:nth-child(even) { flex-direction: row-reverse; }
  .product-visual { flex: 0 0 300px; }
  .product-text { flex: 1; }

  /* About */
  .about-layout {
    flex-direction: row;
    gap: 3.5rem;
    align-items: flex-start;
  }
  .about-visual { flex: 0 0 280px; max-width: 280px; }
  .about-text { flex: 1; }

  /* Contact */
  .contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 3rem;
    align-items: start;
  }

  /* Map */
  .map-container iframe { height: 400px; }

  /* Footer */
  .footer-grid { grid-template-columns: 2fr 1fr 1.5fr; }
}
