/*
 * form21 configurator: layout & component styles.
 * Fully scoped under .f21-configurator; abstract structural class names only.
 * Inherits the theme font + text color; derives neutrals from currentColor and
 * a couple of Kadence globals so it sits inside the theme. Mockup aesthetic:
 * hairline rules, near-square corners, no shadows, generous whitespace.
 * Adjustable knobs are the vars below.
 */

.f21-configurator {
  --f21-accent: #9c5b3b;            /* mockup terracotta; swap to var(--global-palette1) for theme accent */
  --f21-accent-contrast: #fbf7f0;
  --f21-ink: var(--global-palette3, #1a202c);
  --f21-muted: color-mix(in oklab, currentColor 55%, transparent);
  --f21-border: color-mix(in oklab, currentColor 15%, transparent);
  --f21-border-strong: color-mix(in oklab, currentColor 32%, transparent);
  --f21-surface: color-mix(in oklab, currentColor 5%, transparent);
  --f21-rail-width: 27rem;
  --f21-gap: 2.4rem;
  --f21-radius: 2px;
  --f21-bg: var(--global-palette9, #fff); /* opaque bg for the sticky footer */

  color: inherit;
  font-family: inherit;
  line-height: 1.55;
  width: 100%;
  padding-inline: clamp(1rem, 3vw, 2rem);
  padding-block-start: 1rem;
}

/* ---- isolation: universal box-sizing only; controls are neutral divs ---- */
.f21-configurator,
.f21-configurator *,
.f21-configurator *::before,
.f21-configurator *::after { box-sizing: border-box; }
.f21-configurator[x-cloak],
.f21-configurator [x-cloak] { display: none !important; }

/* interactive controls = <div class="f21-btn" role="button" tabindex="0">.
   No theme element chrome can match them; behavior/appearance via f21- classes. */
.f21-configurator .f21-btn { cursor: pointer; -webkit-user-select: none; user-select: none; }
.f21-configurator .f21-btn:focus { outline: none; }
.f21-configurator .f21-btn:focus-visible { outline: 2px solid var(--f21-accent); outline-offset: 2px; }

/* ---- layout ---- */
.f21-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--f21-rail-width);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: stretch;
}
@media (max-width: 900px) {
  .f21-layout { grid-template-columns: 1fr; }
}

/* ---- left: media (sticky within the rail's height, follows scroll) ---- */
.f21-media-sticky {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.f21-stack { display: flex; flex-direction: column; gap: 0.75rem; }
.f21-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--f21-radius);
  aspect-ratio: 16 / 10;
}
/* image containers use a background-image (cover) instead of an <img> element */
.f21-frame,
.f21-card-media {
  background-color: var(--f21-surface);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.f21-media-label {
  position: absolute;
  left: 1rem;
  bottom: 0.85rem;
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f4f0e9;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

/* ---- right: rail ---- */
.f21-rail {
  display: flex;
  flex-direction: column;
  gap: var(--f21-gap);
  max-width: var(--f21-rail-width);
}
.f21-level { display: flex; flex-direction: column; }

/* size selector: squared, hairline, no pills */
.f21-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.f21-chip {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--f21-border);
  border-radius: var(--f21-radius);
  font-size: 0.85rem;
  color: var(--f21-muted);
  transition: color 0.15s, border-color 0.15s;
}
.f21-chip.is-selected { border-color: var(--f21-border-strong); color: inherit; }

.f21-title { font-size: clamp(2rem, 4vw, 2.6rem); font-weight: 300; line-height: 1.1; letter-spacing: -0.01em; }
.f21-subline { color: var(--f21-muted); margin-top: 0.5rem; font-size: 1.0625rem; }

.f21-group-label {
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--f21-muted);
  margin-bottom: 0.35rem;
}

/* options (single-select rows), separated by hairlines */
.f21-option { display: block; width: 100%; padding: 1.05rem 0; border-top: 1px solid var(--f21-border); }
.f21-option-main { display: flex; align-items: center; gap: 0.7rem; width: 100%; }
.f21-option-name { font-size: 1rem; }
.f21-spacer { flex: 1 1 auto; }
.f21-price { font-weight: 500; white-space: nowrap; }
.f21-price-col { display: flex; flex-direction: column; align-items: flex-end; }
.f21-price-line { display: flex; align-items: baseline; }
.f21-price-note {
  font-size: 0.6875rem;
  color: var(--f21-muted);
  margin-top: 0.15rem;
  text-align: right;
}
.f21-tax {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--f21-muted);
  margin-left: 0.45rem;
}
.f21-option-desc { color: var(--f21-muted); font-size: 0.875rem; margin-top: 0.5rem; padding-left: 1.75rem; }

/* radio + check indicators */
.f21-radio,
.f21-check { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; border: 1px solid var(--f21-border-strong); position: relative; }
.f21-radio { border-radius: 50%; }
.f21-check { border-radius: var(--f21-radius); }
.f21-option.is-selected .f21-radio,
.f21-card.is-selected .f21-radio { border-color: var(--f21-accent); }
.f21-option.is-selected .f21-radio::after,
.f21-card.is-selected .f21-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--f21-accent);
}
.f21-option--checkable { display: flex; align-items: center; gap: 0.7rem; }
.f21-option--checkable.is-selected .f21-check { background: var(--f21-accent); border-color: var(--f21-accent); }
.f21-option--checkable.is-selected .f21-check::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: var(--f21-accent-contrast);
}

/* disclosure */
.f21-disclosure { margin-top: 0.85rem; }
.f21-disclosure-toggle { display: flex; gap: 0.55rem; align-items: center; font-size: 0.875rem; color: var(--f21-muted); }
.f21-disclosure-icon { width: 0.9rem; text-align: center; }
.f21-disclosure-body { color: var(--f21-muted); font-size: 0.875rem; line-height: 1.6; margin-top: 0.7rem; }

/* child-group option cards */
.f21-cards { display: flex; flex-direction: column; gap: 0.6rem; }
.f21-card { border: 1px solid var(--f21-border); border-radius: var(--f21-radius); overflow: hidden; cursor: pointer; transition: border-color 0.15s; }
.f21-card.is-selected { border-color: var(--f21-accent); }
.f21-card-media { aspect-ratio: 16 / 7; overflow: hidden; }
.f21-card-body { padding: 0.85rem 1rem 1rem; }
.f21-card-head { display: flex; align-items: center; gap: 0.7rem; }

/* "Mehr erfahren" trigger on an option */
.f21-more {
  display: inline-block;
  margin-top: 0.6rem;
  font-size: 0.8125rem;
  color: var(--f21-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* modal: reusable pattern content (block styling intentionally inherited) */
.f21-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
}
.f21-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); }
/* The panel never scrolls; only .f21-modal-body does. That keeps the close
   button (absolutely positioned against the panel) pinned in view. */
.f21-modal-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100%;
  max-width: min(76rem, 100%);
  max-height: 100%;
  background: var(--f21-bg);
  border: 1px solid var(--f21-border-strong);
  border-radius: var(--f21-radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}
.f21-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  line-height: 1;
  color: var(--f21-ink);
  background: var(--f21-bg);
  border: 1px solid var(--f21-border);
  border-radius: 50%;
}
.f21-modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  /* right padding clears the close button on the first line of content */
  padding: clamp(1.5rem, 4vw, 2.6rem);
  padding-right: clamp(3.6rem, 4vw, 4.4rem);
}
.f21-modal-body :where(img) { max-width: 100%; height: auto; }

/* summary + cta */
.f21-summary {
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--f21-bg);
  border-top: 1px solid var(--f21-border-strong);
  margin-top: 0.4rem;
  padding: 1.1rem 0 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.f21-total { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.f21-total-value { font-size: 2rem; font-weight: 300; letter-spacing: -0.01em; }
.f21-total-note { font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--f21-muted); }
.f21-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.05rem 1.5rem;
  background: var(--f21-ink);
  color: var(--f21-accent-contrast);
  border-radius: var(--f21-radius);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: opacity 0.15s;
}
.f21-cta:hover { opacity: 0.88; }

/* request view: Kadence form shown in place of the configurator */
.f21-request { padding-block: 1rem; }
.f21-request-back {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: var(--f21-accent);
  font-size: 0.9rem;
}
.f21-request-form { max-width: 42rem; }
.f21-request-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 1.2rem;
}
/* the summary field carries the config payload but is never shown to the visitor */
.f21-request .f21-summary { display: none !important; }

/* human-readable configuration summary above the form */
.f21-request-summary {
  max-width: 42rem;
  margin-bottom: 2rem;
  padding: 1.4rem 1.6rem;
  border: 1px solid var(--f21-border);
  border-radius: var(--f21-radius);
}
.f21-request-heading {
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--f21-muted);
  margin-bottom: 0.9rem;
}
.f21-sum-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--f21-border);
}
.f21-sum-key { color: var(--f21-muted); font-size: 0.85rem; }
.f21-sum-val { text-align: right; }
.f21-sum-price { color: var(--f21-muted); white-space: nowrap; }
.f21-sum-row--stack .f21-sum-val { display: flex; flex-direction: column; gap: 0.3rem; }
.f21-sum-item { display: block; }
.f21-sum-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--f21-border-strong);
}
.f21-sum-total-val { font-size: 1.4rem; font-weight: 500; }
.f21-sum-note {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--f21-muted);
  margin-top: 0.3rem;
  text-align: right;
}
