/*
  Interface du viewer 3D multi-produits.

  La galerie de vignettes est volontairement souple pour accueillir
  progressivement plusieurs produits sans refaire la structure de la page.
*/

@font-face {
  font-family: "Bernard MT Condensed";
  src: url("./fonts/BernardMTCondensed.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-1: #d8d5cf;
  --bg-2: #b9b3a8;
  --panel: rgba(247, 245, 240, 0.84);
  --panel-border: rgba(46, 42, 36, 0.12);
  --text-main: #2a2723;
  --text-soft: #5f5850;
  --accent: #e61b21;
  --accent-strong: #e61b21;
  --shadow-soft: 0 24px 80px rgba(45, 38, 29, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text-main);
  font-family: "Segoe UI Variable", "Aptos", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 26%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}

body {
  min-height: 100vh;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(360px, 34%) minmax(0, 66%);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.page-shell > * {
  min-width: 0;
}

.hero-panel,
.viewer-panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
}

.hero-panel {
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.brand-block {
  margin: -10px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}

.brand-logo {
  display: block;
  height: 75px;
  width: auto;
  margin: 0 auto;
}

.brand-tagline {
  margin: 0;
  font-family: "Bernard MT Condensed", "Arial Narrow", serif;
  font-size: 1.77rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.06em;
  color: #7b7b7b;
}

.brand-head-logo {
  display: block;
  height: 30px;
  width: auto;
  transform: translateY(2px);
}

.hero-panel h1 {
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-align: center;
}

.product-dimensions {
  margin: -4px 0 16px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #6c645c;
  text-align: center;
}

.product-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  align-items: start;
}

.product-group {
  min-width: 0;
}

.product-group-title {
  margin: 0 0 10px;
  min-height: 2.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.03em;
  text-align: center;
  color: #3a352f;
}

.product-group-grid {
  display: grid;
  gap: 12px;
}

.product-card {
  appearance: none;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(58, 50, 42, 0.12);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.92);
  text-align: left;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
  box-shadow: 0 10px 24px rgba(44, 36, 28, 0.08);
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(44, 36, 28, 0.12);
}

.product-card.is-selected {
  border-color: rgba(200, 94, 47, 0.55);
  background: rgba(255, 246, 239, 0.98);
  box-shadow: 0 16px 32px rgba(160, 77, 35, 0.16);
}

.product-card:focus-visible {
  outline: 3px solid rgba(200, 94, 47, 0.25);
  outline-offset: 2px;
}

.product-thumbnail {
  display: block;
  width: 84%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 10px;
  background: linear-gradient(180deg, #f1ece3 0%, #d3cabd 100%);
}

.product-card-label {
  display: block;
  margin-top: 9px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  color: var(--text-main);
  text-align: center;
}

.product-card-meta {
  display: block;
  margin-top: 4px;
  color: #6c645c;
  font-size: 0.7rem;
  line-height: 1.2;
  text-align: center;
}

.seo-introduction {
  max-width: 54rem;
  margin: -4px auto 18px;
  color: #6c645c;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}

.viewer-toolbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.viewer-actions button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  color: #fff8f2;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 10px 24px rgba(160, 77, 35, 0.24);
}

.viewer-actions button:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
}

.viewer-actions button:active {
  transform: translateY(0);
}

.viewer-panel {
  padding: 16px;
}

.viewer-frame {
  position: relative;
  height: calc(100vh - 56px);
  min-height: 560px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.18) 42%, transparent 62%),
    linear-gradient(180deg, #e7e3db 0%, #c5beb0 100%);
}

#viewerCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.loading-badge {
  position: relative;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  background: rgba(255, 252, 245, 0.82);
  border: 1px solid rgba(52, 44, 37, 0.08);
  box-shadow: 0 8px 24px rgba(44, 36, 28, 0.12);
}

.loading-badge.is-ready {
  color: #295d35;
}

.loading-badge.is-error {
  color: #7a1f1f;
}

@media (max-width: 1180px) {
  .page-shell {
    grid-template-columns: minmax(300px, 33%) minmax(0, 67%);
    gap: 18px;
  }

  .hero-panel {
    padding: 24px 20px;
  }

  .product-gallery {
    gap: 10px;
  }

  .product-group-title {
    font-size: 0.92rem;
    min-height: 2.7em;
  }

  .product-group-grid {
    gap: 10px;
  }

  .product-card {
    padding: 8px;
  }

  .product-thumbnail {
    width: 74%;
  }

  .product-card-label {
    font-size: 0.78rem;
  }
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: minmax(280px, 36%) minmax(0, 64%);
    gap: 16px;
  }

  .hero-panel {
    padding: 22px 18px;
  }

  .product-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .product-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .product-thumbnail {
    width: 72%;
  }

  .product-card-label {
    font-size: 0.72rem;
  }

  .viewer-frame {
    height: min(72vh, 720px);
    min-height: 420px;
  }
}

@media (max-width: 820px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .product-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: clamp(8px, 3vw, 14px);
    gap: clamp(8px, 3vw, 14px);
  }

  .hero-panel,
  .viewer-panel {
    border-radius: 22px;
  }

  .hero-panel {
    padding: clamp(12px, 3.5vw, 22px) clamp(10px, 3vw, 18px);
  }

  .brand-logo {
    height: 64px;
  }

  .brand-row {
    gap: 8px;
  }

  .brand-tagline {
    font-size: 1.1rem;
  }

  .brand-head-logo {
    height: 24px;
    transform: translateY(1px);
  }

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

  .product-group-title {
    margin-bottom: 8px;
    font-size: 0.92rem;
    min-height: 2.7em;
  }

  .product-group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(4px, 2vw, 8px);
  }

  .product-card {
    padding: clamp(4px, 2vw, 7px);
    border-radius: 12px;
  }

  .product-thumbnail {
    width: clamp(56%, 18vw, 68%);
    border-radius: 8px;
  }

  .product-card-label {
    margin-top: clamp(3px, 1.5vw, 7px);
    font-size: clamp(0.52rem, 2.4vw, 0.74rem);
  }

  .viewer-toolbar {
    align-items: center;
    gap: 8px;
  }

  .viewer-actions button {
    padding: 8px 11px;
    font-size: 0.78rem;
  }

  .loading-badge {
    padding: 8px 0 8px 2px;
    font-size: 0.82rem;
    background: transparent;
    border: none;
    box-shadow: none;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  .product-group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .product-thumbnail {
    width: 70%;
  }

  .product-card-label {
    font-size: 0.72rem;
  }
}

@media (max-width: 280px) {
  .page-shell {
    padding: 6px;
    gap: 6px;
  }

  .hero-panel,
  .viewer-panel {
    border-radius: 16px;
  }

  .hero-panel {
    padding: 10px 8px;
  }

  .brand-block {
    margin: -4px 0 10px;
    gap: 8px;
  }

  .brand-logo {
    height: 52px;
  }

  .brand-row {
    gap: 6px;
  }

  .brand-tagline {
    font-size: 0.88rem;
  }

  .brand-head-logo {
    height: 20px;
    transform: translateY(1px);
  }

  .hero-panel h1 {
    margin-bottom: 10px;
    font-size: 1.05rem;
  }

  .product-dimensions {
    margin-bottom: 10px;
    font-size: 0.72rem;
  }

  .product-gallery {
    gap: 8px;
  }

  .product-group-title {
    min-height: 2.2em;
    margin-bottom: 6px;
    font-size: 0.78rem;
  }

  .product-group-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
  }

  .product-card {
    padding: 3px;
    border-radius: 8px;
  }

  .product-thumbnail {
    width: 54%;
    border-radius: 6px;
  }

  .product-card-label {
    margin-top: 4px;
    font-size: 0.5rem;
    line-height: 1.1;
  }

  .viewer-panel {
    padding: 10px;
  }

  .viewer-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 4px;
  }

  .viewer-actions {
    gap: 4px;
  }

  .viewer-actions button {
    padding: 6px 8px;
    font-size: 0.68rem;
  }

  .loading-badge {
    font-size: 0.7rem;
  }
}
