/* ============================
   Top Quaranta — tqcms.css
   ============================ */

/* --- Reset & base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand, #0047FF); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout --- */
.container {
  max-width: var(--container-max, 1180px);
  margin: 0 auto;
  padding: 0 var(--gutter, 16px);
}

/* --- Header --- */
.site-header {
  background: var(--header-bg, #fff);
  color: var(--header-text, #111);
  min-height: var(--header-h, 96px);
  border-bottom: 1px solid var(--border, #ddd);
}
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h, 96px);
  gap: 1rem;
}
.site-header__nav-left {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.site-header__nav-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.site-logo {
  width: var(--logo-w, 200px);
  height: var(--logo-h, 60px);
  object-fit: contain;
}

/* --- Navigation --- */
.nav-menu {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.menu-item { position: relative; }
.menu-item > a {
  display: inline-block;
  padding: .5rem .75rem;
  color: var(--text, #111);
  font-weight: 500;
  border-radius: 4px;
}
.menu-item > a:hover,
.menu-item > a.is-active {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  text-decoration: none;
}
.nav-menu__submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  list-style: none;
  min-width: 180px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
}
.menu-item:hover .nav-menu__submenu { display: block; }
.nav-menu__submenu a {
  display: block;
  padding: .5rem .75rem;
  color: var(--text, #111);
}
.nav-menu__submenu a:hover {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  text-decoration: none;
}

/* --- Search panel --- */
.search-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: .25rem .5rem;
}
.search-panel {
  display: none;
  background: var(--bg, #fff);
  border-bottom: 1px solid var(--border, #ddd);
  padding: .75rem 0;
}
.search-panel.is-open { display: block; }
.search-panel form {
  display: flex;
  gap: .5rem;
}
.search-panel input[type="search"] {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: 1rem;
}
.search-panel button {
  padding: .5rem 1rem;
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* --- Footer --- */
.site-footer {
  background: var(--footer-bg, #0047FF);
  color: var(--footer-text, #fff);
  padding: 2rem 0;
  margin-top: 3rem;
}

/* --- Main content --- */
main { min-height: 60vh; padding: 2rem 0; }

/* --- Hero --- */
.hero {
  position: relative;
  margin: -2rem calc(-1 * var(--gutter, 16px)) 2rem;
  overflow: hidden;
}
.hero__image {
  width: 100%;
  height: 400px;
  background-size: cover;
  background-position: center;
}
.hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem var(--gutter, 16px);
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff;
}
.hero__subtitle { font-size: 1.1rem; margin-top: .5rem; opacity: .9; }

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: .6rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
}
.btn--primary {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
}

/* --- Chips (order/filter toggles) --- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0;
}
.chip {
  display: inline-block;
  padding: .35rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 999px;
  font-size: .85rem;
  color: var(--text, #111);
  text-decoration: none;
}
.chip:hover { border-color: var(--brand, #0047FF); text-decoration: none; }
.chip--active {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  border-color: var(--brand, #0047FF);
}

/* --- Music toolbar --- */
.music-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
}
.music-search {
  display: flex;
  gap: .5rem;
  flex: 1;
  min-width: 200px;
}
.music-search input {
  flex: 1;
  padding: .5rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: .9rem;
}
.music-search button {
  padding: .5rem 1rem;
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.music-filters {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.music-filters select,
.music-type-filter select {
  padding: .4rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: .85rem;
}

/* --- Music grid (albums, artists, songs) --- */
.music-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.music-card {
  text-decoration: none;
  color: var(--text, #111);
  transition: transform .15s;
}
.music-card:hover { transform: translateY(-2px); text-decoration: none; }
.music-card__cover {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: #f0f0f0;
  position: relative;
}
.music-card__cover--round { border-radius: 50%; }
.music-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.music-card__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
}
.music-card__badge {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: var(--brand, #0047FF);
  color: #fff;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 999px;
  text-transform: uppercase;
}
.music-card__info { padding: .5rem 0; }
.music-card__title {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.music-card__subtitle {
  display: block;
  font-size: .8rem;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Album grid (CarouselBlock) --- */
.album-grid-section { margin: 2rem 0; }
.section-title { margin-bottom: 1rem; }
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}
.album-card {
  text-decoration: none;
  color: var(--text, #111);
}
.album-card:hover { text-decoration: none; }
.album-card__cover {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: #f0f0f0;
}
.album-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.album-card__placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #e0e0e0, #c0c0c0);
}
.album-card__info { padding: .4rem 0; }
.album-card__title {
  display: block;
  font-weight: 600;
  font-size: .85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-card__artist {
  display: block;
  font-size: .75rem;
  color: #666;
}

/* --- Detail pages --- */
.detail-header {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: flex-start;
}
.detail-header__cover {
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.detail-header__cover--round { border-radius: 50%; }
.detail-header__info { flex: 1; }
.detail-header__artists { font-size: 1.1rem; margin: .5rem 0; }
.detail-header__date { color: #666; font-size: .9rem; }
.detail-header__stats {
  display: flex;
  gap: 1.5rem;
  margin-top: .75rem;
  font-size: .9rem;
  color: #666;
}
.detail-header__pop,
.detail-header__isrc { color: #666; font-size: .85rem; margin-top: .25rem; }
.badge {
  display: inline-block;
  background: var(--brand, #0047FF);
  color: #fff;
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  text-transform: uppercase;
  margin-top: .5rem;
}

.detail-bio { margin: 1.5rem 0; }
.detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1rem 0;
}
.detail-links a {
  padding: .35rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: .85rem;
}
.detail-links a:hover {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  text-decoration: none;
}

/* --- Song list --- */
.song-list { counter-reset: song; padding: 0; }
.song-list__item {
  list-style: none;
  border-bottom: 1px solid var(--border, #ddd);
}
.song-list__item a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem 0;
  color: var(--text, #111);
  text-decoration: none;
}
.song-list__item a:hover { color: var(--brand, #0047FF); }
.song-list__pop { font-size: .8rem; color: #666; }

/* --- Pager --- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  font-size: .9rem;
}
.pager__link {
  padding: .4rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
}
.pager__link:hover {
  background: var(--brand, #0047FF);
  color: var(--bg, #fff);
  text-decoration: none;
}
.pager__info { color: #666; }

/* --- Rankings table --- */
.rankings-toolbar { margin: 1rem 0; }
.rankings-filters {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}
.rankings-filters select {
  padding: .4rem .75rem;
  border: 1px solid var(--border, #ddd);
  border-radius: 4px;
  font-size: .9rem;
}
.ranking-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}
.ranking-table th,
.ranking-table td {
  padding: .6rem .5rem;
  text-align: left;
  border-bottom: 1px solid var(--border, #ddd);
}
.ranking-table th {
  font-size: .8rem;
  text-transform: uppercase;
  color: #666;
}
.ranking-table__pos { width: 3rem; text-align: center; font-weight: 700; }
.ranking-table__cover { width: 56px; }
.ranking-table__cover img { border-radius: 4px; }
.ranking-table__title { display: block; font-weight: 600; }
.ranking-table__artist { display: block; font-size: .8rem; color: #666; }
.ranking-table__score { width: 5rem; text-align: right; }
.ranking-table__change { width: 4rem; text-align: center; }
.change--up { color: #0a0; }
.change--down { color: var(--danger, #c00); }
.change--same { color: #999; }

/* --- Utilities --- */
.fw-800 { font-weight: 800; }
.fs-18 { font-size: 18px; }
.tq-link-plain { text-decoration: none; }
.tq-fs-18 { font-size: 18px; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .site-nav { flex-wrap: wrap; }
  .music-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-header__cover { width: 180px; height: 180px; }
  .detail-header__stats { justify-content: center; }
  .nav-menu { overflow-x: auto; }
}
