/* SwissWatchFinder — thème « atelier feutré »
   Les variables sont injectées depuis site.config.js par main.js ;
   les valeurs ci-dessous servent de fallback identique. */

:root {
  --c-bg: #141210;
  --c-surface: #1E1A16;
  --c-text: #F4EFE6;
  --c-muted: #A79B88;
  --c-accent: #C6A15B;
  --c-line: #2E2822;
  --c-overlay: rgba(18, 15, 11, .45);
  --font-heading: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;
  --scene-len: 650vh;
  --header-h: 64px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; line-height: 1.15; }
h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: .01em; margin: 0 0 1.2rem; }
p  { margin: 0 0 1rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

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

/* ------------------------------------------------------------------ loader */
#loader {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1rem; background: var(--c-bg);
  transition: opacity .7s ease, visibility .7s;
}
#loader.is-done { opacity: 0; visibility: hidden; }
.loader-mono {
  font-family: var(--font-heading); font-size: 2rem;
  letter-spacing: .55em; padding-left: .55em; color: var(--c-text);
}
.loader-bar {
  width: min(260px, 60vw); height: 1px; background: var(--c-line);
  position: relative; overflow: hidden;
}
#loader-fill {
  position: absolute; inset: 0 100% 0 0; background: var(--c-accent);
  transition: inset .25s ease;
}
#loader-pct { font-size: .75rem; letter-spacing: .2em; color: var(--c-muted); }
.loader-hint {
  font-size: .7rem; color: var(--c-muted); opacity: 0;
  max-width: 80vw; text-align: center;
  animation: loader-hint-in .5s ease 6s forwards; /* visible même si le JS ne démarre pas (file://) */
}
#loader.is-slow .loader-hint { opacity: .8; }
@keyframes loader-hint-in { to { opacity: .8; } }

/* ------------------------------------------------------------------ header */
#site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 2rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
  color: var(--c-text);
  background: transparent; border-bottom: 1px solid transparent;
  transition: background .4s ease, border-color .4s ease, backdrop-filter .4s;
}
#site-header.is-scrolled {
  background: color-mix(in srgb, var(--c-bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-color: var(--c-line);
}
.brand { display: inline-flex; align-items: center; }
.brand img { display: block; height: 34px; width: auto; }

#main-nav { display: flex; gap: 1.6rem; margin-left: auto; }
#main-nav a {
  color: var(--c-muted); text-decoration: none;
  font-size: .78rem; letter-spacing: .18em; text-transform: uppercase;
  transition: color .25s;
}
#main-nav a:hover { color: var(--c-text); }

.header-actions { display: flex; align-items: center; gap: .9rem; }

#lang-switch { display: flex; gap: .1rem; }
#lang-switch button {
  background: none; border: 0; color: var(--c-muted); cursor: pointer;
  font: inherit; font-size: .72rem; letter-spacing: .14em;
  padding: .3rem .45rem; text-transform: uppercase;
}
#lang-switch button[aria-pressed="true"] { color: var(--c-accent); }
#lang-switch button:hover { color: var(--c-text); }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; color: var(--c-text);
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
  transition: border-color .25s;
}
.icon-btn:hover { border-color: var(--c-line); }
.cart-count {
  position: absolute; top: 2px; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--c-accent); color: #17130D;
  font-size: .62rem; font-weight: 600; line-height: 16px; text-align: center;
}

/* ------------------------------------------------------------------- scène */
#scene { height: var(--scene-len); position: relative; }
#stage {
  position: sticky; top: 0; height: 100vh; height: 100svh;
  overflow: hidden;
}
#seq-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#poster-fallback {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .5s;
}
body.reduced-motion #poster-fallback,
body.seq-failed #poster-fallback { opacity: 1; }

#chapters { position: absolute; inset: 0; pointer-events: none; }
.chapter {
  position: absolute; inset: 0;
  display: flex; align-items: center;
  padding: calc(var(--header-h) + 4vh) clamp(1.4rem, 7vw, 7rem) 10vh;
  opacity: 0; pointer-events: none;
}
.chapter[data-align="center"] { justify-content: center; text-align: center; }
.chapter[data-align="left"]   { justify-content: flex-start; }
.chapter[data-align="right"]  { justify-content: flex-end; text-align: right; }

.chapter-inner {
  max-width: 34rem;
  padding: 1.8rem 2.2rem;
  background: radial-gradient(120% 130% at 50% 50%, var(--c-overlay) 0%, transparent 72%);
}
.chapter-inner::before {
  content: ""; display: block; width: 54px; height: 1px;
  background: var(--c-accent); margin: 0 0 1.3rem;
}
.chapter[data-align="center"] .chapter-inner::before { margin-inline: auto; }
.chapter[data-align="right"]  .chapter-inner::before { margin-left: auto; }

.chapter h2 {
  font-size: clamp(2.1rem, 5.2vw, 3.9rem);
  margin: 0 0 .9rem;
  text-shadow: 0 2px 24px rgba(0,0,0,.55);
}
.chapter p {
  color: var(--c-text);
  font-size: clamp(.95rem, 1.4vw, 1.08rem);
  text-shadow: 0 1px 14px rgba(0,0,0,.6);
  margin: 0;
}
.chapter .chapter-cta { margin-top: 1.6rem; pointer-events: none; }
.chapter.is-active .chapter-cta { pointer-events: auto; }

#scroll-hint {
  position: absolute; left: 50%; bottom: 4vh; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: .55rem;
  color: var(--c-muted); font-size: .68rem; letter-spacing: .3em; text-transform: uppercase;
  opacity: 1; transition: opacity .5s;
}
#scroll-hint.is-hidden { opacity: 0; }
.hint-line { width: 1px; height: 44px; background: linear-gradient(var(--c-accent), transparent); }

/* ---------------------------------------------------------------- sections */
.section { padding: clamp(4rem, 9vh, 7rem) clamp(1.4rem, 6vw, 6rem); }
.section-narrow { max-width: 46rem; }
#about p, #contact p { color: var(--c-muted); }

.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.5rem;
  justify-content: space-between; margin-bottom: 2.2rem;
}
.section-head h2 { margin: 0; }

.text-link { color: var(--c-accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--c-accent) 45%, transparent); }
.text-link:hover { border-color: var(--c-accent); }

/* ---------------------------------------------------------------- boutique */
#shop-controls { display: flex; gap: .8rem; flex-wrap: wrap; }
#shop-controls select {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-line); border-radius: 2px;
  font: inherit; font-size: .82rem; padding: .55rem .8rem;
}

.product-grid {
  display: grid; gap: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
}

.card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: 3px; overflow: hidden; cursor: pointer;
  text-align: left; padding: 0; color: inherit; font: inherit;
  transition: border-color .3s, transform .3s;
  display: flex; flex-direction: column;
}
.card:hover { border-color: color-mix(in srgb, var(--c-accent) 55%, var(--c-line)); transform: translateY(-3px); }

.card-media { display: block; position: relative; aspect-ratio: 4 / 5; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Placeholder élégant (BRIEF §8) : matière + monogramme, zéro crédit */
.card-ph {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(198,161,91,.16), transparent 55%),
    linear-gradient(160deg, #211C16 0%, #17130E 60%, #100D0A 100%);
}
.card-media.is-ph .card-ph { display: flex; }
.card-media.is-ph img { display: none; }
.card-ph::after {
  content: ""; position: absolute; inset: 12px;
  border: 1px solid color-mix(in srgb, var(--c-accent) 28%, transparent);
  border-radius: 2px;
}
.card-ph span {
  font-family: var(--font-heading); font-size: 2.1rem;
  letter-spacing: .5em; padding-left: .5em;
  color: color-mix(in srgb, var(--c-accent) 78%, transparent);
}

.badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: .62rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .3rem .6rem; border-radius: 2px;
  background: rgba(12,10,8,.72); color: var(--c-text);
  border: 1px solid var(--c-line); backdrop-filter: blur(4px);
}
.badge.is-sold { color: var(--c-muted); }
.badge.is-reserved { color: var(--c-accent); border-color: color-mix(in srgb, var(--c-accent) 50%, transparent); }
.card.is-sold .card-media { filter: grayscale(.5) brightness(.75); }

.card-body { padding: 1rem 1.1rem 1.2rem; display: grid; gap: .2rem; }
.card-brand { font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: var(--c-muted); }
.card-model { font-family: var(--font-heading); font-size: 1.25rem; }
.card-meta  { font-size: .78rem; color: var(--c-muted); }
.card-price { margin-top: .45rem; color: var(--c-accent); font-weight: 500; letter-spacing: .04em; }

/* ------------------------------------------------------------------ boutons */
.btn {
  display: inline-block; cursor: pointer;
  font: inherit; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase;
  padding: .8rem 1.5rem; border-radius: 2px;
  background: transparent; color: var(--c-text);
  border: 1px solid var(--c-accent);
  text-decoration: none; text-align: center;
  transition: background .25s, color .25s;
}
.btn:hover { background: var(--c-accent); color: #17130D; }
.btn-solid { background: var(--c-accent); color: #17130D; }
.btn-solid:hover { background: color-mix(in srgb, var(--c-accent) 85%, white); }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn-ghost { border-color: var(--c-line); color: var(--c-muted); }
.btn-ghost:hover { background: var(--c-surface); color: var(--c-text); }

/* ------------------------------------------------------- backdrop / modale */
#backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(8, 6, 4, .6); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .3s;
}
#backdrop.is-open { opacity: 1; }

.modal {
  position: fixed; z-index: 50; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(.8rem, 3vw, 2.5rem);
}
.modal-panel {
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 4px;
  width: min(920px, 100%); max-height: 92vh; overflow: auto;
  overscroll-behavior: contain; touch-action: pan-y;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}
.modal-media { display: block; position: relative; min-height: 340px; }
.modal-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.modal-media .card-ph { display: none; }
.modal-media.is-ph .card-ph { display: flex; }
.modal-media.is-ph img { display: none; }

.modal-info { padding: clamp(1.4rem, 3vw, 2.4rem); position: relative; }
.modal-close { position: absolute; top: .9rem; right: .9rem; }
.modal-brand { font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: var(--c-muted); }
.modal-info h3 { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: .3rem 0 .4rem; }
.modal-year { color: var(--c-muted); font-size: .85rem; }
.modal-desc { color: var(--c-muted); margin: 1.1rem 0 1.4rem; }
.modal-price { font-size: 1.5rem; color: var(--c-accent); font-family: var(--font-heading); }

.spec-grid {
  display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.4rem;
  margin: 1.4rem 0 1.7rem; padding-top: 1.3rem; border-top: 1px solid var(--c-line);
  font-size: .85rem;
}
.spec-grid dt { color: var(--c-muted); letter-spacing: .06em; }
.spec-grid dd { margin: 0; }

/* ------------------------------------------------------------------ drawer */
#cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100vw);
  background: var(--c-surface); border-left: 1px solid var(--c-line);
  transform: translateX(100%); transition: transform .35s ease;
  display: flex; flex-direction: column;
}
#cart-drawer.is-open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--c-line);
}
.drawer-head h3 { margin: 0; font-size: 1.4rem; }
#cart-body {
  flex: 1; overflow: auto; padding: 1.1rem 1.3rem;
  overscroll-behavior: contain; touch-action: pan-y;
  display: flex; flex-direction: column;
}

.cart-empty { color: var(--c-muted); margin: auto; text-align: center; }
.cart-item {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem;
  padding: .9rem 0; border-bottom: 1px solid var(--c-line);
}
.cart-item .ci-name { font-family: var(--font-heading); font-size: 1.05rem; }
.cart-item .ci-meta { font-size: .74rem; color: var(--c-muted); }
.cart-item .ci-price { color: var(--c-accent); }
.ci-remove {
  grid-column: 2; justify-self: end;
  background: none; border: 0; color: var(--c-muted); cursor: pointer;
  font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; padding: 0;
}
.ci-remove:hover { color: var(--c-text); }

.cart-foot { padding-top: 1.2rem; margin-top: auto; }
.cart-subtotal {
  display: flex; justify-content: space-between;
  font-size: 1.05rem; margin-bottom: 1rem;
}
.cart-subtotal strong { color: var(--c-accent); font-weight: 500; }
.cart-foot .btn { width: 100%; }

/* checkout mocké — adresse uniquement, AUCUN champ de paiement */
.checkout-note {
  font-size: .74rem; color: var(--c-muted);
  border: 1px dashed var(--c-line); border-radius: 2px;
  padding: .6rem .8rem; margin-bottom: 1.1rem;
}
.checkout-form { display: grid; gap: .8rem; }
.checkout-form label { display: grid; gap: .3rem; font-size: .74rem; letter-spacing: .08em; color: var(--c-muted); }
.checkout-form input, .checkout-form select {
  background: var(--c-bg); border: 1px solid var(--c-line); border-radius: 2px;
  color: var(--c-text); font: inherit; font-size: .9rem; padding: .6rem .7rem;
}
.checkout-form input:focus, .checkout-form select:focus { border-color: var(--c-accent); outline: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.confirm { text-align: center; margin: auto 0; padding: 2rem 0; }
.confirm-ring {
  width: 74px; height: 74px; margin: 0 auto 1.2rem; border-radius: 50%;
  border: 1px solid var(--c-accent); color: var(--c-accent);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.confirm-order { font-family: var(--font-heading); font-size: 1.5rem; margin-bottom: .4rem; }
.confirm p { color: var(--c-muted); font-size: .88rem; }

/* ------------------------------------------------------------------ footer */
#site-footer {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 2rem clamp(1.4rem, 6vw, 6rem);
  border-top: 1px solid var(--c-line);
  color: var(--c-muted); font-size: .78rem; letter-spacing: .06em;
}

/* ------------------------------------------------- reduced motion / mobile */
body.reduced-motion #scene { height: auto; }
body.reduced-motion #stage { position: static; height: 72vh; }
body.reduced-motion #seq-canvas, body.reduced-motion #scroll-hint { display: none; }
body.reduced-motion #chapters { position: static; }
body.reduced-motion .chapter {
  position: static; opacity: 1 !important; transform: none !important;
  pointer-events: auto; padding: 3.2rem clamp(1.4rem, 7vw, 7rem); height: auto;
}
body.reduced-motion .chapter .chapter-cta { pointer-events: auto; }
body.reduced-motion #chapters { pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media (max-width: 720px) {
  #main-nav { display: none; }
  .modal-panel { grid-template-columns: 1fr; }
  .modal-media { min-height: 300px; }
  .form-row { grid-template-columns: 1fr; }

  /* En portrait, la montre converge au CENTRE du cadre : on remonte le texte
     dans la zone sombre du haut plutôt que de le superposer au sujet.
     Bloc resserré pour dégager le sujet, et voile dégradé (haut opaque ->
     transparent) qui garantit la lisibilité quelles que soient les pièces
     qui passent derrière. */
  .chapter {
    align-items: flex-start;
    padding: calc(var(--header-h) + 1.5vh) clamp(1.1rem, 5vw, 2rem) 10vh;
  }
  .chapter-inner {
    padding: 1.1rem 1.2rem 1.3rem;
    border-radius: 3px;
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--c-bg) 90%, transparent) 0%,
      color-mix(in srgb, var(--c-bg) 74%, transparent) 62%,
      color-mix(in srgb, var(--c-bg) 44%, transparent) 88%,
      transparent 100%);
  }
  .chapter-inner::before { margin-bottom: .8rem; }
  .chapter h2 {
    font-size: clamp(1.7rem, 7.4vw, 2.3rem);
    margin-bottom: .55rem;
  }
  .chapter p { font-size: .92rem; line-height: 1.5; }
  .chapter .chapter-cta { margin-top: 1.1rem; }
  .chapter .chapter-cta .btn { padding: .7rem 1.2rem; }
}

/* Écrans courts (petits téléphones, ou barre d'adresse déployée) : le bloc de
   texte occupe proportionnellement plus de hauteur et risquerait de déborder
   sur le cadran (zone claire ~38-52%). On le resserre pour rester au-dessus. */
@media (max-width: 720px) and (max-height: 700px) {
  .chapter { padding-top: calc(var(--header-h) + 1vh); }
  .chapter-inner { padding: .8rem 1rem .9rem; }
  .chapter-inner::before { margin-bottom: .5rem; }
  .chapter h2 { font-size: clamp(1.35rem, 6vw, 1.9rem); margin-bottom: .4rem; }
  .chapter p { font-size: .84rem; line-height: 1.45; }
  .chapter .chapter-cta { margin-top: .7rem; }
  .chapter .chapter-cta .btn { padding: .6rem 1rem; font-size: .72rem; }
}
