/* theradio.cc archive -- hand-written, no build step. Automatic dark mode
   via prefers-color-scheme, no toggle. The one JS dependency is Pagefind's
   search-ui bundle, self-contained to /search/ (see layouts/p/search.html)
   -- everything else stays JS-free. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-elevated: #f6f5f3;
  --bg-elevated-hover: #eeece7;
  --fg: #1b1b1f;
  --fg-muted: #5b5b63;
  --border: #e4e2de;
  --accent: #c8410b;
  --accent-fg: #ffffff;
  --danger-bg: #fdecea;
  --danger-fg: #8a2c1c;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 15, 10, 0.06), 0 4px 16px rgba(20, 15, 10, 0.06);
  --font-sans:
    system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  --maxw: 72rem;
}

/* Pagefind's search-ui bundle ships its own `:root { --pagefind-ui-* }`
   defaults in pagefind-ui.css, loaded after this file -- same specificity,
   later in the cascade, so it always wins over a :root override here.
   Scoping to #search (its mount point) outranks that :root rule instead of
   depending on load order. */
#search {
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--fg);
  --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--border);
  --pagefind-ui-tag: var(--bg-elevated);
  --pagefind-ui-border-width: 1px;
  --pagefind-ui-border-radius: var(--radius);
  --pagefind-ui-image-border-radius: 8px;
  --pagefind-ui-image-box-ratio: 1 / 1;
  --pagefind-ui-font: var(--font-sans);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121317;
    --bg-elevated: #1c1e24;
    --bg-elevated-hover: #262933;
    --fg: #eeeef0;
    --fg-muted: #a9a9b3;
    --border: #2b2d35;
    --accent: #ff8a5c;
    --accent-fg: #1a1305;
    --danger-bg: #3a1f1a;
    --danger-fg: #ffb4a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.55;
  font-size: 16px;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

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

h1,
h2,
h3 {
  line-height: 1.2;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(1.6rem, 1.1rem + 2vw, 2.4rem);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem);
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* -- header ---------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-title {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.site-title:hover {
  text-decoration: underline;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1.1rem;
  margin-left: auto;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--fg-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--fg);
}

.feeds-menu {
  position: relative;
}

.feeds-menu summary {
  color: var(--fg-muted);
  cursor: pointer;
  list-style: none;
}

.feeds-menu summary::-webkit-details-marker {
  display: none;
}

.feeds-menu summary::after {
  content: "\25BE";
  margin-left: 0.3rem;
  font-size: 0.8em;
}

.feeds-menu summary:hover {
  color: var(--fg);
}

.feeds-menu[open] summary {
  color: var(--fg);
}

.feeds-menu__list {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  margin: 0.5rem 0 0;
  padding: 0.4rem;
  min-width: 8rem;
  list-style: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feeds-menu__list a {
  display: block;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}

.feeds-menu__list a:hover {
  background: var(--bg-elevated-hover);
  color: var(--accent);
}

.site-search {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.site-search input[type="search"] {
  width: 9rem;
  max-width: 40vw;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}

.site-search input[type="search"]::placeholder {
  color: var(--fg-muted);
}

.site-search input[type="search"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.site-search button {
  display: flex;
  padding: 0.3rem;
  border: 0;
  background: none;
  color: var(--fg-muted);
  cursor: pointer;
}

.site-search button:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  .site-search {
    width: 100%;
  }

  .site-search input[type="search"] {
    width: 100%;
    max-width: none;
    flex: 1;
  }
}

/* -- main / footer ----------------------------------------------------- */

main {
  padding: 1.75rem 0 3rem;
  min-height: 60vh;
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 1.5rem 0 2.5rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
}

.site-footer a {
  color: var(--fg-muted);
}

/* -- item grid / cards -------------------------------------------------- */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.item-card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.item-card__thumb-link {
  display: block;
}

.item-card__thumb {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  background: var(--border);
}

.item-card__body {
  padding: 0.9rem 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-grow: 1;
}

.item-card__title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
}

.item-card__title a {
  color: var(--fg);
  text-decoration: none;
}

.item-card__title a:hover {
  color: var(--accent);
}

.item-card__meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin: auto 0 0;
}

.item-card__meta a {
  color: inherit;
  text-decoration: none;
}

.item-card__meta a:hover {
  color: var(--accent);
}

/* -- badges -------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--bg-elevated-hover);
  color: var(--fg-muted);
  white-space: nowrap;
}

.badge--danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

/* -- pagination ------------------------------------------------------- */

.pagination {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  font-size: 0.95rem;
}

.pagination a {
  text-decoration: none;
}

.pagination__spacer {
  color: var(--fg-muted);
}

/* -- single item page --------------------------------------------------- */

.item-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.item-header__thumb {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.item-header__info {
  flex: 1 1 260px;
  min-width: 0;
}

.item-meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.92rem;
  color: var(--fg-muted);
  margin: 0.5rem 0 0.9rem;
  padding: 0;
  list-style: none;
}

.item-meta-list a {
  color: var(--fg-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.6rem 0 0;
  list-style: none;
}

.tag-list a {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  text-decoration: none;
}

.tag-list a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.notice-box {
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.notice-box--danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

audio {
  width: 100%;
  display: block;
  margin: 1rem 0;
}

.download-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0.75rem 0 1.5rem;
  list-style: none;
}

.download-list a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  text-decoration: none;
  color: var(--fg);
  font-size: 0.9rem;
}

.download-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.download-list .format {
  font-weight: 700;
}

.download-list .size {
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.item-body {
  overflow-wrap: break-word;
}

.item-body :first-child {
  margin-top: 0;
}

.comments {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.comment {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.comment:last-child {
  border-bottom: none;
}

.comment__meta {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}

.comment__meta strong {
  color: var(--fg);
}

/* -- channel grid -------------------------------------------------------- */

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.channel-grid > li {
  display: flex;
}

.channel-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: var(--fg);
  box-shadow: var(--shadow);
}

.channel-card:hover {
  background: var(--bg-elevated-hover);
}

.channel-card__thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

.channel-card__name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  min-height: 3.9rem;
  display: flex;
  align-items: center;
}

.channel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.75rem;
}

.channel-header__feeds {
  margin: 0 0 0 auto;
}

.channel-header__feeds a {
  align-items: center;
}

.feed-icon {
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .channel-header__feeds {
    margin-left: 0;
    width: 100%;
  }
}

.channel-header__thumb {
  width: 96px;
  height: 96px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

/* -- tag cloud ------------------------------------------------------- */

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem 1.1rem;
  margin-top: 1.5rem;
}

.tag-cloud__tag {
  color: var(--fg-muted);
  text-decoration: none;
  line-height: 1.2;
}

.tag-cloud__tag:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* -- static pages / legacy raw HTML -------------------------------------- */

.page-body {
  overflow-wrap: break-word;
}

.page-body img {
  border-radius: var(--radius);
}

.page-body .impressum-overlay {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.page-body .impressum-overlay img {
  display: block;
  max-width: 100%;
  height: auto;
}

.page-body .impressum-overlay img:last-child {
  position: absolute;
  top: 0;
  left: 0;
}

@media (prefers-color-scheme: dark) {
  .page-body .impressum-overlay img {
    filter: invert(1);
  }
}

/* -- misc ------------------------------------------------------------ */

.muted {
  color: var(--fg-muted);
}

.empty-state {
  color: var(--fg-muted);
  padding: 3rem 0;
  text-align: center;
}

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