/* VRM E-Paper — barrierearm. Grosse Schrift, hohe Kontraste,
   grosszuegige Touch-Targets, einfaches 4-Ebenen-Layout. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/inter-700.woff2") format("woff2");
}

:root {
  --fg: #111;
  --bg: #f8f8f6;
  --card-bg: #fff;
  --accent: #b30000;
  --muted: #555;
  --border: #d0d0d0;
  --done-bg: #eef5ee;
  --done-fg: #2e7d32;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --base: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--base);
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

/* ---------- Topbar ---------- */

.topbar {
  background: var(--fg);
  color: var(--bg);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 64px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar__meta {
  font-size: 0.85em;
  opacity: 0.75;
}
.topbar__back,
.topbar__fav {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.4);
  color: inherit;
  font: inherit;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 48px;
}
.topbar__back { font-size: 0.9em; }
.topbar__back:hover,
.topbar__back:focus-visible,
.topbar__fav:hover,
.topbar__fav:focus-visible {
  background: rgba(255,255,255,0.12);
  outline: none;
  border-color: rgba(255,255,255,0.8);
}
.topbar__fav {
  min-width: 56px;
  padding: 6px 14px;
}
.topbar__fav-icon {
  font-size: 1.6em;
  line-height: 1;
  color: #ffd54f;
}
.topbar__fav--on .topbar__fav-icon { color: #ffca28; }

.topbar__profile {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.4);
  color: inherit;
  font: inherit;
  font-size: 0.9em;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 160px;
}
.topbar__profile:hover,
.topbar__profile:focus-visible {
  background: rgba(255,255,255,0.12);
  outline: none;
  border-color: rgba(255,255,255,0.8);
}
.topbar__profile-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}
@media (max-width: 520px) {
  .topbar__profile-name { max-width: 70px; }
}

/* ---------- Profil-Dialog ---------- */

.profile-dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  background: var(--card-bg);
  color: var(--fg);
  max-width: 420px;
  width: 90vw;
  font-family: inherit;
  font-size: var(--base);
}
.profile-dialog::backdrop {
  background: rgba(0,0,0,0.5);
}
.profile-dialog h2 {
  margin: 0 0 16px;
  font-size: 1.2em;
}
.profile-dialog__list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-dialog__item {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.profile-dialog__pick {
  flex: 1;
  text-align: left;
  font: inherit;
  background: var(--bg);
  border: 2px solid var(--border);
  color: inherit;
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 52px;
}
.profile-dialog__pick--active {
  border-color: var(--accent);
  font-weight: 700;
}
.profile-dialog__pick:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.profile-dialog__del {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--muted);
  font: inherit;
  font-size: 1.3em;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  min-height: 52px;
}
.profile-dialog__del:hover,
.profile-dialog__del:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}
.profile-dialog__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.profile-dialog__btn {
  font: inherit;
  background: var(--card-bg);
  border: 2px solid var(--border);
  color: inherit;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  min-height: 52px;
}
.profile-dialog__btn--primary {
  border-color: var(--accent);
  font-weight: 700;
}
.profile-dialog__btn:hover,
.profile-dialog__btn:focus-visible {
  background: var(--bg);
  border-color: var(--accent);
  outline: none;
}

/* ---------- Ebene 1: Ausgaben-Grid ---------- */

.issues {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  display: block;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
  min-height: 60px;
}
.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.card:active { transform: scale(0.99); }

.card__cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #e6e6e2 center/contain no-repeat;
  display: block;
  border-bottom: 1px solid var(--border);
}
.card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  color: var(--muted);
}

.card__body { padding: 14px 16px 18px; }
.card__date    { font-weight: 700; font-size: 1.1em; margin: 0 0 4px; }
.card__weekday { color: var(--muted); font-size: 0.9em; margin: 0 0 10px; }
.card__stats   { color: var(--muted); font-size: 0.9em; margin: 0; }

/* ---------- Ebene 2/3: Listen ---------- */

.biglist {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.biglist__row {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 72px;
  font-size: 1.15em;
}
.biglist__row:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.biglist__row:active { transform: scale(0.995); }
.biglist__row--done {
  background: var(--done-bg);
}
.biglist__main {
  font-weight: 700;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
.biglist__sub {
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 400;
  text-align: right;
  white-space: nowrap;
}
.biglist__check {
  font-size: 1.6em;
  color: var(--done-fg);
  text-align: center;
  font-weight: 700;
  line-height: 1;
}
.biglist__star {
  font-size: 1.4em;
  color: #ffb300;
  text-align: center;
  line-height: 1;
}

/* Ebene 2: Rubriken (nur Titel + Counter) */
.biglist--ressorts .biglist__row {
  grid-template-columns: 1fr auto;
}

/* Ebene 3: Artikel-Liste mit/ohne Thumbnail */
.biglist--articles .biglist__row {
  grid-template-columns: 36px 96px 1fr 36px;
}
.biglist--articles .biglist__row--no-image {
  grid-template-columns: 36px 1fr 36px;
}
.biglist--articles .biglist__thumb {
  display: block;
  width: 96px;
  height: 72px;
  border-radius: 6px;
  background: #e6e6e2 center/cover no-repeat;
  border: 1px solid var(--border);
}

/* Bei sehr schmalem Screen: kompakter, Thumb kleiner */
@media (max-width: 520px) {
  .biglist__row { padding: 14px 14px; font-size: 1.05em; min-height: 64px; gap: 10px; }
  .biglist--articles .biglist__row { grid-template-columns: 30px 64px 1fr 30px; }
  .biglist--articles .biglist__row--no-image { grid-template-columns: 30px 1fr 30px; }
  .biglist--articles .biglist__thumb { width: 64px; height: 48px; }
}

/* ---------- Ebene 4: Artikel ---------- */

.article-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  touch-action: pan-y;
  user-select: text;
}
.article-view > * { min-width: 0; }
.article-view__image {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #e6e6e2 center/cover no-repeat;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.article-view__title {
  margin: 0 0 12px;
  font-size: 1.6em;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.article-view__teaser {
  margin: 0 0 16px;
  font-size: 1.15em;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.4;
  overflow-wrap: break-word;
  hyphens: auto;
}
.article-view__body {
  margin: 0 0 12px;
  font-size: 1.05em;
  line-height: 1.55;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Landscape & breit: Bild links, Text rechts */
@media (orientation: landscape) and (min-width: 760px) {
  .article-view {
    grid-template-columns: minmax(0, 45%) 1fr;
    align-items: start;
  }
  .article-view--no-image {
    grid-template-columns: 1fr;
  }
  .article-view__image {
    position: sticky;
    top: 84px;       /* unterhalb der Topbar */
  }
  .article-nav {
    grid-column: 1 / -1;
  }
}

.article-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
.article-nav__btn {
  font: inherit;
  font-size: 1em;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: inherit;
  cursor: pointer;
  min-height: 56px;
}
.article-nav__btn:first-child  { justify-self: start; }
.article-nav__btn:last-child   { justify-self: end; }
.article-nav__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.article-nav__btn:not(:disabled):hover,
.article-nav__btn:not(:disabled):focus-visible {
  background: var(--bg);
  border-color: var(--accent);
  outline: none;
}
.article-nav__pos {
  font-size: 0.9em;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

/* ---------- Diverses ---------- */

.empty {
  text-align: center;
  margin: 60px 24px;
  color: var(--muted);
  font-size: 1.05em;
}
.hidden { display: none !important; }

/* Dark Mode automatisch */
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #f5f5f5;
    --bg: #181818;
    --card-bg: #242424;
    --border: #3a3a3a;
    --muted: #aaa;
    --done-bg: #1f2a1f;
    --done-fg: #81c784;
  }
}
