/* =============================================================================
   Lagernews — Pfadi St. Karl Rickenbach
   Single source of truth for all styling (Phase 2 — Design & Layout).

   Direction: editorial, SRF-News-inspired. Strong condensed headlines (Oswald),
   warm readable body (Nunito), generous whitespace, restraint. The ONLY accent
   colour is the Corporate-Design red (#952525). No blue anywhere.
   ============================================================================= */

/* ── Fonts (self-hosted variable woff2, CD-specified) ─────────────────────── */
@font-face {
  font-family: 'Oswald';
  src: url('/fonts/oswald.woff2') format('woff2');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  /* Colour — red is the single accent; everything else is neutral. No blue. */
  --color-red: #952525;
  --color-red-dark: #7d1f1f;
  --color-red-tint: #fbeaea;

  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-meta: #767676;

  --color-bg: #ffffff;
  --color-border: #e5e5e5;
  --color-thumb-bg: #efece8;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Type */
  --font-display: 'Oswald', 'Helvetica Neue', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fs-hero: 2rem;
  --fs-clip-title: 1.25rem;
  --fs-body: 1rem;
  --fs-meta: 0.75rem;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius-md: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.06);

  --container: 720px;
  --container-narrow: 400px;
  --header-h: 60px;
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-red);
  outline-offset: 2px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.page {
  animation: fade-in 0.35s ease both;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Layout primitives ────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container--narrow {
  max-width: var(--container-narrow);
}

/* ── Site header ──────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  height: var(--header-h);
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.site-header__logo {
  height: 38px;
  width: auto;
}

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  color: var(--color-meta);
  font-size: var(--fs-meta);
  letter-spacing: 0.02em;
  padding: var(--space-7) var(--space-4) var(--space-8);
}

/* ── Editorial text elements ──────────────────────────────────────────────── */
.meta {
  font-weight: 600;
  font-size: var(--fs-meta);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-meta);
}
.desc {
  margin: 0;
  color: var(--color-text-muted);
  max-width: 60ch;
}

/* ── Thumbnail button (static state before playback) ─────────────────────── */
.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-thumb-bg);
  box-shadow: var(--shadow-soft);
}
.thumb__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-red);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.thumb__play::before {
  content: '';
  width: 0;
  height: 0;
  margin-left: 4px;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent #fff;
}
.thumb:hover .thumb__play,
.thumb:focus-visible .thumb__play {
  background: var(--color-red-dark);
  transform: scale(1.06);
}

/* ── Custom video player ──────────────────────────────────────────────────── */
.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: #000;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  outline: none;
  touch-action: manipulation; /* prevent double-tap zoom */
  cursor: pointer;
}
.player-wrap:focus-visible {
  outline: 3px solid var(--color-red);
  outline-offset: 2px;
}

/* Fullscreen: fill screen, drop decorative radius */
.player-wrap:fullscreen,
.player-wrap:-webkit-full-screen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}
.player-wrap:fullscreen .player-video,
.player-wrap:-webkit-full-screen .player-video {
  height: 100%;
}

.player-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* Center play/pause overlay */
.player-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-red);
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  z-index: 2;
  /* hidden by default; visible when paused OR when controls are active */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.15s ease, transform 0.12s ease;
}
.player-center svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}
.player-center:hover {
  background: var(--color-red-dark);
  transform: translate(-50%, -50%) scale(1.06);
}
/* Show center: when paused (always), or when controls are active while playing */
.player-wrap:not(.is-playing) .player-center,
.player-wrap.is-active .player-center {
  opacity: 1;
  pointer-events: auto;
}

/* Bottom control bar */
.player-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.5rem 0.5rem 0.625rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, transparent 100%);
  display: flex;
  align-items: center;
  gap: 0.125rem;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.player-wrap.is-active .player-bar {
  opacity: 1;
  pointer-events: auto;
}

/* Icon buttons in the bar */
.player-btn {
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 4px;
}
.player-btn svg {
  width: 22px;
  height: 22px;
}
/* Fullscreen gets a larger, easier mobile target + icon */
.player-btn--fs {
  width: 52px;
  height: 52px;
  margin-right: 0.125rem;
}
.player-btn--fs svg {
  width: 30px;
  height: 30px;
}
.player-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 1px;
}

/* Time display */
.player-time {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 2.8ch;
  user-select: none;
}

/* Progress bar */
.player-progress {
  flex: 1;
  height: 44px; /* touch target */
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0 0.25rem;
}
.player-progress:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 2px;
}
.player-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.player-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0%;
  background: var(--color-red);
  border-radius: 2px;
  pointer-events: none;
  transition: width 0.1s linear;
}

/* ── Gallery: hero (lead story) ───────────────────────────────────────────── */
/* Full-bleed lead clip: the thumbnail/player spans edge-to-edge with no top
   gap, like a hero video. Only the text below sits inside the container. */
.hero {
  margin-top: 0;
}
.hero > .thumb,
.hero > .player-wrap {
  border-radius: 0;
  box-shadow: none;
}
/* Tight proximity: thumbnail → its own text */
.hero__body {
  margin-top: var(--space-1);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
/* One row directly under the video: "Neuste Sendung" left, date right */
.hero__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.hero__kicker {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-red);
}
/* Same typography as the rest of the clips (no oversized lead headline) */
.hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-clip-title);
  line-height: 1.15;
  color: var(--color-text);
}

/* Ruled divider between hero and older-video list */
.clips-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
  margin-bottom: calc(var(--space-5) * -1); /* cancel out clips' own top margin */
}
.clips-header__rule {
  flex: 1;
  height: 1px;
  background: var(--color-border);
  border: 0;
  margin: 0;
}
.clips-header__label {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-meta);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Gallery: list of older videos ────────────────────────────────────────── */
.clips {
  margin-top: var(--space-6);
  padding-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-7); /* wide gap BETWEEN blocks */
}
/* Tight proximity: thumbnail → its own text */
.clip__body {
  margin-top: var(--space-1);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.clip__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-clip-title);
  line-height: 1.15;
  color: var(--color-text);
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty {
  max-width: 30rem;
  margin-inline: auto;
  padding: var(--space-8) var(--space-4);
  text-align: center;
}
.empty__text {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* ── Auth pages (parent and admin login — identical) ──────────────────────── */
.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.auth__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-4);
}
.auth__logo {
  height: 84px;
  width: auto;
}
.auth__card {
  width: 100%;
  max-width: var(--container-narrow);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.field__label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}
.field__input {
  width: 100%;
  height: 56px;
  padding: 0 var(--space-4);
  font-size: 1rem;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field__input:focus {
  outline: none;
  border-color: var(--color-red);
  box-shadow: 0 0 0 3px rgba(149, 37, 37, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 var(--space-5);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.0625rem;
  color: #fff;
  background: var(--color-red);
  border: 0;
  border-radius: 10px;
  transition: background-color 0.15s ease;
}
.btn:hover,
.btn:active {
  background: var(--color-red-dark);
}

.form-error {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-red-tint);
  border-left: 4px solid var(--color-red);
  border-radius: var(--radius-sm);
  color: var(--color-red-dark);
  font-size: 0.9375rem;
}

/* ── Admin dashboard (upload) ─────────────────────────────────────────────── */
.admin {
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
}
.admin__heading {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--color-text);
}

.upload {
  margin-bottom: var(--space-7);
}

/* Drag-and-drop zone (label wrapping a hidden file input). */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  padding: var(--space-7) var(--space-4);
  text-align: center;
  background: var(--color-thumb-bg);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone.is-drag {
  border-color: var(--color-red);
  background: var(--color-red-tint);
}
.dropzone__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  font-size: 1.5rem;
  color: #fff;
  background: var(--color-red);
  border-radius: 50%;
}
.dropzone__text {
  font-weight: 600;
  color: var(--color-text);
}
.dropzone__link {
  color: var(--color-red);
  text-decoration: underline;
}
.dropzone__hint {
  font-size: var(--fs-meta);
  color: var(--color-meta);
}

.field__textarea {
  height: auto;
  min-height: 96px;
  padding: var(--space-3) var(--space-4);
  line-height: 1.5;
  resize: vertical;
}

/* Upload progress. */
.upload-progress {
  margin-bottom: var(--space-7);
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.upload-progress__file {
  margin: 0 0 var(--space-3);
  font-size: 0.9375rem;
  font-weight: 600;
  word-break: break-all;
}
.upload-progress__bar {
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.upload-progress__fill {
  width: 0%;
  height: 100%;
  background: var(--color-red);
  border-radius: 999px;
  transition: width 0.15s ease;
}
.upload-progress__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-3);
}
.upload-progress__pct {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-text);
}
.upload-progress__cancel {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-red-dark);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.upload-progress__cancel:hover {
  border-color: var(--color-red);
}

/* Already-uploaded list. */
.uploaded__heading {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--color-text);
}
.uploaded__list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.uploaded__item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}
.uploaded__thumb {
  flex: none;
  width: 80px;
  height: 45px;
  object-fit: cover;
  background: var(--color-thumb-bg);
  border-radius: var(--radius-sm);
}
.uploaded__meta {
  min-width: 0;
}
.uploaded__title {
  margin: 0 0 2px;
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25;
  color: var(--color-text);
}
.uploaded__sub {
  margin: 0;
  font-size: var(--fs-meta);
  color: var(--color-meta);
}
.uploaded__empty {
  margin: 0;
  padding: var(--space-5) 0;
  color: var(--color-text-muted);
}

/* ── Desktop refinements ──────────────────────────────────────────────────── */
@media (min-width: 768px) {
  :root {
    --fs-clip-title: 1.375rem;
  }
  /* On wider screens the lead clip joins the centred column instead of
     bleeding to the viewport edges. */
  .hero {
    max-width: var(--container);
    margin-inline: auto;
    margin-top: var(--space-6);
    padding-inline: var(--space-4);
  }
  .hero > .thumb,
  .hero > .player-wrap {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
  }
  .hero__kicker.container,
  .hero__body.container {
    padding-inline: 0;
  }
  .player-center {
    width: 64px;
    height: 64px;
  }
  .player-center svg {
    width: 30px;
    height: 30px;
  }
}

/* ── Reduced motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .page {
    animation: none;
  }
  .thumb__play,
  .field__input,
  .btn,
  .player-center,
  .player-bar,
  .player-fill {
    transition: none;
  }
}
