/* Modern CSS Variables */
:root {
    /* Brand colors */
    --primary-color: #111111;
    --secondary-color: #fbbf24;
    --accent-color: #f9fafb;

    /* Yellow palette */
    --yellow-light: #fcd34d;
    --yellow-base: #fbbf24;
    --yellow-dark: #f59e0b;
    --yellow-darker: #d97706;

    /* Gray palette */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Typography */
    --heading-font: 'Montserrat', sans-serif;
    --body-font: 'Inter', sans-serif;
}

/* Import modern fonts */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&family=Inter:wght@400;500;600&display=swap');

/* Base styles */
body {
    font-family: var(--body-font);
    line-height: 1.6;
    color: var(--gray-900);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Wider container for portfolio to better utilize space */
.container-wide {
    max-width: 1440px;
}

/* Modern Navigation */
.nav {
    background-color: rgba(17, 17, 17, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 50;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

/* Navbar state after scroll */
.nav.scrolled {
    background-color: rgba(17, 17, 17, 0.98);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    padding: 0.5rem 0;
}

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

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-brand img {
    height: 3.5rem;
    width: auto;
}

.nav-brand h1 {
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Hide hamburger on desktop by default */
.nav-mobile-toggle {
    display: none;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--yellow-base);
    transition: width 0.3s ease;
}

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

.nav-link:hover,
.nav-link.active {
    color: var(--yellow-base);
}

/* Language Toggle Button */
.language-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

.language-toggle:hover {
    background: rgba(251, 191, 36, 0.2);
    border-color: var(--yellow-base);
    color: var(--yellow-base);
}

.language-toggle .flag-icon {
    font-size: 1rem;
    line-height: 1;
}

.language-toggle .lang-text {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.mobile-lang-toggle {
    margin-top: 1rem;
    justify-self: center;
    width: fit-content;
}

/* Modern Hero Section */
.hero-section {
    padding-top: 5rem;
    padding-bottom: 4rem;
    position: relative;
    overflow: hidden;
    background: #111111;
    color: white;
}

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

.hero-content h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 1.25rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--gray-300);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Large logo in hero */
.hero-logo {
    width: 100%;
    max-width: 680px;
    height: auto;
    filter: drop-shadow(0 10px 25px rgba(0,0,0,0.35));
    margin-top: 1rem;
}

/* Modern Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 300px;
}

.btn-primary {
    background: var(--yellow-base);
    color: var(--gray-900);
}

.btn-primary:hover {
    background: var(--yellow-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--yellow-base);
    color: var(--yellow-base);
}

.btn-secondary:hover {
    background: var(--yellow-base);
    color: var(--gray-900);
    transform: translateY(-2px);
}

/* Additional button variants used in HTML */
.btn-dark {
    background: var(--gray-900);
    color: white;
}

.btn-dark:hover {
    background: #0b0b0b;
    transform: translateY(-2px);
}

.btn-outline-dark {
    background: transparent;
    border: 2px solid var(--gray-900);
    color: var(--gray-900);
}

.btn-outline-dark:hover {
    background: var(--gray-900);
    color: white;
    transform: translateY(-2px);
}

/* Services Section */
.services-section {
    padding: 4rem 0;
    background: white;
}

/* Portfolio section subtle background */
.portfolio-section {
    background: linear-gradient(180deg, var(--accent-color), #ffffff);
}

.section-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
}

.section-subtitle {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: var(--gray-600);
    text-align: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 0.5rem;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 1rem;
    padding: 1.75rem;
    transition: all 0.3s ease;
    border: 1px solid var(--gray-200);
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-icon {
    font-size: 2rem;
    color: var(--yellow-base);
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card-text {
    color: var(--gray-600);
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.card-link {
    color: var(--yellow-base);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.card-link:hover {
    color: var(--yellow-dark);
}

/* Form inputs used across pages */
.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    background: white;
    color: var(--gray-900);
    width: 100%;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--yellow-base);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.25);
}

/* Portfolio gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    grid-auto-flow: dense;
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (min-width: 1280px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
}

.gallery-item {
    position: relative;
    background: white;
    border-radius: 1rem;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

/* Consistent media container for portfolio images */
.gallery-media {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 1rem;
    overflow: hidden;
    background: #0f0f0f;
    box-shadow: 0 20px 25px -10px rgba(0, 0, 0, 0.35);
}

.gallery-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1);
    transition: transform 0.5s ease, filter 0.3s ease;
    will-change: transform;
}

/* Masonry layout */
.masonry {
    column-gap: 0.75rem;
    column-width: 260px;
}

.masonry .gallery-item {
    display: inline-block;
    width: 100%;
    margin: 0 0 1rem;
    break-inside: avoid;
}

.masonry .gallery-media {
    aspect-ratio: auto;
}

.masonry .gallery-media img {
    height: auto;
    display: block;
}

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25) 60%, rgba(0, 0, 0, 0.08));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

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

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -10px rgba(0,0,0,0.2);
}

.gallery-meta {
    padding: 1rem 1rem 1.25rem;
}

.gallery-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.gallery-chip {
    display: inline-block;
    margin-top: 0.5rem;
    background: var(--yellow-base);
    color: var(--gray-900);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #000;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

.lightbox-content img {
    display: block;
    width: 100%;
    height: auto;
}

.lightbox-caption {
    color: #e5e7eb;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

/* Keyframes for JS-triggered animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); }
    to { transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Navigation */
    .nav {
        padding: 0.4rem 0;
    }

    .nav-brand img {
        height: 3rem;
    }

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

    .nav-menu {
        display: none;
    }

    .nav-menu.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(17, 17, 17, 0.98);
        padding: 1rem;
        gap: 1rem;
    }

    .nav-mobile-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        padding: 0.5rem;
    }

    /* Hero Section */
    .hero-section {
        padding-top: 4rem;
        padding-bottom: 3rem;
        text-align: center;
    }

    .hero-logo {
        max-width: 520px;
        margin-top: 0.5rem;
    }

    .hero-content {
        padding: 0 1rem;
        text-align: center !important;
    }
    
    .hero-content h2 {
        text-align: center !important;
    }
    
    .hero-content p {
        text-align: center !important;
        margin-left: auto;
        margin-right: auto;
    }

    /* Buttons */
    .btn {
        width: 100%;
        margin-bottom: 1rem;
        text-align: center;
    }
    
    /* Button container centering on mobile */
    .hero-content > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    /* Services Grid */
    .services-grid {
        grid-template-columns: 1fr;
        padding: 0 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    /* Sections */
    .section {
        padding: 3rem 0;
    }

    /* Container */
    .container {
        padding: 0 1rem;
    }

    /* Typography */
    h2 {
        font-size: clamp(1.75rem, 4vw, 2.25rem);
    }

    p {
        font-size: 1rem;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .nav-brand {
        gap: 0.5rem;
    }

    .nav-brand img {
        height: 3rem;
    }

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

    .hero-content h2 {
        font-size: 1.75rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-logo {
        max-width: 420px;
        margin-top: 0.25rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .section-subtitle {
        font-size: 0.875rem;
    }

    .card {
        padding: 1.25rem;
    }
}

/* Print styles */
@media print {
    .nav, footer {
        display: none;
    }
}

/* ============================================
   CUSTOM ACCESSIBILITY WIDGET STYLES
   ============================================ */

/* Accessibility Button */
.accessibility-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--yellow-base);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    border: none;
    transition: all 0.3s ease;
}

.accessibility-btn:hover {
    background: var(--yellow-dark);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.accessibility-btn i {
    font-size: 28px;
    color: var(--gray-900);
}

/* Accessibility Panel */
.accessibility-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-height: 600px;
    overflow: hidden;
}

.accessibility-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.accessibility-panel-header {
    background: var(--gray-900);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.accessibility-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.accessibility-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.accessibility-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.accessibility-panel-body {
    padding: 20px;
    max-height: 480px;
    overflow-y: auto;
}

/* Accessibility Options */
.accessibility-option {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.accessibility-option:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.accessibility-option-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--gray-900);
    font-size: 14px;
}

/* Font Size Controls */
.font-size-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.font-size-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
}

.font-size-btn:hover {
    background: var(--yellow-base);
    border-color: var(--yellow-base);
    color: var(--gray-900);
}

.font-size-display {
    font-weight: 700;
    color: var(--gray-900);
    min-width: 50px;
    text-align: center;
}

/* Toggle Switches */
.accessibility-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-bottom: 8px;
}

.accessibility-toggle:hover {
    background: var(--gray-100);
}

.accessibility-toggle-label {
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 500;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--gray-300);
    border-radius: 13px;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: var(--yellow-base);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

/* Reset Button */
.accessibility-reset {
    width: 100%;
    background: var(--gray-900);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s ease;
}

.accessibility-reset:hover {
    background: var(--gray-800);
}

/* Accessibility States */
body.high-contrast {
    background: white !important;
    color: black !important;
}

body.high-contrast * {
    background: white !important;
    color: black !important;
    border-color: black !important;
}

body.high-contrast .nav,
body.high-contrast .hero-section,
body.high-contrast footer,
body.high-contrast .btn-dark {
    background: black !important;
    color: white !important;
}

body.high-contrast img {
    filter: grayscale(100%) contrast(120%);
}

body.highlight-links a {
    background: var(--yellow-base) !important;
    color: var(--gray-900) !important;
    padding: 2px 4px;
    border-radius: 2px;
}

body.large-text {
    font-size: 120% !important;
}

body.letter-spacing * {
    letter-spacing: 0.12em !important;
}

body.line-height * {
    line-height: 2 !important;
}

body.dyslexia-font,
body.dyslexia-font * {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Responsive */
@media (max-width: 480px) {
    .accessibility-panel {
        width: calc(100vw - 40px);
        right: 20px;
    }
    
    .accessibility-btn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    .accessibility-btn i {
        font-size: 24px;
    }
}