:root {
    --primary-color: #f4ecd8; /* Warm paper */
    --secondary-color: #2b3a42; /* Deep ink */
    --accent-color: #e56b55; /* Soft terra cotta */
    --text-color: #2b3a42;
    --background-color: #faf9f5;
    --transition-speed: 0.4s;
}

@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;
    }
}

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

body {
    font-family: "Georgia", serif; /* Premium, story-like typography */
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

body.loaded {
    opacity: 1; /* 8. Smooth page transitions */
}

/* Typography */
h1, h2, h3, h4 {
    font-family: "Playfair Display", "Georgia", serif;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
p { margin-bottom: 1.5rem; font-size: 1.125rem; }
a { color: var(--accent-color); text-decoration: none; transition: color var(--transition-speed); }
a:hover { color: var(--secondary-color); }

/* Grid Strategy 1: Hero Split */
.hero-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 80vh;
    align-items: center;
    padding: 4rem;
    gap: 2rem;
}
.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

/* Grid Strategy 2: Modular Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 4rem;
}

/* Grid Strategy 3: Asymmetrical Editorial */
.editorial-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    padding: 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* 1. Story-scroll chapter reveal */
.chapter-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.chapter-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 2. Direction-aware book card hover (Setup) */
.book-card {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.book-card .overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(43, 58, 66, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
}
.book-card:hover .overlay {
    opacity: 1;
}
.book-image { width: 100%; height: auto; display: block; }

/* 3. Layered shelf-depth parallax */
.parallax-shelf {
    position: relative;
    height: 400px;
    background-image: url('../img/highres_1.jpg');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: flex;
    align-items: center;
    justify-content: center;
}
.parallax-content {
    background: rgba(255, 255, 255, 0.9);
    padding: 3rem;
    border-radius: 8px;
    max-width: 600px;
    text-align: center;
}

/* 4. SVG bookmark morph animation */
.bookmark-svg path {
    transition: d 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.bookmark-container:hover .bookmark-svg path {
    d: path("M10 10 L40 10 L40 90 L25 70 L10 90 Z"); /* Morphs slightly */
}

/* 5. Magnetic read-now CTA */
.magnetic-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background-color: var(--accent-color);
    color: #fff;
    border-radius: 30px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.magnetic-btn:hover {
    box-shadow: 0 8px 20px rgba(229, 107, 85, 0.4);
    color: #fff;
}

/* 6. Kinetic typography for section openers */
.kinetic-text {
    overflow: hidden;
}
.kinetic-text span {
    display: inline-block;
    transform: translateY(100%);
    animation: kineticReveal 0.8s forwards cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes kineticReveal {
    to { transform: translateY(0); }
}

/* 7. Section focus transition by age group */
.age-group-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}
.age-tab {
    padding: 0.5rem 1.5rem;
    cursor: pointer;
    border: 1px solid var(--secondary-color);
    border-radius: 20px;
    transition: all 0.3s;
}
.age-tab.active {
    background: var(--secondary-color);
    color: #fff;
}
.age-content {
    display: none;
    animation: fadeIn 0.5s ease forwards;
}
.age-content.active {
    display: block;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header & Footer */
header {
    padding: 1.5rem 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo { font-size: 1.5rem; font-weight: 700; color: var(--secondary-color); text-transform: uppercase; letter-spacing: 2px;}
nav a { margin-left: 2rem; font-weight: bold; color: var(--secondary-color); }
footer {
    background: var(--secondary-color);
    color: #fff;
    padding: 4rem;
    text-align: center;
    margin-top: 4rem;
}
footer a { color: var(--primary-color); margin: 0 1rem; }

/* Responsive */
@media (max-width: 1024px) {
    .hero-split { padding: 2rem; }
    .grid-cards { padding: 2rem; }
}
@media (max-width: 768px) {
    .hero-split, .editorial-grid { grid-template-columns: 1fr; }
    header { flex-direction: column; gap: 1rem; padding: 1rem; }
    nav a { margin: 0 1rem; }
}
@media (max-width: 480px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    .parallax-shelf { height: 300px; }
}

/* Icon Cards */
.icon-card {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}
.icon-card:hover {
    transform: translateY(-5px);
}
.icon-card img {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
}
