/* ==========================================
   Patentiere - Interactive Story Book Design
   Scrapbook aesthetic with page-turning animations
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Caveat:wght@400;500;600;700&family=Patrick+Hand&display=swap');

:root {
    --color-primary: #007aec;
    --color-primary-dark: #0056b3;
    --color-accent: #00bac7;
    --color-accent-light: #1ac4d0;

    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fa;
    --color-surface: #ffffff;
    --color-border: #e0e4e8;

    --color-text: #212529;
    --color-text-secondary: #6c757d;
    --color-text-muted: #adb5bd;

    /* Book/Scrapbook colors */
    --book-page: #f9f6f0;
    --book-page-shadow: #d4c5a9;
    --book-spine: #8b7355;
    --book-leather: #5d4e37;
    --book-aged: #e8dcc8;
    --tape-color: rgba(255, 248, 220, 0.7);

    /* Highly readable fonts for main content */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;

    /* Book-only fonts (keep these for book modal) */
    --font-handwritten: 'Caveat', cursive;
    --font-casual: 'Patrick Hand', cursive;

    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================
   Global Font Optimization for Readability
   ========================================== */

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Apply readable fonts to main page content ONLY (excluding book modal) */
.page-header *:not(.book-modal *),
.filter-toolbar *:not(.book-modal *),
.animals-showcase *:not(.book-modal *),
.info-banner *:not(.book-modal *) {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

/* Explicit book modal font restoration - completely separate from main page */
.book-modal {
    font-family: 'Cormorant Garamond', serif !important;
}

.book-modal h1,
.book-modal h2,
.book-modal h3,
.book-modal h4,
.book-modal h5,
.book-modal h6,
.book-modal .profile-name,
.book-modal .intro-title,
.book-modal .cta-heading {
    font-family: 'Crimson Text', serif !important;
}

.book-modal .profile-trait,
.book-modal .polaroid-caption,
.book-modal .intro-signature,
.book-modal .cta-page {
    font-family: 'Caveat', cursive !important;
}

.book-modal p,
.book-modal span,
.book-modal div:not([class*="profile-name"]):not([class*="intro-title"]):not([class*="cta-heading"]),
.book-modal .page-content,
.book-modal .story-page,
.book-modal .intro-text,
.book-modal .benefit-text {
    font-family: 'Cormorant Garamond', serif !important;
}

/* ==========================================
   Page Header
   ========================================== */

.page-header {
    position: relative;
    background: linear-gradient(135deg, #FAFAFA 0%, #F5F5F5 100%);
    padding: 8rem 0 6rem;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(0, 122, 236, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 186, 199, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.header-content {
    max-width: 800px;
    position: relative;
    z-index: 1;
}

.header-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease-out;
}

.page-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 800;
    color: #212121;
    margin-bottom: 1.5rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    animation: fadeInUp 0.8s ease-out 0.1s backwards;
}

.page-intro {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.75;
    color: #595959;
    max-width: 650px;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   Filter Toolbar
   ========================================== */

.filter-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    padding: 1.5rem 0;
}

.toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.filter-left {
    flex-shrink: 0;
}

.animal-count {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.count-number {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}

.count-label {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.filter-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.filter-pills {
    display: flex;
    gap: 0.5rem;
    padding: 4px;
    background: var(--color-bg-alt);
    border-radius: 50px;
}

.pill-btn {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.625rem 1.5rem;
    background: transparent;
    color: var(--color-text-secondary);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.pill-btn:hover {
    color: var(--color-text);
    background: rgba(0, 122, 236, 0.08);
}

.pill-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 122, 236, 0.25);
}

.filter-right {
    flex-shrink: 0;
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-field {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    padding: 0.75rem 1rem 0.75rem 3rem;
    background: var(--color-bg-alt);
    border: 1px solid transparent;
    border-radius: 50px;
    color: var(--color-text);
    min-width: 240px;
    transition: var(--transition-smooth);
}

.search-field:focus {
    outline: none;
    background: white;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 236, 0.1);
}

.search-field::placeholder {
    color: var(--color-text-muted);
}

/* ==========================================
   Animals Showcase - Grid View
   ========================================== */

.animals-showcase {
    padding: 4rem 0 6rem;
    background: white;
}

.animals-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2rem;
}

/* ==========================================
   Animal Card - Grid View Only
   ========================================== */

.animal-card {
    position: relative;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInScale 0.6s ease-out backwards;
}

.animal-card:nth-child(1) { animation-delay: 0.05s; }
.animal-card:nth-child(2) { animation-delay: 0.1s; }
.animal-card:nth-child(3) { animation-delay: 0.15s; }
.animal-card:nth-child(4) { animation-delay: 0.2s; }
.animal-card:nth-child(5) { animation-delay: 0.25s; }
.animal-card:nth-child(6) { animation-delay: 0.3s; }

.animal-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.card-header-image {
    position: relative;
    width: 100%;
    height: 320px;
    overflow: hidden;
    background: #F5F5F5;
}

.header-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animal-card:hover .header-img {
    transform: scale(1.08);
}

.card-type-badge {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card-expand-hint {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    padding: 0.625rem 1.25rem;
    background: rgba(0, 122, 236, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--transition-smooth);
    pointer-events: none;
}

.animal-card:hover .card-expand-hint {
    opacity: 1;
    transform: translateY(0);
}

.card-compact-content {
    padding: 1.75rem;
}

.card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-name {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

.sponsor-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--color-accent-light) 0%, var(--color-accent) 100%);
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: #757575;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-dot {
    width: 3px;
    height: 3px;
    background: #E0E0E0;
    border-radius: 50%;
}

.card-story-preview {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: #757575;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.card-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.trait-tag {
    padding: 0.375rem 0.875rem;
    background: #F5F5F5;
    border-radius: 50px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    color: #757575;
    transition: all 0.3s ease;
}

.animal-card:hover .trait-tag {
    background: var(--color-accent-light);
    color: white;
}

/* Book styles moved to patentiere-book.css */

/* ==========================================
   Info Banner - Expanded
   ========================================== */

.info-banner {
    padding: 7rem 0;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
    position: relative;
    overflow: hidden;
}

.info-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 0, 0, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* Header Section */
.banner-header {
    position: relative;
    text-align: center;
    max-width: 800px;
    margin: 0 auto 5rem;
    animation: fadeInUp 0.8s ease-out;
}

.banner-eyebrow {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.banner-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 1.5rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.banner-lead {
    font-family: var(--font-body);
    font-size: 1.25rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.95);
    max-width: 700px;
    margin: 0 auto;
}

/* Benefits Grid */
.benefits-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 5rem;
}

.benefit-card {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInScale 0.6s ease-out backwards;
}

.benefit-card:nth-child(1) { animation-delay: 0.1s; }
.benefit-card:nth-child(2) { animation-delay: 0.2s; }
.benefit-card:nth-child(3) { animation-delay: 0.3s; }
.benefit-card:nth-child(4) { animation-delay: 0.4s; }

.benefit-card:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.benefit-card .benefit-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: white;
}

.benefit-card .benefit-icon svg {
    width: 32px;
    height: 32px;
}

.benefit-card .benefit-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.75rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.benefit-card .benefit-text {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* How It Works */
.how-it-works {
    position: relative;
    margin-bottom: 5rem;
}

.section-subtitle {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-align: center;
    margin-bottom: 3rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.step-item {
    position: relative;
    display: flex;
    gap: 1.5rem;
    animation: fadeInUp 0.6s ease-out backwards;
}

.step-item:nth-child(1) { animation-delay: 0.1s; }
.step-item:nth-child(2) { animation-delay: 0.2s; }
.step-item:nth-child(3) { animation-delay: 0.3s; }
.step-item:nth-child(4) { animation-delay: 0.4s; }

.step-number {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.step-content {
    flex: 1;
}

.step-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.step-description {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

/* Pricing & CTA Section */
.banner-cta-section {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3rem;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.pricing-info {
    flex: 1;
    text-align: center;
}

.price-tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.price-amount {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 800;
    color: white;
    line-height: 1;
    letter-spacing: -0.02em;
}

.price-period {
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.5rem;
}

.price-note {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    max-width: 350px;
    margin: 0 auto;
}

.banner-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 2.75rem;
    background: white;
    color: var(--color-primary);
    font-family: var(--font-body);
    font-size: 1.125rem;
    font-weight: 600;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.banner-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@media (max-width: 1200px) {
    .book {
        max-width: 900px;
        height: 600px;
    }

    .animals-masonry {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 5rem 0 3rem;
    }

    .page-title {
        font-size: 2.5rem;
    }

    .page-intro {
        font-size: 1.125rem;
    }

    .toolbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .filter-center {
        order: -1;
    }

    .filter-pills {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .pill-btn {
        padding: 0.5rem 1.125rem;
        font-size: 0.875rem;
    }

    .search-field {
        width: 100%;
        min-width: 0;
    }

    .animals-masonry {
        grid-template-columns: 1fr;
    }

    .book {
        max-width: 600px;
        height: 500px;
    }

    .page-content {
        padding: 2rem;
    }

    .profile-name {
        font-size: 2.5rem;
    }

    .story-page {
        font-size: 1rem;
    }

    .photo-collage {
        grid-template-columns: 1fr;
    }

    /* Banner Responsive */
    .info-banner {
        padding: 5rem 0;
    }

    .banner-title {
        font-size: 2.5rem;
    }

    .banner-header {
        margin-bottom: 3rem;
    }

    .benefits-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 3rem;
    }

    .section-subtitle {
        font-size: 2rem;
    }

    .steps-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .how-it-works {
        margin-bottom: 3rem;
    }

    .banner-cta-section {
        flex-direction: column;
        padding: 2rem;
        gap: 2rem;
    }

    .price-amount {
        font-size: 2.75rem;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 2rem;
    }

    .book-container {
        padding: 1rem;
    }

    .book {
        height: 400px;
    }

    .page-content {
        padding: 1.5rem;
    }

    .book-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    /* Banner Mobile */
    .banner-title {
        font-size: 2rem;
    }

    .banner-lead {
        font-size: 1.0625rem;
    }

    .section-subtitle {
        font-size: 1.75rem;
    }

    .benefit-card {
        padding: 2rem 1.5rem;
    }

    .price-amount {
        font-size: 2.25rem;
    }

    .banner-cta {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   Accessibility
   ========================================== */

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

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}
