/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --silver: #b8c4d0;
    --silver-light: #dce3eb;
    --silver-glow: rgba(184, 196, 208, 0.15);
    --silver-bright: #f0f3f7;
    --dark: #0a0e14;
    --dark-surface: #111820;
    --dark-card: #161d27;
    --dark-border: #1e2a3a;
    --dark-border-hover: #2d3f54;
    --text: #c9d1d9;
    --text-bright: #e6edf3;
    --text-muted: #8b949e;
    --accent: #7eb8da;
    --accent-soft: rgba(126, 184, 218, 0.12);
    --success: #3fb950;
    --error: #f85149;
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --max-width: 1120px;
    --radius: 10px;
    --radius-lg: 16px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--dark);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main { flex: 1; }

/* === Page transitions === */
body { opacity: 0; transition: opacity 0.3s ease; }
body.page-loaded { opacity: 1; }
body.page-exit { opacity: 0; transition: opacity 0.2s ease; }

/* === Scroll progress bar === */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: linear-gradient(90deg, var(--silver), var(--accent));
    z-index: 200;
    transition: width 0.05s linear;
    pointer-events: none;
}

/* === Skip Link (a11y) === */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--silver);
    color: var(--dark);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    z-index: 200;
    transition: top 0.2s;
}

.skip-link:focus { top: 0.5rem; }

/* === Links === */
a { color: var(--accent); text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--silver-light); }

/* === Typography === */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; color: var(--text-bright); letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }

em { font-style: italic; color: var(--silver-bright); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }
.content-narrow { max-width: 680px; margin: 0 auto; }
.center { text-align: center; }

/* === Navigation === */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 14, 20, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
    border-bottom-color: var(--dark-border);
    box-shadow: 0 1px 20px rgba(0, 0, 0, 0.4);
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

.nav-logo:hover { color: var(--silver-bright); }

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

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

.nav-links li { display: contents; }

.nav-links a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.25s;
    position: relative;
}

.nav-links a:not(.btn)::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--silver);
    transition: width 0.3s var(--ease);
}

.nav-links a:not(.btn):hover { color: var(--text-bright); }
.nav-links a:not(.btn):hover::after { width: 100%; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}

.nav-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* === Active Nav Link === */
.nav-links a.active:not(.btn) { color: var(--text-bright); }
.nav-links a.active:not(.btn)::after { width: 100%; }

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.25s var(--ease);
    cursor: pointer;
    border: none;
    text-align: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--silver);
    color: var(--dark);
    box-shadow: 0 2px 12px rgba(184, 196, 208, 0.15);
}

.btn-primary:hover {
    background: var(--silver-light);
    color: var(--dark);
    box-shadow: 0 4px 20px rgba(184, 196, 208, 0.25);
    transform: translateY(-1px);
}

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

.btn-outline {
    border: 1px solid var(--dark-border);
    color: var(--text);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--silver);
    color: var(--text-bright);
    background: var(--silver-glow);
}

.btn-sm { padding: 0.5rem 1.1rem; font-size: 0.8rem; min-height: 44px; }
.btn-lg { padding: 0.85rem 2.2rem; font-size: 0.95rem; }

/* === Hero === */
.hero {
    padding: 11rem 0 7rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero h1 {
    margin-bottom: 1.2rem;
    position: relative;
    z-index: 1;
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 2.5rem;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

/* === Typing cursor === */
.hero-typed {
    display: inline;
    border-right: 2px solid var(--silver);
    padding-right: 4px;
    animation: blink 0.8s step-end infinite;
    opacity: 0;
}

@keyframes blink {
    50% { border-color: transparent; }
}

/* === Page hero === */
.page-hero {
    padding: 9rem 0 3.5rem;
    text-align: center;
    position: relative;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(184, 196, 208, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero h1 { margin-bottom: 0.8rem; position: relative; }
.page-hero .hero-sub { position: relative; }

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

.section-alt {
    background: var(--dark-surface);
    border-top: 1px solid var(--dark-border);
    border-bottom: 1px solid var(--dark-border);
}

.section-title {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-muted);
    max-width: 540px;
    margin: -2.5rem auto 3.5rem;
    font-size: 1rem;
}

/* === Cards === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    --glow-x: 50%;
    --glow-y: 50%;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    position: relative;
    overflow: hidden;
}

/* Cursor-following glow */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(300px circle at var(--glow-x) var(--glow-y), rgba(184, 196, 208, 0.06), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(184, 196, 208, 0.2), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    border-color: var(--dark-border-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.card:hover::before { opacity: 1; }
.card:hover::after { opacity: 1; }

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--silver-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    color: var(--silver);
    transition: transform 0.3s var(--ease), background 0.3s;
}

.card:hover .card-icon {
    transform: scale(1.1);
    background: rgba(184, 196, 208, 0.2);
}

.card h3 { margin-bottom: 0.6rem; }
.card p { color: var(--text-muted); font-size: 0.925rem; line-height: 1.7; }

/* === Stats / Counters === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat {
    padding: 1.5rem;
}

.counter-value {
    font-size: clamp(2.4rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--silver-light);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* === Features (Why section) === */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
}

.feature {
    --glow-x: 0;
    --glow-y: 0;
    padding: 1.8rem;
    padding-left: 2rem;
    border-left: 2px solid var(--dark-border);
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: border-color 0.3s, background 0.3s;
    position: relative;
    overflow: hidden;
}

.feature::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(250px circle at var(--glow-x) var(--glow-y), rgba(184, 196, 208, 0.04), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.feature:hover {
    border-left-color: var(--silver);
    background: rgba(184, 196, 208, 0.03);
}

.feature:hover::before { opacity: 1; }

.feature h3 { color: var(--silver-light); margin-bottom: 0.6rem; }
.feature p { color: var(--text-muted); font-size: 0.925rem; line-height: 1.7; }

/* === Service Blocks (expandable) === */
.service-block {
    margin-bottom: 2rem;
    padding: 2rem;
    border: 1px solid var(--dark-border);
    border-radius: var(--radius-lg);
    background: var(--dark-card);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.service-block:hover {
    border-color: var(--dark-border-hover);
}

.service-block:last-child { margin-bottom: 0; }

.service-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    cursor: pointer;
}

.service-header h2 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0;
}

.service-toggle {
    background: none;
    border: 1px solid var(--dark-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.2rem;
    transition: all 0.3s var(--ease);
    flex-shrink: 0;
}

.service-toggle:hover {
    border-color: var(--silver);
    color: var(--text-bright);
}

.service-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s var(--ease);
}

.service-block.expanded .service-toggle svg {
    transform: rotate(180deg);
}

.service-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--silver-glow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--silver);
    flex-shrink: 0;
}

.service-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s var(--ease), opacity 0.3s;
    opacity: 0;
}

.service-block.expanded .service-details {
    max-height: 500px;
    opacity: 1;
}

.service-details-inner {
    padding-top: 1.5rem;
}

.service-block p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    max-width: 680px;
    line-height: 1.8;
}

.service-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.2rem 2rem;
}

.service-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-muted);
    font-size: 0.925rem;
}

.service-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--silver);
    opacity: 0.5;
    transform: translateY(-50%);
}

/* === CTA Section === */
.cta-section {
    background: var(--dark-surface);
    border-top: 1px solid var(--dark-border);
    position: relative;
    overflow: hidden;
}

.cta-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(ellipse, rgba(184, 196, 208, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.cta-section h2 { margin-bottom: 0.6rem; position: relative; }
.cta-section p { color: var(--text-muted); margin-bottom: 2rem; position: relative; }

/* === Contact Form === */
.contact-form { margin-top: 2rem; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.form-group { margin-bottom: 1.2rem; }

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--text);
    letter-spacing: 0.01em;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: var(--radius);
    color: var(--text-bright);
    font-family: var(--font);
    font-size: 0.925rem;
    transition: border-color 0.25s, box-shadow 0.25s;
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* === Form Validation States === */
.form-group input:user-invalid,
.form-group textarea:user-invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.1);
}

.form-group input:user-valid,
.form-group textarea:user-valid {
    border-color: var(--success);
}

.form-group .field-error {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: none;
}

.form-group input:user-invalid ~ .field-error,
.form-group textarea:user-invalid ~ .field-error {
    display: block;
}

.contact-alt {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--dark-border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* === Alerts === */
.alert {
    padding: 1.2rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    font-size: 0.925rem;
}

.alert-success {
    background: rgba(63, 185, 80, 0.08);
    border: 1px solid rgba(63, 185, 80, 0.25);
    color: var(--success);
}

/* === Submit Loading State === */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Footer === */
.footer {
    background: var(--dark-surface);
    border-top: 1px solid var(--dark-border);
    padding: 3.5rem 0 1.5rem;
    margin-top: auto;
}

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

.footer h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.footer h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    font-weight: 600;
}

.footer-tagline { color: var(--text-muted); font-size: 0.875rem; }

.footer-links a {
    display: block;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 0.25rem 0;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--text-bright); }

.footer-bottom {
    border-top: 1px solid var(--dark-border);
    padding-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* === About page === */
.content-narrow h2 { margin-top: 2.8rem; }
.content-narrow h2:first-child { margin-top: 0; }
.content-narrow p { color: var(--text-muted); margin-bottom: 1.1rem; line-height: 1.8; }
.content-narrow strong { color: var(--silver-light); font-weight: 600; }

/* === Scroll Reveal Animation === */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.12s; }
.reveal-delay-2 { transition-delay: 0.24s; }
.reveal-delay-3 { transition-delay: 0.36s; }

/* === Focus styles (a11y) === */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn:focus-visible {
    outline: 2px solid var(--silver);
    outline-offset: 2px;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    body { opacity: 1; }

    .reveal {
        opacity: 1;
        transform: none;
    }

    .card:hover { transform: none; }
    .btn-primary:hover { transform: none; }
    .hero-typed { border-right: none; }
}

/* === Mobile === */
@media (max-width: 768px) {
    .hero { padding: 8rem 0 5rem; }
    .page-hero { padding: 7rem 0 2.5rem; }
    .section { padding: 3.5rem 0; }

    .nav-toggle { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        background: rgba(10, 14, 20, 0.98);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        flex-direction: column;
        padding: 1.5rem 2rem;
        gap: 0.8rem;
        border-bottom: 1px solid var(--dark-border);
    }

    .nav-links a:not(.btn)::after { display: none; }
    .nav-links.open { display: flex; }

    .form-row { grid-template-columns: 1fr; }

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

    .card-grid { grid-template-columns: 1fr; }
    .service-list { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .container { padding: 0 1.25rem; }
    .hero { padding: 7rem 0 4rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 280px; }
    .stats-grid { grid-template-columns: 1fr; }
}
