/* Sommarprat arkiv — designtoken: varm radioskymning.
   Inga externa typsnitt/CDN:er, allt självhostat enligt projektets princip. */

:root {
  --bg: #12181c;
  --bg-elevated: #171e23;
  --bg-card: #192126;
  --text: #ede6d6;
  --text-muted: #8b9198;
  --accent: #d9a14b;
  --accent-soft: rgba(217, 161, 75, 0.16);
  --line: #2b343a;
  --danger: #c9634f;
  --radius: 3px;

  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

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

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ── Waveform-motiv: enda återkommande strukturdetalj, används sparsamt ── */
.waveform-rule {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 14px;
  margin: 0;
}
.waveform-rule span {
  flex: 1;
  background: var(--line);
  border-radius: 1px;
}
.waveform-rule span:nth-child(3n) { height: 100%; }
.waveform-rule span:nth-child(3n+1) { height: 45%; }
.waveform-rule span:nth-child(3n+2) { height: 70%; }

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}
.site-header .wordmark {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.site-header .wordmark:hover { text-decoration: none; color: var(--accent); }
.search-sort-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.search-sort-block input,
.search-sort-block select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
}
.header-actions { display: flex; align-items: center; gap: 16px; font-size: 0.9rem; color: var(--text-muted); }

/* ── Layout: filter + innehåll ── */
.page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  max-width: 1600px;
  width: 94%;
  margin: 0 auto;
  padding: 32px;
}
@media (max-width: 800px) {
  .page { grid-template-columns: 1fr; padding: 16px; }
}

.filters { display: flex; flex-direction: column; gap: 24px; }
.filter-group { }
.filter-group h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.filter-group .sub-heading {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 8px 0 2px;
  opacity: 0.8;
}
.filter-group label.subcategory {
  margin-left: 22px;
  position: relative;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.filter-group label.subcategory::before {
  content: "↳";
  position: absolute;
  left: -18px;
  color: var(--line);
}
.filter-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 0.92rem;
  cursor: pointer;
}
.filter-group label.master { font-weight: 600; }
.filter-group input[type="checkbox"] { margin: 0; accent-color: var(--accent); }

/* ── Header: extra-knappar (stort-text-läge) ── */
.header-actions button.icon-toggle {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.header-actions button.icon-toggle.active { color: var(--accent); border-color: var(--accent); }
.header-actions input[type="range"] { accent-color: var(--accent); }
.music-notice {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--line);
  padding: 6px 32px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.music-notice strong { color: var(--text); }

/* ── Trekolumns-layout på startsidan ── */
.page.with-sidebar {
  grid-template-columns: 220px minmax(0, 1fr) 260px;
}
@media (max-width: 1000px) {
  .page.with-sidebar { grid-template-columns: 220px minmax(0, 1fr); }
  .page.with-sidebar .sidebar { display: none; }
}

.sidebar { display: flex; flex-direction: column; gap: 28px; }
.sidebar h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 10px;
}
.sidebar-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.sidebar-item .who { color: var(--accent); }
.sidebar-item .snippet { color: var(--text-muted); display: block; margin-top: 2px; }
.sidebar-item a { color: var(--text); }
.sidebar .empty-note { font-size: 0.82rem; }
.listening-count {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  padding: 1px 7px;
  font-size: 0.75rem;
  margin-left: 6px;
}

/* ── Röster ── */
.vote-widget { display: flex; align-items: center; gap: 8px; }
.vote-widget button {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: var(--radius);
  width: 34px; height: 34px;
  cursor: pointer;
  font-size: 1rem;
}
.vote-widget button.active.up { color: var(--accent); border-color: var(--accent); }
.vote-widget button.active.down { color: var(--danger); border-color: var(--danger); }
.vote-widget .score { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.vote-badge {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Andra avsnitt med samma person ── */
.other-episodes { display: flex; flex-wrap: wrap; gap: 8px; }
.other-episodes a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 10px;
  font-size: 0.85rem;
  color: var(--text);
}
.other-episodes a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Stort-text-läge (för äldre användare) ── */
body.large-mode { font-size: 26px; }
body.large-mode .site-header { padding: 26px 32px; }
body.large-mode .wordmark { font-size: 1.6rem; }
body.large-mode .episode-card { grid-template-columns: 130px minmax(0, 1fr) auto; padding: 24px 26px; gap: 26px; }
body.large-mode .episode-card img { width: 130px; height: 130px; }
body.large-mode .episode-card .name { font-size: 1.7rem; }
body.large-mode .episode-card .desc { font-size: 1.25rem; white-space: normal; }
body.large-mode .episode-card .meta { font-size: 1.05rem; }
body.large-mode .episode-header img { width: 220px; height: 220px; }
body.large-mode .episode-header h1 { font-size: 2.9rem; }
body.large-mode .episode-header .description { font-size: 1.2rem; }
body.large-mode .transcript-text { font-size: 1.4rem; max-width: 72ch; line-height: 1.8; }
body.large-mode button.btn { padding: 16px 24px; font-size: 1.25rem; }
body.large-mode .vote-widget button { width: 54px; height: 54px; font-size: 1.5rem; }
body.large-mode .filter-group label { font-size: 1.15rem; padding: 6px 0; }
body.large-mode .filter-group h3 { font-size: 1rem; }
body.large-mode .comment-form textarea,
body.large-mode .search-sort-block input,
body.large-mode .search-sort-block select { font-size: 1.15rem; padding: 12px 14px; }

/* ── Avsnittslista ── */
.episode-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.episode-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  background: var(--bg-card);
  padding: 16px 20px;
  min-width: 0;
}
.episode-card > div {
  min-width: 0;
}
.episode-card:hover { background: var(--bg-elevated); }
.episode-card img {
  width: 88px; height: 88px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.episode-card .name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--text);
}
.episode-card .desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.episode-card .meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
}

.load-more {
  margin: 20px auto 0;
  display: block;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }

/* ── Avsnittssida ── */
.episode-page { max-width: 760px; margin: 0 auto; padding: 32px; }
.back-link { color: var(--text-muted); font-size: 0.9rem; }
.episode-header { display: flex; gap: 20px; margin: 20px 0 24px; }
.episode-header img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); }
.episode-header h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.8rem;
  margin: 0 0 6px;
}
.episode-header .description { color: var(--text-muted); margin: 0 0 8px; }
.notable-banner {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  font-size: 0.88rem;
  margin: 8px 0 12px;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notable-banner a { margin-left: 6px; }
.episode-header .tags { display: flex; gap: 8px; flex-wrap: wrap; font-size: 0.8rem; }
.tag {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2px 8px;
  color: var(--text-muted);
}

/* ── Spelare ── */
.player {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 28px;
}
.player audio { width: 100%; }
.player-actions { display: flex; gap: 12px; margin-top: 12px; }

button.btn {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
}
button.btn:hover { border-color: var(--accent); }
button.btn.primary { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
button.btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }

section.block { margin-bottom: 32px; }
section.block h2 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: none;
  margin: 0 0 12px;
}

.transcript-text {
  max-width: 68ch;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.7;
}
.transcript-status {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

.songs-list { list-style: none; padding: 0; margin: 0; color: var(--text-muted); }
.songs-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.empty-note { color: var(--text-muted); font-size: 0.9rem; }

/* ── Kommentarer ── */
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.comment-form textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px;
  min-height: 70px;
  resize: vertical;
}
.comment-form .row { display: flex; align-items: center; justify-content: space-between; }
.visibility-toggle { display: flex; gap: 6px; font-size: 0.85rem; color: var(--text-muted); }

.comment {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.comment .who { font-size: 0.85rem; color: var(--accent); }
.comment .when { font-size: 0.78rem; color: var(--text-muted); margin-left: 8px; }
.comment .body { margin-top: 4px; }
.comment .private-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1px 6px;
  margin-left: 8px;
}

/* ── Auth-formulär ── */
.auth-page { max-width: 360px; margin: 80px auto; padding: 0 24px; }
.auth-page h1 { font-family: var(--font-serif); font-weight: 400; font-size: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.auth-form input {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
}
.form-error { color: var(--danger); font-size: 0.88rem; }
.auth-switch { margin-top: 16px; font-size: 0.9rem; color: var(--text-muted); }

[hidden] { display: none !important; }
