/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --ink: #0F2028;         /* fond sombre, bleu nuit méditerranéen */
  --ink-2: #16303D;
  --sea: #2C6E8E;         /* accent interactif, liens */
  --sea-light: #7FB2C7;
  --bronze: #A6813F;      /* patine bronze, accent rare */
  --bronze-light: #C9A65C;
  --stone: #EDE7DA;       /* fond clair, pierre calcaire */
  --stone-2: #E1D8C4;
  --paper: #F6F3EA;
  --graphite: #3A362E;    /* texte sur fond clair */
  --graphite-soft: #6B6558;
  --line: #CFC4A9;        /* traits fins sur fond clair */
  --line-dark: rgba(237, 231, 218, 0.16);
  --radius: 3px;
  --content-width: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--graphite);
  background: var(--paper);
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-family: "Cinzel", "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: inherit;
  margin: 0;
}

a { color: var(--sea); text-decoration: none; }
a:hover { color: var(--bronze); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--bronze); outline-offset: 3px; }

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

.wrap {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 28px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  background: var(--ink);
  color: var(--stone);
  border-bottom: 1px solid var(--line-dark);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 18px;
  padding-bottom: 18px;
}
.site-header .brand {
  font-family: "Cinzel", serif;
  font-size: 1.15rem;
  color: var(--stone);
  letter-spacing: 0.03em;
}
.site-header .brand:hover { color: var(--bronze-light); }
.site-header nav a {
  color: var(--sea-light);
  font-size: 0.95rem;
  margin-left: 24px;
}
.site-header nav a:hover { color: var(--bronze-light); }
.site-header nav a.is-active {
  color: var(--bronze-light);
  border-bottom: 1px solid var(--bronze);
  padding-bottom: 3px;
}

@media (max-width: 600px) {
  .site-header .wrap {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 10px;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  .site-header nav {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    column-gap: 18px;
    row-gap: 4px;
  }
  .site-header nav a { margin-left: 0; font-size: 0.88rem; }
}

/* ==========================================================================
   Hero (accueil)
   ========================================================================== */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--stone);
  padding: 52px 0;
  overflow: hidden;
}
.hero .bg-layer {
  position: absolute;
  inset: -20px; /* déborde légèrement pour que la dérive n'expose jamais de bord */
  z-index: 0;
  background-image:
    radial-gradient(900px 480px at 12% 8%, rgba(44, 110, 142, 0.4), transparent 62%),
    radial-gradient(700px 420px at 88% 92%, rgba(166, 129, 63, 0.16), transparent 60%),
    radial-gradient(var(--sea-light) 1px, transparent 1.4px),
    linear-gradient(160deg, #0F2028 0%, #16303D 65%, #0F2028 100%);
  background-size: auto, auto, 34px 34px, auto;
  background-position: 0 0, 0 0, -8px -8px, 0 0;
  animation: drift-dots 46s linear infinite;
}
@keyframes drift-dots {
  from { background-position: 0 0, 0 0, -8px -8px, 0 0; }
  to   { background-position: 0 0, 0 0, 26px 20px, 0 0; }
}
.hero .hero-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.hero .hero-particles span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--sea-light);
  opacity: 0;
  animation: twinkle 7s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: translateY(5px); }
  50% { opacity: 0.85; transform: translateY(-4px); }
}
.hero::before {
  /* voile pour assourdir le fond et garder le texte lisible */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(15,32,40,0.9) 0%, rgba(15,32,40,0.82) 55%, rgba(15,32,40,0.95) 100%);
}
.hero .wrap { position: relative; z-index: 3; }

@media (prefers-reduced-motion: reduce) {
  .hero .bg-layer { animation: none; }
  .hero .hero-particles { display: none; }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 44px;
  align-items: center;
}
@media (max-width: 780px) {
  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
}

.hero h1 {
  font-size: clamp(1.7rem, 3.1vw, 2.5rem);
  line-height: 1.16;
  max-width: 17ch;
}
.hero .tagline {
  margin-top: 12px;
  font-size: 1rem;
  color: var(--sea-light);
  max-width: 46ch;
}
.hero .brief {
  max-width: 46ch;
  border-left: 2px solid var(--bronze);
  padding-left: 22px;
}
.hero .brief p {
  margin: 0 0 12px;
  color: var(--stone);
  font-size: 0.92rem;
  line-height: 1.6;
}
.hero .brief p:last-child { margin-bottom: 0; }

/* ==========================================================================
   Galerie
   ========================================================================== */
.gallery-section { padding: 56px 0 80px; }
.gallery-section h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.gallery-section .section-note {
  color: var(--graphite-soft);
  margin: 0 0 32px;
  max-width: 60ch;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px 24px;
}

.scan-card {
  display: block;
  background: var(--paper);
  color: inherit;
}
.scan-card .thumb-frame {
  border: 1px solid var(--line);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--stone-2);
}
.scan-card .thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.scan-card:hover .thumb-frame img { transform: scale(1.04); }

.scan-card .meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--graphite-soft);
}
.scan-card .commune { color: var(--bronze); font-weight: 600; }
.scan-card h3 {
  font-size: 1.15rem;
  margin-top: 6px;
  color: var(--graphite);
}
.scan-card:hover h3 { color: var(--sea); }
.scan-card .teaser {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--graphite-soft);
}

.empty-state {
  border: 1px dashed var(--line);
  padding: 40px;
  text-align: center;
  color: var(--graphite-soft);
}

/* ==========================================================================
   Fiche scan
   ========================================================================== */
.scan-hero {
  background: var(--ink);
  border-bottom: 1px solid var(--line-dark);
}
.back-link {
  display: inline-block;
  color: var(--sea-light);
  font-size: 0.9rem;
  margin: 18px 0 10px;
}
.back-link:hover { color: var(--bronze-light); }

.viewer-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0A171D;
  border: 1px solid var(--line-dark);
}
.viewer-frame iframe { width: 100%; height: 100%; display: block; border: 0; }

@media (max-width: 600px) {
  .viewer-frame {
    aspect-ratio: auto;
    height: 62vh;
    height: 62dvh; /* unité plus fiable sur mobile, ignorée si non supportée */
  }
}

.viewer-switch {
  display: flex;
  width: fit-content;
  margin: 0 0 12px auto;
  background: rgba(15, 32, 40, 0.88);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  overflow: hidden;
}
.switch-btn {
  font-family: "Work Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--sea-light);
  background: transparent;
  border: none;
  padding: 9px 15px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.switch-btn + .switch-btn { border-left: 1px solid var(--line-dark); }
.switch-btn:hover:not(.is-active):not(:disabled) { color: var(--stone); background: rgba(255,255,255,0.06); }
.switch-btn.is-active { background: var(--bronze); color: #fff; }
.switch-btn:disabled { color: var(--graphite-soft); cursor: not-allowed; opacity: 0.5; }
@media (max-width: 520px) {
  .viewer-switch { width: 100%; margin: 0 0 10px; }
  .switch-btn { flex: 1; padding: 9px 6px; font-size: 0.76rem; }
}

.viewer-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--sea-light);
  font-size: 0.95rem;
  background: rgba(10, 23, 29, 0.88);
  transition: opacity 0.35s ease;
}
.viewer-overlay.is-hidden { opacity: 0; pointer-events: none; }
.viewer-overlay .spinner {
  width: 26px; height: 26px;
  border: 2px solid var(--line-dark);
  border-top-color: var(--bronze);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-overlay.is-error { color: var(--bronze-light); }

.viewer-hint {
  text-align: center;
  font-size: 0.82rem;
  color: var(--graphite-soft);
  padding: 10px 0 26px;
  background: var(--ink);
  color: var(--sea-light);
  margin: 0;
}

.scan-body {
  padding-top: 48px;
  padding-bottom: 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
}
@media (max-width: 780px) {
  .scan-body { grid-template-columns: 1fr; gap: 40px; }
}

.scan-body h1 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  margin-bottom: 6px;
}
.scan-body .meta-line {
  color: var(--bronze);
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 22px;
}
.scan-body .meta-line span.sep { color: var(--line); margin: 0 8px; }
.scan-body .description p {
  margin: 0 0 16px;
  max-width: 64ch;
}

.tech-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 22px;
  margin: 28px 0 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--graphite-soft);
}
.tech-line.is-empty { display: none; }
.tech-heading {
  font-family: "Cinzel", serif;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  color: var(--bronze);
  margin-right: 2px;
}
.tech-item strong { color: var(--graphite); font-weight: 600; }

.download-panel {
  border: 1px solid var(--line);
  padding: 24px;
  align-self: start;
  background: var(--stone);
  display: flex;
  flex-direction: column;
}
.download-panel h2 {
  font-size: 1rem;
  text-transform: none;
  margin-bottom: 4px;
}
.download-panel .license-note {
  font-size: 0.82rem;
  color: var(--graphite-soft);
  margin: 0 0 20px;
}
.dl-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--graphite);
  background: var(--ink);
  color: var(--paper);
  font-family: inherit;
  font-size: 0.94rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.download-panel .dl-btn + .dl-btn { margin-top: 12px; }
.dl-btn:hover { background: var(--sea); border-color: var(--sea); color: #fff; }
.dl-btn .dl-size { color: var(--sea-light); font-size: 0.8rem; white-space: nowrap; }
.dl-btn:hover .dl-size { color: var(--stone); }
.dl-btn.secondary { background: transparent; color: var(--graphite); }
.dl-btn.secondary .dl-size { color: var(--graphite-soft); }
.dl-btn.secondary:hover { background: var(--bronze); border-color: var(--bronze); color: #fff; }
.dl-btn.secondary:hover .dl-size { color: var(--paper); }

.dl-btn.view360 {
  background: transparent;
  border-color: var(--bronze);
  color: var(--bronze);
}
.dl-btn.view360 .dl-size { color: var(--bronze); opacity: 0.75; }
.dl-btn.view360:hover { background: var(--bronze); color: #fff; }
.dl-btn.view360:hover .dl-size { color: #fff; opacity: 1; }

.not-found {
  padding: 90px 0;
  text-align: center;
}
.not-found h1 { margin-bottom: 12px; }

/* ==========================================================================
   Page À propos
   ========================================================================== */
.page-intro {
  background: var(--ink);
  color: var(--stone);
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--line-dark);
}
.page-intro h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
.page-intro .tagline { margin-top: 10px; color: var(--sea-light); font-size: 1rem; }

.article {
  padding-top: 48px;
  padding-bottom: 90px;
}
/*.article > p {
  max-width: 62ch;
}*/
.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  max-height: 50px;
  width: auto;
}
.article p {
  margin: 0 0 18px;
  font-size: 1.02rem;
}
.article .pull-quote {
  font-family: "Cinzel", serif;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--sea);
  border-left: 2px solid var(--bronze);
  padding-left: 20px;
  margin: 40px 0;
  max-width: 62ch;
}
.article .signature {
  color: var(--graphite-soft);
  font-style: italic;
  margin-top: 32px;
}
.article .cta-link {
  display: inline-block;
  margin-top: 12px;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  color: var(--sea);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.article .cta-link:hover { color: var(--bronze); border-color: var(--bronze); }

/* -- Blocs photo/vidéo + texte, en alternance ---------------------------- */
.about-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
  margin: 48px 0;
}
/*.about-block .about-text p { max-width: 56ch; }*/
.about-block .about-text p:last-child { margin-bottom: 0; }

.about-media {
  margin: 0;
  border: 1px solid var(--line);
  background: var(--stone-2);
  overflow: hidden;
}
.about-media img,
.about-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink-2);
}
.about-block--photo { grid-template-columns: 1fr; }
.about-block--photo .about-lead {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 18px;
}
.about-block--photo .about-lead .about-media {
  flex: none;
  width: 140px;
  aspect-ratio: 4 / 5;
  margin: 0;
}
.about-block--photo .about-lead p { margin: 0; max-width: none; }
.about-block--photo .about-text p { max-width: none; }

@media (max-width: 480px) {
  .about-block--photo .about-lead { flex-direction: column; align-items: flex-start; }
}
.about-block--video .about-media { aspect-ratio: 16 / 9; }
.about-media figcaption {
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--graphite-soft);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

@media (max-width: 780px) {
  .about-block { grid-template-columns: 1fr; gap: 18px; margin: 36px 0; }
  .about-block .about-text p { max-width: none; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--ink);
  color: var(--sea-light);
  border-top: 1px solid var(--line-dark);
  padding: 32px 0;
  font-size: 0.85rem;
}
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
}
.site-footer a { color: var(--sea-light); }
.site-footer a:hover { color: var(--bronze-light); }
