/* ============================================================================
   Demo-Widget — Sticky-Sidebar rechts mittig
   Theme-Swap (Tann/Kupfer/Tinte) + Light/Dark/Auto. Tastaturbedienbar.
   ============================================================================ */

/* Wrapper ist nur logischer Container, kein Flex — Handle und Panel positionieren sich beide fix */
.demo-widget {
  pointer-events: none;
}

.demo-widget__panel,
.demo-widget__handle {
  pointer-events: auto;
}

/* Handle: klebt immer am rechten Rand, unabhängig vom Panel-Zustand */
.demo-widget__handle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1080;
  width: 32px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-primary);
  color: var(--ds-on-primary);
  border: 0;
  border-radius: var(--ds-radius) 0 0 var(--ds-radius);
  cursor: pointer;
  font: 600 12px/1 var(--ds-font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 28px 0;
  writing-mode: vertical-rl;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
  transition: background var(--ds-dur) var(--ds-ease),
              right var(--ds-dur-slow) var(--ds-ease-out);
}

.demo-widget__handle:hover,
.demo-widget__handle:focus-visible {
  background: var(--ds-primary-hover);
  outline: none;
}

/* Panel: separat fixiert, schiebt sich vom rechten Rand herein */
.demo-widget__panel {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(100%);
  z-index: 1079;
  width: 240px;
  max-width: calc(100vw - 28px);
  padding: 16px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  transition: transform var(--ds-dur-slow) var(--ds-ease-out),
              visibility 0s linear var(--ds-dur-slow);
  visibility: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--ds-text);
}

.demo-widget[data-open="true"] .demo-widget__panel {
  transform: translateY(-50%) translateX(0);
  visibility: visible;
  min-height: 280px;
  transition: transform var(--ds-dur-slow) var(--ds-ease-out),
              visibility 0s linear 0s;
}

/* Wenn Panel offen ist, schiebt sich der Handle mit nach links */
.demo-widget[data-open="true"] .demo-widget__handle {
  right: 240px;
}
@media (max-width: 480px) {
  .demo-widget[data-open="true"] .demo-widget__handle {
    right: 200px;
  }
}

/* Sektionen */
.demo-widget__section-label {
  font: 500 10px/1 var(--ds-font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ds-text-subtle);
  margin: 0 0 6px;
}

.demo-widget__hint {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ds-text-subtle);
  margin: 0;
}

/* Theme-Swatches */
.demo-widget__themes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.demo-widget__theme-btn {
  border: 2px solid transparent;
  background: transparent;
  border-radius: var(--ds-radius);
  padding: 6px 4px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color var(--ds-dur-fast) var(--ds-ease);
}

.demo-widget__theme-btn[aria-pressed="true"] {
  border-color: var(--ds-text);
}

.demo-widget__theme-btn:focus-visible {
  outline: none;
  border-color: var(--ds-text);
  box-shadow: var(--ds-focus-ring);
}

.demo-widget__swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--ds-border);
}

.demo-widget__theme-btn[data-theme="tann"] .demo-widget__swatch  { background: #2E6B4F; }
.demo-widget__theme-btn[data-theme="kupfer"] .demo-widget__swatch { background: #B85C38; }
.demo-widget__theme-btn[data-theme="tinte"] .demo-widget__swatch  { background: #3A4A8C; }

.demo-widget__theme-label {
  font-size: 10px;
  color: var(--ds-text-muted);
}

/* Surface-Segmented-Control */
.demo-widget__surface {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  background: var(--ds-surface-sunken);
  border-radius: var(--ds-radius);
}

.demo-widget__surface-btn {
  border: 0;
  background: transparent;
  padding: 6px 4px;
  border-radius: calc(var(--ds-radius) - 2px);
  cursor: pointer;
  font-size: 11px;
  color: var(--ds-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background var(--ds-dur-fast) var(--ds-ease),
              color var(--ds-dur-fast) var(--ds-ease);
}

.demo-widget__surface-btn[aria-pressed="true"] {
  background: var(--ds-surface);
  color: var(--ds-text);
  box-shadow: var(--ds-shadow-sm);
}

.demo-widget__surface-btn:focus-visible {
  outline: none;
  box-shadow: var(--ds-focus-ring);
}

.demo-widget__icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ============================================================================
   Hero-Panel — Headline groß, Eyebrow heller, Buttons mit klarer Hierarchie
   ============================================================================ */
.st-hero .panel-heading {
  padding: 32px 32px 0;
}
.st-hero .panel-title {
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
  letter-spacing: var(--ds-tracking-tight);
  line-height: var(--ds-leading-tight);
  text-wrap: balance;
}
.st-hero .panel-body { padding: 16px 32px 32px; }
.st-hero .ds-eyebrow {
  color: rgba(255, 255, 255, 0.78);
}
.st-hero .lead {
  font-size: 1.25rem;
  opacity: 0.92;
  max-width: 56ch;
}

/* Hero-Buttons: solid mit Schatten, outline mit stärkerer Border */
.st-hero .btn-light {
  background: #fff;
  color: var(--ds-primary-active);
  border-color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.st-hero .btn-light:hover,
.st-hero .btn-light:focus-visible {
  background: var(--ds-primary-subtle);
  color: var(--ds-primary-active);
  border-color: var(--ds-primary-subtle);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}
.st-hero .btn-outline-light {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
  border-width: 1.5px;
  font-weight: 500;
}
.st-hero .btn-outline-light:hover,
.st-hero .btn-outline-light:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.85);
}

/* Meta-Zeile unter Buttons: leicht transparent */
.st-hero .st-hero__meta {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.875rem;
}
.st-hero .st-hero__meta i { color: rgba(255, 255, 255, 0.95); }

/* ============================================================================
   Final CTA (Panel unten) — abgerundeter Kasten mit Glow-Gradient.
   Vorlage: T3Bootstrap Demo/sections.jsx → .st-cta + .st-cta__glow
   ============================================================================ */
.st-cta {
  /* Etwas Luft zum Viewport-Rand — visuell als Kasten, nicht als Banner */
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}
.st-cta .panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--ds-radius-xl, 1.5rem);
  border: 0;
  box-shadow: 0 20px 50px -20px rgba(46, 107, 79, 0.55);
}
/* Radial Glow oben — bricht das einfarbige Grün auf */
.st-cta .panel::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto;
  height: 320px;
  background: radial-gradient(
    circle at 50% 0,
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0) 60%
  );
  pointer-events: none;
  z-index: 0;
}
/* Diagonaler Sekundär-Verlauf für mehr Tiefe */
.st-cta .panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(0, 0, 0, 0.12) 100%
  );
  pointer-events: none;
  z-index: 0;
}
/* Inhalte über die Overlays heben */
.st-cta .panel-heading,
.st-cta .panel-body {
  position: relative;
  z-index: 1;
}
.st-cta .panel-heading {
  padding: 48px 32px 0;
  text-align: center;
}
.st-cta .panel-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
}
.st-cta .panel-body {
  padding: 20px;
  text-align: center;
}

/* ============================================================================
   Floating Lizenz-kaufen-Button — unten rechts auf allen Seiten
   ============================================================================ */
.license-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1070;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.4rem;
  background: var(--ds-primary);
  color: var(--ds-on-primary) !important;
  border-radius: var(--ds-radius-pill);
  font: 600 0.9375rem/1 var(--ds-font-sans);
  text-decoration: none !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform var(--ds-dur) var(--ds-ease),
              box-shadow var(--ds-dur) var(--ds-ease),
              background var(--ds-dur) var(--ds-ease);
}
.license-fab:hover,
.license-fab:focus-visible {
  background: var(--ds-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22), 0 4px 10px rgba(0, 0, 0, 0.10);
  outline: none;
}
.license-fab:focus-visible {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 0 0 4px color-mix(in srgb, var(--ds-primary) 35%, transparent);
}
.license-fab i {
  font-size: 1.1em;
}

/* Bei sehr schmalen Viewports: nur Icon, Label im sr-only */
@media (max-width: 480px) {
  .license-fab {
    right: 16px;
    bottom: 16px;
    padding: 0.85rem 1rem;
  }
  .license-fab span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Mobile: bei sehr schmalen Screens komplett ausblendbar */
@media (max-width: 480px) {
  .demo-widget__panel {
    width: 200px;
  }
}
