/* 1. Font Face Setup */
@font-face {
    font-family: 'KASugarLuck';
    src: url('../assets/KASugarLuck.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 2. Variables & Global Styles */
:root {
    --primary-dark: #252525;
    --primary-pink: #f578b1;
    --light-pink: #ffd8ec;
    --accent-teal: #a5dbd3;
    --accent-blue: #6ca9f0;
    --light-blue: #d4e8ff;
    --accent-yellow: #fdd862;
    --accent-purple: #cc89f1;
    --white: #ffffff;
    --off-white: #f9f9f9;

    /* Spacing scale — replaces one-off magic numbers used throughout the file */
    --space-xs: 8px;
    --space-sm: 16px;
    --space-md: 24px;
    --space-lg: 40px;
    --space-xl: 60px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    color: var(--primary-dark);
    background-color: var(--white);
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
}

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

/* Utility Classes */
.text-center {
    text-align: center;
}

.align-center {
    align-items: center;
}

.mt-50 {
    margin-top: var(--space-xl);
}

.mb-60 {
    margin-bottom: var(--space-xl);
}

/* 3. Typography & Headings */
h1,
h2,
h3 {
    color: var(--primary-dark);
}

.page-title,
.section-title {
    font-family: 'KASugarLuck', serif;
    font-weight: 400;
    text-align: center;
    font-size: clamp(2.25rem, 6vw, 4rem);
    margin: 0 0 var(--space-md) 0;
}

.page-title {
    font-size: clamp(2.5rem, 8vw, 3.8rem);
    margin: 0 0 var(--space-xs) 0;
}

.book-title {
    font-family: 'KASugarLuck', serif;
    font-weight: 400;
    font-size: 2.5rem;
    margin: 0 0 var(--space-xs) 0;
}

/* 4. Layout, Grids & Components */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 50px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 50px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(20px, 5vw, 75px);
    align-items: center;
    justify-items: center;
}

.card {
    background-color: var(--off-white);
    border-radius: 12px;
    padding: 25px;
}

.footer-copyright {
    margin-top: 30px;
    font-size: 0.8rem;
    color: #888888;
}

/* Resource Images Grid */
.resource-img {
    margin: 0 auto;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.resource-img:hover {
    transform: scale(1.03);
}

/* 5. Navigation & Header */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border-bottom: none;
    margin-bottom: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.site-header .nav-logo {
    height: 48px;
    width: auto;
    display: block;
    transform-origin: left center;
    transition: transform 0.5s ease;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--primary-dark);
    font-weight: 500;
    font-size: 1.0rem;
}

.site-header .nav-links a,
.site-header .nav-name {
    transition: font-size 0.5s ease;
}

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

.nav-name {
    font-family: 'KASugarLuck', sans-serif;
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-left: var(--space-sm);
    white-space: nowrap;
}

.site-header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--white);
    border-bottom: 1px solid #EEE;
    padding: var(--space-sm) 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.5s ease;
}

.site-header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding: var(--space-xs) 0;
}

.site-header.scrolled .nav-logo {
    transform: scale(0.667);
}

.site-header.scrolled .nav-name {
    font-size: 1.4rem;
    margin-left: var(--space-xs);
    transition: margin-left 0.3s ease;
}

.site-header.scrolled .nav-links a {
    font-size: .8rem;
}

/* 6. Homepage Sections (Featured Book & Math Symbols) */
.about-top-section {
    padding: var(--space-xl) 0;
    background-color: var(--white);
    position: relative;
}

.about-card-bg {
    background-color: var(--light-pink);
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    padding: var(--space-lg) 0;
}

.about-top-grid {
    display: grid;
    grid-template-columns: minmax(240px, 400px) 1fr;
    gap: var(--space-lg);
    align-items: center;
}

.portrait-img {
    max-width: 380px;
    border: 4px solid var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    margin: -75px auto;
    position: relative;
    z-index: 10;
}

.about-top-content {
    text-align: center;
    max-width: 750px;
    width: 100%;
    margin: 0 auto;
}

.about-top-content .btn {
    margin-top: var(--space-sm);
    display: inline-block;
}

.about-top-content p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--primary-dark);
    margin-bottom: var(--space-sm);
}

.title-with-squiggle {
    font-family: 'KASugarLuck', serif;
    font-size: 3.5rem;
    color: var(--primary-dark);
    display: inline-block;
    position: relative;
    margin: 0 0 10px 0;
    padding-bottom: var(--space-xs);
}

.title-with-squiggle::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--space-sm);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20'%3E%3Cpath fill='none' stroke='%23f578b1' stroke-width='8' stroke-linecap='round' d='M0,10 Q12.5,2 25,10 T50,10 T75,10 T100,10'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 60px 15px;
}

.book-cover {
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.featured-book-section {
    margin-bottom: var(--space-xl);
}

.retailer-buttons {
    list-style: none;
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin: var(--space-md) 0 0;
    padding: 0;
}

.retailer-buttons .btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 10px 15px;
    font-size: 0.9rem;
}

.math-symbols-section {
    padding: var(--space-xl) 0;
    background-color: var(--white);
}

.math-icon {
    max-width: 100px;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.math-icon:hover {
    transform: scale(1.08);
}

.newsletter-section {
    padding: 10px 0;
    width: 100%;
    background-color: var(--light-blue);
}

/* 7. Testimonials & Carousel */
.testimonials-bg {
    background-color: var(--accent-blue);
    padding: 50px 0;
    margin-bottom: var(--space-xs);
    overflow: hidden;
}

.testimonials-bg .section-title {
    color: var(--primary-dark);
    text-align: center;
    margin-bottom: var(--space-xs);
}

.carousel-container {
    position: relative;
    padding: 0 50px;
    margin: 0 auto;
    overflow: hidden;
}

.carousel-track {
    display: flex;
    gap: 20px;
    transition: transform 0.5s ease-in-out;
}

.testimonial-card {
    background-color: var(--light-blue);
    color: #333;
    border-radius: 12px;
    padding: 20px;
    flex: 0 0 calc(50% - 10px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.review-text {
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: var(--space-xs);
    line-height: 1.5;
}

.review-author {
    font-weight: 600;
    margin: 0;
}

.review-stars {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.8);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--accent-blue);
    z-index: 10;
    transition: background 0.3s;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 1);
}

.prev-btn {
    left: 0;
}

.next-btn {
    right: 0;
}

.pause-btn {
    position: static;
    display: block;
    margin: 15px auto 0;
    transform: none;
}

/* 8. About Page Styles */
.page-title-section {
    margin-top: 50px;
    margin-bottom: 40px;
}

.page-subtitle {
    max-width: 600px;
    margin: 0 auto;
}

.bio-section {
    margin-bottom: var(--space-xl);
}

.bio-layout {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 50px;
}

.bio-image {
    max-width: 280px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.bio-content {
    max-width: 450px;
    padding-bottom: 5px;
}

.bio-greeting {
    font-family: 'KASugarLuck', serif;
    margin-top: 0;
    font-size: 2.2rem;
}

.philosophy-bg {
    background-color: var(--accent-teal);
    padding: var(--space-xl) 0;
    margin-bottom: var(--space-xl);
}

.philosophy-card h3 {
    margin-top: 0;
}

.contact-section {
    margin-bottom: var(--space-xl);
}

.contact-info-card {
    height: 100%;
}

.contact-card-title {
    margin-top: 0;
    font-size: 1.5rem;
}

.contact-email {
    color: var(--primary-dark);
    font-weight: 500;
}

.form-card {
    background-color: var(--light-pink);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--primary-dark);
}

.form-input {
    width: 100%;
    font-family: inherit;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background-color: var(--white);
}

textarea.form-input {
    resize: vertical;
}

.submit-btn {
    align-self: flex-start;
    margin-top: 10px;
}

/* 9. Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--primary-pink);
    color: var(--white);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: #E05C97;
}

/* 10. Footer */
footer {
    text-align: center;
    padding: 40px 0 20px 0;
    border-top: 1px solid #EEE;
    margin-top: var(--space-xl);
    font-size: 0.9rem;
}

/* 11. Mobile Rules */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .nav-links {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        gap: var(--space-md);
    }

    .nav-links a {
        display: inline-block;
        width: auto;
        padding: 8px 12px;
        text-align: center;
        font-size: 1.0rem;
    }

    .site-header.scrolled .nav,
    .site-header.scrolled .nav-links a {
        font-size: 0.88rem;
    }

    section-title {
        font-size: 2.2 rem;
    }

    /* Testimonials: One Visible at a Time */
    .testimonial-card {
        flex: 0 0 100%;
    }

    .math-icon {
        max-width: var(--space-lg);
        margin: 0 auto;
    }

    /* Override Flodesk */
    #fd-form-6a9dd48a88ab964c44a91fef * {
        word-break: normal !important;
        overflow-wrap: normal !important;
        hyphens: none !important;
    }

    .newsletter-section .container {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
    }

    /* Layout Grids: Images/Book Cover on Top of Text */
    .featured-book-section .grid-2 {
        display: flex;
        flex-direction: column-reverse;
        gap: var(--space-xs);
    }

    .portrait-img,
    .book-cover {
        margin: 0 auto 20px auto;
        max-width: 280px;
    }

    .about-top-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
    }

    /* General Spacing & Mobile Scaffolding */
    .page-title-section {
        margin-top: 30px;
        margin-bottom: 20px;
    }

    .bio-section {
        margin-bottom: 40px;
    }

    .philosophy-bg {
        padding: 40px 0;
        margin-bottom: 40px;
    }

    .contact-section {
        margin-bottom: 40px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .bio-layout {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }

    /* Tap-Friendly Form Controls */
    .form-input {
        min-height: 48px;
        padding: 12px;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .carousel-container {
        padding: 0 40px;
    }
}