/* ============================================================
   Global Styles
   ============================================================ */
* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    scroll-behavior: smooth;
}

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

body.menu-open {
    overflow: hidden;
}

/* Accessible focus ring for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ============================================================
   Brand colors / utilities
   ============================================================ */
.gradient-bg {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

.text-gradient {
    background: linear-gradient(135deg, #1e293b 0%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    /* Extra room for descenders (g, q, y…) — background-clip clips tight boxes */
    padding-bottom: 0.15em;
    padding-right: 0.05em;
    margin-bottom: -0.15em;
}

.text-muted {
    color: #64748b;
}

.bg-section {
    background: #fafafa;
}

/* ============================================================
   Cards
   ============================================================ */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #cbd5e1;
}

/* ============================================================
   Profile Image
   ============================================================ */
.profile-image {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   Navigation (desktop links underline animation)
   ============================================================ */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
    font-weight: 500;
    min-height: 44px;
}

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

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

/* ============================================================
   Desktop language switcher (in nav, right side)
   ============================================================ */
.nav-lang {
    align-items: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.875rem;
    font-weight: 500;
}

.nav-lang-link {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.375rem 0.625rem;
    border-radius: 0.375rem;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.nav-lang-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nav-lang-link.is-active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-weight: 600;
}

.nav-lang-sep {
    color: rgba(255, 255, 255, 0.4);
    user-select: none;
}

/* ============================================================
   Mobile menu button + panel + lang
   ============================================================ */
.mobile-menu-button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mobile-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Force hidden at sm+ to override our inline-flex (our rule has same specificity
   as Tailwind's .sm\:hidden so we'd otherwise win due to CSS load order). */
@media (min-width: 640px) {
    .mobile-menu-button {
        display: none !important;
    }
}

/* Panel base state: collapsed */
.mobile-menu {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    pointer-events: none;
}

.mobile-menu.is-open {
    max-height: calc(100vh - 4rem);
    opacity: 1;
    overflow-y: auto;
    pointer-events: auto;
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.25);
}

/* Hide entirely on desktop */
@media (min-width: 640px) {
    .mobile-menu {
        display: none !important;
    }
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: #fff;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.9375rem;
    min-height: 44px;
    transition: background-color 0.15s ease;
}

.mobile-menu-link:hover {
    background: #334155;
}

.mobile-menu-link.is-active {
    background: #334155;
    font-weight: 600;
}

.mobile-menu-lang {
    margin-top: 0.5rem;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-lang-label {
    display: block;
    color: #94a3b8;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.mobile-menu-lang-row {
    display: flex;
    gap: 0.5rem;
}

.mobile-menu-lang-link {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 0.875rem;
    min-height: 44px;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.mobile-menu-lang-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
}

.mobile-menu-lang-link.is-active {
    background: #334155;
    border-color: #475569;
    font-weight: 600;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn-primary {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border: none;
    transition: all 0.3s ease;
    min-height: 44px;
    position: relative;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(30, 41, 59, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.05);
    color: #1e293b;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    min-height: 44px;
}

.btn-secondary:hover {
    background: rgba(30, 41, 59, 0.1);
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.btn-download {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
    border: none;
    transition: all 0.3s ease;
    color: white;
    min-height: 44px;
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

/* ============================================================
   Typography
   ============================================================ */
.section-title {
    color: #1e293b;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.cv-section-title {
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.cv-section-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: #64748b;
}

/* ============================================================
   Forms (Contact, Newsletter)
   ============================================================ */
.form-input {
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    background: white;
    min-height: 44px;
    width: 100%;
    color: #111827;
}

.form-input:focus {
    border-color: #1e293b;
    box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.1);
    outline: none;
}

.contact-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

/* Inline form status (success / error) */
.form-status {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    display: none;
}

.form-status.is-visible {
    display: block;
}

.form-status.is-success {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.form-status.is-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* ============================================================
   Skill Tags
   ============================================================ */
.skill-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 32px;
}

.skill-tag-expert {
    background: #1e40af;
    color: white;
}

.skill-tag-expert:hover {
    background: #1e3a8a;
    transform: translateY(-1px);
}

.skill-tag-advanced {
    background: #3b82f6;
    color: white;
}

.skill-tag-advanced:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.skill-tag-intermediate {
    background: #93c5fd;
    color: #1e3a8a;
}

.skill-tag-intermediate:hover {
    background: #60a5fa;
    color: white;
    transform: translateY(-1px);
}

/* ============================================================
   CV Navigation (in-page TOC on CV)
   ============================================================ */
.cv-nav-link.active {
    background: #1e293b;
    color: white;
}

#cv-sticky-header {
    background: rgba(255, 255, 255, 0.97);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

#cv-sticky-header.visible {
    transform: translateY(0);
}

/* Side nav anchors — solid white, blurred glass if browser supports it */
#cv-nav ul {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* ============================================================
   Article filter chips (articles archive)
   ============================================================ */
.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    background: white;
    color: #334155;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 36px;
}

.filter-chip:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.filter-chip.is-active {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff;
}

/* ============================================================
   Table of contents (guide pages) - active highlight
   ============================================================ */
.toc-link {
    color: #475569;
    transition: color 0.15s ease, background-color 0.15s ease;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    display: inline-block;
    min-height: 32px;
}

.toc-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}

a.toc-active {
    color: #1e40af !important;
    font-weight: 600;
    background: #eff6ff;
    border-radius: 0.375rem;
    padding: 0.125rem 0.5rem;
}

/* Section scroll margin so anchor jumps clear the fixed nav (h-16 = 64px) */
.toc-target {
    scroll-margin-top: 5rem;
}

/* ============================================================
   Spinner (used on button while submitting)
   ============================================================ */
.is-loading .btn-label {
    visibility: hidden;
}

.is-loading::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    left: 50%;
    top: 50%;
    margin-left: -0.625rem;
    margin-top: -0.625rem;
}

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