/*
  Zweck: Kartenlayout und Kartenoberflächen der Modulansicht.
  Zielpfad: public_html/design/components-cards.css
  Verantwortlich: mckie-Portal
*/
.module-view {
  flex: 1;
  min-height: 0;
  margin-top: clamp(0.75rem, 2vw, 1.25rem);
  overflow: auto;
  scroll-margin-top: 1rem;
}

.module-view.is-history,
.module-view.is-single {
  overflow: auto;
}

.module-stack {
  display: grid;
  align-content: start;
  gap: 0.75rem;
  height: auto;
  min-height: auto;
}

.module-stack:has(.module-card:nth-child(2)) {
  grid-template-rows: minmax(18rem, auto) minmax(8rem, auto);
}

.module-stack:has(.module-card:nth-child(3)) {
  grid-template-rows: minmax(18rem, auto) repeat(2, minmax(7rem, auto));
}

.module-stack:has(.module-card:nth-child(4)) {
  grid-template-rows: minmax(16rem, auto) repeat(3, minmax(6.25rem, auto));
}

.module-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(13rem, 0.62fr) minmax(20rem, 1fr);
  gap: clamp(1rem, 3vw, 2rem);
  min-width: 0;
  min-height: clamp(14rem, 38svh, 26rem);
  padding: clamp(1rem, 3vw, 2rem);
  overflow: visible;
  background:
    linear-gradient(180deg, var(--wash-white-5), transparent 34%),
    linear-gradient(90deg, color-mix(in srgb, var(--tone) 10%, transparent), transparent 46%), var(--panel-soft);
  border: 0;
  border-radius: var(--radius-lg);
  clip-path: none;
  box-shadow:
    inset 0 0 0 var(--segment-line-thin) var(--wash-white-5),
    inset 0 -2.5rem 5rem var(--wash-black-22);
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-top: var(--segment-rail) solid var(--tone, var(--orange));
  border-right: var(--segment-line-thin) solid color-mix(in srgb, var(--tone) 34%, transparent);
  border-bottom: var(--segment-line-thin) solid color-mix(in srgb, var(--tone) 22%, transparent);
  border-left: var(--segment-line-strong) solid color-mix(in srgb, var(--tone) 78%, transparent);
  border-radius: inherit;
  box-shadow:
    inset var(--dock-offset-sm) 0 0 color-mix(in srgb, var(--tone) 18%, transparent),
    inset calc(-1 * var(--dock-offset-sm)) 0 0 var(--wash-black-18);
  opacity: var(--segment-opacity-strong);
  pointer-events: none;
}

.module-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: calc(var(--dock-offset-lg) + var(--step-corner-sm));
  width: min(42%, var(--segment-guide-medium));
  height: var(--segment-rail);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--tone, var(--orange)) 90%, transparent),
    color-mix(in srgb, var(--tone, var(--orange)) 42%, transparent),
    transparent
  );
  border-radius: 0 0 var(--radius-pill) 0;
  opacity: var(--segment-opacity-strong);
  pointer-events: none;
}

.module-card.is-secondary {
  min-height: 7rem;
  cursor: pointer;
  opacity: 0.86;
}

.module-card.is-secondary::before {
  border-top-width: var(--segment-line-strong);
  border-left-width: var(--segment-line);
  opacity: var(--segment-opacity-soft);
}

.module-card.is-secondary::after {
  display: none;
}

.module-card.is-secondary:hover,
.module-card.is-secondary:focus-visible {
  opacity: 1;
  filter: brightness(1.08);
}

.module-card.is-secondary .module-intro h2 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.module-card.is-secondary .module-description {
  display: none;
}

.module-card.is-secondary .segment-link-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: calc(var(--console-matrix-gap) * 2);
}

.module-card.is-secondary .segment-link {
  --segment-cap-width: 3.75rem;
  align-self: stretch;
  min-width: 0;
  min-height: 4.25rem;
  height: 100%;
}

.module-card.is-secondary .segment-link__body {
  align-self: stretch;
  justify-content: center;
}

.module-card.is-secondary .segment-link__body strong {
  font-size: 0.95rem;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.module-card.is-secondary .segment-link__body span {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.1;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.module-intro .system-label {
  color: var(--tone, var(--orange));
}

.module-intro {
  container-type: inline-size;
  min-width: 0;
}

.module-intro h2 {
  margin-bottom: 1rem;
  color: var(--peach);
  font-size: clamp(1rem, 14cqi, 4.35rem);
  line-height: 0.92;
  /* Lange/zweiwortige Titel (z. B. „ZENTRALE INHALTE") umbrechen lassen statt waagerecht in die
     Modulspalte zu überlaufen. Schriftgröße bleibt cqi-gedeckelt → Kachel wird nicht riesig. */
  white-space: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
  text-transform: uppercase;
}

.module-description,
.module-meta {
  color: var(--muted);
  font-size: 1.1rem;
}

.module-meta {
  color: var(--text);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
