/* ============================================
   ppuzzl.bar — Styles
   aesthetic: dark-mode / masonry / tech-mono
   palette: high-contrast
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-elevated: #141414;
    --border-default: #2a2a2a;
    --border-hover: #4a4a4a;
    --text-primary: #e8e8e8;
    --text-secondary: #8a8a8a;
    --text-tertiary: #4a4a4a;
    --accent-botanical: #7a9a6a;
    --accent-crystalline: #6a8a9a;
    --accent-highlight: #b8d8b0;
    --scroll-y: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.82rem, 1.1vw, 0.95rem);
    letter-spacing: 0.02em;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Crystalline Background --- */
.crystal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
}

.crystal-shape {
    position: absolute;
}

.crystal-1 {
    width: 600px;
    height: 600px;
    top: 10%;
    left: -5%;
    transform: rotate(17deg);
}

.crystal-2 {
    width: 500px;
    height: 500px;
    top: 40%;
    right: -8%;
    transform: rotate(-23deg);
}

.crystal-3 {
    width: 800px;
    height: 800px;
    bottom: -10%;
    left: 30%;
    transform: rotate(41deg);
}

/* --- Header --- */
.site-header {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    min-height: 500px;
    background-color: var(--bg-primary);
}

.site-header.settled {
    height: 280px;
    min-height: 280px;
    transition: height 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0), min-height 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.hero-title {
    font-family: 'Space Mono', monospace;
    font-size: clamp(2.8rem, 7vw, 5.2rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: var(--text-primary);
    opacity: 0;
    animation: fadeInTitle 600ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 200ms forwards;
}

.hero-rule {
    width: 60%;
    max-width: 500px;
    height: 1px;
    background-color: var(--border-default);
    margin: 1.2rem auto;
    transform: scaleX(0);
    transform-origin: center;
    animation: drawRule 500ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 800ms forwards;
}

.hero-subtitle {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: #6a6a6a;
    opacity: 0;
    animation: fadeInSubtitle 400ms cubic-bezier(0.25, 0.1, 0.25, 1.0) 1000ms forwards;
}

/* Entry Animations */
@keyframes fadeInTitle {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes drawRule {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

@keyframes fadeInSubtitle {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* --- Masonry Grid --- */
.masonry-container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 1200px;
    margin: 4rem auto 0;
    column-count: 3;
    column-gap: 1.5rem;
}

/* --- Specimen Cards --- */
.specimen-card {
    position: relative;
    break-inside: avoid;
    background-color: var(--bg-primary);
    border: 1px solid #3a3a3a;
    border-radius: 2px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition:
        transform 350ms ease-out,
        box-shadow 350ms ease-out,
        border-color 350ms ease-out,
        background-color 350ms ease-out;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.specimen-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 2px;
    background: radial-gradient(ellipse at center, rgba(122, 154, 106, 0.06) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 400ms ease-out;
    pointer-events: none;
    z-index: 0;
}

.specimen-card.visible {
    opacity: 1;
    transform: translateY(0);
    transition:
        opacity 400ms ease-out,
        transform 400ms ease-out;
}

/* Hover-Lift */
.specimen-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--border-hover);
    background-color: var(--bg-elevated);
    transition:
        transform 280ms ease-out,
        box-shadow 280ms ease-out,
        border-color 200ms ease-out,
        background-color 200ms ease-out;
}

.specimen-card:hover::before {
    opacity: 1;
    transition: opacity 400ms ease-out;
}

.specimen-card:hover .botanical-svg g {
    opacity: 1;
    transition: opacity 300ms ease-out;
}

/* Puzzle Tab */
.puzzle-tab {
    clip-path: polygon(
        0% 0%,
        calc(50% - 20px) 0%,
        calc(50% - 20px) -12px,
        calc(50% - 12px) -12px,
        calc(50% - 8px) -6px,
        calc(50% + 8px) -6px,
        calc(50% + 12px) -12px,
        calc(50% + 20px) -12px,
        calc(50% + 20px) 0%,
        100% 0%,
        100% 100%,
        0% 100%
    );
}

/* Simpler puzzle tab using border-top pseudo-element */
.puzzle-tab::after {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 12px;
    background-color: var(--bg-primary);
    border: 1px solid #3a3a3a;
    border-bottom: none;
    border-radius: 50% 50% 0 0;
    z-index: 1;
}

.puzzle-tab:hover::after {
    background-color: var(--bg-elevated);
    border-color: var(--border-hover);
}

.puzzle-tab {
    clip-path: none;
    margin-top: 12px;
}

/* --- Card Internals --- */
.card-illustration {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.card-illustration.tall-illustration {
    min-height: 280px;
}

.card-illustration.short-illustration {
    min-height: 120px;
}

.botanical-svg {
    width: 100%;
    max-width: 280px;
    height: auto;
}

.botanical-svg g {
    transition: opacity 350ms ease-out;
}

.card-rule {
    border: none;
    height: 1px;
    background-color: var(--border-default);
    margin: 1rem 0;
    position: relative;
    z-index: 1;
}

.card-title {
    position: relative;
    z-index: 1;
    font-family: 'Space Mono', monospace;
    font-size: clamp(1rem, 1.8vw, 1.35rem);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}

.card-latin {
    position: relative;
    z-index: 1;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(0.75rem, 1vw, 0.88rem);
    font-weight: 300;
    font-style: italic;
    letter-spacing: 0.08em;
    color: var(--accent-botanical);
    margin-bottom: 0.6rem;
}

.card-body {
    position: relative;
    z-index: 1;
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.82rem, 1.1vw, 0.95rem);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.7;
    color: var(--text-primary);
}

/* --- Scroll Indicator --- */
.scroll-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
    z-index: 100;
    letter-spacing: 0.04em;
    transition: color 200ms ease-out;
}

.scroll-indicator:hover {
    color: var(--text-secondary);
}

/* --- Footer --- */
.site-footer {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 6rem 0 2rem;
}

.site-footer p {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .masonry-container {
        column-count: 2;
    }

    .site-header {
        height: 100vh;
    }

    .site-header.settled {
        height: 240px;
        min-height: 240px;
    }
}

@media (max-width: 600px) {
    .masonry-container {
        column-count: 1;
        width: 92%;
    }

    .site-header.settled {
        height: 200px;
        min-height: 200px;
    }

    .hero-rule {
        width: 80%;
    }

    .card-illustration {
        min-height: 160px;
    }

    .card-illustration.tall-illustration {
        min-height: 220px;
    }
}
