/* Font Face Declarations */
@font-face {
    font-family: 'KO Methlama';
    src: url('../fonts/komethlama/KOMethlama-SemiBold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Source Sans Pro', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #0a0a0a;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Global olive cursor */
html,
body {
    cursor: url('../img/olive.png') 32 32, auto;
}

input,
textarea {
    cursor: text;
}

a,
button,
[role="button"] {
    cursor: url('../img/olive.png') 32 32, pointer;
}

@media (pointer: coarse) {
    html,
    body {
        cursor: auto;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    line-height: 1.2;
}

h2.author-name,
.author-name {
    font-family: 'KO Methlama', serif !important;
}

/* Navigation */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    background-color: transparent;
    transition: background-color 0.3s ease, background-image 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    padding: 1.5rem 0;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hide nav bar during intro animation */
#intro-overlay:not(.fade-out) ~ .main-nav {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none;
}

.main-nav.scrolled {
    background-color: #2d1810;
    background-image: url('../img/Kuffiyeh.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.main-nav.scrolled::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2d1810;
    opacity: 0.7;
    z-index: -1;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.nav-brand h1 {
    font-family: 'KO Methlama', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links li {
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    font-family: 'KO Methlama', serif;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-weight: 600;
    display: inline-block;
    line-height: 1.5;
    vertical-align: middle;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255,255,255,0.1);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10001;
    position: relative;
}

.mobile-menu-toggle:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Hero Section */
.hero-section {
    height: 100vh;
    background-color: #8B0000; /* Deep red */
    background-image: url('../img/Kuffiyeh.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    text-align: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #8B0200;
    opacity: 0.85;
    z-index: 0;
}

.hero-content {
    z-index: 1;
    position: relative;
}

.hero-name {
    font-family: 'KO Methlama', serif;
    font-size: 8rem;
    font-weight: 600;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero-name-english {
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 1.8rem;
    color: white;
    font-weight: 600;
    margin: 0.5rem 0 1rem 0;
    opacity: 0.95;
}

.hero-name-english strong {
    font-weight: 700;
}

.hero-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: white;
    font-weight: 400;
    opacity: 0.9;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
    animation: bounce 2s infinite;
    z-index: 1;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

/* Floating poppy rain */
.poppy-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 200;
}

.poppy-rain .poppy {
    position: absolute;
    top: -120px;
    opacity: 0.9;
    animation-name: poppyFall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    --sway: 30px;
}

@keyframes poppyFall {
    0% {
        transform: translate3d(0, -120px, 0) rotate(0deg);
    }
    50% {
        transform: translate3d(calc(var(--sway, 30px) * 0.5), 50vh, 0) rotate(12deg);
    }
    100% {
        transform: translate3d(var(--sway, 30px), 110vh, 0) rotate(-8deg);
    }
}

/* About Section */
.about-section {
    background-color: #79aaa5;
    padding: 6rem 0;
    min-height: 100vh;
    position: relative;
}

.section-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    overflow: visible !important;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    color: #8B0200;
    font-size: 2.5rem;
    font-family: 'Playfair Display', serif;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: #8b4513;
    margin: 1rem auto 0;
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    align-items: start;
}

.about-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.author-portrait {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #8B0200;
}

.author-bio {
    margin-bottom: 1.5rem;
}

.about-decoration {
    position: absolute;
    width: 120px;
    max-width: 20vw;
    transition: transform 0.3s ease;
}

.about-decoration img {
    width: 100%;
    height: auto;
    display: block;
}

.about-decoration--poppy {
    top: 5%;
    left: 3%;
}

.about-decoration:hover img {
    animation: shake 0.9s ease-in-out infinite;
}

@keyframes shake {
    0%, 100% {
        transform: rotate(0deg) translate(0);
    }
    25% {
        transform: rotate(2deg) translate(2px, -2px);
    }
    50% {
        transform: rotate(-2deg) translate(-1px, 2px);
    }
    75% {
        transform: rotate(1deg) translate(1px, -1px);
    }
}

/* Book Section */
.book-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    align-items: start;
}

.book-image {
    width: 100%;
    max-width: 250px;
    height: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 4px;
}

.book-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 2rem;
}

.buy-book h3 {
    margin-bottom: 1rem;
    color: #2d1810;
}

.book-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.book-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: #8b4513;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    font-weight: 600;
}

.book-link:hover {
    background-color: #a0551a;
}

.book-link.amazon {
    background-color: #ff9900;
    color: #000;
}

.book-link.amazon:hover {
    background-color: #e68a00;
}

.book-link.publisher {
    background-color: #2d1810;
}

.book-link.bookshop {
    background-color: #8b4513;
}

/* Videos Section */
.videos-section {
    position: relative;
    z-index: 2;
    background-color: #adb886;
    padding-bottom: 6rem;
    margin-bottom: 0;
}

.videos-intro {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 3rem;
    color: #666;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.video-item {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.video-item iframe {
    width: 100%;
    height: 200px;
    border: none;
}

/* Media Section */
.media-list {
    display: grid;
    gap: 2rem;
}

.media-item {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-left: 4px solid #8b4513;
}

.media-item h3 {
    margin-bottom: 0.5rem;
    color: #2d1810;
}

.media-type {
    display: inline-block;
    background-color: #f4f1ed;
    color: #8b4513;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.media-description {
    color: #666;
    margin-bottom: 1.5rem;
}

.media-link {
    display: inline-block;
    color: #8b4513;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.media-link:hover {
    border-bottom-color: #8b4513;
}

/* Main Content */
.main-content {
    position: relative;
    z-index: 1;
}

.section {
    scroll-margin-top: 100px;
    padding: 4rem 0;
    position: relative;
    z-index: 1;
}

.videos-section {
    position: relative;
    z-index: 2;
    background-color: #adb886;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.active {
    display: block !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-name {
        font-size: 4rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .nav-container {
        flex-direction: column;
        align-items: stretch;
        padding: 0;
        position: relative;
    }

    .nav-brand {
        display: flex !important;
        visibility: visible !important;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 2rem;
        z-index: 10001;
        position: relative;
        width: 100%;
    }

    .nav-brand h1 {
        font-size: 1.3rem;
        margin: 0;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 0;
        background-color: #2d1810;
        background-image: url('../img/Kuffiyeh.jpg');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        padding: 0 1rem;
        margin: 0;
        gap: 0.5rem;
        transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease, visibility 0.3s ease;
        z-index: 10000;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    .nav-links::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #2d1810;
        opacity: 0.7;
        z-index: -1;
    }

    .nav-links.active {
        max-height: 300px;
        padding: 1.5rem 1rem;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .nav-links li {
        width: auto;
        margin: 0;
        padding: 0;
        flex-shrink: 0;
    }

    .nav-link {
        display: block;
        padding: 0.75rem 1rem;
        text-align: center;
        white-space: nowrap;
        border-radius: 4px;
        pointer-events: auto;
        position: relative;
        z-index: 1;
    }

    .nav-link:hover,
    .nav-link.active {
        background-color: rgba(255, 255, 255, 0.15);
    }
    
    /* Remove backdrop for top dropdown */
    .mobile-menu-backdrop {
        display: none;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .author-portrait {
        width: 250px;
        height: 250px;
    }

    .section-container {
        padding: 2rem 1rem;
    }

    .videos-grid {
        grid-template-columns: 1fr;
    }

    .book-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .book-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-name {
        font-size: 3rem;
    }

    .nav-brand h1 {
        font-size: 1.25rem;
    }

    .nav-links {
        gap: 0.25rem;
        padding: 0 0.5rem;
    }

    .nav-links.active {
        padding: 1rem 0.5rem;
    }

    .nav-link {
        padding: 0.625rem 0.75rem;
        font-size: 0.9rem;
    }

    .book-link {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
