:root {
  color-scheme: light;
  --paper: #eee8da;
  --paper-light: #f8f4eb;
  --ink: #20372e;
  --muted: #566257;
  --quiet: #697368;
  --rule: #b4bbab;
  --panel: #203d32;
  --panel-rule: #6d8473;
  --panel-copy: #e2e8d8;
  --accent: #e3b35d;
  --focus: #a64327;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --page-width: 1320px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.25rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

::selection { color: var(--ink); background: var(--accent); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

.skip-link {
  position: fixed;
  z-index: 5;
  top: 0.75rem;
  inset-inline-start: 0.75rem;
  padding: 0.7rem 1rem;
  transform: translateY(-160%);
  color: var(--paper);
  background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-header,
.page-shell,
.site-footer {
  width: min(100% - 4rem, var(--page-width));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--ink);
  background: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: -0.06em;
}
.brand-name {
  font-size: 0.93rem;
  font-weight: 750;
  letter-spacing: -0.035em;
}
.brand-name span { font-family: var(--serif); font-style: italic; font-weight: 400; }

.site-footer > a:last-child {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.page-shell { padding-bottom: 5.5rem; }
h1, h2, h3, p { margin-top: 0; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, 0.29fr);
  align-items: end;
  gap: clamp(2.5rem, 7vw, 7rem);
  padding: clamp(4.25rem, 8vw, 7rem) 0 3.5rem;
  border-bottom: 1px solid var(--ink);
}
.hero-copy { min-width: 0; }
h1 {
  max-width: 10ch;
  margin-bottom: 1.6rem;
  font-family: var(--sans);
  font-size: clamp(4rem, 8vw, 6rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 0.9;
}
h1 > span { display: block; }
.intro-copy {
  max-width: 37ch;
  margin: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(1.1rem, 1.5vw, 1.38rem);
  line-height: 1.45;
}
.hero-now-playing {
  align-self: stretch;
  min-width: 0;
  padding: 1.15rem 0 0.15rem;
  border-top: 1px solid var(--ink);
}
.now-playing-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.now-playing-copy { min-width: 0; }
.now-playing-copy h2 {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.now-playing-copy p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.music-toggle {
  display: grid;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--accent);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.music-toggle svg { width: 1.45rem; height: 1.45rem; }
.music-toggle .speaker-muted { display: none; }
.music-toggle[aria-pressed="false"] .speaker-waves { display: none; }
.music-toggle[aria-pressed="false"] .speaker-muted { display: block; }
.music-toggle:disabled { color: var(--quiet); background: color-mix(in oklch, var(--paper-light) 70%, var(--paper)); cursor: wait; }
.now-playing-status {
  min-height: 1.1em;
  margin: 0.8rem 0 0.45rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
}
.now-playing-player,
.now-playing-embed {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.now-playing-player iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 0;
}
.now-playing-fallback {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  text-underline-offset: 0.2em;
}
.now-playing-count {
  margin: 0.45rem 0 0;
  color: var(--quiet);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.library-section {
  margin-top: 2.75rem;
  padding: clamp(1.4rem, 3.2vw, 2.6rem);
  background: var(--paper-light);
  scroll-margin-top: 1.25rem;
}
.domain-directory {
  padding: clamp(1.4rem, 3.2vw, 2.6rem);
  color: var(--paper-light);
  background: var(--panel);
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.2rem;
}
.section-heading h2 {
  margin-bottom: 0;
  font-family: var(--serif);
  font-size: clamp(1.75rem, 3vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1;
}
.section-heading p {
  margin: 0 0 0.12rem;
  color: var(--panel-copy);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-align: right;
}
.source-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--panel-rule);
  border-left: 1px solid var(--panel-rule);
}
.source-shortcut {
  position: relative;
  display: flex;
  min-height: 118px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.1rem 0.85rem;
  border: 0;
  border-right: 1px solid var(--panel-rule);
  border-bottom: 1px solid var(--panel-rule);
  color: var(--paper-light);
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease;
}
.source-shortcut[aria-pressed="true"] { color: var(--ink); background: var(--paper-light); }
.source-shortcut--lead { grid-column: span 2; }
.source-shortcut--lead[aria-pressed="true"] { color: var(--ink); background: var(--accent); }
.source-shortcut--all { color: var(--accent); }
.source-shortcut-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(0.87rem, 1.35vw, 1.13rem);
  font-weight: 700;
  letter-spacing: -0.025em;
}
.source-shortcut-count {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.035em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.source-shortcut-unit { font-family: var(--mono); font-size: 0.76rem; }
.source-shortcut--all:hover,
.source-shortcut--all[aria-pressed="true"] { color: var(--ink); background: var(--accent); }

.catalogue-results {
  margin-top: clamp(2.25rem, 5vw, 4rem);
}
.links-heading { margin-bottom: 1.75rem; }
.links-heading h2 { font-size: clamp(2.2rem, 5vw, 4.5rem); }
.links-heading p { color: var(--muted); }
.results-panel { min-width: 0; }
.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px) minmax(180px, 220px);
  align-items: end;
  gap: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--ink);
}
.controls--spotify { grid-template-columns: minmax(0, 1fr) repeat(3, minmax(150px, 190px)); }
.search-form, .source-control, .spotify-control, .sort-control { display: grid; gap: 0.42rem; }
.search-form label, .source-control label, .spotify-control label, .sort-control label {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.search-box {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.8rem;
  border: 1px solid var(--ink);
  background: color-mix(in oklch, var(--paper-light) 72%, white);
}
.search-box:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.search-mark { position: relative; width: 14px; height: 14px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 50%; }
.search-mark::after { position: absolute; right: -5px; bottom: -3px; width: 6px; height: 1.5px; transform: rotate(45deg); background: currentColor; content: ""; }
.search-box input { width: 100%; min-width: 0; padding: 0.6rem 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 0.95rem; }
.search-box input::placeholder { color: var(--muted); opacity: 1; }
.search-box input::-webkit-search-cancel-button { display: none; }
.clear-search { padding: 0.3rem 0.15rem; border: 0; color: var(--ink); background: transparent; cursor: pointer; font-size: 0.82rem; text-decoration: underline; text-underline-offset: 0.15em; }
.source-control select, .spotify-control select, .sort-control select {
  width: 100%;
  min-height: 48px;
  padding: 0 2rem 0 0.75rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  background: color-mix(in oklch, var(--paper-light) 72%, white);
  font-size: 0.95rem;
}
.result-summary { padding: 1rem 0 0.55rem; }
.result-summary p { margin: 0; color: var(--muted); font-family: var(--mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

.resource-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1.3rem, 3vw, 2.8rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.resource-list--x-feed {
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 36rem);
  margin-inline: auto;
  border-inline: 1px solid var(--rule);
}
.resource-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(105px, 0.35fr);
  align-content: start;
  align-items: start;
  column-gap: 0.8rem;
  row-gap: 0.85rem;
  min-width: 0;
  padding: 1.15rem 0 1.3rem;
  border-top: 1px solid var(--rule);
}
.resource-list--x-feed .resource-row {
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
  padding: 0.8rem;
}
.resource-list--x-feed .resource-row--x-profile { padding: 0.95rem; }
.resource-list--x-feed .resource-row--x-post { padding: 0.3rem; }
.resource-list--x-feed .resource-row--x-post .resource-social-preview {
  grid-column: auto;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
}
.resource-main-wrap { min-width: 0; }
.resource-thumbnail { display: block; width: 100%; aspect-ratio: 1.91; margin-bottom: 0.8rem; object-fit: cover; background: var(--paper); }
.resource-row.resource-row--illustrated { grid-template-columns: minmax(0, 1fr); }
.resource-row--illustrated .resource-meta { justify-items: start; text-align: left; }
.resource-main { display: block; min-width: 0; color: var(--ink); text-decoration: none; }
.resource-title {
  display: block;
  max-width: 38ch;
  font-family: var(--serif);
  font-size: clamp(1.18rem, 1.7vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.resource-address { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.5rem; margin-top: 0.45rem; }
.resource-domain { color: color-mix(in oklch, var(--ink) 72%, var(--paper)); font-size: 0.8rem; font-weight: 750; overflow-wrap: anywhere; }
.resource-path { min-width: 0; color: var(--muted); font-family: var(--mono); font-size: 0.74rem; line-height: 1.45; overflow-wrap: anywhere; }
.resource-meta { display: grid; gap: 0.22rem; justify-items: end; margin: 0.05rem 0 0; color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; line-height: 1.45; text-align: right; }
.resource-meta span:first-child { color: var(--ink); font-size: 0.76rem; font-weight: 750; }
.resource-player { grid-column: 1 / -1; min-width: 0; margin-top: 0.05rem; }
.resource-social-preview { grid-column: 1 / -1; width: min(100%, 540px); min-width: 0; margin-top: 0.05rem; }
.social-preview-status { margin: 0.15rem 0 0.45rem; color: var(--muted); font-size: 0.78rem; }
.social-embed { min-width: 0; overflow: hidden; }
.social-embed .twitter-tweet,
.social-embed .instagram-media { width: 100% !important; min-width: 0 !important; max-width: 540px !important; margin: 0 !important; }
.social-embed iframe { display: block; max-width: 100% !important; }
.social-preview-fallback { display: inline-block; margin-top: 0.45rem; color: var(--ink); font-size: 0.8rem; text-underline-offset: 0.2em; }
.media-frame { width: min(100%, 720px); margin-top: 0.65rem; overflow: hidden; background: var(--panel); }
.media-frame--video { aspect-ratio: 16 / 9; }
.media-frame iframe { display: block; width: 100%; border: 0; }
.media-frame--video iframe { height: 100%; }
.media-frame--audio iframe { height: var(--embed-height); border-radius: 0; }
.media-frame[data-media-provider="Spotify"] { min-height: var(--embed-height); }
.spotify-embed-target { min-height: var(--embed-height); }
.media-player-fallback { display: inline-block; margin: 0.7rem; color: var(--paper-light); font-size: 0.82rem; }

.empty-state { padding: 3rem 0; border-top: 1px solid var(--rule); }
.empty-state h3 { margin-bottom: 0.45rem; font-family: var(--serif); font-size: 1.65rem; font-weight: 500; }
.empty-state p { max-width: 44ch; margin-bottom: 1rem; color: var(--muted); }
.text-button { padding: 0; border: 0; color: var(--ink); background: transparent; cursor: pointer; text-decoration: underline; text-underline-offset: 0.2em; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--ink); }
.pagination span { color: var(--muted); font-family: var(--mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.page-button { min-height: 40px; padding: 0.45rem 0.8rem; border: 1px solid var(--ink); color: var(--ink); background: transparent; cursor: pointer; font-size: 0.88rem; font-weight: 700; }
.page-button:disabled { color: var(--quiet); background: transparent; cursor: not-allowed; }
.loading-copy { color: var(--muted); font-size: 0.9rem; }
.source-shortcuts .loading-copy { color: var(--panel-copy); }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 0 2.3rem; border-top: 1px solid var(--ink); }
.footer-brand { color: var(--ink); font-family: var(--serif); font-size: 1rem; font-weight: 600; text-decoration: none; }
[hidden] { display: none !important; }

@media (max-width: 1000px) {
  .controls, .controls--spotify { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-form { grid-column: 1 / -1; }
  .resource-row { grid-template-columns: minmax(0, 1fr) minmax(95px, 0.33fr); }
}

@media (max-width: 760px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 2rem, var(--page-width)); }
  .site-header { min-height: 68px; }
  .brand { gap: 0.55rem; }
  .brand-mark { width: 34px; height: 34px; font-size: 0.66rem; }
  .brand-name { max-width: 16ch; font-size: 0.78rem; line-height: 1.15; }
  .intro { grid-template-columns: minmax(0, 1fr); gap: 2rem; padding: 2.4rem 0 2.5rem; }
  .hero-copy { width: 100%; text-align: center; }
  h1 { max-width: none; width: 100%; margin-bottom: 1.15rem; font-size: clamp(2.6rem, 14.4vw, 6rem); line-height: 0.98; }
  .intro-copy { max-width: none; width: 100%; font-size: 1.08rem; text-wrap: balance; }
  .hero-now-playing { padding-top: 1rem; }
  .library-section { margin-top: 1.8rem; padding: 1rem; }
  .domain-directory { padding: 1.15rem; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 0.55rem; margin-bottom: 0.9rem; }
  .section-heading h2 { font-size: 2rem; }
  .section-heading p { text-align: left; }
  .source-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-shortcut { min-height: 102px; padding: 0.8rem; }
  .source-shortcut--lead { grid-column: span 2; min-height: 120px; }
  .source-shortcut-name { font-size: 0.9rem; }
  .source-shortcut-count { font-size: 2.35rem; }
  .source-shortcut-unit { font-size: 0.7rem; }
  .catalogue-results { margin-top: 2.4rem; }
  .links-heading { gap: 0.55rem; }
  .links-heading h2 { font-size: 2.4rem; }
  .links-heading p { font-size: 0.76rem; }
  .controls { grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
  .search-form { grid-column: auto; }
  .source-control, .spotify-control, .sort-control { grid-template-columns: minmax(88px, 0.36fr) minmax(0, 1fr); align-items: center; gap: 0.65rem; }
  .source-control label, .spotify-control label, .sort-control label { font-size: 0.72rem; }
  .source-control select, .spotify-control select, .sort-control select { min-height: 42px; font-size: 0.9rem; }
  .search-box { min-height: 44px; }
  .result-summary { padding: 0.85rem 0 0.5rem; }
  .resource-list { grid-template-columns: minmax(0, 1fr); }
  .resource-row { grid-template-columns: minmax(0, 1fr) minmax(105px, 0.38fr); column-gap: 0.75rem; padding-block: 1rem 1.15rem; }
  .resource-title { font-size: 1.28rem; }
  .resource-domain { font-size: 0.76rem; }
  .resource-path { font-size: 0.7rem; }
  .resource-meta { font-size: 0.72rem; }
  .resource-meta span:first-child { font-size: 0.72rem; }
}

@media (max-width: 390px) {
  .site-header, .page-shell, .site-footer { width: min(100% - 1.35rem, var(--page-width)); }
  .brand-name { max-width: 14ch; font-size: 0.7rem; }
  h1 { font-size: clamp(2.5rem, 14.4vw, 6rem); }
  .library-section { padding: 0.9rem; }
  .domain-directory { padding: 0.9rem; }
  .resource-row { grid-template-columns: minmax(0, 1fr); row-gap: 0.4rem; }
  .resource-meta { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 0.25rem 0.65rem; order: 2; text-align: left; }
  .resource-player { order: 3; }
}

@media (hover: hover) and (pointer: fine) {
  a:hover { color: color-mix(in oklch, var(--ink) 72%, var(--paper-light)); }
  .skip-link:hover { color: var(--accent); }
  .site-footer > a:last-child:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
  .music-toggle:hover:not(:disabled) { background: color-mix(in oklch, var(--accent) 78%, white); }
  .source-shortcut:hover { color: var(--ink); background: var(--paper-light); }
  .source-shortcut--lead:hover { background: color-mix(in oklch, var(--accent) 78%, white); }
  .resource-main:hover .resource-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.17em; }
  .page-button:hover:not(:disabled) { color: var(--ink); background: var(--accent); }
}

.music-toggle:active:not(:disabled),
.source-shortcut:active,
.page-button:active:not(:disabled),
.text-button:active { background: color-mix(in oklch, var(--accent) 78%, white); }

@media (prefers-reduced-motion: no-preference) {
  .source-shortcut { transition-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
