/* === Custom Properties === */
:root {
  --bg:           #ffffff;
  --text:         #111827;
  --muted:        #6b7280;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --border:       #e5e7eb;
  --surface:      #f9fafb;
  --radius:       8px;
  --max-width:    48rem;
  --pad-x:        1.5rem;
  interpolate-size: allow-keywords;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; }

/* === Base === */
body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

/* === Layout — centre all direct body children === */
body > *:not(header) {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

/* === Header === */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-block: 1.25rem 0;
  margin-bottom: 2.5rem;
}

header > * {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--pad-x);
}

header h1 {
  max-width: none;
  padding-inline: 0;
  margin: 0 0 0.875rem;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

header h1 a:hover { color: var(--accent); }

/* === Root nav === */
header > nav:not(.breadcrumbs) {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0;
}

header > nav:not(.breadcrumbs) a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  display: inline-block;
}

header > nav:not(.breadcrumbs) a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* === Breadcrumbs === */
nav.breadcrumbs {
  font-size: 0.8125rem;
  color: var(--muted);
  padding-block: 0.625rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

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

nav.breadcrumbs a:hover {
  color: var(--accent);
  text-decoration: underline;
}

nav.breadcrumbs span {
  color: var(--text);
  font-weight: 500;
}

/* === Typography === */
h1, h2, h3, h4 {
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-block: 1.75rem 0.5rem;
}

h1 { font-size: 2rem;    margin-top: 0; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.0625rem; }

p { margin-block: 0 1rem; }

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

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

code {
  font-family: 'Fira Code', 'Cascadia Code', Consolas, monospace;
  font-size: 0.875em;
  background: var(--border);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin-block: 0 1rem;
}

pre code { background: none; padding: 0; }

blockquote {
  margin-inline: 0;
  padding: 0.75rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-block: 0 1rem;
}

/* === List === */
.list {
  display: grid;
  gap: 0.875rem;
  padding-block: 0 2.5rem;
}

/* === Icons === */
.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  color: var(--muted);
}

.item-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3em;
}

.item a:has(.icon),
.embed-meta a:has(.icon),
.embed-meta span:has(.icon) {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

/* === Item cards === */
.item {
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}

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

.item .title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.item a:hover .title { color: var(--accent); }
.item a.title:hover,
.item a.source-path:hover { color: var(--accent); }

.item .tags,
.item .artist {
  font-size: 0.8125rem;
  color: var(--muted);
}

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

/* === Embeds === */
.embed {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-block: 0 1.5rem;
}

.embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  display: block;
}

.embed-soundcloud iframe {
  aspect-ratio: unset;
  height: 166px;
}

.embed-meta {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.embed-meta a {
  text-decoration: none;
  color: var(--text);
}

.embed-meta a:hover { color: var(--accent); }

.embed-meta .title { font-weight: 600; }

.embed-meta .artist {
  font-size: 0.875rem;
  color: var(--muted);
}

/* === Collapsible embed cards === */
details.embed-collapsible > summary.embed-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
}

details.embed-collapsible > summary.embed-summary::-webkit-details-marker {
  display: none;
}

.embed-toggle-icon {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--muted);
  display: flex;
  align-items: center;
}

.icon-collapse { display: none; }
details.embed-collapsible[open] .icon-expand { display: none; }
details.embed-collapsible[open] .icon-collapse { display: inline; }

details.embed-collapsible .embed-body {
  display: none;
  grid-template-rows: 0fr;
  overflow: hidden;
  opacity: 0;
  transition: display 0.35s allow-discrete,
              grid-template-rows 0.35s ease,
              opacity 0.2s ease;
}

details.embed-collapsible .embed-body > * {
  min-height: 0;
  margin-top: 0.75rem;
}

details.embed-collapsible[open] .embed-body {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: display 0.6s allow-discrete,
              grid-template-rows 0.6s ease-in,
              opacity 0.5s ease-in;
}

@starting-style {
  details[open].embed-collapsible .embed-body {
    grid-template-rows: 0fr;
    opacity: 0;
  }
}

/* === Tags index styles === */
.tags-cloud-container {
  --cloud-hue-lo:    200;
  --cloud-hue-hi:    260;
  --cloud-lightness: 0.50;
  --cloud-chroma:    0.18;

  width: 100%;
  padding-block: 0 2.5rem;
}

.tag-datum { display: none; }

.tags-cloud-container svg { display: block; }

.tags-cloud-container svg text {
  cursor: pointer;
  transition: opacity 0.12s;
}

.tags-cloud-container svg a:hover text { opacity: 0.7; }

.tags-heatmap {
  /* Palette: override these to change the heatmap colour range.
     --heat-lightness-lo/hi: oklch lightness at weight 0 and 1 (0–1).
     --heat-chroma-lo/hi:    oklch chroma at weight 0 and 1 (0–0.4 typical).
     --heat-hue-lo/hi:       oklch hue angle at weight 0 and 1 (0–360). */
  --heat-lightness-lo: 0.92;
  --heat-lightness-hi: 0.88;
  --heat-chroma-lo:    0.06;
  --heat-chroma-hi:    0.10;
  --heat-hue-lo:       100;  /* yellow */
  --heat-hue-hi:       145;  /* green */

  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-block: 0 2.5rem;
}

.tag-heatmap-item {
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background-color: oklch(
    calc(var(--heat-lightness-lo) + var(--heat, 0) * (var(--heat-lightness-hi) - var(--heat-lightness-lo)))
    calc(var(--heat-chroma-lo)    + var(--heat, 0) * (var(--heat-chroma-hi)    - var(--heat-chroma-lo)))
    calc(var(--heat-hue-lo)       + var(--heat, 0) * (var(--heat-hue-hi)       - var(--heat-hue-lo)))
  );
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
}

.tag-heatmap-item:hover {
  text-decoration: underline;
}

.tag-heatmap-item .count {
  font-size: 0.75em;
  opacity: 0.8;
}

.channel-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.channel-col-left {
  flex: 0 0 20%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.channel-thumbnail {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.channel-subscribers {
  margin: 0;
  font-size: 0.85em;
  opacity: 0.7;
}

.channel-col-right {
  flex: 1;
}

.channel-title {
  margin-top: 0;
}

.channel-description {
  white-space: pre-line;
}

.sitemap,
.sitemap ul {
  list-style: none;
  padding-left: 1.5rem;
}

.sitemap > li {
  padding-left: 0;
}

.sitemap .icon {
  margin-right: 0.3em;
  vertical-align: middle;
}

/* === Slideshow === */
.slideshow {
  position: relative;
  width: 100%;
  height: 70vh;
  background: transparent;
  border-radius: var(--radius);
  overflow: hidden;
  outline: none;
  margin-block: 2rem;
  max-width: var(--max-width);
}

.slideshow-track {
  height: 100%;
}

.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
}

.slide.slide-active {
  visibility: visible;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.slideshow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  padding: 0.2em 0.5em;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}

.slideshow-btn:hover { background: rgba(0, 0, 0, 0.75); }
.slideshow-prev { left: 0.5rem; }
.slideshow-next { right: 0.5rem; }

.slide-caption {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 100px);
  margin: 0;
  padding: 0.3em 0.75em;
  font-size: 0.875rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border-radius: var(--radius);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slideshow-counter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 0.8125rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.15em 0.5em;
  border-radius: 999px;
}

.photo-page img {
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: contain;
  display: block;
  border-radius: var(--radius);
}
