/* Defaults only. Folder :root vars must load AFTER this file
   or --bg-image / colours get reset to none / beige. */
@property --fg { syntax: "<color>"; inherits: true; initial-value: #111111; }
@property --bg { syntax: "<color>"; inherits: true; initial-value: #e8dcc4; }
@property --link { syntax: "<color>"; inherits: true; initial-value: #1238a0; }
@property --vlink { syntax: "<color>"; inherits: true; initial-value: #6b2d8b; }
@property --panel-a { syntax: "<number>"; inherits: true; initial-value: 0.5; }

:root {
  --fg: #111111;
  --bg: #e8dcc4;
  --link: #1238a0;
  --vlink: #6b2d8b;
  --bg-image: none;
  --bg-fit: cover;
  --panel-a: 0.5;
}

html {
  transition: --bg 1.2s ease, --fg 1.2s ease, --link 1.2s ease, --vlink 1.2s ease;
}

html, body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--fg);
  font-family: Verdana, Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

/* Photo lives on .page-bg. Beat custom.css `body { background-image }` (0,0,1). */
html body {
  background-image: none;
}

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--vlink); }
a:hover { text-decoration: underline; }

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.page-bg-layer {
  position: absolute;
  inset: 0;
  background-color: var(--bg);
  background-image: var(--bg-image);
  background-size: var(--bg-fit, cover);
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.page-bg-layer.is-on { opacity: 1; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: 54rem;
  padding: 1.1rem 1.2rem 8rem;
  background-color: color-mix(in srgb, var(--bg) calc(var(--panel-a) * 100%), transparent);
  color: var(--fg);
}

@supports (animation-timeline: scroll()) {
  html:not(.is-reduce-motion) .wrap {
    animation: panel-reveal linear both;
    animation-timeline: scroll();
    animation-range: 0% 80%;
  }
}

@keyframes panel-reveal {
  from { --panel-a: 0.5; }
  to { --panel-a: 0.08; }
}

.bg-spacer {
  min-height: 100vh;
  pointer-events: none;
}

.mast {
  display: flex;
  align-items: baseline;
  gap: 0.55rem 0.85rem;
  flex-wrap: wrap;
  margin: 0 0 1.4rem;
  border-bottom: 1px solid var(--fg);
  padding-bottom: 0.45rem;
}
.mast-id {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}
.brand {
  font-style: italic;
  font-size: 1.55rem;
  font-weight: 700;
  text-decoration: underline;
  color: inherit;
}
.brand:visited { color: inherit; }
.tag { font-size: 0.95rem; }

.mast-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.28rem;
}
.mast-btn {
  display: inline-block;
  border: 1px solid color-mix(in srgb, var(--fg) 38%, transparent);
  padding: 0.05rem 0.38rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: inherit;
  text-decoration: none;
  background: transparent;
  font-family: inherit;
}
.mast-btn:visited { color: inherit; }
.mast-btn:hover, .mast-btn:focus-visible {
  border-color: var(--fg);
  text-decoration: none;
}

.tree-nav { position: relative; display: inline-block; flex: 0 0 auto; white-space: nowrap; }
.tree-open {
  /* find-cluster: match the search input visually */
  background: color-mix(in srgb, var(--bg) calc(var(--panel-a) * 100%), transparent);
  border: 1px solid var(--fg);
  padding: 0.15rem 0.55rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.tree-open:hover,
.tree-open:focus-visible {
  text-decoration: none;
  border-color: var(--fg);
  background: color-mix(in srgb, var(--fg) 9%, color-mix(in srgb, var(--bg) calc(var(--panel-a) * 100%), transparent));
}
.tree-open[aria-expanded="true"] {
  font-weight: 700;
  background: color-mix(in srgb, var(--fg) 13%, color-mix(in srgb, var(--bg) calc(var(--panel-a) * 100%), transparent));
}

.tree-panel {
  position: absolute;
  left: auto;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 12;
  width: 18.5rem;
  max-height: 20rem;
  overflow: auto;
  padding: 0.45rem 0.55rem 0.55rem;
  border: 1px solid var(--fg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  color: var(--fg);
}
.tree-crumbs {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  line-height: 1.4;
}
.tree-sep { opacity: 0.55; }
.tree-crumb,
.tree-level {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}
.tree-crumb:hover,
.tree-level:hover { text-decoration: underline; }
.tree-here { margin: 0 0 0.35rem; font-size: 0.78rem; font-style: italic; }
.tree-q { width: 100%; box-sizing: border-box; }
.tree-list {
  list-style: none;
  padding: 0;
  margin: 0.3rem 0 0;
}
.tree-list li { margin: 0; }
.tree-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--fg) 30%, transparent);
  color: inherit;
  font: inherit;
  padding: 0.2rem 0.15rem;
  cursor: pointer;
}
.tree-list li:last-child .tree-row { border-bottom: 0; }
.tree-mark { opacity: 0.55; }
.tree-row:hover,
.tree-row:focus-visible {
  background: var(--fg);
  color: var(--bg);
}
.tree-empty { margin: 0.3rem 0 0; font-size: 0.78rem; }

@media (prefers-reduced-motion: no-preference) {
  .tree-panel:not([hidden]) {
    animation: tree-in 140ms ease-out;
  }
}
@keyframes tree-in {
  from { opacity: 0; transform: translateY(-0.25rem); }
  to { opacity: 1; transform: none; }
}

.find-side {
  margin-left: auto;
  display: flex;
  align-items: center; /* center-align so button and input share the same midline */
  gap: 0.55rem;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  font-size: 0.85rem;
}
.find { margin-left: 0; }
.find input, textarea, select, input[type="text"], input[type="password"], input[type="search"] {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  font: inherit;
  padding: 0.15rem 0.35rem;
}
/* find-cluster: give the header search the same panel-opacity as .tree-open */
.find-side .find input[type="search"] {
  background: color-mix(in srgb, var(--bg) calc(var(--panel-a) * 100%), transparent);
}
.find.big { margin: 0 0 1rem; display: flex; gap: 0.4rem; }

.color-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.color-row label { min-width: 7rem; }
input[type="color"].color-pick {
  width: 2rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid var(--fg);
  background: var(--bg);
  cursor: pointer;
  vertical-align: middle;
}
input.color-hex { width: 7rem; }
.farben-preview {
  max-width: 22rem;
  margin: 0.35rem 0 1rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--fg);
}
.farben-preview .prev-vlink { margin-left: 0.4rem; }

.lede { max-width: 36rem; margin: 0 0 0.85rem; }
.home-intro { max-width: 40rem; }
.home-intro .long { margin-top: 0.5rem; }
.home-intro .long p { margin: 0.4rem 0; }
.flash { border: 1px solid var(--fg); padding: 0.35rem 0.55rem; }

h1, h2 { font-weight: 700; }
h1 { font-size: 1.45rem; margin: 0 0 0.4rem; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 0.4rem; font-style: italic; }

.wrap:has(.home-now) { max-width: 58rem; }

.home-now {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 0 1.5rem;
  align-items: start;
}
.home-now .now-col:first-child { padding-right: 1.5rem; }
.home-now .now-col + .now-col {
  border-left: 1px solid color-mix(in srgb, var(--fg) 22%, transparent);
  padding-left: 1.5rem;
}
.home-now h2 { margin: 0 0 0.3rem; }
.played-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2rem 0.5rem;
  margin: 0 0 0.3rem;
}
.played-head h2 { margin: 0; }
/* play-all sits beside the heading; range pills pushed to the far right */
.played-head .play-all-btn {
  font-size: 0.78em;
  opacity: 0.75;
  padding-inline: 0.45em;
}
.played-head .play-all-btn::before {
  content: "▶\00a0";
  font-size: 0.72em;
}
.played-ranges {
  display: inline-flex;
  align-items: baseline;
  gap: 0.2rem;
  font-style: normal;
  margin-left: auto;
  padding-left: 0.6rem;
  border-left: 1px solid color-mix(in srgb, var(--fg) 20%, transparent);
}
.played-ranges .btn.is-on {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}
.played-more {
  display: block;
  width: 100%;
  flex-basis: 100%;
  margin: 0.35rem 0 0;
}
.home-comments { margin-top: 1.4rem; }
.home-comments h2 { margin: 0 0 0.3rem; }
.home-now .home-comments .cmt-who {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.85em;
}

.site-foot {
  margin-top: 2.4rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--fg);
  font-size: 0.8rem;
}
.site-foot p { margin: 0.12rem 0 0; }
.site-foot a + a { margin-left: 0.85rem; }
.legal-people { margin: 0.8rem 0 0; }
.legal-people .meta { margin-left: 0.45rem; }

.home-now .file-list {
  margin-top: 0;
  max-height: none;
  overflow: visible;
}
.home-now .file {
  flex-wrap: nowrap;
  min-width: 0;
  gap: 0.3rem 0.5rem;
  padding: 0.1rem 0;
}
.home-now .file .btn,
.home-now .file .btn-glyph,
.home-now .file .meta,
.home-now .file .meta-pl,
.home-now .file .cmt-who { flex-shrink: 0; }
.home-now .file > a,
.home-now .file-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-now .file .meta {
  flex: 0 0 auto;
  overflow: visible;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* date column: YYYY-MM-DD needs ~7.2em to never wrap */
.home-now .now-col:first-child .file .meta {
  min-width: 7.2em;
}
/* play-count column: up to 5 digits + × needs ~4.5em */
.home-now .now-col + .now-col .file .meta {
  min-width: 4.5em;
}
@media (prefers-reduced-motion: no-preference) {
  .home-now .file > a,
  .home-now .file-name {
    transition: opacity 120ms ease;
  }
  .home-now .file:hover > a,
  .home-now .file:hover .file-name { opacity: 0.78; }
}

.subdirs, .plain { list-style: none; padding: 0; margin: 0; }
.subdirs li, .plain li { margin: 0.35rem 0; }
.subdirs a { font-weight: 700; }

.albums { clear: both; margin: 0.2rem 0 1rem; }

.album-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.9rem 0.75rem;
  align-items: start;
  list-style: none;
  padding: 0;
  margin: 0;
}
.album-card {
  display: block;
  color: var(--album-fg, var(--fg));
  background: color-mix(in srgb, var(--album-bg, var(--bg)) 78%, transparent);
  text-decoration: none;
}
.album-card:visited { color: var(--album-fg, var(--fg)); }
.album-card:hover { text-decoration: none; }
.album-card:hover .album-title { text-decoration: underline; }
.album-card img,
.album-card .album-plate {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}
.album-card .album-plate {
  background: color-mix(in srgb, var(--album-bg, var(--bg)) 88%, var(--album-fg, var(--fg)));
}
.album-card .album-body { padding: 0.4rem 0.5rem 0.55rem; }
.album-title { font-weight: 700; line-height: 1.25; }
.album-kurz {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  font-style: italic;
  opacity: 0.85;
}

@media (prefers-reduced-motion: no-preference) {
  .album-card {
    transition: background-color 160ms ease;
  }
  .album-card:hover {
    background: color-mix(in srgb, var(--album-bg, var(--bg)) 92%, transparent);
  }
}
.meta { font-size: 0.78rem; opacity: 0.8; }
.priv { font-size: 0.75rem; text-transform: lowercase; }

.dirhead { margin-bottom: 1rem; }
.dirpic { max-width: 220px; height: auto; float: left; margin: 0 1rem 0.6rem 0; }
.short { font-weight: 700; }
.long { clear: both; }
.thumb { height: 48px; width: auto; vertical-align: middle; margin-right: 0.4rem; }

.files, .file-list {
  margin-top: 1rem;
  clear: both;
  overflow: auto;
  max-height: calc(100vh - 12rem);
}
.file {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.65rem;
  align-items: baseline;
  padding: 0.22rem 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--fg) 30%, transparent);
}
.file.is-current {
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--fg);
  padding-left: 0.4rem;
  background: color-mix(in srgb, var(--fg) 7%, transparent);
}
.file.is-current::before { content: "▶\00a0"; font-size: 0.72em; vertical-align: 0.07em; }
.file.is-paused::after { content: " (pause)"; }
.file.is-removed { opacity: 0.55; }
.file.is-removed .gone { font-style: italic; }

.btn {
  display: inline-block;
  border: 1px solid var(--fg);
  padding: 0.08rem 0.42rem;
  font-size: 0.75rem;
  cursor: pointer;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-decoration: none;
}
/* compact glyph variant: speech-bubble (read) / ! (write) / + (playlist) */
.btn-glyph { padding: 0 0.2rem; font-size: 0.82rem; }
.cmt-bubble { font-size: 0.78rem; }   /* keeps emoji small vs surrounding text */
#isde-comment-dlg:not(.is-write) .isde-comment-form,
#isde-comment-dlg:not(.is-write) .isde-pop-login { display: none; }
.btn:hover, .btn:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

.inline { display: inline; }
.folder-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.crumbs { font-size: 0.85rem; }

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 0.5rem 1.2rem 0.7rem;
  background: var(--bg);
  color: var(--fg);
  border-top: 1px solid var(--fg);
  z-index: 20;
}
.player-controls { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.25rem; }
.times { font-size: 0.85rem; }
.bar {
  height: 14px;
  border: 1px solid var(--fg);
  cursor: pointer;
  margin-top: 0.4rem;
  max-width: 22rem;
  background: var(--fg);
  touch-action: none; /* let JS handle touch; prevents scroll hijacking during drag */
  user-select: none;  /* no text selection during drag */
}
.bar.is-stream {
  opacity: 0.4;
  cursor: not-allowed;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--bg);
  transition: width 80ms linear;
  pointer-events: none;
}

.album-pick { max-width: 36rem; }
.album-pick .album-q,
.path-in { width: 100%; max-width: 36rem; box-sizing: border-box; }
.album-list {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0.85rem;
  max-height: 12rem;
  overflow: auto;
  border: 1px solid var(--fg);
}
.album-list li { margin: 0; }
.album-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--fg) 30%, transparent);
  color: inherit;
  font: inherit;
  padding: 0.22rem 0.4rem;
  cursor: pointer;
}
.album-list li:last-child .album-opt { border-bottom: 0; }
.album-opt .meta { margin-left: 0.45rem; }
.album-opt:hover,
.album-opt:focus-visible,
.album-opt.is-on {
  background: var(--fg);
  color: var(--bg);
}
.album-opt:hover .meta,
.album-opt:focus-visible .meta,
.album-opt.is-on .meta { opacity: 0.75; }
.album-none { margin: 0.2rem 0 0.8rem; }

.user-row {
  border: 1px solid color-mix(in srgb, var(--fg) 35%, transparent);
  margin: 0 0 1rem;
  padding: 0 0.8rem 0.2rem;
  max-width: 36rem;
}
.user-row legend { font-weight: 700; }

.upload-log { margin-top: 0.6rem; font-size: 0.85rem; }
.upload-row { margin: 0.25rem 0; }
.upload-row .bar { max-width: 18rem; }

.file-comments { font-size: 0.85rem; }
.file-comments summary { cursor: pointer; }
.file-comments textarea { width: 100%; max-width: 28rem; display: block; margin: 0.3rem 0; }
.file-comments p { margin: 0.25rem 0; }

dialog.isde-pop {
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  padding: 0.55rem 0.7rem 0.7rem;
  max-width: 22rem;
  width: calc(100% - 2rem);
  font: inherit;
}
dialog.isde-pop::backdrop { background: rgb(0 0 0 / 0.28); }
.isde-pop-close { float: right; margin: 0 0 0.3rem 0.5rem; }
.isde-pop-title { font-weight: 700; margin: 0 2.2rem 0.4rem 0; }
.isde-pop-list { max-height: 10rem; overflow: auto; font-size: 0.85rem; clear: both; }
.isde-pop-list p { margin: 0.25rem 0; }
.isde-comment-form textarea { width: 100%; box-sizing: border-box; display: block; margin: 0.35rem 0; }
.isde-comment-form p { margin: 0.2rem 0 0.35rem; font-size: 0.85rem; }
.isde-pop .addpl { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.35rem; }
.isde-pop-status { min-height: 1.1em; font-size: 0.85rem; margin: 0.3rem 0 0; }
.isde-pop-login { margin: 0.4rem 0 0; }

@media (max-width: 768px) {
  .home-now { grid-template-columns: 1fr; }
  .home-now .now-col:first-child { padding-right: 0; }
  .home-now .now-col + .now-col {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--fg) 22%, transparent);
    padding-top: 0.85rem;
    margin-top: 0.85rem;
  }
}

@media (max-width: 640px) {
  .wrap { padding: 0.8rem 0.8rem 9rem; }
  .dirpic { float: none; display: block; }
  .find-side { margin-left: 0; width: 100%; flex-wrap: wrap; }
  .find { margin-left: 0; width: 100%; }
  .tree-panel {
    position: static;
    width: min(18.5rem, 100%);
    max-height: 16rem;
    margin: 0.35rem 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { transition: none; }
  .page-bg-layer { transition: none; }
  .wrap { animation: none !important; }
  :root { --panel-a: 0.5; }
}
