:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --bg-2: #131518;
  --bg-3: #1c1f24;
  --text: #eaecef;
  --muted: #9ea3ab;
  --soft: #6b7280;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #e0e2e6;
  --glow: rgba(255, 255, 255, 0.03);
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --radius-sm: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(120, 119, 198, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(255, 255, 255, 0.03), transparent);
  background-attachment: fixed;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease-smooth), transform 0.6s var(--ease-out);
}

body.is-loaded {
  opacity: 1;
  transform: translateY(0);
}

main {
  display: flex;
  flex-direction: column;
  gap: 6rem;
  padding: 1rem 6vw 6rem;
  max-width: 1200px;
  margin: 0 auto;
}

h1, h2, h3, h4 {
  font-family: "Playfair Display", "Times New Roman", serif;
  margin: 0 0 0.5rem;
  letter-spacing: 0.5px;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

/* ── Grain overlay ── */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px;
  mix-blend-mode: overlay;
  z-index: 0;
  transform: translateZ(0);
}

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 6vw;
  background: rgba(10, 11, 13, 0.75);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  border-bottom: 1px solid var(--line);
  transform: translateZ(0);
}

.logo {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.header-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-left: auto;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--soft);
  cursor: pointer;
  transition: color 0.2s var(--ease-smooth), background 0.2s var(--ease-smooth), border-color 0.2s var(--ease-smooth);
  position: relative;
}

.header-btn:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
}

.header-btn svg {
  flex-shrink: 0;
}

.sign-up-btn {
  width: auto;
  padding: 0 0.85rem;
  gap: 0.4rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sign-up-btn .account-icon {
  display: none;
}

.sign-up-btn.is-signed-in {
  width: 38px;
  padding: 0;
}

.sign-up-btn.is-signed-in .account-icon {
  display: inline-flex;
}

.sign-up-btn.is-signed-in .account-label {
  display: none;
}

.cart-count {
  position: absolute;
  top: 3px;
  right: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: #fff;
  color: var(--bg);
  font-family: inherit;
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

/* ── Account dropdown ── */
.account-wrapper {
  position: relative;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -8px, 0) scale(0.96);
  transition: opacity 0.22s var(--ease-smooth), visibility 0.22s var(--ease-smooth), transform 0.3s var(--ease-out);
  will-change: opacity, transform;
  z-index: 100;
}

.account-wrapper:hover .account-dropdown,
.account-dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
}

.account-option {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s var(--ease-smooth), background 0.15s var(--ease-smooth);
}

.account-option:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* ── Google sign-in & signed-in state ── */
#google-signin-state {
  padding: 0.5rem;
  display: flex;
  justify-content: center;
}

#google-signin-state iframe,
#g-btn-container iframe {
  border-radius: 8px !important;
  color-scheme: auto;
}

#g-btn-container > div {
  border-radius: 8px !important;
  overflow: hidden;
}

#signed-in-state {
  animation: fadeSlideIn 0.3s var(--ease-out) both;
}

.signed-in-email {
  display: block;
  padding: 0.75rem 1rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.3px;
}

.sign-out-btn {
  margin-top: 2px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  color: var(--soft);
}

.sign-out-btn:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
}

/* ── Cart dropdown ── */
.cart-wrapper {
  position: relative;
}

.cart-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 330px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(20, 22, 26, 0.96);
  backdrop-filter: blur(24px) saturate(1.6);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.03);
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -8px, 0) scale(0.96);
  transition: opacity 0.22s var(--ease-smooth), visibility 0.22s var(--ease-smooth), transform 0.3s var(--ease-out);
  will-change: opacity, transform;
  z-index: 100;
  overflow: hidden;
}

.cart-dropdown.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0) scale(1);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.cart-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
}

.cart-close {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--soft);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s var(--ease-smooth), background 0.15s var(--ease-smooth);
}

.cart-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.cart-items {
  padding: 0.75rem 1.25rem;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cart-empty {
  text-align: center;
  font-size: 0.85rem;
  color: var(--soft);
  padding: 2rem 0;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-img {
  width: 64px;
  height: auto;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--soft);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0 0 0.75rem;
  transition: color 0.15s var(--ease-smooth);
}

.cart-item-remove:hover {
  color: #f87171;
}

.cart-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.cart-checkout-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  border: none;
  background: #fff;
  color: #0a0b0d;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s var(--ease-smooth), transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-smooth);
}

.cart-checkout-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.1);
}

.cart-checkout-btn:active {
  transform: translateY(0);
  opacity: 0.85;
}

/* ── Checkout form ── */
.cart-checkout-form {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid var(--line);
  animation: fadeSlideIn 0.25s var(--ease-out) both;
}

.checkout-back {
  background: none;
  border: none;
  color: var(--soft);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0 0 0.75rem;
  transition: color 0.15s var(--ease-smooth);
}

.checkout-back:hover {
  color: var(--text);
}

.checkout-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.checkout-input {
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s var(--ease-smooth), background 0.2s var(--ease-smooth);
}

.checkout-input::placeholder {
  color: var(--soft);
  opacity: 0.6;
}

.checkout-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.checkout-pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.stripe-lock {
  flex-shrink: 0;
}

.checkout-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--soft);
  margin-bottom: 0.35rem;
}

.checkout-card-group {
  margin-top: 0.2rem;
}

.checkout-card-input {
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.2s var(--ease-smooth), background 0.2s var(--ease-smooth);
}

.checkout-card-input.StripeElement--focus {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.checkout-card-input.StripeElement--invalid {
  border-color: rgba(248, 113, 113, 0.5);
}

.checkout-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.checkout-card-error {
  font-size: 0.75rem;
  color: #f87171;
  min-height: 0;
  transition: min-height 0.2s var(--ease-smooth);
}

.checkout-card-error:not(:empty) {
  min-height: 1.2rem;
  margin-top: 0.35rem;
}

.checkout-note {
  text-align: center;
  font-size: 0.65rem;
  color: var(--soft);
  margin-top: 0.6rem;
  letter-spacing: 0.5px;
}

/* ── Section titles ── */
.top-title {
  font-family: "Playfair Display", serif;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: none;
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.section-head.centered {
  justify-content: center;
  text-align: center;
}

/* ── Sections ── */
.top-songs {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

.top-songs .section-head {
  justify-content: center;
  text-align: center;
}

.song-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.plugins {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  padding-top: 2.5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

.plugin-showcase {
  display: flex;
  justify-content: center;
}

.plugin-card--hero {
  max-width: 960px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.plugin-hero-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  transform: translate3d(0, 0, 0);
}

.plugin-hero-footer {
  padding: 1.5rem 1.25rem;
  display: flex;
  justify-content: center;
}

.plugin-buy-btn {
  padding: 0.8rem 3rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s var(--ease-smooth), transform 0.25s var(--ease-spring), box-shadow 0.25s var(--ease-smooth);
}

.plugin-buy-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 255, 255, 0.06);
}

.plugin-buy-btn:active {
  transform: translateY(0);
  opacity: 0.85;
}

.sample-packs {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.sample-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,0.02), transparent);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: border-color 0.3s var(--ease-smooth), background 0.3s var(--ease-smooth), transform 0.4s var(--ease-spring), box-shadow 0.3s var(--ease-smooth);
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.sample-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  transform: translate3d(0, -3px, 0);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.sample-card:active {
  transform: translate3d(0, -1px, 0);
}

.sample-placeholder {
  font-size: 0.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--soft);
  transition: color 0.3s var(--ease-smooth);
}

.sample-card:hover .sample-placeholder {
  color: var(--muted);
}

/* ── Production cards ── */
.song-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-2);
  overflow: hidden;
  box-shadow: 0 8px 24px var(--shadow);
  transition: border-color 0.3s var(--ease-smooth), box-shadow 0.35s var(--ease-smooth), transform 0.4s var(--ease-spring);
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.song-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 52px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255,255,255,0.04);
  transform: translate3d(0, -4px, 0);
}

.song-card:active {
  transform: translate3d(0, -2px, 0);
}

.yt-card {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #0b0c0e;
  overflow: hidden;
}

.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.15) brightness(0.95);
  transform: scale(1.02) translate3d(0, 0, 0);
  transition: transform 0.6s var(--ease-out), filter 0.5s var(--ease-smooth);
}

.yt-card:hover .yt-thumb {
  transform: scale(1.07) translate3d(0, 0, 0);
  filter: grayscale(0) brightness(1);
}

.yt-play {
  position: absolute;
  inset: auto 1.25rem 1.25rem auto;
  padding: 0.45rem 1.1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.65rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  transition: background 0.25s var(--ease-smooth), border-color 0.25s var(--ease-smooth), transform 0.3s var(--ease-spring);
  transform: translate3d(0, 0, 0);
}

.yt-card:hover .yt-play {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translate3d(0, -1px, 0);
}

/* ── Reveal animations ── */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Staggered card reveal */
[data-reveal].is-visible .plugin-card,
[data-reveal].is-visible .sample-card,
[data-reveal].is-visible .song-card {
  animation: cardReveal 0.6s var(--ease-out) both;
}

[data-reveal].is-visible :nth-child(1) { animation-delay: 0s; }
[data-reveal].is-visible :nth-child(2) { animation-delay: 0.07s; }
[data-reveal].is-visible :nth-child(3) { animation-delay: 0.14s; }
[data-reveal].is-visible :nth-child(4) { animation-delay: 0.21s; }

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translate3d(0, -4px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .song-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  main {
    padding: 0.5rem 5vw 4rem;
    gap: 4rem;
  }

  .site-header {
    padding: 1rem 5vw;
  }

  .cart-dropdown {
    width: 290px;
  }
}

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