/* langerjannik – shared stylesheet for the public pages.
   No inline styles anywhere: the CSP is default-src 'self'. */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-from: #2E2A6B;
  --bg-to: #4A3A7A;
  --card: #0D0D0D;
  --surface: #151515;
  --surface-hover: #1C1C1C;
  --border: #2A2A2A;
  --border-hover: #444444;
  --accent: #FF7F24;
  --text: #EDEDED;
  --muted: #A8A8A8;
  --live: #FF3B3B;
  --live-bg: #3A1010;
  --live-text: #FF9C9C;
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: dark;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg-from);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-from) 0%, var(--bg-to) 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Elements toggled via the hidden attribute must stay hidden even when a
   class sets a display value. Loading skeletons override this below. */
[hidden] {
  display: none !important;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

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

/* ---------- Page and card ---------- */

.page {
  width: 100%;
  max-width: calc(900px + 2 * 16px);
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px -24px rgba(0, 0, 0, 0.7);
}

.card-body {
  padding: 20px 16px 8px;
}

/* ---------- Banner ---------- */

.banner {
  position: relative;
  /* Explicit width: otherwise min-height is transferred through the
     aspect ratio into a 640px minimum width on narrow screens. */
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 1;
  min-height: 120px;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  background-color: var(--accent);
}

.banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: right center;
}

.banner-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 16px 20px;
}

.banner-name {
  color: #FFFFFF;
  /* On narrow screens the photo takes a fixed ~122px on the right (banner
     min-height); the second term keeps the name on the orange area. */
  font-size: max(1.25rem, min(clamp(2rem, 1.3rem + 3.6vw, 3.5rem), calc((100vw - 190px) / 6)));
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.55),
    0 2px 14px rgba(0, 0, 0, 0.45);
}

.badge {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3em;
  max-width: 100%;
  padding: 0.4em 0.85em;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.badge-count {
  color: var(--accent);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* ---------- Live hint ---------- */

.live-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #1F0A0A;
  border-bottom: 1px solid #4D1A1A;
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.live-hint:hover {
  background: #2C0F0F;
}

.live-hint:focus-visible {
  outline-offset: -3px;
}

.live-hint-cta {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.live-hint-arrow {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--accent);
  transition: transform 0.15s ease;
}

.live-hint:hover .live-hint-arrow {
  transform: translateX(3px);
}

/* ---------- Social cards ---------- */

.social-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-height: 76px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.social-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.social-card:focus-visible {
  outline-offset: 2px;
}

.social-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  color: #FFFFFF;
}

.social-icon svg {
  width: 26px;
  height: 26px;
}

.social-icon--twitch {
  background: #9146FF;
}

.social-icon--instagram {
  background: linear-gradient(45deg, #F58529 0%, #DD2A7B 50%, #8134AF 100%);
}

.social-icon--tiktok {
  background: #000000;
  box-shadow: inset 0 0 0 1px #333333;
}

.social-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 46px;
  /* Long words from the API (e.g. a category name) must not widen the page. */
  overflow-wrap: anywhere;
}

/* With live details the Twitch card grows; keep icon and arrow at the top. */
.social-card:has(.live-details:not([hidden])) {
  align-items: flex-start;
}

.social-card:has(.live-details:not([hidden])) .social-arrow {
  margin-top: 13px;
}

.social-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.social-name {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.social-sub {
  color: var(--muted);
  font-size: 0.9375rem;
}

.social-handle + .social-count {
  margin-left: 0.6em;
}

.count {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.social-arrow {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: color 0.15s ease, transform 0.15s ease;
}

.social-card:hover .social-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* Status badge (Twitch) */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status--offline {
  background: #1F1F1F;
  border-color: #2E2E2E;
  color: #B3B3B3;
}

.status--offline .status-dot {
  background: #6E6E6E;
}

.status--live {
  background: var(--live-bg);
  border-color: #5A1A1A;
  color: var(--live-text);
}

.status--live .status-dot {
  background: var(--live);
  animation: live-pulse 1.6s ease-out infinite;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.7);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 59, 59, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 59, 59, 0);
  }
}

.live-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.live-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.live-meta {
  color: var(--muted);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

/* ---------- Loading skeletons (only after app.js set .is-loading) ---------- */

html.is-loading [data-skeleton] {
  display: inline-block !important;
  min-height: 1.4em;
  border-color: transparent;
  border-radius: 999px;
  background: linear-gradient(90deg, #1E1E1E 0%, #2E2E2E 50%, #1E1E1E 100%) 0 0 / 200% 100%;
  box-shadow: none;
  color: transparent;
  animation: skeleton-shimmer 1.4s linear infinite;
  user-select: none;
}

html.is-loading [data-skeleton] * {
  visibility: hidden;
}

html.is-loading .badge[data-skeleton] {
  min-width: 13em;
  background-image: linear-gradient(90deg, rgba(13, 13, 13, 0.45) 0%, rgba(13, 13, 13, 0.7) 50%, rgba(13, 13, 13, 0.45) 100%);
}

html.is-loading .social-count[data-skeleton] {
  min-width: 7.5em;
}

html.is-loading .status[data-skeleton] {
  min-width: 4.75em;
}

html.is-loading [data-hide-while-loading] {
  display: none !important;
}

@keyframes skeleton-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

/* ---------- Impressum ---------- */

.impressum {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.section-title {
  margin-bottom: 16px;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.impressum-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 32px;
}

.imp-heading {
  margin: 18px 0 6px;
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.impressum-col > .imp-heading:first-child {
  margin-top: 0;
}

.imp-row {
  margin-bottom: 10px;
  color: #D4D4D4;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.imp-label {
  display: block;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Own Impressum text from the admin area (instead of the structured fields). */

.impressum-text {
  max-width: 70ch;
  color: #D4D4D4;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.impressum-text h3,
.impressum-text h4 {
  margin: 18px 0 6px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.impressum-text h3 {
  font-size: 0.9375rem;
}

.impressum-text h4 {
  font-size: 0.8125rem;
}

.impressum-text p,
.impressum-text ul {
  margin: 0 0 10px;
}

.impressum-text ul {
  padding-left: 1.25em;
}

.impressum-text li {
  margin-bottom: 4px;
}

.impressum-text > :first-child {
  margin-top: 0;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding: 18px 16px 22px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.footer-nav a {
  color: var(--text);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-nav a[aria-current='page'] {
  color: var(--accent);
}

.data-age {
  font-variant-numeric: tabular-nums;
}

/* ---------- Legal pages ---------- */

.legal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.legal-brand {
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.legal-brand:hover {
  color: var(--accent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.legal {
  max-width: 70ch;
  padding: 24px 16px 8px;
}

.legal h1 {
  margin-bottom: 20px;
  font-size: clamp(1.625rem, 1.3rem + 1.5vw, 2.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.legal h2 {
  margin: 28px 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
}

.legal h3 {
  margin: 18px 0 6px;
  font-size: 1rem;
  font-weight: 700;
}

.legal p,
.legal ul {
  margin: 0 0 12px;
  color: #D4D4D4;
  overflow-wrap: anywhere;
}

.legal ul {
  padding-left: 1.25em;
}

.legal code {
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: #1F1F1F;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.9em;
}

.legal li {
  margin-bottom: 4px;
}

/* Own legal text from the admin area: long words and addresses must not widen the page. */

.legal-text {
  overflow-wrap: anywhere;
}

.legal-text > :first-child {
  margin-top: 0;
}

.template-note {
  margin-bottom: 20px;
  padding: 10px 14px;
  border: 1px solid #5C3A1F;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #1F140B;
  color: #F5D7C0;
  font-size: 0.875rem;
}

.legal .template-note {
  color: #F5D7C0;
}

/* ---------- Larger screens ---------- */

@media (min-width: 640px) {
  .page {
    max-width: calc(900px + 2 * 32px);
    padding: 40px 32px 48px;
  }

  .card-body {
    padding: 28px 32px 8px;
  }

  .banner-overlay {
    padding: 24px 36px;
    gap: 14px;
  }

  .badge {
    font-size: 0.9375rem;
  }

  .live-hint {
    padding: 14px 32px;
  }

  .social-list {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .social-item--wide {
    grid-column: 1 / -1;
  }

  .social-card {
    padding: 16px 18px;
  }

  .impressum {
    margin-top: 36px;
    padding-top: 28px;
  }

  .impressum-grid {
    grid-template-columns: 1fr 1fr;
  }

  .impressum-col > .imp-heading:first-child {
    margin-top: 0;
  }

  .footer {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px 24px;
  }

  .legal-header {
    padding: 18px 32px;
  }

  .legal {
    padding: 32px 32px 8px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .social-card:hover,
  .social-card:hover .social-arrow,
  .live-hint:hover .live-hint-arrow {
    transform: none;
  }
}
