/* ------------------------------------------
   FONTS & RESET
------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e3a8a;
    --primary-dark: #152e6b;
    --primary-light: #3b5cb0;
    --bg-light: #f8f4eb;
    --bg-card: #ffffff;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-light: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Typography */
.heading-font {
    font-family: 'Playfair Display', serif;
}

/* Responsive images & media */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ------------------------------------------
   LAYOUT & UTILITIES
------------------------------------------ */
.container-custom {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container-custom {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-custom {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Line clamp utility */
.line-clamp-4 {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Responsive visibility helper */
@media (max-width: 480px) {
    .xs\:flex {
        display: flex;
    }
    .xs\:hidden {
        display: none;
    }
}

/* ------------------------------------------
   NAVBAR & MOBILE MENU (Fully Responsive)
------------------------------------------ */
.nav-link {
    position: relative;
    font-weight: 500;
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--primary);
    transition: width var(--transition-fast);
}

.nav-link:hover:after,
.nav-link.active:after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary);
}

/* Mobile menu animation */
#mobile-menu {
    transition: all var(--transition-normal);
    transform-origin: top;
}

#mobile-menu:not(.hidden) {
    animation: slideDown 0.25s ease-out forwards;
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------------------------------
   HERO SECTION (Responsive typography & layout)
------------------------------------------ */
.hero-bg {
    background: linear-gradient(135deg, #f8f4eb 0%, #e2d9c8 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.hero-content {
    display: grid;
    gap: 2rem;
}

@media (min-width: 768px) {
    .hero-content {
        grid-template-columns: 1fr 1fr;
        align-items: center;
        gap: 3rem;
    }
}

.hero-text h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    line-height: 1.1;
}

.hero-text .subhead {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
}

/* Responsive badge */
.availability-badge {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ------------------------------------------
   BOOKS SECTION (Grid adjusts)
------------------------------------------ */
.books-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.book-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.book-cover {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
    height: auto;
}

/* ------------------------------------------
   ABOUT SECTION (Responsive columns)
------------------------------------------ */
.about-grid {
    display: grid;
    gap: 2rem;
}

@media (min-width: 768px) {
    .about-grid {
        grid-template-columns: 7fr 5fr;
        align-items: center;
    }
}

/* ------------------------------------------
   BLOG CARDS (Fully responsive)
------------------------------------------ */
.blog-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .blog-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .blog-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.blog-card {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    background: var(--bg-card);
    border-radius: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border-light);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.blog-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.blog-card:hover img {
    transform: scale(1.02);
}

.blog-card-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ------------------------------------------
   BUTTONS & INTERACTIONS
------------------------------------------ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .btn-primary, .btn-outline {
        white-space: normal;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    transition: all var(--transition-fast);
    cursor: pointer;
    text-align: center;
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-1px);
}

/* ------------------------------------------
   FOOTER (Responsive stacking)
------------------------------------------ */
.footer-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .footer-grid {
        flex-direction: column;
        text-align: center;
    }
}

footer a {
    transition: color var(--transition-fast);
}

footer a:hover {
    color: white;
}

/* ------------------------------------------
   AUTHOR CREDIT & WIKI LINK (Responsive)
------------------------------------------ */
.author-credit {
    text-align: center;
    font-family: 'Inter', system-ui, sans-serif;
    margin: 1rem 0;
}

.author-credit h3 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.25rem, 5vw, 1.5rem);
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.author-credit p {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 1rem;
}

.wiki-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    color: #1e3a8a;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid #e2e8f0;
}

.wiki-link:hover {
    background-color: #e2e8f0;
    color: #0f172a;
    transform: translateY(-2px);
}

.external-icon {
    stroke: currentColor;
}

/* ------------------------------------------
   CONTACT FORM (Responsive)
------------------------------------------ */
.contact-form-container {
    max-width: 100%;
    width: 100%;
}

.form-grid {
    display: grid;
    gap: 1rem;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.form-field {
    width: 100%;
}

input, textarea, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* ------------------------------------------
   RESPONSIVE TYPOGRAPHY & SPACING
------------------------------------------ */
@media (max-width: 640px) {
    body {
        font-size: 15px;
    }
    h1, .h1 {
        font-size: 2rem;
    }
    h2, .h2 {
        font-size: 1.75rem;
    }
    section {
        padding: 3rem 0;
    }
    .container-custom {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    section {
        padding: 4rem 0;
    }
}

/* ------------------------------------------
   UTILITIES
------------------------------------------ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Grid utilities */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

@media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Spacing */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }

/* ------------------------------------------
   ANIMATIONS (keep existing)
------------------------------------------ */
.animate-ping {
    animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
    75%, 100% {
        transform: scale(2);
        opacity: 0;
    }
}

.modal {
    animation: modalPop 0.3s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

@keyframes modalPop {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ------------------------------------------
   ACCESSIBILITY & FOCUS STATES
------------------------------------------ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 0.5rem;
}

/* ------------------------------------------
   MISC UTILITIES (Tailwind helpers if needed)
------------------------------------------ */
.prose {
    max-width: 65ch;
    color: var(--text-dark);
}

.prose p {
    margin-bottom: 1.25rem;
}

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.rounded-3xl { border-radius: 1.5rem; }
.rounded-2xl { border-radius: 1rem; }