/* ==========================================================
   Produktseite – Unter-Navigation (Registerkarten), Karten, Detailansicht
   Baut auf css/styles.css auf (Farben, Header, Buttons, Footer)
   ========================================================== */

.products-page {
  --hdr: 110px; /* Höhe des Headers, wird per JS aktualisiert */
  --sub-h: 74px; /* Höhe der Unter-Navigation, wird per JS aktualisiert */
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Kopf der Seite ---------- */
.prod-hero {
  padding: 38px 0 6px;
}

.prod-hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 3.6vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- Unter-Navigation ---------- */
.subnav-bar {
  position: sticky;
  top: var(--hdr);
  z-index: 20;
  padding: 12px 0;
  background: transparent; /* kein Balken um die Registerleiste */
  pointer-events: none;
}

.subnav-bar .container {
  pointer-events: auto;
}

.subnav-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 26px rgba(9, 41, 69, 0.06);
}

.subnav-indicator {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 10px 20px rgba(0, 92, 161, 0.28);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), width 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.subnav-tab {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: color 0.3s ease, background-color 0.25s ease;
}

.subnav-tab:hover {
  background: var(--brand-soft);
}

.subnav-tab:focus-visible {
  outline: 3px solid rgba(0, 92, 161, 0.45);
  outline-offset: 1px;
}

.tab-count {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.76rem;
  font-weight: 800;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.subnav-tab[aria-selected="true"] {
  color: #fff;
  background: transparent;
}

.subnav-tab[aria-selected="true"] .tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ---------- Panels ---------- */
.prod-panels {
  padding: 28px 0 70px;
}

.prod-panel[hidden] {
  display: none;
}

.prod-panel {
  outline: none;
  animation: panel-in 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-head {
  margin-bottom: 26px;
}

.panel-banner {
  position: relative;
  margin: 0 0 26px;
  height: clamp(130px, 17vw, 220px);
  border-radius: 28px;
  overflow: hidden;
  background: #dfeaf7;
  box-shadow: var(--shadow);
}

.panel-banner img {
  width: 100%;
  height: 134%; /* schneidet die im Bild eingebrannte Beschriftung am unteren Rand ab */
  object-fit: cover;
  object-position: center top;
}

.panel-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 18px 44px;
  align-items: start;
}

.panel-copy .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
}

.panel-copy h2 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 700;
  color: var(--ink);
}

.panel-intro p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.panel-intro p + p {
  margin-top: 12px;
}

.panel-intro a {
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 92, 161, 0.3);
}

.panel-intro a:hover {
  border-bottom-color: var(--brand);
}

/* ---------- Werkzeugleiste (Suche) ---------- */
.panel-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  margin: 8px 0 20px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.search {
  position: relative;
  flex: 0 1 360px;
  min-width: 220px;
}

.search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 92, 161, 0.14);
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-count strong {
  color: var(--brand-dark);
}

/* ---------- Produktkarten ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-grid li {
  display: flex;
  animation: card-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: calc(var(--i, 0) * 35ms);
}

.product-grid li[hidden] {
  display: none;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

.product-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 26px rgba(9, 41, 69, 0.05);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.28s ease, border-color 0.28s ease;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 92, 161, 0.28);
  box-shadow: 0 24px 44px rgba(9, 41, 69, 0.13);
}

.product-card:focus-visible {
  outline: 3px solid rgba(0, 92, 161, 0.5);
  outline-offset: 2px;
}

.product-media {
  position: relative;
  display: block;
  aspect-ratio: 5 / 4;
  background: radial-gradient(circle at 50% 38%, #ffffff 0%, var(--surface-soft) 58%, var(--brand-soft) 100%);
}

.product-media img {
  position: absolute;
  inset: 14px;
  width: calc(100% - 28px);
  height: calc(100% - 28px);
  object-fit: contain;
  mix-blend-mode: multiply; /* weiße JPG-Hintergründe verschmelzen mit der Karte */
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.product-card:hover .product-media img {
  transform: scale(1.07);
}

.product-media::after {
  content: "+";
  position: absolute;
  right: 12px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.product-card:hover .product-media::after,
.product-card:focus-visible .product-media::after {
  opacity: 1;
  transform: none;
}

.product-info {
  display: block;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
}

.product-name {
  display: block;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}

.product-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.no-results {
  margin: 30px 0 0;
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  text-align: center;
}

/* ---------- Informationskarten (Zubehör / Verschlüsse) ---------- */
.info-list {
  display: grid;
  gap: 22px;
}

.info-card {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 16px 30px rgba(9, 41, 69, 0.06);
}

.info-card:nth-child(even) {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}

.info-card:nth-child(even) .info-media {
  order: 2;
}

.info-media {
  position: relative;
  min-height: 300px;
  background: var(--surface-soft);
}

.info-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.info-card:hover .info-media img {
  transform: scale(1.04);
}

.info-body {
  padding: 30px 34px 32px;
}

.info-body .eyebrow {
  margin-bottom: 8px;
}

.info-body h3 {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 1.9vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.info-body p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.75;
}

.info-body h4 {
  margin: 18px 0 8px;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.info-body ul {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  color: var(--text);
  line-height: 1.55;
}

.info-body li {
  position: relative;
  padding: 3px 0 3px 22px;
  font-size: 0.94rem;
}

.info-body li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.78em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 92, 161, 0.12);
}

.info-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px 20px;
  margin: 6px 0 14px;
  padding: 4px 18px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
}

/* ---------- Fuß des Panels ---------- */
.panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  margin-top: 40px;
}

.panel-next {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 260px;
  padding: 18px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 14px 26px rgba(9, 41, 69, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.panel-next span {
  color: var(--brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-next strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.panel-next strong::after {
  content: " →";
  color: var(--brand);
}

.panel-next:hover {
  transform: translateX(4px);
  box-shadow: 0 20px 36px rgba(9, 41, 69, 0.1);
}

.panel-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  padding: 16px 20px 16px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, var(--brand-soft), #ffffff);
}

.panel-ask p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

/* ---------- Detailansicht ---------- */
html.modal-open {
  overflow: hidden;
}

.detail {
  width: min(1000px, calc(100% - 28px));
  max-height: min(96vh, 960px);
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: var(--surface);
  color: var(--text);
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(4, 26, 46, 0.4);
}

.detail[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.detail::backdrop {
  background: rgba(6, 28, 48, 0.58);
  backdrop-filter: blur(6px);
  animation: fade-in 0.3s ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.detail-close {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.detail-close:hover {
  background: var(--brand-soft);
  transform: rotate(90deg);
}

.detail-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--brand-dark);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.detail-media {
  display: grid;
  place-items: center;
  min-height: 320px;
  padding: 36px;
  background: radial-gradient(circle at 50% 40%, #ffffff 0%, var(--surface-soft) 55%, var(--brand-soft-strong) 100%);
}

.detail-media img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(64vh, 560px);
  mix-blend-mode: multiply;
}

.detail-copy {
  min-width: 0;
  padding: 34px 38px 26px;
}

.detail-copy h2 {
  margin: 0;
  padding-right: 40px;
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.detail-sub {
  margin: 8px 0 0;
  color: var(--brand-dark);
  font-size: 1.05rem;
  font-weight: 600;
}

.spec {
  margin: 24px 0 0;
}

.spec + .spec {
  margin-top: 18px;
}

.spec dl {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.spec dl > div {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  padding: 9px 18px;
  font-size: 0.94rem;
}

.spec dl > div:nth-child(odd) {
  background: var(--surface-soft);
}

.spec dt {
  color: var(--muted);
}

.spec dd {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.spec table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  font-size: 0.92rem;
}

.spec th,
.spec td {
  padding: 10px 14px;
  text-align: left;
}

.spec th {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.spec td {
  border-top: 1px solid var(--line);
  color: var(--ink);
}

.spec-note {
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
}

.detail-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color 0.2s ease;
}

.detail-links a:hover {
  background: var(--brand-soft-strong);
}

.detail-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.detail-actions {
  margin-top: 20px;
}

.detail-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.detail-step {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.detail-step:hover:not(:disabled) {
  background: var(--brand-soft);
}

.detail-step:disabled {
  opacity: 0.4;
  cursor: default;
}

.detail-pos {
  color: var(--muted);
  font-size: 0.84rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .subnav-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .subnav-track::-webkit-scrollbar {
    display: none;
  }

  .subnav-tab {
    flex: 0 0 auto;
    width: 190px;
    scroll-snap-align: center;
  }
}

@media (max-width: 900px) {
  .panel-copy {
    grid-template-columns: 1fr;
  }

  .info-card,
  .info-card:nth-child(even) {
    grid-template-columns: 1fr;
  }

  .info-card:nth-child(even) .info-media {
    order: 0;
  }

  .info-media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .detail-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-body {
    grid-auto-rows: max-content;
    align-content: start;
    overflow-x: hidden;
  }

  .spec table {
    display: block;
    overflow-x: auto;
  }

  .detail-step {
    padding: 0 12px;
    white-space: nowrap;
  }

  .detail-pos {
    white-space: nowrap;
  }

  .detail-media {
    min-height: 0;
    padding: 28px 28px 8px;
  }

  .detail-media img {
    max-height: 260px;
  }
}

@media (max-width: 560px) {
  .products-page {
    --hdr: 0px;
  }

  .prod-hero {
    padding-top: 24px;
  }

  .subnav-tab {
    width: 168px;
  }

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

  .product-info {
    padding: 11px 12px 13px;
  }

  .product-name {
    font-size: 0.92rem;
  }

  .info-body {
    padding: 24px 20px 26px;
  }

  .detail-copy {
    padding: 22px 20px 20px;
  }

  .spec dl > div {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px 14px;
  }

  .panel-next,
  .panel-ask {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prod-panel,
  .product-grid li,
  .detail[open],
  .detail::backdrop {
    animation: none;
  }

  .subnav-indicator,
  .product-card,
  .product-media img,
  .info-media img {
    transition: none;
  }
}
