/* Audiowafa — Folio: bersih, hangat, mobile-first */

:root {
  --paper: #fbf8f1;
  --paper-2: #f4efdf;
  --card: #ffffff;
  --ink: #153228;
  --ink-2: #4a685c;
  --ink-3: #82a093;
  --line: rgba(21, 50, 40, 0.08);
  --line-2: rgba(21, 50, 40, 0.14);
  --accent: #0e7a5f;
  --accent-strong: #0a5f49;
  --accent-soft: rgba(14, 122, 95, 0.08);
  --gold: #a8862c;
  --gold-soft: rgba(168, 134, 44, 0.12);
  --font-display: "Amiri", "Times New Roman", Georgia, serif;
  --font-ui: "Karla", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow-card:
    0 1px 2px rgba(21, 50, 40, 0.04), 0 8px 20px -12px rgba(21, 50, 40, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  background:
    radial-gradient(
      120% 60% at 50% -10%,
      #fdfbf5 0%,
      rgba(251, 248, 241, 0) 55%
    ),
    var(--paper);
  padding-bottom: 128px;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

.hero {
  border-bottom: 1px solid var(--line);
}

.hero-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  flex: none;
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(21, 50, 40, 0.18));
}

.brand-text {
  min-width: 0;
}

.brand-kicker {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.hero-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.ring-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  flex: none;
}

.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 144.5;
  stroke-dashoffset: 144.5;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.hero-meta {
  display: none;
}

/* ---------- toolbar ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 248, 241, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.toolbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-ic {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--ink-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}

.search input::placeholder {
  color: var(--ink-3);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 9px 16px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 0.15s,
    background 0.15s,
    border-color 0.15s;
}

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

.chip.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- kategori ---------- */

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  display: grid;
  gap: 6px;
}

.cat {
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 12px;
}

.cat-index {
  display: none;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.cat-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-rule {
  flex: 1;
  min-width: 20px;
  border-top: 1px dashed var(--line-2);
}

.cat-meta {
  flex: none;
  display: grid;
  gap: 5px;
  justify-items: end;
}

.cat-count {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cat-progress {
  width: 84px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.cat-progress i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.5s ease;
}

/* ---------- grid folio (mobile-first) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.track {
  position: relative;
  min-width: 0;
}

.track-btn {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-display);
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.track-btn:hover,
.track-btn:active {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 22px -12px rgba(21, 50, 40, 0.25);
}

.track-num {
  font-size: 0.98rem;
  line-height: 1;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.track-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--card);
  opacity: 0;
  transition: opacity 0.2s;
}

.track.done .track-dot {
  opacity: 1;
}

.track-eq {
  display: none;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
}

.track.playing .track-eq {
  display: flex;
}

.track-eq i {
  width: 2.5px;
  height: 100%;
  border-radius: 1px;
  background: var(--accent);
  animation: eq 1s ease-in-out infinite;
}

.track-eq i:nth-child(2) {
  animation-delay: 0.18s;
}
.track-eq i:nth-child(3) {
  animation-delay: 0.36s;
}

.track.current .track-btn {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: linear-gradient(180deg, #fff, var(--accent-soft));
  box-shadow:
    0 0 0 3px var(--accent-soft),
    0 8px 20px -12px rgba(21, 50, 40, 0.2);
}

.track.flash .track-btn {
  animation: flash 1.4s ease;
}

/* ---------- kosong / footer ---------- */

.empty {
  max-width: 1120px;
  margin: 0 auto;
  padding: 48px 20px 60px;
  text-align: center;
  color: var(--ink-3);
  display: none;
}

.empty.show {
  display: block;
  animation: rise 0.4s ease both;
}

.empty-star {
  color: var(--gold);
  font-size: 26px;
}

.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px 28px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

/* ---------- pemutar ---------- */

.player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgba(251, 248, 241, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-2);
  box-shadow: 0 -12px 30px -18px rgba(21, 50, 40, 0.35);
}

.p-progress {
  height: 5px;
  background: var(--line);
}

.p-progress input {
  display: block;
  width: 100%;
  height: 5px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  --fill: 0%;
}

.p-progress input::-webkit-slider-runnable-track {
  height: 5px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill, 0%),
    rgba(21, 50, 40, 0.12) var(--fill, 0%)
  );
}

.p-progress input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5.5px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 1px 4px rgba(21, 50, 40, 0.3);
}

.p-progress input::-moz-range-track {
  height: 5px;
  background: linear-gradient(
    to right,
    var(--accent) var(--fill, 0%),
    rgba(21, 50, 40, 0.12) var(--fill, 0%)
  );
}

.p-progress input::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

.p-body {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  display: grid;
  gap: 8px;
}

.p-info {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.p-cat {
  flex: none;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

.p-label {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.p-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.cbtn {
  width: 46px;
  height: 46px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s,
    background 0.15s,
    transform 0.15s;
}

.cbtn svg {
  width: 19px;
  height: 19px;
}

.cbtn:hover,
.cbtn:active {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.cbtn:active {
  transform: translateY(0);
}

.cbtn-main {
  width: 56px;
  height: 56px;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 20px -10px rgba(14, 122, 95, 0.55);
}

.cbtn-main:hover,
.cbtn-main:active {
  color: #fff;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.p-extra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.p-time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* ---------- aksesibilitas & detail ---------- */

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

::selection {
  background: var(--accent-soft);
}

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

@keyframes eq {
  0%,
  100% {
    height: 30%;
  }
  50% {
    height: 100%;
  }
}

@keyframes flash {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 122, 95, 0.5);
  }
  45% {
    box-shadow: 0 0 0 12px rgba(14, 122, 95, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 122, 95, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- layar lebih lebar ---------- */

@media (min-width: 480px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 10px;
  }
  .hero-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }
  .hero-meta strong {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1;
    color: var(--ink);
  }
  .hero-meta > span {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .resume {
    margin-top: 6px;
    padding: 6px 14px;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 999px;
    cursor: pointer;
  }
  .resume:hover {
    background: var(--accent-strong);
  }
  .cat-index {
    display: inline;
  }
  .cat-head {
    gap: 12px;
  }
}

@media (min-width: 720px) {
  .toolbar-inner {
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
  }
  .search {
    flex: 1 1 320px;
  }
  .chips {
    overflow-x: visible;
    flex-wrap: wrap;
    margin-left: auto;
  }
  .hero-inner {
    padding: 22px 24px 16px;
  }
  .app {
    padding: 24px 24px 48px;
  }
  .p-body {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 24px calc(10px + env(safe-area-inset-bottom));
  }
  .p-info {
    flex: 1 1 240px;
  }
  .p-extra {
    flex: 1 1 240px;
  }
}

@media (min-width: 960px) {
  .grid {
    grid-template-columns: repeat(10, minmax(0, 1fr));
  }
}
