@property --bg{ syntax:'<color>'; inherits:true; initial-value:#0F1410; }
@property --surface{ syntax:'<color>'; inherits:true; initial-value:#1A221B; }
@property --line{ syntax:'<color>'; inherits:true; initial-value:#2E3A2C; }
@property --text-dim{ syntax:'<color>'; inherits:true; initial-value:#93A08C; }
@property --gold{ syntax:'<color>'; inherits:true; initial-value:#C9A24B; }
@property --moss{ syntax:'<color>'; inherits:true; initial-value:#7FA65C; }
@property --bloom{ syntax:'<color>'; inherits:true; initial-value:#C98BA0; }

:root{
  --bg: #0F1410;
  --bg-2: #131A14;
  --surface: #1A221B;
  --surface-veil: color-mix(in srgb, var(--surface) 90%, transparent);
  --surface-hi: #212B22;
  --line: #2E3A2C;
  --text: #EDE8DC;
  --text-dim: #93A08C;
  --gold: #C9A24B;
  --gold-soft: color-mix(in srgb, var(--gold) 14%, transparent);
  --moss: #7FA65C;
  --moss-soft: color-mix(in srgb, var(--moss) 14%, transparent);
  --error: #C9604B;
  --error-soft: rgba(201,96,75,0.12);
  --bloom: #C98BA0;
  --bloom-soft: color-mix(in srgb, var(--bloom) 14%, transparent);
  --dur: 1;            /* motion speed multiplier, set per mood */
  --theme-ms: 900ms;   /* how long a theme change takes to glide */
  transition: --bg var(--theme-ms) ease, --surface var(--theme-ms) ease,
              --line var(--theme-ms) ease, --text-dim var(--theme-ms) ease,
              --gold var(--theme-ms) ease, --moss var(--theme-ms) ease,
              --bloom var(--theme-ms) ease;
  --font-display: "Fraunces", serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }

body{
  margin:0;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, color-mix(in srgb, var(--moss) 10%, transparent), transparent 60%),
    var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  min-height:100vh;
  padding-bottom:8rem;
}

header{
  position:sticky; top:0; z-index:30;
  background:transparent;           /* the backdrop shows straight through at the top of the page */
  padding:2.2rem 1.5rem 1rem;
  transition:background 0.3s ease, backdrop-filter 0.3s ease;
}
/* once the page scrolls, the header gets a frosted plate so content never ghosts behind it */
header.scrolled{
  background:color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
}
.brand{
  display:flex; align-items:center; justify-content:center; gap:0.6rem;
  margin-bottom:1.3rem;
}
.brand svg{ width:26px; height:26px; flex-shrink:0; }
.brand h1{
  font-family:var(--font-display);
  font-weight:600;
  font-size:1.6rem;
  letter-spacing:0.01em;
  margin:0;
}
.brand h1 em{
  font-style:italic; font-weight:500; color:var(--moss);
}
.tagline{
  text-align:center;
  font-size:0.85rem;
  color:var(--text-dim);
  margin:0 0 1.4rem;
  font-family:var(--font-mono);
  letter-spacing:0.02em;
}

form#searchForm{
  max-width:460px; margin:0 auto;
  display:flex; gap:0.5rem;
}
#artistInput{
  flex:1;
  background:var(--surface);
  border:1px solid var(--line);
  color:var(--text);
  font-family:var(--font-body);
  font-size:0.95rem;
  padding:0.75rem 1rem;
  border-radius:10px;
  outline:none;
  transition:border-color 0.15s ease;
}
#artistInput::placeholder{ color:var(--text-dim); }
#artistInput:focus{ border-color:var(--moss); }
#searchBtn, .startOverBtn{
  background:var(--moss);
  color:var(--bg);
  border:none;
  font-family:var(--font-body);
  font-weight:600;
  font-size:0.9rem;
  padding:0 1.2rem;
  border-radius:10px;
  cursor:pointer;
  transition:filter 0.15s ease, transform 0.1s ease;
}
#searchBtn:hover, .startOverBtn:hover{ filter:brightness(1.12); }
#searchBtn:active, .startOverBtn:active{ transform:scale(0.97); }
#searchBtn:focus-visible, .startOverBtn:focus-visible, .node:focus-visible, .crumb:focus-visible{
  outline:2px solid var(--gold); outline-offset:2px;
}

.topRow{
  max-width:460px; margin:0.7rem auto 0;
  display:flex; justify-content:center;
}
.startOverBtn{
  display:none;
  background:transparent;
  border:1px solid var(--line);
  color:var(--text-dim);
  font-weight:500;
  padding:0.4rem 0.9rem;
  font-size:0.8rem;
}
.startOverBtn.show{ display:inline-block; }
.startOverBtn:hover{ color:var(--text); border-color:var(--moss); }

#breadcrumb{
  max-width:900px; margin:1.1rem auto 0;
  display:flex; flex-wrap:wrap; gap:0.35rem;
  justify-content:center;
  padding:0 1rem;
}
.crumb{
  font-family:var(--font-mono);
  font-size:0.72rem;
  letter-spacing:0.01em;
  background:none;
  border:1px solid var(--line);
  color:var(--text-dim);
  border-radius:999px;
  padding:0.28rem 0.7rem;
  cursor:pointer;
  display:flex; align-items:center; gap:0.4rem;
}
.crumb:hover{ color:var(--text); border-color:var(--moss); }
.crumb .n{ opacity:0.5; }
.crumb.artist{ color:var(--gold); }
.crumb.genre{ color:var(--moss); }
.crumb.mood{ color:var(--bloom); }

#treeWrap{
  position:relative;
  max-width:1000px;
  margin:2rem auto 0;
  padding:0 1rem;
}
#connectorSvg{
  position:absolute; top:0; left:0;
  width:100%; height:100%;
  pointer-events:none;
  z-index:0;
  overflow:visible;
}
.link{
  fill:none;
  stroke:color-mix(in srgb, var(--moss) 40%, var(--bg));   /* follows the theme, and stays readable over art */
  stroke-width:1.4;
  opacity:0.8;
  transition:stroke 0.3s ease, opacity 0.3s ease;
}
.link.active{ stroke:var(--gold); opacity:0.85; stroke-width:1.8; }

.row{
  position:relative;
  z-index:1;
  display:flex;
  flex-direction:column;
  gap:2.1rem;
  padding:3.2rem 0 0;
  scroll-margin-top:9rem;
  transition:opacity 0.5s ease, filter 0.5s ease;
}
.row--faded{
  opacity:0.38;
  filter:saturate(0.55);
}
.row--faded:hover{
  opacity:0.75;
  filter:saturate(0.85);
}
.tagGroup{ display:flex; flex-direction:column; align-items:center; }
.nodeGroup{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:0.9rem 0.8rem;
  width:100%;
}
.eyebrow{
  width:fit-content;
  align-self:center;
  text-align:center;
  font-family:var(--font-mono);
  font-size:0.68rem;
  letter-spacing:0.06em;
  text-transform:uppercase;
  color:var(--text-dim);
  margin:0 auto 1.1rem;
  /* a small plate behind the label keeps connector lines and backdrop art from running through the text */
  background:color-mix(in srgb, var(--bg) 90%, transparent);
  padding:0.4rem 1rem;
  border-radius:999px;
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px);
}
.eyebrow b{ color:var(--text); font-weight:500; }
.groupNote{
  color:var(--error);
  font-family:var(--font-mono);
  font-size:0.78rem;
  text-align:center;
  padding:0 1rem;
}

footer.support{
  text-align:center;
  padding:3.5rem 0 2rem;
  font-family:var(--font-mono);
  font-size:0.75rem;
  color:var(--text-dim);
}
footer.support a{
  color:var(--text-dim);
  text-decoration:none;
  border-bottom:1px solid var(--line);
  transition:color 0.15s ease, border-color 0.15s ease;
}
footer.support a:hover{ color:var(--moss); border-color:var(--moss); }
footer.support .dot{ margin:0 0.6rem; opacity:0.4; }

@keyframes riseIn{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:translateY(0); }
}

.node{
  font-family:var(--font-body);
  font-size:0.92rem;
  cursor:pointer;
  border:1px solid var(--line);
  color:var(--text);
  background:var(--surface-veil);
  padding:0.7rem 1.15rem;
  min-width:5.5rem;
  -webkit-backdrop-filter:blur(6px);
  backdrop-filter:blur(6px);   /* art behind a pill goes soft, so it can't cut across the text */
  text-align:center;
  animation:riseIn calc(0.45s * var(--dur)) ease both;
  transition:border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.node:hover{ transform:translateY(-2px); }
.node:active{ transform:translateY(0); }

.node.artist{
  border-radius:44% 56% 52% 48% / 48% 44% 56% 52%;
  background:linear-gradient(160deg, var(--gold-soft), var(--surface-veil) 65%);
  border-color:color-mix(in srgb, var(--gold) 35%, transparent);
  font-weight:600;
  padding:0.85rem 1.3rem;
  text-align:center;
}
.node.artist:hover{ border-color:var(--gold); }
.node.artist.selected{ background:var(--gold-soft); border-color:var(--gold); }
.node.artist .count{ display:block; font-family:var(--font-mono); font-size:0.62rem; color:var(--text-dim); margin-top:0.15rem; font-weight:400; }

.node.genre{
  border-radius:999px 999px 999px 4px;
  background:linear-gradient(160deg, var(--moss-soft), var(--surface-veil) 65%);
  border-color:color-mix(in srgb, var(--moss) 35%, transparent);
  font-family:var(--font-mono);
  font-size:0.78rem;
  letter-spacing:0.01em;
  text-transform:lowercase;
}
.node.genre:hover{ border-color:var(--moss); }
.node.genre.selected{ background:var(--moss-soft); border-color:var(--moss); }

.node.mood{
  border-radius:60% 40% 55% 45% / 45% 55% 40% 60%;
  background:linear-gradient(160deg, var(--bloom-soft), var(--surface-veil) 65%);
  border-color:color-mix(in srgb, var(--bloom) 35%, transparent);
  font-style:italic;
  font-size:0.88rem;
}
.node.mood:hover{ border-color:var(--bloom); }
.node.mood.selected{ background:var(--bloom-soft); border-color:var(--bloom); }

.seedNode{
  font-family:var(--font-display);
  font-weight:600;
  font-size:1.5rem;
  text-align:center;
  padding:1.1rem 1.8rem;
}

.statusRow{
  text-align:center;
  padding:2.2rem 0 0;
  color:var(--text-dim);
  font-family:var(--font-mono);
  font-size:0.8rem;
  animation:riseIn 0.3s ease both;
}
.statusRow.error{ color:var(--error); }
.spinner{
  width:18px; height:18px;
  border-radius:50%;
  border:2px solid var(--line);
  border-top-color:var(--moss);
  display:inline-block;
  margin-right:0.5rem;
  vertical-align:-4px;
  animation:spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

#intro{
  max-width:520px; margin:3.5rem auto 0;
  text-align:center;
  color:var(--text-dim);
  font-size:0.9rem;
  line-height:1.6;
  padding:0 1.2rem;
}
#intro .examples{
  margin-top:1.3rem;
  display:flex; gap:0.5rem; justify-content:center; flex-wrap:wrap;
}
#intro .ex{
  font-family:var(--font-mono);
  font-size:0.75rem;
  border:1px solid var(--line);
  border-radius:999px;
  padding:0.32rem 0.8rem;
  cursor:pointer;
  color:var(--text-dim);
  background:none;
}
#intro .ex:hover{ color:var(--text); border-color:var(--moss); }

@media (max-width:600px){
  .brand h1{ font-size:1.35rem; }
  .seedNode{ font-size:1.2rem; }
  .row{ gap:0.6rem; }
}

@media (prefers-reduced-motion: reduce){
  .node, .statusRow{ animation:none; }
  html{ scroll-behavior:auto; }
}

/* Logo mark follows the theme */
.brand svg .logo-gold{ stroke:var(--gold); }
.brand svg .logo-moss{ stroke:var(--moss); }
.brand svg circle.logo-gold{ fill:var(--gold); stroke:none; }
.brand svg circle.logo-moss{ fill:var(--moss); stroke:none; }

/* No gliding between themes for people who ask for less motion */
@media (prefers-reduced-motion: reduce){
  :root{ transition:none; }
}

/* ---- Genre backdrop: a quiet pattern plus a line-art scene behind the page ---- */
#backdrop{
  position:fixed; inset:0;
  z-index:-1;               /* behind all page content, above the page background */
  pointer-events:none;
  overflow:hidden;
  opacity:var(--bd, 1);     /* mood dials the whole backdrop up or down */
  transition:opacity 1s ease;
}
.bd-layer{ position:absolute; inset:0; opacity:0; transition:opacity 1.3s ease; }
.bd-layer.on{ opacity:1; }
.bd-pattern{ position:absolute; inset:0; }
.bd-scene{
  position:absolute; inset:0;      /* the scene now fills the whole page, behind the header too */
  color:color-mix(in srgb, var(--moss) 52%, transparent);
}
.bd-scene svg{ display:block; width:100%; height:100%; }
.bd-scene svg *{ vector-effect:non-scaling-stroke; }   /* hairlines stay hairlines at any size */
.bd-scene .hl{ color:color-mix(in srgb, var(--gold) 78%, transparent); }
.bd-scene .mask{ fill:var(--bg); }                     /* solid objects hide what's behind them */
.bd-scene .bare{ fill:var(--bg); stroke:none; }
.bd-scene .bl{ color:color-mix(in srgb, var(--bloom) 88%, transparent); }   /* mood lighting */
.bd-scene .glow{ fill:color-mix(in srgb, var(--bloom) 92%, transparent); stroke:none; }
.bd-scene .st{ color:color-mix(in srgb, var(--text) 72%, transparent); }    /* starlight */


/* while the page is scrolling, the art eases back so it can't shimmer against the moving roots */
#backdrop.calm{ opacity:calc(var(--bd, 1) * 0.6); transition:opacity 0.2s ease; }

/* ?bg=attached: the backdrop belongs to the page and scrolls away with the roots */
body{ position:relative; }
#backdrop.attached{ position:absolute; inset:0; }

@media (prefers-reduced-motion: reduce){
  #backdrop, .bd-layer{ transition:none; }
}
