/*
 * Rúdtervező - only the configurator components. Everything else (header, footer, form-box, buttons,
 * typography, theme) comes from the live site's main.css and its --alafa-* tokens.
 * No :root / html / body / header / footer rules here.
 */

/* ---------- 3D preview slot (inside the product page's .gallery) ---------- */
.rt-frame {
  border: 1px solid var(--alafa-brown);
  background: var(--alafa-bg-card);
  box-shadow: 0 8px 24px var(--alafa-shadow);
  overflow: hidden;
}
.rt-stage {
  position: relative;
  width: 100%;
  height: clamp(260px, 72vw, 340px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 70% 60% at 50% 62%, var(--alafa-bg-card), var(--alafa-bg));
}
/* white paint must read white: a deeper warm backdrop in the light theme */
html[data-theme="light"] .rt-stage {
  background: radial-gradient(ellipse 70% 60% at 50% 62%, #ddc79b, #b79c6a 85%);
}
@media (min-width: 861px) {
  .rt-stage { height: clamp(380px, 52vh, 520px); }
  .rt-preview { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
}
.rt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.rt-canvas:active { cursor: grabbing; }
.rt-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 12px;
  border-top: 1px solid var(--alafa-brown);
}
.rt-hint { margin: 0; flex: 1 1 14rem; font-size: 0.85rem; color: var(--alafa-cream-muted); }

.rt-summary {
  margin-top: 12px;
  padding: 10px 14px;
  border-left: 4px solid var(--alafa-gold);
  background: var(--alafa-bg-card);
}
.rt-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--alafa-cream-muted);
}
.rt-summary-text {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--alafa-cream);
  overflow-wrap: anywhere;
}

/* 2D fallback: striped bar */
.rt-fallback { width: 100%; padding: 24px 16px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.rt-fallback-pole { width: min(100%, 520px); display: flex; align-items: stretch; height: 48px; filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.35)); }
.rt-fallback-bar { flex: 1; display: flex; border-block: 1px solid rgba(0, 0, 0, 0.35); }
.rt-fallback-stripe { flex: 1 1 0; min-width: 0; transition: background-color 0.25s ease, box-shadow 0.2s ease; }
.rt-fallback-stripe.is-selected { box-shadow: inset 0 0 0 3px var(--alafa-gold); }
.rt-fallback-cap { width: 11px; background: #d8b67d; border: 1px solid #8a6330; }
.rt-fallback-cap:first-child { border-radius: 8px 0 0 8px; }
.rt-fallback-cap:last-child { border-radius: 0 8px 8px 0; }
.rt-fallback-message { margin: 0; max-width: 40ch; text-align: center; color: var(--alafa-cream-muted); font-size: 0.9rem; }

/* ---------- Configurator (a .form-box from the site) ---------- */
.rt-box { margin-top: 16px; }
.rt-box :focus-visible { outline: 3px solid var(--alafa-cream); outline-offset: 3px; }
.rt-group { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.rt-group:last-child { margin-bottom: 0; }
.rt-group > legend,
.rt-title {
  display: block;
  padding: 0;
  margin: 0 0 8px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--alafa-cream-muted);
}

/* segmented control: 3 / 4 / 5 / Végcsíkos */
.rt-seg { display: flex; flex-wrap: wrap; max-width: 100%; border: 1px solid var(--alafa-brown-light); width: fit-content; }
.rt-seg-option { position: relative; display: block; }
.rt-seg-option input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rt-seg-face {
  display: grid;
  place-items: center;
  min-width: 56px;
  min-height: 48px;
  padding: 0 16px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--alafa-bg-card);
  color: var(--alafa-cream);
  transition: background-color 0.15s, color 0.15s;
}
.rt-seg-option[data-option="v"] .rt-seg-face { font-family: var(--font-sans); font-size: 0.95rem; padding: 0 18px; }
.rt-seg-option + .rt-seg-option .rt-seg-face { border-left: 1px solid var(--alafa-brown-light); }
.rt-seg-option:hover .rt-seg-face { background: var(--alafa-brown); }
.rt-seg-option input:checked + .rt-seg-face { background: var(--alafa-gold); color: var(--alafa-on-gold); }
.rt-seg-option input:focus-visible + .rt-seg-face { outline: 3px solid var(--alafa-cream); outline-offset: -5px; }

/* preset chips */
.rt-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.rt-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 14px 4px 8px;
  font: inherit;
  font-size: 0.92rem;
  color: var(--alafa-cream);
  background: var(--alafa-bg-card);
  border: 1px solid var(--alafa-brown-light);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.rt-chip:hover { background: var(--alafa-brown); }
.rt-chip[aria-pressed="true"] { border-color: var(--alafa-gold); box-shadow: 0 0 0 2px var(--alafa-gold) inset; font-weight: 700; }
.rt-preset-stripes { display: inline-flex; width: 34px; height: 16px; overflow: hidden; border: 1px solid rgba(0, 0, 0, 0.4); }
.rt-preset-stripes span { flex: 1; }

/* colour rows */
#section-rows { display: flex; flex-direction: column; gap: 8px; }
.rt-row {
  padding: 8px 12px 10px;
  border: 1px solid var(--alafa-brown);
  border-left: 4px solid var(--alafa-brown);
  background: var(--alafa-bg-card);
  transition: border-color 0.2s;
}
.rt-row.is-selected { border-color: var(--alafa-gold); }
.rt-row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.rt-row-title { font-weight: 700; font-size: 0.95rem; color: var(--alafa-cream); }
.rt-row-color { font-size: 0.9rem; color: var(--alafa-cream-muted); }
.rt-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; padding: 6px 4px; }
.rt-swatch { position: relative; display: block; width: 100%; aspect-ratio: 1; max-width: 44px; cursor: pointer; }
.rt-swatch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rt-swatch-chip {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.rt-swatch:hover .rt-swatch-chip { transform: scale(1.08); }
.rt-tick { opacity: 0; transform: scale(0.4); font-size: 1.25rem; font-weight: 900; line-height: 1; transition: opacity 0.15s, transform 0.15s; }
.rt-swatch-chip[data-tone="light"] { color: #1a1209; }
.rt-swatch-chip[data-tone="dark"] { color: #ffffff; }
.rt-swatch input:checked + .rt-swatch-chip { box-shadow: 0 0 0 3px var(--alafa-bg-card), 0 0 0 6px var(--alafa-cream); transform: scale(0.92); }
.rt-swatch input:checked + .rt-swatch-chip .rt-tick { opacity: 1; transform: scale(1); }
.rt-swatch input:focus-visible + .rt-swatch-chip { outline: 3px solid var(--alafa-cream); outline-offset: 6px; }

/* quantity stepper */
.rt-stepper { display: inline-flex; align-items: stretch; gap: 0; border: 1px solid var(--alafa-brown-light); }
.rt-stepper .rt-step { min-width: 48px; padding: 0; font-size: 1.5rem; line-height: 1; border: 0; background: var(--alafa-bg-card); color: var(--alafa-cream) !important; }
.rt-stepper .rt-step:hover:not(:disabled) { background: var(--alafa-gold); color: var(--alafa-on-gold) !important; }
.rt-stepper .rt-step:disabled { opacity: 0.45; cursor: not-allowed; }
.rt-stepper input {
  width: 88px;
  min-height: 48px;
  text-align: center;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--alafa-cream);
  background: var(--alafa-bg-card);
  border: 0;
  border-inline: 1px solid var(--alafa-brown-light);
  border-radius: 0;
  appearance: textfield;
  -moz-appearance: textfield;
}
.rt-stepper input::-webkit-outer-spin-button,
.rt-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rt-stepper:focus-within { outline: 3px solid var(--alafa-cream); outline-offset: 2px; }
.rt-stepper :focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  .rt-box *, .rt-fallback-stripe { transition-duration: 0.001ms !important; }
}

/* the site's .btn sets display, which would defeat the hidden attribute on our buttons */
.rt-preview [hidden],
.rt-box [hidden] { display: none !important; }
