:root {
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --accent: #0284c7;
    --accent-glow: #38bdf8;
    --bg-color: #f8fafc;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --gradient-brand: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
    --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(37, 99, 235, 0.1), 0 8px 10px -6px rgba(37, 99, 235, 0.05);
    --radius-lg: 24px;
    --radius-xl: 40px;
    --ease-ios: cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.4s var(--ease-ios);
}

ul {
    list-style: none;
}

.allow-select {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

.header.header-active {
    background-color: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom-color: transparent;
}

.header.header-active .logo {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.header.header-active .a11y-toggle-btn {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo img {
    width: 36px;
    height: auto;
    flex: 0 0 36px;
    border-radius: 4px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    align-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

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

.hero {
    padding: 160px 20px 100px;
    text-align: center;
    max-width: 1000px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.badge {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary-dark);
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 24px;
    padding: 0 20px 20px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 40px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 32px;
    background: var(--gradient-brand);
    color: white;
    font-weight: 600;
    border-radius: 100px;
    box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.4);
    transform: translateY(0);
    border: none;
    cursor: pointer;
    transition: all 0.4s var(--ease-ios);
}

.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(37, 99, 235, 0.5);
}

.btn-full {
    width: 100%;
}

.btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Додано для центрування лоадера */
    gap: 8px;
    transition: all 0.3s ease;
    opacity: 1;
    transform: scale(1);
    width: 100%;
    /* Гарантуємо, що контент займає всю ширину для центрування */
}

.btn-content.fade-out {
    opacity: 0;
    transform: scale(0.9);
}

.btn.success {
    background-color: #22c55e !important;
    background-image: none;
    box-shadow: 0 10px 20px -5px rgba(34, 197, 94, 0.4);
    pointer-events: none;
}

.btn-outline {
    background: transparent;
    border: 2px solid rgba(37, 99, 235, 0.2);
    color: var(--primary);
    box-shadow: none;
}

.btn-outline:hover {
    background: rgba(37, 99, 235, 0.05);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.section {
    padding: 80px 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: all 0.5s var(--ease-ios);
}

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

.card a {
    margin-top: auto;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.card-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.footer {
    background: #0f172a;
    color: white;
    padding: 60px 20px;
    margin-top: auto;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 40px;
}

.footer-logo {
    display: block;
    height: 40px;
    width: auto;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
}

.footer h4 {
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.footer p {
    color: #94a3b8;
    margin-bottom: 12px;
    line-height: 1.6;
    letter-spacing: 0.02em;
}

.footer-bottom {
    max-width: 1200px;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid #1e293b;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s var(--ease-ios) forwards;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-input {
    width: 100%;
    padding: 16px 20px;
    border-radius: 16px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 1rem;
    transition: all 0.3s var(--ease-ios);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: white;
}

textarea.form-input {
    resize: vertical;
    min-height: 120px;
    max-height: 350px;
}

/* --- Mobile Menu Components --- */

.burger {
    display: none;
    position: relative;
    width: 30px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
    padding: 0;
}

.burger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all 0.4s var(--ease-ios);
}

.burger span:nth-child(1) {
    top: 0;
}

.burger span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.burger span:nth-child(3) {
    bottom: 0;
}

.burger.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.burger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
}

.burger.active span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s var(--ease-ios);
    z-index: 999;
    transform: translateZ(0);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* --- Skeleton Loading Animation --- */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-pulse {
    background: linear-gradient(90deg,
            #f1f5f9 25%,
            #e2e8f0 50%,
            #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 3s infinite linear;
    border-radius: 12px;
}

.skeleton-card .skeleton-img {
    width: 100%;
    height: 200px;
    margin-bottom: 20px;
    border-radius: 16px;
}

.skeleton-card .skeleton-date {
    width: 30%;
    height: 14px;
    margin-bottom: 12px;
}

.skeleton-card .skeleton-title {
    width: 85%;
    height: 24px;
    margin-bottom: 16px;
    border-radius: 8px;
}

.skeleton-card .skeleton-text {
    width: 100%;
    height: 14px;
    margin-bottom: 8px;
}

.skeleton-card .skeleton-text:last-of-type {
    width: 60%;
}

.skeleton-card .skeleton-btn {
    width: 100px;
    height: 20px;
    margin-top: 20px;
}

@media (max-width: 1163px) {
    .burger {
        display: block;
    }

    .nav-menu {
        display: flex;
        position: fixed;
        top: 0;
        right: 0;
        width: 85vw;
        max-width: 320px;
        height: 100dvh;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        padding: 40px;
        padding-top: env(safe-area-inset-top, 40px);
        padding-bottom: env(safe-area-inset-bottom, 40px);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
        transform: translateX(100%);
        transition: transform 0.5s var(--ease-ios);
        z-index: 1000;
        will-change: transform;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-link {
        font-size: 1.5rem;
        margin-bottom: 24px;
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.4s var(--ease-ios);
    }

    .nav-menu.active .nav-link {
        opacity: 1;
        transform: translateX(0);
    }

    .nav-menu.active .nav-link:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-menu.active .nav-link:nth-child(2) {
        transition-delay: 0.2s;
    }

    .nav-menu.active .nav-link:nth-child(3) {
        transition-delay: 0.3s;
    }

    .nav-menu.active .nav-link:nth-child(4) {
        transition-delay: 0.4s;
    }

    .nav-menu.active .nav-link:nth-child(5) {
        transition-delay: 0.5s;
    }

    .nav-menu.active .nav-link:nth-child(6) {
        transition-delay: 0.6s;
    }

    .hero {
        padding: 120px 20px 100px;
    }

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

    .btn {
        width: 100%;
        margin-left: 0;
        margin-bottom: 12px;
    }

    .card {
        padding: 24px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .logo {
        font-size: 1.1rem;
    }
}

/* --- A11y (Accessibility) Panel Styles --- */

.a11y-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    padding: 8px 12px;
    margin-right: 10px;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
}

.a11y-label-container {
    display: flex;
    flex-direction: column;
    line-height: 1;
    align-items: flex-start;
}

.a11y-label {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.a11y-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background: #ffffff;
    border: 2px solid var(--text-main);
    border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

.a11y-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.a11y-header h2 {
    font-size: 1.25rem;
    margin: 0;
    color: #0f172a;
}

.a11y-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.a11y-content {
    padding: 24px;
}

.a11y-section {
    margin-bottom: 24px;
}

.a11y-section label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    color: #0f172a;
    font-size: 1rem;
}

.a11y-controls {
    display: flex;
    gap: 12px;
}

.a11y-controls button {
    flex: 1;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.a11y-controls button:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}

.a11y-controls button:active {
    transform: scale(0.98);
}

.a11y-toggles {
    display: flex;
    gap: 12px;
}

.a11y-toggles button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 500;
}

.a11y-toggles button.active {
    border: 2px solid #0f172a;
    background: #f8fafc;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    /* border: 1px solid rgba(0, 0, 0, 0.1); */
}

.color-dot.default {
    background: linear-gradient(135deg, #ffd700, #2563eb);
}

.color-dot.bw {
    background: linear-gradient(135deg, #000 50%, #fff 50%);
}

.a11y-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.a11y-option-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-weight: 500;
    transition: all 0.2s;
}

.a11y-option-btn .icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.a11y-option-btn.active {
    background: #0f172a;
    color: white;
    border-color: #0f172a;
}

.a11y-footer {
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    text-align: right;
}

.a11y-reset-btn {
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.a11y-reset-btn:hover {
    color: #ef4444;
}

html.a11y-grayscale {
    filter: grayscale(100%);
}

html.a11y-font-1 {
    font-size: 110%;
}

html.a11y-font-2 {
    font-size: 120%;
}

html.a11y-font-3 {
    font-size: 130%;
}

body.a11y-spacing-1 {
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
}

body.a11y-spacing-2 {
    letter-spacing: 0.1em;
    word-spacing: 0.2em;
}

body.a11y-spacing-3 {
    letter-spacing: 0.15em;
    word-spacing: 0.3em;
}

body.a11y-links-underline a {
    text-decoration: underline !important;
    text-underline-offset: 4px;
}

body.a11y-cursor-big,
body.a11y-cursor-big a,
body.a11y-cursor-big button {
    cursor: url('data:image/svg+xml;utf8,<svg width="48" height="48" viewBox="0 0 24 24" fill="black" stroke="white" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87a.5.5 0 0 0 .35-.85L6.35 2.85a.5.5 0 0 0-.85.35Z"/></svg>'), auto !important;
}

body.a11y-cursor-big a:hover,
body.a11y-cursor-big button:hover,
body.a11y-cursor-big input[type="submit"]:hover,
body.a11y-cursor-big [role="button"]:hover,
body.a11y-cursor-big label:hover,
body.a11y-cursor-big select:hover {
    /* cursor: url('data:image/svg+xml;utf8,<svg width="48" height="48" viewBox="0 0 24 24" fill="black" stroke="white" stroke-width="2" xmlns="http://www.w3.org/2000/svg"><path d="M9 11.24V7.5a2.5 2.5 0 0 1 5 0v1.78a2.5 2.5 0 0 1 .5 4.72v.25l.87 4.35C15.86 20.4 14.4 21.5 12.72 21.5H9a3 3 0 0 1-3-3v-4.34l-.37-.75c-.38-.75-.12-1.72.63-2.1l1.5-.75c.19-.09.41-.14.63-.14.2 0 .4.04.59.12zM14 7.5a.5.5 0 0 0-1 0v3.74h2V7.5a.5.5 0 0 0-1 0z"/></svg>'), pointer !important; */
    cursor: pointer !important;
    /* Redraw the cursor */
}

.reading-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    pointer-events: none;
    display: none;
    /* box-shadow: 0 0 0 100vh rgba(0, 0, 0, 0.15); */
    transform: translateY(-50%);
}

body.a11y-reading-line .reading-line {
    display: block;
}

@media (max-width: 480px) {
    .a11y-panel {
        width: 100%;
        height: 100%;
        top: 0;
        right: 0;
        border-radius: 0;
        border: none;
        overflow-y: auto;
    }

    .a11y-label-container {
        display: none;
    }
}

/* --- Button Loading & Success Animation --- */

.btn-success {
    background: #27ae60 !important;
    border-color: #27ae60 !important;
    color: #fff !important;
    background-image: none !important;
    pointer-events: none;
    box-shadow: 0 10px 20px -5px rgba(39, 174, 96, 0.4) !important;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
    margin-right: 8px;
    /* Відступ, якщо є текст */
}

.spinner .path {
    stroke: currentColor;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}