@font-face {
  font-family: "MinionPro";
  src: url("/assets/fonts/MinionPro-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MinionPro";
  src: url("/assets/fonts/MinionPro-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "MinionPro";
  src: url("/assets/fonts/MinionPro-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MinionPro";
  src: url("/assets/fonts/MinionPro-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "MinionPro";
  src: url("/assets/fonts/MinionPro-SemiboldIt.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "CustomMono";
  src: url("/assets/fonts/LeagueMono-VF.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #20211f;
  --bg-deep: #171816;
  --surface: #2b2c29;
  --surface-muted: #343530;
  --accent: #c4a97a;
  --accent-hover: #d4bc92;
  --accent-soft: #353026;
  --text-primary: #f4f3ee;
  --text-secondary: #b1ada1;
  --text-muted: #7f7c73;
  --border: #45463f;
  --border-strong: #52544c;

  --shadow-soft: rgb(0 0 0 / 0.18);
  --shadow-medium: rgb(0 0 0 / 0.28);
  --overlay-20: rgb(244 243 238 / 0.06);
  --overlay-30: rgb(244 243 238 / 0.1);
  --overlay-40: rgb(244 243 238 / 0.14);
  --overlay-50: rgb(196 169 122 / 0.22);
  --selection-bg: rgb(196 169 122 / 0.25);

  --panel-shadow:
    0 1px 2px var(--shadow-soft),
    0 12px 40px var(--shadow-medium);
  --panel-border: var(--border);

  --radius: 14px;
  --gap: 1rem;
  --control-size: 44px;
  --play-size: 3.75rem;

  --loop-green: #16a34a;
  --loop-green-border: rgb(22 163 74 / 0.45);
  --loop-icon-green-filter:
    brightness(0) saturate(100%)
    invert(42%) sepia(85%) saturate(424%) hue-rotate(93deg) brightness(92%) contrast(89%);
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-primary);
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-weight: 400;
  line-height: 1.5;
  background:
    radial-gradient(
      circle at 50% 0%,
      rgb(52 53 48 / 0.45),
      transparent 55%
    ),
    linear-gradient(
      180deg,
      var(--bg) 0%,
      var(--bg-deep) 100%
    );
  background-attachment: fixed;
}

::selection {
  background: var(--selection-bg);
  color: var(--text-primary);
}

.app {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

.site-header {
  margin-bottom: 2rem;
}

.site-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.site-header__title {
  margin: 0;
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  font-style: normal;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.site-header__desc {
  margin: 0;
  max-width: 36rem;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.45;
}

.player-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

.loop-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-family: "CustomMono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    border-color 0.4s ease,
    color 0.4s ease;
}

.loop-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.loop-toggle:not(.loop-toggle--active):hover img {
  opacity: 1;
}

.loop-toggle--active:hover {
  border-color: var(--loop-green-border);
  color: var(--loop-green);
}

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

.loop-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.loop-toggle img {
  width: 1rem;
  height: 1rem;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.55;
  transition:
    opacity 0.4s ease,
    filter 0.4s ease;
}

.loop-toggle--active {
  border-color: var(--loop-green-border);
  color: var(--loop-green);
}

.loop-toggle--active img {
  opacity: 1;
  filter: var(--loop-icon-green-filter);
}

.sections {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.section {
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--panel-shadow);
  transition:
    border-color 0.2s ease,
    background 0.2s ease;
}

.section:hover {
  border-color: var(--border-strong);
}

.section[open] {
  background: linear-gradient(180deg, var(--surface) 0%, rgb(43 44 41 / 0.92) 100%);
}

.section__toggle {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1rem 1rem 1.125rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.section__toggle::-webkit-details-marker {
  display: none;
}

.section__toggle::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.35rem;
  background-color: var(--accent);
  mask: url("/assets/icons/caret-right.svg") center / contain no-repeat;
  -webkit-mask: url("/assets/icons/caret-right.svg") center / contain no-repeat;
  transform: rotate(0deg);
  transform-origin: center;
  transition: transform 0.25s ease;
}

.section[open] > .section__toggle::before {
  transform: rotate(90deg);
}

.section__info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.section__name {
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: 1.15rem;
  font-weight: 600;
  font-style: normal;
  color: var(--accent);
  line-height: 1.25;
}

.section__subtitle {
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: 0.92rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.35;
}

.section__meta {
  font-family: "CustomMono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section__preview {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.section:not([open]) .section__preview {
  display: -webkit-box;
}

.section[open] .section__preview {
  display: none;
}

.section__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-size);
  height: var(--control-size);
  flex-shrink: 0;
  align-self: center;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.15s ease;
}

.section__play:hover {
  border-color: var(--accent);
  background: var(--surface-muted);
  transform: scale(1.04);
}

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

.section__play img {
  width: 1rem;
  height: 1rem;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.section__body {
  overflow: hidden;
}

.section .track-list {
  padding: 0 1rem 1rem;
}

@media (prefers-reduced-motion: reduce) {
  .section__toggle::before,
  .section__play {
    transition: none;
  }

  .section {
    transition: none;
  }

  .loop-toggle,
  .loop-toggle img {
    transition: none;
  }
}

.playlist {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.playlist__section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.playlist__heading {
  margin: 0;
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.track {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 0.5rem 0.75rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface-muted);
  color: var(--text-primary);
}

.track--error {
  border-color: var(--accent);
}

.track__title {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: 1rem;
  font-weight: 500;
}

.track__play {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-size);
  height: var(--control-size);
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}

.track__play:hover {
  border-color: var(--accent);
  background: var(--surface);
}

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

.track__play img {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.track--chapters {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1rem;
}

.transport {
  display: grid;
  grid-template-columns: var(--play-size) 1fr;
  gap: 0.875rem;
  align-items: start;
}

.transport__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--play-size);
  height: var(--play-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--overlay-20);
  flex-shrink: 0;
}

.transport__play:hover {
  background: var(--accent-hover);
}

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

.transport__play img {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
  filter: brightness(0) invert(1);
}

.transport__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.track--chapters .track__timeline-wrap {
  grid-column: auto;
  grid-row: auto;
}

.track__now {
  margin: 0;
  font-family: "MinionPro", ui-serif, Georgia, serif;
  font-size: 1.1rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.35;
}

.track--chapters .track__time {
  grid-column: auto;
  grid-row: auto;
  margin: 0;
}

.timeline--segmented {
  height: 40px;
  border-radius: var(--radius);
  background: transparent;
}

.timeline__segments {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.timeline__segment {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--overlay-20);
  pointer-events: none;
}

.timeline__segment:nth-child(even) {
  background: var(--surface-muted);
}

.timeline__markers {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.timeline__marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  padding: 0;
  border: 0;
  background: var(--overlay-30);
  pointer-events: auto;
  cursor: pointer;
}

.timeline__marker:hover {
  background: var(--accent);
}

.timeline--segmented .timeline__played {
  background: var(--overlay-50);
}

.chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chapters__item {
  margin: 0;
}

.chapter {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
  font-family: "MinionPro", ui-serif, Georgia, serif;
}

.chapter:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--surface-muted);
}

.chapter--active {
  color: var(--text-primary);
}

.chapter--active .chapter__time {
  color: var(--accent);
  font-weight: 600;
}

.chapter--active .chapter__title {
  font-weight: 500;
}

.chapter__time {
  font-family: "CustomMono", ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 500;
}

.chapter__title {
  font-size: 0.92rem;
  line-height: 1.35;
}

.track__timeline-wrap {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.timeline {
  position: relative;
  height: 28px;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.timeline__played {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  pointer-events: none;
}

.timeline__head {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 3;
  height: 100%;
  width: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background-color: var(--accent-hover);
  mask: url("/assets/icons/circle.svg") center / contain no-repeat;
  -webkit-mask: url("/assets/icons/circle.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 6px var(--overlay-40));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.track--active .timeline__head,
.timeline--playing .timeline__head,
.timeline:hover .timeline__head,
.timeline--dragging .timeline__head {
  opacity: 1;
}

.track__time {
  grid-column: 1;
  grid-row: 3;
  margin: 0;
  font-family: "CustomMono", ui-monospace, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
}

.track__error {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--accent);
}

.status {
  margin: 0;
  padding: 2rem 0;
  text-align: center;
  font-style: italic;
  color: var(--text-secondary);
}

.status--error {
  color: var(--text-primary);
  text-shadow: none;
}
