:root {
    --color-primary: #0d47a1;
    --color-primary-dark: #072f6b;
    --color-accent: #00b4d8;
    --color-muted: #667085;
    --color-surface: #ffffff;
    --color-background: #f5f7fb;
    --color-border: rgba(13, 71, 161, 0.12);
    --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 12px 32px rgba(15, 23, 42, 0.12);
    --container-width: 1200px;
    --radius-base: 16px;
    --radius-pill: 999px;
    --header-height: clamp(64px, 15vw, 88px);
    --header-offset: calc(var(--header-height) + 32px);
    --body-text: #1f2933;
    --gradient-header: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    --hero-gradient: linear-gradient(135deg, rgba(13, 71, 161, 0.9), rgba(0, 180, 216, 0.85));
    --hero-subtext: #e8f1ff;
    --nav-surface: rgba(6, 19, 45, 1);
    --footer-background: #0a2859;
    --footer-text: rgba(255, 255, 255, 0.86);
    --input-background: #f8fafc;
    --input-border: rgba(102, 112, 133, 0.2);
    --control-background: rgba(255, 255, 255, 0.16);
    --control-background-hover: rgba(255, 255, 255, 0.24);
    --control-border: rgba(255, 255, 255, 0.35);
    --btn-text-color: #043259;
}

body[data-theme="dark"] {
    --color-primary: #8ab4ff;
    --color-primary-dark: #4f67ff;
    --color-accent: #38bdf8;
    --color-muted: #cbd5f5;
    --color-surface: #111827;
    --color-background: #050b1d;
    --color-border: rgba(148, 163, 184, 0.25);
    --shadow-soft: 0 14px 38px rgba(2, 6, 23, 0.55);
    --shadow-card: 0 18px 44px rgba(2, 6, 23, 0.6);
    --body-text: #e2e8f0;
    --gradient-header: linear-gradient(135deg, rgba(24, 32, 64, 0.98), rgba(7, 102, 172, 0.92));
    --hero-gradient: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(14, 116, 144, 0.88));
    --hero-subtext: rgba(226, 240, 255, 0.88);
    --nav-surface: rgba(5, 12, 28, 1);
    --footer-background: #020818;
    --footer-text: rgba(228, 236, 255, 0.85);
    --input-background: rgba(15, 23, 42, 0.65);
    --input-border: rgba(148, 163, 184, 0.35);
    --control-background: rgba(148, 163, 184, 0.15);
    --control-background-hover: rgba(148, 163, 184, 0.28);
    --control-border: rgba(148, 163, 184, 0.35);
    --btn-text-color: #011d3a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    line-height: 1.6;
    color: var(--body-text);
    background-color: var(--color-background);
    transition: background-color 0.35s ease, color 0.35s ease;
    -webkit-font-smoothing: antialiased;
}

html {
    scroll-behavior: smooth;
}

/* Prevent anchor targets hiding under sticky header */
section {
    scroll-margin-top: calc(var(--header-offset, var(--header-height, 72px)) + 20px);
}

/* Reveal animations */
.reveal {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    filter: blur(8px);
    will-change: opacity, transform, filter;
    backface-visibility: hidden;
    transition: opacity 900ms ease, transform 900ms cubic-bezier(0.22, 1, 0.36, 1), filter 900ms ease;
    transition-delay: var(--reveal-delay, 140ms);
}

.reveal.reveal--visible {
    opacity: 1;
    transform: none;
    filter: none;
}

.reveal--quick {
    transition-duration: 650ms;
}

/* Reduced motion: disable animations and smooth scroll */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
}
body.nav-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1500;
    background: var(--gradient-header);
    color: var(--color-surface);
    box-shadow: 0 12px 32px rgba(13, 71, 161, 0.18);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
    padding-top: env(safe-area-inset-top, 0px);
}

header.is-scrolled {
    box-shadow: 0 18px 40px rgba(8, 27, 57, 0.25);
}

.header-inner {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1rem, 4vw, 2rem);
    position: relative;
    min-height: var(--header-height);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex: 1 1 auto;
}

.brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    background: radial-gradient(circle at top, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.1));
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: #072f6b;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 12px 24px rgba(11, 51, 98, 0.25);
    flex-shrink: 0;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.brand-text {
    font-weight: 700;
    font-size: clamp(1.05rem, 0.85rem + 1.2vw, 1.65rem);
    letter-spacing: -0.01em;
    color: #ffffff;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-text .accent {
    color: #8ce2ff;
}

.brand-text .highlight {
    color: #ffd166;
}

nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #ffffff;
    z-index: 10;
}

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

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: 1rem;
    color: #ffffff;
    transition: background-color 0.25s ease, transform 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateY(-1px);
    opacity: 1;
}

header,
nav,
.hero,
.card,
.article-card,
.contact-info,
.contact-block,
form,
footer {
    transition: background-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.theme-toggle,
.menu-toggle {
    display: none;
    background: var(--control-background);
    border: 1px solid var(--control-border);
    color: #ffffff;
    border-radius: 12px;
    padding: 0.6rem;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-pill);
    color: #ffffff;
}

.theme-toggle__label {
    color: inherit;
}

.theme-toggle__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.theme-toggle .sun-icon {
    display: none;
}

body[data-theme="dark"] .theme-toggle .sun-icon {
    display: inline-flex;
}

body[data-theme="dark"] .theme-toggle .moon-icon {
    display: none;
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.menu-toggle:hover,
.menu-toggle:focus-visible {
    background: var(--control-background-hover);
    box-shadow: 0 12px 24px rgba(8, 24, 68, 0.18);
}

.menu-toggle__icon {
    position: relative;
    width: 20px;
    height: 2px;
    display: inline-block;
    background: currentColor;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.menu-toggle__icon::before,
.menu-toggle__icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: currentColor;
    transition: transform 0.3s ease, top 0.3s ease, background-color 0.3s ease;
}

.menu-toggle__icon::before {
    top: -6px;
}

.menu-toggle__icon::after {
    top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon {
    background-color: transparent;
}

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

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

.menu-toggle:active {
    transform: scale(0.95);
}

main {
    padding: 4rem 0 5rem;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 5rem 2rem;
    border-radius: clamp(24px, 4vw, 36px);
    background: var(--hero-gradient);
    color: var(--color-surface);
    box-shadow: var(--shadow-card);
}

body[data-theme="dark"] .hero {
    color: #f9fbff;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1581579186989-7afe72948bd6?auto=format&fit=crop&w=1400&q=80') center/cover no-repeat;
    opacity: 0.28;
    z-index: 0;
}

.hero .container {
    padding: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 680px;
    text-align: left;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.8rem);
    line-height: 1.1;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.05rem;
    margin-bottom: 2rem;
    color: var(--hero-subtext);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-pill);
    border: none;
    padding: 0.85rem 1.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    background: linear-gradient(135deg, var(--color-accent), #38b6ff);
    color: var(--btn-text-color);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 132, 168, 0.28);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(0, 132, 168, 0.32);
}

section {
    padding: clamp(3.5rem, 6vw, 5rem) 0;
}

.section-title {
    font-size: clamp(2rem, 3.5vw, 2.6rem);
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--color-primary-dark);
}

.about {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    align-items: center;
}

.card {
    background: var(--color-surface);
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border);
    padding: 2rem;
}

.about h3 {
    font-size: 1.45rem;
    margin-bottom: 1.25rem;
    color: var(--color-primary);
}

.about p {
    color: var(--color-muted);
    margin-bottom: 1rem;
}

.about img {
    border-radius: var(--radius-base);
    box-shadow: var(--shadow-soft);
}

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

.article-card {
    background: var(--color-surface);
    border-radius: var(--radius-base);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-card img {
    height: 200px;
    object-fit: cover;
}

.article-card h3 {
    padding: 1.5rem 1.5rem 0.75rem;
    font-size: 1.3rem;
    color: var(--color-primary-dark);
}

.article-card p {
    padding: 0 1.5rem 1.5rem;
    color: var(--color-muted);
    flex-grow: 1;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-card);
}

.contact {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    align-items: start;
}

.contact-info {
    display: grid;
    gap: 1.5rem;
    background: var(--color-surface);
    border-radius: var(--radius-base);
    padding: 2.25rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.contact-block {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--color-surface);
    border-radius: var(--radius-base);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.contact-block strong {
    font-size: 1.4rem;
    color: var(--color-accent);
}

.contact-block h4 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    color: var(--color-primary-dark);
}

form {
    display: grid;
    gap: 1.25rem;
    background: var(--color-surface);
    padding: 2.25rem;
    border-radius: var(--radius-base);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
}

.form-group {
    display: grid;
    gap: 0.5rem;
}

label {
    font-weight: 600;
    color: var(--color-primary-dark);
}

input,
textarea {
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--input-background);
    color: inherit;
}

input:focus,
textarea:focus {
    border-color: rgba(13, 71, 161, 0.65);
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.15);
    outline: none;
    background-color: var(--color-surface);
}

textarea {
    min-height: 140px;
    resize: vertical;
}

footer {
    background: var(--footer-background);
    color: var(--footer-text);
    padding: 2.25rem 1rem;
    text-align: center;
}

footer .footer-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    gap: 0.35rem;
}

footer p {
    margin: 0.25rem 0;
    font-size: 0.95rem;
}

@media (max-width: 900px) {
    header {
        position: fixed;
        top: 0;
    }

    body {
        padding-top: var(--header-offset, var(--header-height, 72px));
    }

    .header-inner {
        position: relative;
        padding: 1rem 1.5rem;
    }

    .theme-toggle {
        font-size: 0.85rem;
        padding: 0.5rem 0.85rem;
    }

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

    nav {
        position: fixed;
        top: calc(var(--header-offset, var(--header-height, 72px)) + 0.75rem);
        right: 0.75rem;
        left: 0.75rem;
        flex-direction: column;
        background: var(--nav-surface);
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.3);
        padding: 1.25rem 1rem;
        box-shadow: 0 32px 48px rgba(8, 21, 45, 0.45);
        transform-origin: top;
        transform: scaleY(0.94) translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, transform 0.25s ease;
        z-index: 9999;
        backdrop-filter: blur(18px);
        max-height: calc(100vh - (var(--header-offset, var(--header-height, 72px)) + 2.5rem));
        overflow-y: auto;
    }

    nav.open {
        opacity: 1;
        visibility: visible;
        transform: scaleY(1) translateY(0);
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.75rem;
    }

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

    .hero {
        padding: 4rem 1.5rem;
    }

    .container {
        padding: 0 1.5rem;
    }
}

@media (max-width: 600px) {
    .header-inner {
        padding: 0.85rem 1.25rem;
        gap: 0.6rem;
    }

    .brand {
        gap: 0.6rem;
    }

    .brand-icon {
        width: 52px;
        height: 52px;
        font-size: 0.95rem;
    }

    .brand-text {
        font-size: clamp(0.95rem, 4.5vw, 1.28rem);
        white-space: normal;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .theme-toggle {
        padding: 0.5rem;
        width: 42px;
        justify-content: center;
    }

    .theme-toggle__label {
        display: none;
    }

    .theme-toggle__icon {
        font-size: 1rem;
    }

    main {
        padding: 3rem 0 4rem;
    }

    section {
        padding: 3rem 0;
    }

    form {
        padding: 1.75rem;
    }
}
