/* --- THEME VARIABLES --- */
:root {
    /* DEFAULT (DARK) */
    --bg-color: #0B0E14; 
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --accent: #38BDF8;
    --accent-hover: #0EA5E9;
    --accent-glow: rgba(56, 189, 248, 0.4);
    
    --glass-bg: rgba(22, 27, 34, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(11, 14, 20, 0.85);

    --radius: 16px;
    --nav-height: 80px;
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    --title-gradient: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    --card-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    /* LIGHT MODE */
    --bg-color: #F8FAFC;
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --accent: #0369A1;
    --accent-hover: #075985;
    --accent-glow: rgba(3, 105, 161, 0.3);
    
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.08);
    --nav-bg: rgba(248, 250, 252, 0.85);

    --title-gradient: linear-gradient(135deg, #0F172A 0%, #475569 100%);
    --card-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.05);
}

/* --- RESET & BODY --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.8;
    min-height: 100vh;
    overflow-x: hidden;
    /* Default dark bg gradient. JS updates it slightly on switch */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(56, 189, 248, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    margin-top: 2rem;
    transition: color 0.4s ease;
}

h2 { font-size: 2.25rem; }
h3 { font-size: 1.75rem; }

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-hover);
    text-shadow: 0 0 8px var(--accent-glow);
}

p {
    margin-bottom: 1.75rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    letter-spacing: 0.2px;
}

/* Strong / Bold Elements */
strong, b {
    color: var(--text-primary);
    font-weight: 600;
}

/* Clean Blockquotes */
blockquote {
    border-left: 4px solid var(--accent);
    padding: 1.5rem 2rem;
    margin: 2rem 0;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text-primary);
    font-size: 1.15rem;
}

/* --- RESOURCE GRID (PUPIL AREA) --- */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.resource-card {
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease, border-color 0.3s ease;
    text-decoration: none !important;
}

.resource-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    border-color: var(--accent);
}

.resource-icon {
    width: 60px;
    height: 60px;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: background 0.3s ease, color 0.3s ease;
}

.resource-card:hover .resource-icon {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 8px 25px var(--accent-glow);
}

.resource-icon svg {
    width: 32px;
    height: 32px;
}

.resource-title {
    font-size: 1.35rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.resource-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    flex-grow: 1;
}

.resource-action {
    font-weight: 600;
    color: var(--accent);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.resource-card:hover .resource-action {
    color: var(--accent-hover);
}

/* Footer */
ul:not(.nav-menu):not(.dropdown), ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

ul:not(.nav-menu):not(.dropdown) li, ol li {
    margin-bottom: 0.75rem;
    position: relative;
}

/* --- NAVIGATION --- */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 100;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.logo span {
    color: var(--accent);
    font-weight: 400;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 1rem;
}

.nav-menu > li > a {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0;
    position: relative;
    letter-spacing: 0.5px;
}

.nav-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-menu > li > a:hover::after {
    width: 100%;
}

.nav-menu > li > a:hover {
    color: var(--text-primary);
    text-shadow: none;
}

/* Theme Toggle Button (Floating) */
.theme-toggle {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s, color 0.3s, box-shadow 0.3s;
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-5px);
    box-shadow: 0 15px 35px var(--accent-glow);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
}

/* Dropdown */
.has-dropdown {
    position: relative;
    padding: 1rem 0;
}

.dropdown {
    position: absolute;
    top: calc(100% - 0.5rem);
    left: -1rem;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem 0;
    min-width: 220px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--card-shadow);
}

.has-dropdown:hover .dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown li a {
    display: block;
    padding: 0.75rem 1.75rem;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s, padding-left 0.2s;
    font-weight: 500;
}

.dropdown li a:hover {
    background: var(--glass-border);
    color: var(--text-primary);
    padding-left: 2rem;
    text-shadow: none;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    width: 32px;
    height: 32px;
}

/* --- MAIN CONTENT & GLASS CARD --- */
.main-content {
    max-width: 900px; /* narrowed slightly for better reading width */
    margin: calc(var(--nav-height) + 4rem) auto 4rem;
    padding: 0 1.5rem;
}

.page-header {
    text-align: center;
    margin-bottom: 4rem;
}

.page-title {
    font-size: 4rem;
    font-weight: 800;
    background: var(--title-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    margin-top: 0;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    letter-spacing: -1px;
}

.content-glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 4rem;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--card-shadow);
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Ensure first element inside card has no top margin */
.content-glass > *:first-child {
    margin-top: 0;
}

/* --- RESPONSIVE GRIDS --- */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.split-layout-pricing {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}
.hero-title {
    font-size: 3.5rem;
    text-align: left;
}
.hero-subtitle {
    font-size: 1.35rem; 
    color: var(--text-primary); 
    text-align: left; 
    max-width: 800px;
}

/* --- MEDIA & COMPONENTS --- */
.content-glass img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem 0;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.content-glass img:hover {
    transform: scale(1.02);
}

/* Clearfix for WP aligned images */
.content-glass::after {
    content: "";
    display: table;
    clear: both;
}

/* Forms (Contact Page) */
input, textarea, select {
    width: 100%;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

button[type="submit"], .btn-link, .botiga-button {
    background: var(--accent);
    color: #fff;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 15px var(--accent-glow);
    display: inline-block;
}

button[type="submit"]:hover, .btn-link:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
    color: #fff;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 3rem 0;
    background: rgba(148, 163, 184, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

th, td {
    padding: 1.25rem;
    border-bottom: 1px solid var(--glass-border);
    text-align: left;
}

th {
    color: var(--text-primary);
    font-weight: 700;
    background: rgba(148, 163, 184, 0.05);
}

/* Responsive WP Video/iframes */
.wp-video, iframe {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin: 2rem 0;
}

/* --- FOOTER --- */
.site-footer {
    border-top: 1px solid var(--glass-border);
    padding: 4rem 2rem;
    text-align: center;
    margin-top: 8rem;
    background: rgba(0,0,0,0.1);
    transition: background-color 0.4s ease;
}

.site-footer p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* --- ANIMATIONS --- */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.stagger-fade {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        margin-left: 0;
    }
    
    .theme-toggle {
        margin-right: 1.5rem;
    }

    .nav-menu {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        width: 100%;
        background: var(--bg-color);
        flex-direction: column;
        gap: 0;
        border-bottom: 1px solid var(--glass-border);
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
        transition: clip-path 0.4s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
        border-top: 1px solid var(--glass-border);
    }
    
    .nav-menu.active {
        clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    }

    .nav-menu > li {
        width: 100%;
        border-bottom: 1px solid var(--glass-border);
    }

    .nav-menu > li > a {
        display: block;
        padding: 1.5rem 2rem;
        font-size: 1.1rem;
    }

    .dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--glass-border);
        border-radius: 0;
        padding: 0;
        display: none;
    }
    
    .dropdown li a {
        padding: 1.25rem 3rem;
    }
    .has-dropdown.open .dropdown {
        display: block;
        background: rgba(148, 163, 184, 0.05);
    }

    .page-title {
        font-size: 2.5rem;
    }

    .content-glass {
        padding: 2rem 1.5rem;
    }
    
    blockquote {
        padding: 1rem 1.5rem;
    }

    .split-layout, .split-layout-pricing {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem !important;
        text-align: center !important;
    }

    .hero-subtitle {
        font-size: 1.15rem !important;
        text-align: center !important;
    }

    .page-header div {
        flex-direction: column;
    }

    /* Fix potential overflow from very long text links */
    .botiga-button {
        width: 100% !important;
        text-align: center;
    }
}

/* --- LEGACY WP GALLERY FIX (MASONRY LAYOUT) --- */
.gallery-container {
    margin: 0;
    padding: 0;
    width: 100%;
}

.gallery-grid {
    display: block;
    column-count: 1;
    column-gap: 1.5rem;
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

@media (min-width: 600px) {
    .gallery-grid { column-count: 2; }
}
@media (min-width: 900px) {
    .gallery-grid { column-count: 3; }
}

.gallery-item {
    break-inside: avoid; /* Prevent images from splitting across columns */
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.05);
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.gallery-item figure {
    margin: 0;
    display: block;
}

.gallery-item img {
    display: block;
    width: 100%;
    height: auto; /* Natural aspect ratio respected, no cropping! */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-item img:hover {
    transform: scale(1.02);
}
