/**
 * Students of Decay — "Patina" Design System
 * A refined minimal site that carries traces of its origins.
 */

/* ==========================================================================
   Custom Properties
   ========================================================================== */

:root {
    /* Colors */
    --color-bg:          #f4f0eb;
    --color-bg-deep:     #ebe5dd;
    --color-text:        #2a2520;
    --color-text-muted:  #706860;
    --color-accent:      #4a6741;
    --color-accent-hover:#3a5433;
    --color-border:      #ddd6cc;
    --color-overlay:     rgba(42, 37, 32, 0.7);

    /* Typography */
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body:    'IBM Plex Sans', -apple-system, sans-serif;
    --font-mono:    'IBM Plex Mono', 'SF Mono', monospace;

    /* Spacing */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  2rem;
    --space-xl:  3rem;
    --space-2xl: 5rem;

    /* Layout */
    --container-max: 1200px;
    --nav-height: 6.5rem;
}


/* ==========================================================================
   Reset / Base
   ========================================================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-accent-hover);
}

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


/* ==========================================================================
   Grain Overlay (SVG filter — no image file)
   ========================================================================== */

.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    mix-blend-mode: multiply;
}

.grain-overlay svg {
    width: 100%;
    height: 100%;
}


/* ==========================================================================
   Typography System
   ========================================================================== */

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--color-text);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

.font-mono {
    font-family: var(--font-mono);
}


/* ==========================================================================
   Layout
   ========================================================================== */

.site-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: var(--space-lg);
    width: 100%;
}

@media (max-width: 700px) {
    .container {
        padding: var(--space-md);
    }
}


/* ==========================================================================
   Navigation / Header
   ========================================================================== */

.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem var(--space-lg);
    background: transparent;
}

.site-nav::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    mask-image: linear-gradient(to bottom, black 30%, transparent);
    -webkit-mask-image: linear-gradient(to bottom, black 30%, transparent);
    pointer-events: none;
}

.site-nav .nav-title {
    position: relative;
    display: flex;
    align-items: center;
}

.site-nav .nav-title img {
    height: 5rem;
    width: auto;
}

.site-nav .nav-title .logo-full {
    opacity: calc(1 - var(--logo-progress, 0));
}

.site-nav .nav-title .logo-outline {
    position: absolute;
    top: 0;
    left: 0;
    opacity: var(--logo-progress, 0);
}

.site-nav .nav-links {
    display: flex;
    gap: var(--space-lg);
    list-style: none;
    align-self: flex-start;
    padding-top: 0.75rem;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.site-nav.nav-hidden .nav-links {
    opacity: 0;
    transform: translateY(-1rem);
    pointer-events: none;
}

.site-nav .nav-links a {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}

.site-nav .nav-links a:hover,
.site-nav .nav-links a.active {
    color: var(--color-accent);
}

/* Spacer to push content below fixed nav */
.nav-spacer {
    height: var(--nav-height);
}

/* On homepage, nav floats over the hero */
body.page-home .site-nav .nav-title img {
    filter: invert(1) drop-shadow(0 1px 4px rgba(0, 0, 0, 0.3));
}

body.page-home .site-nav .nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

body.page-home .site-nav .nav-links a:hover {
    color: #fff;
}

body.page-home .site-footer {
    display: none;
}


/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
    margin-top: auto;
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.site-footer p {
    margin-bottom: var(--space-xs);
}

.site-footer a {
    color: var(--color-text-muted);
}

.site-footer a:hover {
    color: var(--color-accent);
}

.now-listening {
    margin-top: var(--space-lg);
}

.now-listening-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.7;
    margin-bottom: 0.15rem;
}

.now-listening-track {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-style: italic;
}

.headphones-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.now-listening:hover .headphones-icon {
    animation: headphone-rock 0.5s ease;
}

@keyframes headphone-rock {
    0%   { transform: rotate(0deg); }
    25%  { transform: rotate(-8deg); }
    50%  { transform: rotate(8deg); }
    75%  { transform: rotate(-4deg); }
    100% { transform: rotate(0deg); }
}


/* ==========================================================================
   Homepage Hero
   ========================================================================== */

.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: var(--color-text);
    cursor: pointer;
}

.hero-slides {
    position: absolute;
    inset: 0;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
    will-change: opacity;
}

.hero-slide.active {
    opacity: 1;
}

.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-slide::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(42, 37, 32, 0.3) 0%,
        rgba(42, 37, 32, 0.15) 40%,
        rgba(42, 37, 32, 0.5) 100%
    );
}

/* Fallback when no images */
.hero-fallback {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-deep);
}

.hero-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: var(--space-2xl) var(--space-lg) var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-info-stack {
    display: grid;
    margin-bottom: var(--space-md);
}

.hero-release-info {
    grid-area: 1 / 1;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.hero-release-info.active {
    opacity: 1;
    pointer-events: auto;
}

.hero-release-info .release-artist {
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.hero-release-info .release-artist::after {
    content: none;
}

.hero-release-info .release-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    margin-top: var(--space-xs);
}

.hero-release-info .release-catalog {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: var(--space-xs);
}

/* Hero navigation dots */
.hero-dots {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
    padding: 0;
}

.hero-dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.2);
}

.hero-dot:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   Back Link
   ========================================================================== */

.back-link {
    display: inline-block;
    margin-bottom: var(--space-lg);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--color-accent);
}


/* ==========================================================================
   Catalog Page
   ========================================================================== */

/* Product Grid — 3 columns on desktop */
.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-xl) var(--space-lg);
}

@media (max-width: 960px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
}

/* Product Card */
.product-card {
    display: flex;
    flex-direction: column;
    color: inherit;
}

a.product-card:hover .product-card-info {
    transform: translateY(-2px);
}

a.product-card:hover .product-title {
    color: var(--color-accent);
}

/* Cover Image */
.product-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--color-bg-deep);
    margin-bottom: var(--space-md);
    overflow: hidden;
}

.product-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.4s ease;
}

.product-cover img.loaded {
    opacity: 1;
}

.product-cover .placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--color-border);
    letter-spacing: 0.05em;
}

/* Product Card Info */
.product-card-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    transition: transform 0.3s ease;
}

.product-card-info .product-artist {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.product-card-info .product-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.3;
    transition: color 0.2s ease;
}

.product-card-info .product-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-xs);
}

.product-card-info .product-catalog {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.product-card-info .product-format {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* Loading indicator */
.loading-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: var(--space-xl) 0;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-container.hidden {
    display: none;
}


/* ==========================================================================
   Product Detail Page
   ========================================================================== */

.product-detail-layout {
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: var(--space-xl);
    align-items: start;
}

@media (max-width: 800px) {
    .product-detail-layout {
        grid-template-columns: 1fr;
    }
}

/* Product Images */
.product-images {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-detail-cover {
    width: 100%;
    background: var(--color-bg-deep);
}

.product-detail-cover img {
    width: 100%;
    height: auto;
    display: block;
}

.product-detail-cover.no-image {
    aspect-ratio: 1;
}

.product-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.product-gallery img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 0 1px transparent;
}

.product-gallery img:hover {
    opacity: 1;
}

.product-gallery img.is-active {
    opacity: 1;
    box-shadow: 0 0 0 1px var(--color-border);
}

/* Product Detail Info */
.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.product-header .product-artist {
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.product-header .product-title {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.15;
}

.product-meta-detail {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
}

.product-meta-detail .meta-item dt {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-xs);
}

.product-meta-detail .meta-item dd {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin: 0;
}

.product-description {
    line-height: 1.85;
    color: var(--color-text);
    font-size: 0.95rem;
}

.product-description p {
    margin-bottom: var(--space-md);
}

.product-description p:last-child {
    margin-bottom: 0;
}

.product-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.product-links a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-accent);
}

.product-links a:hover {
    color: var(--color-accent-hover);
}

.product-links a .arrow {
    transition: transform 0.2s ease;
}

.product-links a:hover .arrow {
    transform: translateX(3px);
}

.product-player {
    margin-top: var(--space-sm);
}

.product-player iframe {
    max-width: 100%;
}

.product-info-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    font-style: italic;
}


/* Product Detail — Prev/Next Navigation */
.product-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
    transition: color 0.2s ease, transform 0.2s ease;
}

.product-nav-arrow:hover {
    color: var(--color-text);
}

.product-nav-prev {
    left: var(--space-lg);
}

.product-nav-prev:hover {
    transform: translate(-3px, -50%);
}

.product-nav-next {
    right: var(--space-lg);
}

.product-nav-next:hover {
    transform: translate(3px, -50%);
}

@media (max-width: 700px) {
    .product-nav-arrow {
        display: none;
    }
}


/* ==========================================================================
   Discography Page
   ========================================================================== */

.year-group {
    margin-bottom: var(--space-xl);
}

.year-heading {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

.releases {
    display: grid;
    gap: 0;
}

.release {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: var(--space-md);
    align-items: baseline;
    padding: 0.65rem 0;
    border-bottom: 1px solid rgba(221, 214, 204, 0.5);
}

.release:last-child {
    border-bottom: none;
}

.catalog-number {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--color-text-muted);
    letter-spacing: 0.02em;
}

.release-info {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: var(--space-xs);
    row-gap: 0.15rem;
}

.release-artist,
.release-title {
    font-size: 0.85rem;
}

.release-title a {
    color: inherit;
}

.release-title a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

.release-artist::after {
    content: "\2013";
    margin-left: var(--space-xs);
    color: var(--color-text-muted);
}

.release-format {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    text-align: right;
}

@media (max-width: 600px) {
    .release {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
        padding: var(--space-sm) 0;
    }

    .release-format {
        text-align: left;
    }
}


/* ==========================================================================
   About Page
   ========================================================================== */

.about-layout {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: var(--space-2xl);
    align-items: start;
}

.about-image img {
    width: 100%;
    height: auto;
    display: block;
}

.about-image-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--color-bg-deep);
}

.about-text h1 {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    margin-bottom: var(--space-lg);
}

.about-body {
    font-size: 0.95rem;
    line-height: 1.85;
    color: var(--color-text);
}

.about-body p {
    margin-bottom: var(--space-md);
}

.about-body p:last-child {
    margin-bottom: 0;
}

@media (max-width: 800px) {
    .about-layout {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }

    .about-image {
        max-width: 60%;
    }
}


/* ==========================================================================
   Animations
   ========================================================================== */

/* Staggered fade-in on scroll */
.fade-in {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.stagger-children > *:nth-child(1)  { transition-delay: 0s; }
.stagger-children > *:nth-child(2)  { transition-delay: 0.05s; }
.stagger-children > *:nth-child(3)  { transition-delay: 0.1s; }
.stagger-children > *:nth-child(4)  { transition-delay: 0.15s; }
.stagger-children > *:nth-child(5)  { transition-delay: 0.2s; }
.stagger-children > *:nth-child(6)  { transition-delay: 0.25s; }
.stagger-children > *:nth-child(7)  { transition-delay: 0.3s; }
.stagger-children > *:nth-child(8)  { transition-delay: 0.35s; }
.stagger-children > *:nth-child(9)  { transition-delay: 0.4s; }
.stagger-children > *:nth-child(10) { transition-delay: 0.45s; }
.stagger-children > *:nth-child(11) { transition-delay: 0.5s; }
.stagger-children > *:nth-child(12) { transition-delay: 0.55s; }


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 700px) {
    :root {
        --nav-height: 5rem;
    }

    .site-nav {
        padding: 0.5rem var(--space-md);
    }

    .site-nav .nav-title img {
        height: 3.8rem;
    }

    .site-nav .nav-links {
        padding-top: 0.5rem;
    }

    .site-nav .nav-links {
        gap: var(--space-md);
    }

    .site-nav .nav-links a {
        font-size: 0.75rem;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.4rem; }

    .hero-content {
        padding: var(--space-xl) var(--space-md) var(--space-lg);
    }
}

/* Print styles */
@media print {
    .grain-overlay,
    .site-nav,
    .hero-dots {
        display: none;
    }

    body {
        background: #fff;
        color: #000;
    }
}
