/* ── Variables (set by JS from portal.json theme) ──────────────────────────── */
:root {
  --primary:    #C8A96E;
  --secondary:  #5B8A5E;
  --bg:         #FAF8F5;
  --text:       #1a1a1a;
  --text2:      #666666;
  --text3:      #999999;
  --border:     rgba(0,0,0,0.08);
  --card-bg:    rgba(0,0,0,0.03);
  --shadow:     0 2px 16px rgba(0,0,0,0.08);
  --radius:     12px;
  --radius-sm:  6px;
  --font-hl:    Georgia, serif;
  --font-body:  Arial, Helvetica, sans-serif;
  --font-mono:  "SF Mono", Menlo, monospace;
  --max-w:      960px;
  --gap:        6px;
}

/* ── Dark mode ─────────────────────────────────────────────────────────────── */
body.dark {
  --bg:      #111111;
  --text:    #eeeeee;
  --text2:   #aaaaaa;
  --text3:   #666666;
  --border:  rgba(255,255,255,0.12);
  --card-bg: rgba(255,255,255,0.16);
  --shadow:  0 2px 16px rgba(0,0,0,0.4);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

body.loading { overflow: hidden; }

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* ── Loader ────────────────────────────────────────────────────────────────── */
.loader {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}
.loader.fade-out { opacity: 0; pointer-events: none; }
.loader-ring {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Hero ──────────────────────────────────────────────────────────────────── */
.hero {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 80vh;
  overflow: hidden;
  position: relative;
  background: #000;
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.92;
}
.hero video {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
}
.hero-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.25);
}
.hero-play-btn {
  width: 64px; height: 64px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  padding-left: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  transition: transform 0.2s, background 0.2s;
}
.hero-play-btn:hover { transform: scale(1.08); background: white; }

/* ── Portal header ─────────────────────────────────────────────────────────── */
.portal-header {
  text-align: center;
  padding: 48px 24px 32px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.portal-title {
  font-family: var(--font-hl);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: normal;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.portal-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px auto 0;
  max-width: 300px;
  color: var(--primary);
  opacity: 0.6;
}
.portal-divider::before,
.portal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--primary);
  opacity: 0.4;
}

/* ── Group navigation bar ───────────────────────────────────────────────────── */
.group-nav {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 100;
}
.group-nav--visible {
  opacity: 1;
  pointer-events: auto;
}

/* Desktop: vertical scrubber on the right */
@media (min-width: 601px) {
  .group-nav {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 10px 0;
  }
  .group-nav-item {
    background: none;
    border: none;
    border-right: 2px solid transparent;
    color: var(--text3);
    font-family: var(--font-body);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    padding: 4px 12px 4px 20px;
    cursor: pointer;
    text-align: right;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .group-nav-item:hover { color: var(--text); border-right-color: var(--text3); }
  .group-nav-item.active {
    color: var(--primary);
    border-right-color: var(--primary);
    font-weight: 600;
  }
}

/* Mobile: horizontal strip at the bottom */
@media (max-width: 600px) {
  .group-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 0 8px;
    gap: 0;
  }
  .group-nav::-webkit-scrollbar { display: none; }
  .group-nav-item {
    flex-shrink: 0;
    background: none;
    border: none;
    border-top: 2px solid transparent;
    color: var(--text3);
    font-family: var(--font-body);
    font-size: 0.78rem;
    padding: 10px 14px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
  }
  .group-nav-item:active { opacity: 0.7; }
  .group-nav-item.active {
    color: var(--primary);
    border-top-color: var(--primary);
    font-weight: 600;
  }
}

/* ── Intro text ────────────────────────────────────────────────────────────── */
.portal-intro {
  max-width: 640px;
  margin: 24px auto 0;
  padding: 0 24px 50px;
  text-align: center;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  opacity: 0.8;
}

/* ── Stats section ─────────────────────────────────────────────────────────── */
.stats-title {
  max-width: var(--max-w);
  margin: 0 auto 16px;
  padding: 0 24px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);

  gap: 10px;
  max-width: var(--max-w);
  margin: 0 auto 40px;
  padding: 0 24px;
}
.stat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.03);
  min-height: 64px;
  min-width: 0;
}
body.dark .stat-item {
  border-color: rgba(0,0,0,.08);
  background: rgba(255,255,255,.7);
  backdrop-filter: saturate(140%) blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.stat-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(0,0,0,.04);
  font-size: 20px;
  flex: 0 0 40px;
  margin-top: 2px;
}
body.dark .stat-icon { background: rgba(0,0,0,.04); }
.stat-body { min-width: 0; }
.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}
body.dark .stat-value {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0,0,0,.88);
}
.stat-label {
  font-size: 12px;
  color: rgba(0,0,0,.55);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ── Main content ──────────────────────────────────────────────────────────── */
.portal-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── Season section ────────────────────────────────────────────────────────── */
.season-section {
  margin-bottom: 56px;
}
.season-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-hl);
  font-size: 1.4rem;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 8px;
}
.season-icon { font-size: 1.2em; }
.season-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
}
.season-text {
  font-size: 16px;
  color: #E0E0E0;
  margin-bottom: 24px;
  padding-left: 4px;
  line-height: 1.6;
  column-count: 3;
  column-gap: 28px;
}

/* ── Group section ─────────────────────────────────────────────────────────── */
.group-section {
  margin-bottom: 40px;
}
.group-heading {
  margin-top: 8px;
  margin-bottom: 0;
  text-align: center;
  padding-bottom: 20px;
}
.group-text {
  font-size: 15px;
  color: var(--text2);
  margin: 0 auto;
  padding-bottom: 20px;
  line-height: 1.7;
  text-align: center;
  max-width: calc(100% * 2 / 3);
}

/* ── Masonry grid ──────────────────────────────────────────────────────────── */
.masonry-grid {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.masonry-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.photo-item,
.video-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-bg);
  cursor: pointer;
  position: relative;
  width: 100%;
}

.photo-item img,
.video-item img,
.video-item video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.35s ease;
}
.photo-item:hover img,
.video-item:not(.playing):hover img,
.video-item:not(.playing):hover video { transform: scale(1.03); }
.video-item.playing { cursor: default; }
.video-item.playing .photo-caption-hint { display: none; }

.photo-caption-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  color: white;
  font-size: 11px;
  padding: 20px 8px 6px;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1.3;
}
.photo-item:hover .photo-caption-hint { opacity: 1; }

/* Video placeholder when no thumb */
.video-item-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--card-bg);
  display: block;
}

.video-play-badge {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 52px; height: 52px;
  background: rgba(0,0,0,0.58);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: white;
  padding-left: 4px;
  pointer-events: none;
  box-shadow: 0 2px 20px rgba(0,0,0,0.55);
  transition: transform 0.2s, background 0.2s;
}
.video-item:hover .video-play-badge {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(0,0,0,0.78);
}

/* ── No-content placeholder ────────────────────────────────────────────────── */
.empty-group {
  padding: 12px 0;
  color: var(--text3);
  font-size: 14px;
  font-style: italic;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 800px) {
  .stats-bar { grid-template-columns: repeat(3, 1fr); }
  .season-text { column-count: 2; }
}

@media (max-width: 750px) {
  .group-text { max-width: 100%; }
}

@media (max-width: 600px) {
  .masonry-grid { gap: 5px; }
  .masonry-col { gap: 5px; }
  .portal-header { padding: 32px 16px 24px; }
  .stats-bar { grid-template-columns: 1fr; gap: 8px; padding: 0 16px; }
  .season-text { column-count: 1; }
}

@media (max-width: 400px) {
  .stats-bar { grid-template-columns: 1fr; }
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 32px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
}
@media (max-width: 600px) {
  .portal-footer { padding-bottom: 72px; }
}
.footer-logo-link { display: flex; align-items: center; }
.footer-logo { height: 28px; width: auto; opacity: 0.7; transition: opacity 0.2s; }
.footer-logo:hover { opacity: 1; }
.footer-change-pw {
  font-size: 12px;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.footer-change-pw:hover { color: var(--primary); }

/* ── Passwort-Modal ──────────────────────────────────────────────────────────── */
.pw-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}
.pw-modal-inner {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.pw-modal-title {
  font-family: var(--font-hl);
  font-size: 20px;
  color: var(--text);
  margin: 0 0 6px;
}
.pw-modal-hint {
  font-size: 12px;
  color: var(--text3);
  margin: 0 0 20px;
}
.pw-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: transparent;
  box-sizing: border-box;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.pw-input:focus { outline: none; border-color: var(--primary); }
.pw-modal-msg {
  font-size: 12px;
  min-height: 18px;
  margin: 4px 0 16px;
  color: var(--text3);
}
.pw-modal-msg.error { color: #e05252; }
.pw-modal-msg.success { color: #4caf50; }
.pw-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.pw-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.pw-btn:disabled { opacity: 0.5; cursor: default; }
.pw-btn-ghost { background: var(--border); color: var(--text2); }
.pw-btn-primary { background: var(--primary); color: #fff; }
