/* ==========================================================================
   HÄNDLERBEREICH — geschützter Partner-Bereich
   Baut auf den Tokens & Komponenten aus style.css auf (--red, --cream,
   --near-black, .btn, .section-label, .footer …). Eigene Klassen: .hb-*
   ========================================================================== */

/* --------------------------------------------------------------------------
   LOGIN — atmosphärischer, dunkler Gateway mit zentrierter Cream-Karte
   -------------------------------------------------------------------------- */
.hb-login-body {
  min-height: 100vh;
  background: var(--near-black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-sm);
}

.hb-login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 18% -5%, color-mix(in srgb, var(--red) 26%, transparent), transparent 60%),
    radial-gradient(ellipse 80% 60% at 100% 105%, color-mix(in srgb, var(--charcoal) 70%, transparent), transparent 55%),
    var(--near-black);
}

.hb-login {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 30rem;
}

.hb-login-card {
  background: var(--cream);
  border-radius: var(--radius-lg);
  padding: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--white) 60%, transparent) inset,
    0 30px 70px color-mix(in srgb, #000 50%, transparent),
    0 10px 30px color-mix(in srgb, var(--red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--white) 40%, transparent);
}

.hb-login-logo {
  display: inline-flex;
  margin-bottom: var(--space-md);
}
.hb-login-logo img { height: 2.4rem; width: auto; }
.hb-login-logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.hb-login-card .section-label { display: block; margin-bottom: 0.6rem; }

.hb-login-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--near-black);
  line-height: 1.05;
  margin-bottom: 0.75rem;
}

.hb-login-sub {
  font-size: var(--text-sm);
  color: var(--charcoal);
  line-height: 1.65;
  margin-bottom: var(--space-md);
  max-width: 26rem;
}

/* Fehler-/Hinweis-Banner */
.hb-alert {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  border: 1px solid transparent;
}
.hb-alert.is-error {
  background: color-mix(in srgb, var(--red) 10%, var(--white));
  border-color: color-mix(in srgb, var(--red) 35%, transparent);
  color: var(--red-dark);
}
.hb-alert.is-info {
  background: color-mix(in srgb, var(--charcoal) 8%, var(--white));
  border-color: color-mix(in srgb, var(--charcoal) 25%, transparent);
  color: var(--charcoal);
}

/* Formular */
.hb-form { display: flex; flex-direction: column; gap: var(--space-sm); }

.hb-field { display: flex; flex-direction: column; gap: 0.4rem; }

.hb-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--charcoal);
}

.hb-field input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 0.9rem 1rem;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.hb-field input::placeholder { color: color-mix(in srgb, var(--charcoal) 50%, transparent); }
.hb-field input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 16%, transparent);
}

.cf-turnstile { min-height: 65px; }

.hb-submit { width: 100%; justify-content: center; margin-top: 0.25rem; }

.hb-login-foot {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--cream-dark);
  font-size: var(--text-sm);
}
.hb-login-foot a { color: var(--charcoal); }
.hb-login-foot a:hover { color: var(--red); }

/* Sanfte Einblend-Animation der Karte */
@media (prefers-reduced-motion: no-preference) {
  .hb-login-card { animation: hb-rise 0.7s var(--ease-out) both; }
}

/* --------------------------------------------------------------------------
   PORTAL — Begrüßungs-/Status-Leiste mit Abmelden
   -------------------------------------------------------------------------- */
.hb-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: 0.9rem 1.25rem;
  background: color-mix(in srgb, var(--red) 6%, var(--white));
  border: 1px solid color-mix(in srgb, var(--red) 18%, transparent);
  border-radius: var(--radius-md);
}
.hb-bar-status {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  color: var(--charcoal);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.hb-bar-dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: #2e9e5b;
  box-shadow: 0 0 0 3px color-mix(in srgb, #2e9e5b 22%, transparent);
}
.hb-bar-status strong { color: var(--near-black); font-weight: 600; }

.hb-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--near-black);
  padding: 0.5rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--near-black) 22%, transparent);
  border-radius: 0;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.hb-logout:hover { background: var(--near-black); color: var(--white); border-color: var(--near-black); }
.hb-logout:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   KATEGORIE-GRID (Landing)
   -------------------------------------------------------------------------- */
.hb-cats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--grid-gap);
}
@media (min-width: 601px) { .hb-cats { grid-column: 2 / 24; grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 901px) { .hb-cats { grid-template-columns: repeat(3, 1fr); } }

.hb-cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: var(--space-md);
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--duration-med) var(--ease-out),
              box-shadow var(--duration-med) var(--ease-out),
              border-color var(--duration-med) var(--ease-out);
}
.hb-cat-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-med) var(--ease-out);
  z-index: 1;
}
.hb-cat-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--red) 30%, var(--cream-dark));
  box-shadow:
    0 1px 2px color-mix(in srgb, #000 6%, transparent),
    0 18px 40px color-mix(in srgb, var(--near-black) 12%, transparent),
    0 6px 16px color-mix(in srgb, var(--red) 8%, transparent);
}
.hb-cat-card:hover::after { transform: scaleX(1); }
.hb-cat-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.hb-cat-icon {
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--red) 10%, var(--white));
  color: var(--red);
  margin-bottom: 0.25rem;
}
.hb-cat-icon svg { width: 1.6rem; height: 1.6rem; }

.hb-cat-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--near-black);
}
.hb-cat-desc { font-size: var(--text-sm); color: var(--charcoal); line-height: 1.6; flex-grow: 1; }
.hb-cat-go {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: var(--text-xs);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--red);
  margin-top: 0.5rem;
}
.hb-cat-card:hover .hb-cat-go svg { transform: translateX(4px); }
.hb-cat-go svg { width: 1rem; height: 1rem; transition: transform var(--duration-fast) var(--ease-out); }

/* gestaffelte Einblendung */
@media (prefers-reduced-motion: no-preference) {
  .hb-cat-card { animation: hb-rise 0.6s var(--ease-out) both; }
  .hb-cat-card:nth-child(2) { animation-delay: 0.06s; }
  .hb-cat-card:nth-child(3) { animation-delay: 0.12s; }
  .hb-cat-card:nth-child(4) { animation-delay: 0.18s; }
  .hb-cat-card:nth-child(5) { animation-delay: 0.24s; }
}

/* --------------------------------------------------------------------------
   DATEI-LISTE (Kategorie-Seiten)
   -------------------------------------------------------------------------- */
.hb-files {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
@media (min-width: 601px) { .hb-files { grid-column: 2 / 24; } }

.hb-file {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.hb-file:hover {
  border-color: color-mix(in srgb, var(--red) 28%, var(--cream-dark));
  box-shadow: 0 8px 22px color-mix(in srgb, var(--near-black) 9%, transparent);
}

.hb-file-badge {
  flex-shrink: 0;
  width: 3rem; height: 3rem;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--charcoal) 10%, var(--white));
  color: var(--charcoal);
}
.hb-file-badge[data-ext="pdf"] { background: color-mix(in srgb, var(--red) 12%, var(--white)); color: var(--red-dark); }
.hb-file-badge[data-ext="img"] { background: color-mix(in srgb, #2e7d9e 14%, var(--white)); color: #1f6680; }
.hb-file-badge[data-ext="zip"] { background: color-mix(in srgb, #8a6d1f 16%, var(--white)); color: #6f5616; }

.hb-file-main { flex-grow: 1; min-width: 0; }
.hb-file-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--near-black);
  word-break: break-word;
}
.hb-file-meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.hb-file-dl {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--white);
  background: var(--red);
  padding: 0.6rem 1.1rem;
  border-radius: 0;
  transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.hb-file-dl:hover { background: var(--red-dark); }
.hb-file-dl:active { transform: scale(0.97); }
.hb-file-dl:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.hb-file-dl svg { width: 1.05rem; height: 1.05rem; }
@media (max-width: 480px) {
  .hb-file-dl span { display: none; }
  .hb-file-dl { padding: 0.6rem 0.75rem; }
}

/* Lade- / Leer- / Fehler-Zustände */
.hb-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-lg) var(--space-md);
  border: 1px dashed var(--cream-dark);
  border-radius: var(--radius-md);
  color: var(--charcoal);
}
@media (min-width: 601px) { .hb-state { grid-column: 2 / 24; } }
.hb-state-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 600; color: var(--near-black); margin-bottom: 0.4rem; }
.hb-state-text { font-size: var(--text-sm); }
.hb-state.is-error { border-color: color-mix(in srgb, var(--red) 35%, transparent); border-style: solid; background: color-mix(in srgb, var(--red) 5%, var(--white)); }

.hb-skel {
  height: 4.6rem;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--charcoal) 6%, var(--white)) 25%,
    color-mix(in srgb, var(--charcoal) 12%, var(--white)) 37%,
    color-mix(in srgb, var(--charcoal) 6%, var(--white)) 63%);
  background-size: 400% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .hb-skel { animation: hb-shimmer 1.4s ease infinite; }
}

.hb-back {
  grid-column: 1 / -1;
  margin-top: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
@media (min-width: 601px) { .hb-back { grid-column: 2 / 24; } }
.hb-back a { color: var(--charcoal); display: inline-flex; align-items: center; gap: 0.45rem; }
.hb-back a:hover { color: var(--red); }

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */
@keyframes hb-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes hb-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}
