@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    /* Color Palette */
    --canvas: #FFF8E7;
    /* Crema Pergamena */
    --primary: #A0522D;
    /* Terracotta Bruciata */
    --text: #3B3131;
    /* Espresso Scuro */
    --accent: #78866B;
    /* Verde Salvia Antico */
    --accent-light: rgba(120, 134, 107, 0.1);
    --white-soft: rgba(255, 255, 255, 0.5);

    /* Typography - Fluid scaling */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --text-h1: clamp(2.5rem, 8vw, 4.5rem);
    --text-h2: clamp(2rem, 5vw, 3rem);
    --text-body: clamp(1rem, 1vw + 0.5rem, 1.125rem);

    /* Spacing & Effects */
    --section-gap: clamp(5rem, 10vw, 10rem);
    --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-soft: 0 15px 45px rgba(59, 49, 49, 0.08);
    --shadow-hover: 0 30px 60px rgba(160, 82, 45, 0.15);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--canvas);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: 1.7;
    overflow-x: hidden;
    background-image: url('https://www.transparenttextures.com/patterns/paper-fibers.png');
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary);
    color: white;
    padding: 1rem;
    z-index: 9999;
    transition: 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

h1,
h2,
h3,
h4,
.brand {
    font-family: var(--font-heading);
    color: var(--primary);
    font-weight: 700;
    line-height: 1.2;
}

p {
    margin-bottom: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

ul {
    list-style: none;
}

/* --- Layout Components --- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: var(--section-gap) 0;
}

/* --- Header & Navigation --- */

#header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: var(--transition-smooth);
    background: rgba(255, 248, 231, 0.7);
    /* More transparent for modern glass look */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.03);
}

.reading-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--primary);
    transition: width 0.1s ease;
    z-index: 1001;
}

#header.scrolled {
    padding: 1rem 0;
    background: rgba(255, 248, 231, 0.92);
    box-shadow: var(--shadow-soft);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.2rem);
    font-weight: 900;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    white-space: nowrap;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: var(--transition-smooth);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-links a:hover {
    color: var(--accent);
}

/* Mobile Menu Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    z-index: 1001;
}

.hamburger {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--primary);
    position: relative;
    transition: 0.3s;
    border-radius: 3px;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 3px;
    background: var(--primary);
    left: 0;
    transition: 0.3s;
    border-radius: 3px;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    bottom: -8px;
}

/* Hamburger Open State */
.mobile-menu-toggle[aria-expanded="true"] .hamburger {
    background: transparent;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::before {
    top: 0;
    transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger::after {
    bottom: 0;
    transform: rotate(-45deg);
}

/* --- Buttons --- */

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--primary);
    color: var(--canvas);
    box-shadow: 0 4px 15px rgba(160, 82, 45, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    background: #8b4513;
}

/* --- Footer --- */

footer {
    background: var(--text);
    color: var(--canvas);
    padding: 5rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-logo {
    font-size: 2rem;
    font-weight: 900;
    font-family: var(--font-heading);
    color: var(--canvas);
    margin-bottom: 1.5rem;
}

.footer-links h4 {
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.footer-links ul li {
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.footer-links ul li:hover {
    opacity: 1;
    color: var(--accent);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 248, 231, 0.1);
    text-align: center;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* --- Animations --- */

.reveal {
    opacity: 0;
    transform: translateY(50px);
    filter: blur(5px);
    transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1),
        transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
        filter 1s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.fade-in-title {
    animation: fadeInScale 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- Cookie Modal --- */

@keyframes cookieSlideUp {
    from {
        opacity: 0;
        transform: translateY(120%) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cookie-modal {
    position: fixed;
    bottom: 1.75rem;
    left: 1.75rem;
    max-width: 420px;
    width: calc(100% - 3.5rem);
    background: rgba(59, 49, 49, 0.97);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 248, 231, 0.12);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(160, 82, 45, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    z-index: 2000;
    opacity: 0;
    transform: translateY(120%) scale(0.96);
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.cookie-modal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    animation: cookieSlideUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.9rem;
}

.cookie-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: linear-gradient(135deg, var(--primary), #c1693a);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(160, 82, 45, 0.35);
}

.cookie-modal h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--canvas);
    line-height: 1.3;
    margin-bottom: 0;
}

.cookie-modal p {
    font-size: 0.82rem;
    line-height: 1.6;
    color: rgba(255, 248, 231, 0.65);
    margin-bottom: 1.4rem;
}

.cookie-modal p a {
    color: rgba(120, 134, 107, 0.9);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s ease;
}

.cookie-modal p a:hover {
    color: var(--accent);
}

.cookie-buttons {
    display: flex;
    gap: 0.65rem;
    align-items: center;
}

.cookie-btn-accept {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.2rem;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: var(--canvas);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 14px rgba(160, 82, 45, 0.4);
}

.cookie-btn-accept:hover {
    background: #b5602f;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(160, 82, 45, 0.5);
}

.cookie-btn-accept:active {
    transform: translateY(0);
}

.cookie-btn-reject {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 248, 231, 0.18);
    background: rgba(255, 248, 231, 0.07);
    color: rgba(255, 248, 231, 0.6);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    white-space: nowrap;
}

.cookie-btn-reject:hover {
    background: rgba(255, 248, 231, 0.12);
    color: var(--canvas);
    border-color: rgba(255, 248, 231, 0.3);
}

.cookie-btn-details {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    border: 1px solid rgba(120, 134, 107, 0.35);
    background: transparent;
    color: rgba(120, 134, 107, 0.85);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    white-space: nowrap;
}

.cookie-btn-details:hover {
    background: rgba(120, 134, 107, 0.12);
    color: var(--accent);
    border-color: var(--accent);
}

/* --- Media Queries (Base) --- */

@media (max-width: 1024px) {
    .container {
        padding: 0 4rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 56px;
        --header-height-scrolled: 50px;
    }

    .container {
        padding: 0 1.25rem;
    }

    #header {
        padding: 0.75rem 0;
    }

    #header.scrolled {
        padding: 0.6rem 0;
    }

    .logo {
        font-size: clamp(1.1rem, 5vw, 1.35rem);
        gap: 0.5rem;
    }

    .logo img {
        width: 32px;
        height: 32px;
    }

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

    .nav-links {
        position: fixed;
        right: -100%;
        top: 0;
        height: 100vh;
        width: 80%;
        max-width: 300px;
        background: var(--canvas);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 3rem;
        box-shadow: var(--shadow-hover);
        transition: var(--transition-smooth);
        z-index: 1000;
    }

    .nav-links.active {
        right: 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .cookie-modal {
        left: 1rem;
        bottom: 1rem;
        width: calc(100% - 2rem);
        max-width: none;
        border-radius: 16px;
    }

    .cookie-buttons {
        flex-wrap: wrap;
    }

    .cookie-btn-accept {
        flex: 1 1 100%;
        order: -1;
    }
}