/* Fifteen songs — styles follow the personal design system (Nordic minimalist, Inter, slate + Pacific blue). */

:root {
  --bg: #f6f7f8;
  --heading: #1f2933;
  --body: #5b6773;
  --caption: #8b95a1;
  --surface-light: #e6e8eb;
  --surface-medium: #d3d7dc;
  --line: #9aa3ad;
  --divider: #ced3d9;
  --accent: #41aebd;
  --lead: #4a5561;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 3px; /* controls and badges only; images and layout stay square */
  --gutter: clamp(16px, 6vw, 96px);
  --max: 1280px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* keep the scrollbar's space reserved so filtering to a short list doesn't widen the layout */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 400 16px/1.4 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1,
h2,
h3 {
  color: var(--heading);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.04em;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: var(--accent);
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--heading);
  color: var(--bg);
  padding: 8px 12px;
  font-size: 14px;
  z-index: 10;
}

.skip-link:focus {
  top: 8px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.caption {
  color: var(--caption);
  font-size: 12px;
}

/* Controls and tags are set in lowercase (genre names stay as written in Notion in the data) */
.chip,
.badge,
.button,
.link-button,
.back-link,
.select,
.input,
.input::placeholder {
  text-transform: lowercase;
}

/* ---------- Hero (home) ---------- */

.hero {
  padding-top: clamp(40px, 7vw, 88px);
  padding-bottom: clamp(32px, 5vw, 56px);
}

.hero h1 {
  color: var(--accent);
  font-weight: 700;
  font-size: clamp(48px, 9vw, 96px);
  line-height: 1;
}

.hero p {
  margin-top: 20px;
  max-width: 34em;
  color: var(--lead);
  font-size: 18px;
}

/* ---------- Section heading ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.section-head h2 {
  font-size: 20px;
}

.section-head .count {
  color: var(--caption);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Controls ---------- */

.controls {
  display: grid;
  gap: 16px;
  padding: 20px 0 8px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.field label,
.genre-filter legend {
  color: var(--caption);
  font-size: 12px;
}

.field-search {
  flex: 1 1 260px;
}

.input,
.select {
  height: 36px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  color: var(--heading);
  font-size: 13px;
}

.input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--caption);
}

.input:hover,
.select:hover {
  border-color: var(--line);
}

.select {
  padding-right: 30px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa3ad' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.genre-filter {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.genre-filter legend {
  padding: 0;
  margin-bottom: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (max-width: 640px) {
  /* one scrollable row instead of a tall wall of chips */
  .chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 4px;
    scrollbar-width: none;
  }
  .chips::-webkit-scrollbar {
    display: none;
  }
}

.chip {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  color: var(--body);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--line);
  color: var(--heading);
}

.chip[aria-pressed="true"] {
  background: var(--heading);
  border-color: var(--heading);
  color: var(--bg);
}

.status-line {
  min-height: 18px;
  padding-top: 4px;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ---------- Card grid ---------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 24px 0 0;
  display: grid;
  /* at least two columns on phones */
  grid-template-columns: repeat(auto-fill, minmax(min(200px, calc((100% - 16px) / 2)), 1fr));
  gap: clamp(24px, 3vw, 40px) clamp(16px, 2.4vw, 32px);
}

.card {
  position: relative;
  display: grid;
  gap: 10px;
  align-content: start;
}

.card-cover {
  aspect-ratio: 1;
  width: 100%;
  object-fit: cover;
  background: var(--surface-light);
  transition: opacity 0.2s ease;
}

.card h3 {
  font-size: 18px;
  letter-spacing: -0.03em;
}

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

/* whole card clickable while keeping a single link in the a11y tree */
.card a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card a:focus-visible {
  outline: none;
}

.card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.card:hover .card-cover {
  opacity: 0.88;
}

.card:hover h3 {
  color: var(--accent);
}

.card .caption {
  margin-top: -4px;
}

.badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  background: var(--surface-light);
  border-radius: var(--radius);
  color: var(--body);
  font-size: 12px;
  line-height: 1.3;
}

/* ---------- Loading / empty / error ---------- */

.skeleton .card-cover,
.skeleton .bar {
  background: var(--surface-light);
  animation: pulse 1.4s ease-in-out infinite;
}

.skeleton .bar {
  height: 14px;
  width: 70%;
}

.skeleton .bar.short {
  width: 40%;
  height: 10px;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton .card-cover,
  .skeleton .bar {
    animation: none;
  }
  .card-cover {
    transition: none;
  }
}

.notice {
  padding: 48px 0;
  max-width: 34em;
}

.notice h2,
.notice h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.notice p + p,
.notice p + button {
  margin-top: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  background: var(--heading);
  border: 1px solid var(--heading);
  border-radius: var(--radius);
  color: var(--bg);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #33404d;
}

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

.site-header {
  position: relative;
  border-bottom: 1px solid var(--divider);
}

.site-header > .wrap {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-height: 72px;
}

.back-link {
  justify-self: start;
  color: var(--heading);
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.wordmark {
  color: var(--accent);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--heading);
  cursor: pointer;
}

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

.search-toggle {
  justify-self: end;
  margin-right: -10px; /* align the glyph, not the hit area, with the gutter */
}

/* Search overlay: covers the whole header bar while open */
.header-search {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--bg);
}

.header-search[hidden] {
  display: none;
}

.header-search .wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
}

.header-search .input {
  flex: 1;
  height: 40px;
  border-width: 0 0 1px;
  padding: 0 2px;
  font-size: 16px; /* avoids iOS zoom on focus */
}

.header-search .input:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.header-search .icon-button {
  margin-right: -10px;
}

@media (max-width: 640px) {
  .back-link {
    font-size: 13px;
  }
  .wordmark {
    font-size: 16px;
  }
}

/* ---------- Detail body ---------- */

.detail {
  padding-top: clamp(32px, 6vw, 72px);
}

.detail-top {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: start;
}

.detail-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--surface-light);
}

.detail-info {
  display: grid;
  gap: 16px;
  max-width: 36em;
}

.detail-info h1 {
  font-size: clamp(36px, 5vw, 48px);
}

.detail-info .description {
  color: var(--lead);
  font-size: 18px;
}

.spotify-link {
  justify-self: start;
  margin-top: 8px;
}

.spotify-link .arrow {
  color: var(--accent);
}

@media (max-width: 760px) {
  .detail-top {
    grid-template-columns: 1fr;
  }
  .detail-cover {
    max-width: 420px;
  }
}

.block {
  padding-top: clamp(48px, 7vw, 88px);
}

.block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.block-head h2 {
  font-size: 24px;
}

/* ---------- Related carousel ---------- */

/* One row; cards keep the grid's size, so it only scrolls when they don't fit */
.carousel {
  --gap: clamp(16px, 2.4vw, 32px);
  list-style: none;
  margin: 0 calc(var(--gutter) * -1);
  padding: 24px var(--gutter) 12px;
  display: grid;
  grid-auto-flow: column;
  /* five across the content width; never narrower than 150px (then it scrolls) */
  grid-auto-columns: max(150px, calc((100% - 4 * var(--gap)) / 5));
  gap: var(--gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--divider) transparent;
}

.carousel .card {
  scroll-snap-align: start;
}

.carousel:focus-visible {
  outline-offset: -2px;
}

/* ---------- Track list ---------- */

.tracks {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.tracks th {
  text-align: left;
  font-weight: 400;
  color: var(--caption);
  font-size: 12px;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--divider);
}

.tracks td {
  padding: 14px 16px 14px 0;
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
}

.tracks .num {
  width: 3.5em;
  color: var(--caption);
  font-variant-numeric: tabular-nums;
}

.tracks .name {
  color: var(--heading);
}

.tracks .album {
  color: var(--body);
}

@media (max-width: 560px) {
  .tracks thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .tracks tr {
    display: grid;
    grid-template-columns: 2.5em 1fr;
    border-bottom: 1px solid var(--divider);
    padding: 12px 0;
  }
  .tracks td {
    border: 0;
    padding: 0;
  }
  .tracks .num {
    grid-row: span 2;
    width: auto;
  }
  .tracks .album {
    font-size: 13px;
    color: var(--caption);
    margin-top: 2px;
  }
}

/* ---------- Footer (decorative) ---------- */

.site-footer {
  margin-top: clamp(64px, 10vw, 120px);
  padding: 32px 0 40px;
  border-top: 1px solid var(--divider);
}

.site-footer .ticks {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 16px;
}

.site-footer .ticks span {
  width: 2px;
  height: 100%;
  background: var(--divider);
}

.site-footer .ticks span:nth-child(5n) {
  background: var(--line);
}
