/* ============================================================
   DinBrudi News on Meta Ray-Ban Display — Teenage Engineering edit

   ZWECK: TE-Design-System angewandt auf das additive 600×600 Display.
   Weil schwarz auf der Brille TRANSPARENT ist, drehen wir TE um:
     - BG bleibt true-black (= transparente Lens-Canvas)
     - "Ink" wird white statt black
     - "Paper" wird dark-surface (#0a0a0f) statt #F7F5F0
     - 2px solid WHITE borders + hard offset shadows in white
     - UPPERCASE + JetBrains Mono fuer Labels/Meta/Badges
     - Space Grotesk fuer Headlines + Body
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Display physics: bleibt dark — schwarz = transparent auf additivem Display. */
  --bg-page: #000000;
  --bg-surface: #0a0a0f;
  --bg-tertiary: #14141f;
  --bg-card: #1a1a2e;

  --ink: #ffffff;                  /* "Black ink" inverted: weiss leuchtet */
  --ink-soft: rgba(255,255,255,0.72);
  --ink-mute: rgba(255,255,255,0.45);
  /* TE-Signature-Akzente: Orange (OP-1) als Primary, Cream als Secondary.
     Nur als FILLS, nie als Border/Shadow — TE-Regel. */
  --te-orange: #FF6B00;
  --te-cream: #F5C200;
  --accent: var(--te-orange);
  --danger: #ff4466;

  /* Hard offset shadows — TE-Signature, in weiss damit es auf der Brille leuchtet */
  --shadow-default: 2px 2px 0 0 var(--ink);
  --shadow-hover:   3px 3px 0 0 var(--ink);
  --shadow-active:  0 0 0 0 var(--ink);

  --radius-sm: 0;       /* Badges komplett eckig */
  --radius-md: 4px;     /* Cards / Buttons fast eckig */
  --radius-lg: 6px;

  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Animation curves (kept from prior — Meta display-guidelines) */
  --curve-focus-on:  cubic-bezier(0.6, 0, 0.4, 1);
  --curve-focus-off: cubic-bezier(0.24, 0.24, 0.6, 1);
  --curve-press:     cubic-bezier(0.68, 0, 0.29, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--ink);
  width: 600px;
  height: 600px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 8px;
  box-sizing: border-box;
}

/* ===== Screens ===== */
.screen {
  position: absolute;
  top: 8px;
  left: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-page);
}
.screen.hidden { display: none; }

/* ===== Header (spec-strip-Style) ===== */
.header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-surface);
  gap: 10px;
  flex-shrink: 0;
  height: 56px;
  border-bottom: 2px solid var(--ink);
}
.header h1 {
  font-family: var(--font);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex: 1;
}
.header-meta {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}
.back-btn {
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  padding: 0 14px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  height: 42px;
  min-width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Content (scrollable list area) ===== */
.content {
  flex: 1;
  padding: 10px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-page);
  position: relative;
}

/* ===== Focus States (TE-Signature mit harter Offset-Shadow) ===== */
.focusable {
  border: 2px solid var(--ink);
  cursor: pointer;
  background: var(--bg-surface);
  /* KEINE Transition — Brille hat begrenzte Render-Performance, Animations
     fuehren zu spuerbarem Tap-Lag. Snap-State ist TE-on-Brand. */
}
.focusable:focus {
  outline: none;
  background: var(--te-orange);
  color: #000;
  box-shadow: var(--shadow-default);
}
.focusable:active {
  box-shadow: var(--shadow-active);
}

/* ===== Nav-Bar ===== */
.nav-bar {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-surface);
  flex-shrink: 0;
  border-top: 2px solid var(--ink);
}
.nav-item {
  flex: 1;
  padding: 0 8px;
  background: var(--bg-page);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
}
.nav-item:focus {
  background: var(--te-orange);
  color: #000;
}
.nav-item.primary {
  background: var(--te-orange);
  color: #000;
  box-shadow: var(--shadow-default);
}
.nav-item.primary:focus {
  background: var(--te-cream);
  color: #000;
}

/* Arrow-Buttons (prev/next) sind etwas breiter angedeutet */
.nav-arrow {
  font-size: 20px;
  font-weight: 700;
}

/* ===== Feed-Liste: Artikel-Card ===== */
.article-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px 12px 28px;
  background: var(--bg-surface);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  text-align: left;
  width: 100%;
  position: relative;
  flex-shrink: 0;
  min-height: 88px;
  justify-content: center;
  /* Keine Transition — Brille ist sonst zu zaeh beim Tap-Feedback */
}
.article-card .card-body { opacity: 0.85; }
.article-card:focus {
  outline: none;
  background: var(--te-orange);
  color: #000;
  box-shadow: var(--shadow-default);
}
.article-card:focus .card-body { opacity: 1; }
.article-card:active { box-shadow: var(--shadow-active); }

/* Unread-Indikator: TE-Orange-Square — Akzent-Fill, nicht weiss */
.article-card.unread::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--te-orange);
  border-radius: 0;
}
.article-card:focus.unread::before {
  background: #000;
}

.article-card-title {
  font-family: var(--font);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
  word-break: break-word;
  color: inherit;
}
.article-card-meta {
  display: flex;
  gap: 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  align-items: center;
}
.article-card:focus .article-card-meta { color: rgba(0,0,0,0.6); }
.article-card-source {
  color: inherit;
  font-weight: 700;
}
.article-card-dot { opacity: 0.5; }

/* ===== Artikel-Detail ===== */
.article-content {
  gap: 8px;
  padding-top: 12px;
}
.article-source {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  flex: 1;
}
.article-title {
  font-family: var(--font);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.article-meta {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.article-snippet {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  overflow-y: auto;
  max-height: 280px;
}

/* ===== Loading / Diagnose-Panel ===== */
.diag-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 24px;
  text-align: center;
  flex: 1;
  min-height: 360px;
}
.diag-icon {
  font-size: 48px;
  line-height: 1;
}
.diag-loading .diag-icon {
  animation: diagPulse 1.4s ease-in-out infinite;
}
@keyframes diagPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.92); }
}
.diag-title {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.diag-error .diag-title { color: var(--danger); }
.diag-detail {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 480px;
  word-break: break-word;
}
.diag-meta {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  line-height: 1.6;
  text-align: left;
  background: var(--bg-surface);
  border: 2px solid var(--ink);
  padding: 10px 12px;
  border-radius: 0;
}

/* Skeleton-Loading bleibt fuer evtl. spaeteren Gebrauch */
.skeleton-list { display: flex; flex-direction: column; gap: 8px; }
.skeleton-card {
  height: 88px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, var(--bg-surface) 25%, var(--bg-tertiary) 50%, var(--bg-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  flex-shrink: 0;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ===== Empty / Error ===== */
.empty-state, .error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 36px 24px;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 17px;
  flex: 1;
}
.empty-state .icon, .error-state .icon { font-size: 36px; }

/* ===== Pair / Setup Screen ===== */
.pair-content {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 22px;
  gap: 12px;
}
.pair-icon { font-size: 48px; }
.pair-text {
  font-family: var(--font);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
}
.pair-text-secondary {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* ===== Status-Banner ===== */
.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 0;
  border: 2px solid var(--ink);
  background: var(--bg-page);
  color: var(--ink);
  flex-shrink: 0;
}
.status-banner::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--ink);
  border-radius: 0;
}
.status-banner.live::before {
  background: var(--te-orange);
  animation: tePulse 1.4s steps(2) infinite;
}
@keyframes tePulse { 50% { background: transparent; } }
.status-banner.mock {
  border-style: dashed;
}
.status-banner.error {
  background: var(--danger);
  color: #000;
  border-color: var(--danger);
}
.status-banner.error::before { background: #000; }

/* ===== Toast ===== */
.toast {
  position: absolute;
  bottom: 80px;
  left: 20px;
  right: 20px;
  background: var(--te-orange);
  color: #000;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 16px;
  border-radius: 0;
  border: 2px solid var(--ink);
  box-shadow: var(--shadow-default);
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 100;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); color: #fff; border-color: var(--ink); }
.toast.success { background: var(--te-cream); color: #000; border-color: var(--ink); }

/* ===== Key-Debug-Overlay (?debug=1) ===== */
.key-debug {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  background: #000;
  border: 1px solid var(--ink);
  padding: 2px 6px;
  border-radius: 0;
  z-index: 200;
  pointer-events: none;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.spacer { flex: 1; }
