/* ═══════════════════════════════════════════════════════════════════════
   Lavrenroof — RAL palette
   ral.css · Interactive color picker — click to recolor the roof
   ═══════════════════════════════════════════════════════════════════════ */

.ral {
  background: var(--bg);
  padding: var(--s-11) 0;
  position: relative;
  border-top: 1px solid var(--line);
}

.ral-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  margin-bottom: 56px;
  align-items: end;
}
.ral-head .eyebrow { margin-bottom: 24px; }
.ral-head h2 {
  max-width: 18ch;
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.04;
  color: var(--ink);
}
.ral-head h2 em {
  font-style: normal;
  color: var(--accent);
}
.ral-head .meta {
  max-width: 44ch;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1.55;
}
.ral-head .meta p { color: var(--ink-3); }

/* ─── ROOF PREVIEW (image-based) ─────────────────────────────────── */
.ral-preview {
  position: relative;
  background: linear-gradient(180deg, #f8f5ef 0%, #ebe6dd 100%);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  /* Studio product shot aspect — wide enough to feel premium, tall enough
     for the portrait tile shots to read clearly */
  aspect-ratio: 20 / 9;
  margin-bottom: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Image stage — sits centered, image is contained (no cropping) */
.ral-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ral-roof-img {
  max-width: 60%;
  max-height: 86%;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.18))
          drop-shadow(0 8px 16px rgba(0, 0, 0, 0.08));
  /* Crossfade as the src swaps */
  opacity: 0;
  transform: scale(0.97);
  transition:
    opacity 420ms var(--ease),
    transform 520ms var(--ease-power);
  will-change: opacity, transform;
}
.ral-roof-img.is-loaded {
  opacity: 1;
  transform: scale(1);
}

/* Fallback panel — shown when the image fails to load */
.ral-fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  background: var(--bg);
  transition: background 600ms var(--ease-power);
}
.ral-stage.is-fallback .ral-fallback {
  display: flex;
}
.ral-stage.is-fallback .ral-roof-img {
  display: none;
}
.ral-fallback-chip {
  width: 96px;
  height: 96px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    0 12px 24px rgba(0, 0, 0, 0.08);
  transition: background-color 600ms var(--ease-power);
}
.ral-fallback-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}
.ral-fallback-label b {
  display: block;
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 4px;
}

/* Active swatch label overlay (top-left of preview) */
.ral-active {
  position: absolute;
  top: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 12px 16px;
  border-radius: 2px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  z-index: 2;
}
.ral-active-chip {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: background-color 600ms var(--ease-power);
}
.ral-active-code {
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ral-active-name {
  color: var(--ink-3);
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-sans);
  font-size: 13px;
}

/* ─── COLOR GRID ──────────────────────────────────────────────────── */
.ral-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-radius: 4px;
  overflow: hidden;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

.ral-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px 24px;
  background: var(--bg);
  border: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
  transition: background 320ms var(--ease);
	margin-right: -1px;
	margin-bottom: -1px;
}

.ral-card:hover {
  background: var(--bg-2);
}
.ral-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ral-card.is-active {
  background: var(--bg-2);
}
.ral-card.is-active::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
}

/* Swatch — solid color square */
.ral-swatch {
  width: 42px;
  height: 42px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: transform 320ms var(--ease-power);
}
.ral-card:hover .ral-swatch {
  transform: scale(1.06);
}

.ral-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ral-code {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.1;
}
.ral-code-prefix {
  font-weight: 400;
  color: var(--ink-3);
  margin-right: 4px;
}
.ral-name {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.3;
  letter-spacing: 0;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────── */
@media (max-width: 1280px) {
  /* 3 columns × ceil(10/3)=4 rows; with 10 items the last row has 1 */
  .ral-grid { grid-template-columns: repeat(3, 1fr); }
  /* Reset all border behaviour first */
}

@media (max-width: 1100px) {
  .ral-head { grid-template-columns: 1fr; gap: 24px; }
  .ral-head h2 { max-width: 22ch; }
  .ral-preview { aspect-ratio: 5 / 3; }
  .ral-roof-img { max-width: 70%; max-height: 84%; }
}

@media (max-width: 700px) {
  /* 2 columns × 5 rows = exactly 10 cards, perfectly filled */
  .ral-grid { grid-template-columns: repeat(2, 1fr); }
  .ral-card { padding: 16px 18px; gap: 14px; }
  .ral-swatch { width: 36px; height: 36px; }
  .ral-code { font-size: 14px; }
  .ral-name { font-size: 11px; }
  .ral-preview { aspect-ratio: 1 / 1; }
  .ral-roof-img { max-width: 78%; max-height: 80%; }
  .ral-fallback-chip { width: 72px; height: 72px; }
  .ral-active {
    top: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 10px;
  }
  .ral-active-name { font-size: 12px; }
}

/* ─── REDUCED MOTION ──────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ral-roof-img,
  .ral-fallback-chip,
  .ral-swatch,
  .ral-active-chip,
  .ral-card {
    transition: none !important;
    transform: none !important;
  }
}
