/* ═══════════════════════════════════════════
   ARCHIVO SONORO — Music Archive
   ═══════════════════════════════════════════ */

:root {
  --purple: #c084fc;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 100vh;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

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

/* ── header ── */
.header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.5rem;
  border-bottom: 1px solid rgba(0,212,255,.15);
  background: rgba(8,6,13,.85);
}

.back-btn {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(0,212,255,.2);
  border-radius: 50%;
  background: rgba(0,212,255,.05);
  transition: background .2s, border-color .2s, transform .15s;
}
.back-btn:hover {
  background: rgba(0,212,255,.12);
  border-color: var(--pink);
}
.back-btn:active { transform: scale(.92); }

.logo {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  color: var(--gold);
  letter-spacing: .1em;
}

/* ═══════════════════════════════════════════
   HERO
   ═══════════════════════════════════════════ */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.5rem, 4vh, 3rem) 1.25rem clamp(.5rem, 1.5vh, 1rem);
}

.hero__title {
  font-family: 'Righteous', cursive;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 400;
  color: var(--purple);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0 0 .3rem;
}

.hero__sub {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--dim);
  margin-top: 0;
}

/* ═══════════════════════════════════════════
   CONTROLS
   ═══════════════════════════════════════════ */
.archive-controls {
  padding: 0 1.25rem;
  max-width: 600px;
  margin: 0 auto;
}

.search-wrap {
  display: flex;
  justify-content: center;
  position: relative;
  max-width: 370px;
  margin: 0 auto;
}

.search-wrap::before {
  content: '\1F50D';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: .8rem;
  pointer-events: none;
  opacity: .5;
}

.search-input {
  width: 100%;
  padding: .6rem 1rem .6rem 2.2rem;
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text);
  background: rgba(192,132,252,.04);
  border: 1px solid rgba(192,132,252,.15);
  border-radius: 20px;
  outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.search-input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 16px -4px rgba(192,132,252,.15);
}
.search-input::placeholder {
  color: var(--dim);
  font-style: italic;
}

.counter {
  text-align: center;
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .12em;
  margin: .6rem 0 .4rem;
  text-transform: uppercase;
}

.filters {
  display: flex;
  justify-content: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(192,132,252,.05);
  border: 1px solid rgba(192,132,252,.12);
  border-radius: 16px;
  padding: .4rem .9rem;
  cursor: pointer;
  transition: all .25s;
}
.filter-btn:hover {
  border-color: var(--purple);
  color: var(--text);
  background: rgba(192,132,252,.08);
}
.filter-btn.active {
  background: var(--purple);
  color: var(--bg);
  border-color: var(--purple);
  box-shadow: 0 0 12px -2px rgba(192,132,252,.3);
}

/* ═══════════════════════════════════════════
   ARCHIVE GRID — THUMBNAIL CARDS
   ═══════════════════════════════════════════ */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 1rem 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.song-card {
  margin-bottom: 0;
  background: rgba(0,212,255,.03);
  border: 1px solid rgba(0,212,255,.08);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  width: 100%;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}

.song-card:hover {
  transform: translateY(-3px);
  border-color: rgba(192,132,252,.3);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.6);
}

.song-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.song-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(.85);
  transition: filter .3s, transform .4s;
}

.song-card:hover .song-card__thumb img {
  filter: brightness(1);
  transform: scale(1.03);
}

.song-card__play {
  position: absolute;
  top: 50%; left: 50%;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  background: rgba(192,132,252,.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}

.song-card:hover .song-card__play {
  opacity: 1;
  transform: scale(1.1);
}

.song-card__play::after {
  content: '';
  display: block;
  width: 0; height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 12px solid var(--bg);
}

.song-card__info {
  padding: .7rem .8rem;
}

.song-card__title {
  font-family: 'Caveat', cursive;
  font-size: 1rem;
  font-weight: 700;
  color: var(--purple);
  margin: 0 0 .15rem;
  line-height: 1.2;
}

.song-card__artist {
  font-family: var(--font-mono);
  font-size: .6rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .08em;
  margin: 0;
}

/* ═══════════════════════════════════════════
   EMPTY CARD — PENDING SONG
   ═══════════════════════════════════════════ */
.song-card--empty {
  border-style: dashed;
  border-color: rgba(192,132,252,.25);
  opacity: .7;
}

.song-card--empty .song-card__thumb {
  background: rgba(192,132,252,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
}

.song-card--empty .song-card__thumb img {
  display: none;
}

.song-card--empty .song-card__thumb::after {
  content: '+';
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--purple);
  opacity: .4;
}

.song-card--empty .song-card__play {
  display: none;
}

.song-card--empty .song-card__title {
  color: var(--dim);
  font-style: italic;
}

.song-card--empty .song-card__artist {
  opacity: .5;
}

/* ═══════════════════════════════════════════
   NOTES — FLOATING PANEL
   ═══════════════════════════════════════════ */
.notes-fab {
  position: fixed;
  bottom: calc(4.5rem + env(safe-area-inset-bottom));
  right: 1.2rem;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--purple);
  color: var(--bg);
  border: none;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px -4px rgba(192,132,252,.5);
  transition: transform .25s, box-shadow .25s;
  z-index: 900;
}
.notes-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px -4px rgba(192,132,252,.6);
}
.notes-fab:active {
  transform: scale(.95);
}

.notes-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 70vh;
  background: rgba(8,6,13,.97);
  border-top: 1px solid rgba(192,132,252,.2);
  border-radius: 16px 16px 0 0;
  padding: 1rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  z-index: 950;
  transform: translateY(100%);
  transition: transform .4s cubic-bezier(.22,.8,.25,1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.notes-panel.open {
  transform: translateY(0);
}

.notes-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .8rem;
}

.notes-panel__title {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--purple);
  margin: 0;
}

.notes-panel__close {
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 .2rem;
  transition: color .2s;
}
.notes-panel__close:hover {
  color: var(--text);
}

.notes-input {
  width: 100%;
  min-height: 50px;
  padding: .6rem .8rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text);
  background: rgba(192,132,252,.04);
  border: 1px solid rgba(192,132,252,.15);
  border-radius: 8px;
  resize: vertical;
  outline: none;
  transition: border-color .25s;
}
.notes-input:focus {
  border-color: var(--purple);
}
.notes-input::placeholder {
  color: var(--dim);
}

.notes-actions {
  display: flex;
  gap: .4rem;
  margin-top: .5rem;
}

.notes-list {
  margin-top: .8rem;
}

.note-item {
  position: relative;
  background: rgba(192,132,252,.04);
  border-left: 3px solid var(--purple);
  padding: .5rem .7rem;
  margin-bottom: .5rem;
  border-radius: 0 6px 6px 0;
}

.note-item__date {
  font-family: var(--font-mono);
  font-size: .55rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .1em;
}

.note-item__text {
  font-family: var(--font-body);
  font-size: .8rem;
  color: var(--text);
  margin: .15rem 0 0;
  white-space: pre-wrap;
}

.note-item__delete {
  position: absolute;
  top: .3rem; right: .4rem;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  transition: color .2s;
}
.note-item__delete:hover {
  color: var(--purple);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: .6rem 1rem;
}
.footer__divider {
  width: 60px; height: 2px; margin: 0 auto .5rem;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  border-radius: 1px;
  opacity: .5;
}
.footer__text {
  font-family: var(--font-display);
  font-size: .8rem;
  color: var(--gold);
  letter-spacing: .1em;
  min-height: 1.2em;
}
.footer__credit {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  color: var(--dim);
  letter-spacing: .15em;
  margin-top: .3rem;
  opacity: .8;
}

/* ═══════════════════════════════════════════
   TABBAR
   ═══════════════════════════════════════════ */
.tabbar {
  position: fixed; bottom: 0; left: 0; width: 100%;
  display: none;
  justify-content: space-around;
  background: rgba(4,14,26,.95);
  border-top: 1px solid rgba(0,212,255,.2);
  box-shadow: 0 -6px 24px -16px rgba(0,0,0,.8);
  z-index: 1000;
  padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
}
.tabbar__indicator {
  position: absolute; bottom: 0; left: 0;
  height: 3px; width: 0;
  background: linear-gradient(90deg, var(--pink), var(--gold));
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 10px var(--glow-pink);
  transition: transform .4s cubic-bezier(.22,.8,.25,1), width .3s;
  pointer-events: none;
}
.tabbar__item {
  flex: 1; text-align: center;
  padding: .5rem .3rem .4rem;
  border-radius: 10px;
  transition: background .3s, transform .15s;
  -webkit-tap-highlight-color: transparent;
}
.tabbar__item:active { transform: translateY(1px); }
.tabbar__ico { font-size: 1.15rem; display: block; }
.tabbar__label {
  font-family: var(--font-display);
  font-size: .6rem; letter-spacing: .08em;
  color: var(--dim);
  display: block; margin-top: 2px;
  transition: color .3s;
}
.tabbar__item.active {
  background: rgba(0,212,255,.1);
}
.tabbar__item.active .tabbar__label { color: var(--gold); }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 600px) {
  .tabbar { display: flex; }
  body { padding-bottom: 0; }
  .header { padding: .6rem 1rem; }
  .hero { padding: 1.2rem 1rem .5rem; }
  .archive-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .8rem;
    padding: .5rem 1rem;
  }
  .notes-fab {
    bottom: calc(5rem + env(safe-area-inset-bottom));
    right: 1rem;
    width: 44px; height: 44px;
    font-size: 1.2rem;
  }
}
@media (max-width: 380px) {
  .archive-grid { grid-template-columns: 1fr; }
}
@media (min-width: 601px) and (max-width: 900px) {
  .archive-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 901px) {
  .tabbar { display: none; }
  .archive-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
