/* ============================================
   Components — Header, Megamenu, Buttons, Cards, Badges, Form, Footer
   ============================================ */

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 500;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-base);
    white-space: nowrap;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn--primary {
    background: var(--accent);
    color: #0a0e1a;
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lime);
    color: #0a0e1a;
}

.btn--secondary {
    background: transparent;
    color: var(--fg1);
    border-color: var(--border-medium);
}

.btn--secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Light mode: secondary button needs visible border + readable hover (lime on white is unreadable) */
html[data-theme="light"] .btn--secondary {
    border-color: #d4d4dc;
    color: var(--fg1-light);
}
html[data-theme="light"] .btn--secondary:hover {
    background: rgba(200, 255, 0, 0.20);
    border-color: var(--accent-dark);
    color: var(--fg1-light);
}

.btn--ghost {
    padding: 0.5rem 0.75rem;
    color: var(--fg2);
}

.btn--ghost:hover { color: var(--fg1); }

.btn--sm {
    padding: 0.625rem 1rem;
    font-size: var(--text-xs);
}

.btn--lg {
    padding: 1rem 2.25rem;
    font-size: var(--text-base);
}

/* ---------- Header ---------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    transition: background var(--transition-base), border-color var(--transition-base);
}
html[data-theme="light"] .header {
    background: rgba(244, 244, 245, 0.82);
    border-bottom-color: rgba(13, 15, 24, 0.08);
}

.header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--space-3xl);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
}
@media (max-width: 768px) { .header__inner { padding: 0 var(--space-xl); } }

.header__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-body);
    font-weight: 700;
    color: var(--fg1);
    text-decoration: none;
    font-size: var(--text-base);
    letter-spacing: -0.01em;
}

.header__mark {
    width: 24px;
    height: 24px;
    display: block;
}

.header__brand:hover {
    color: var(--fg1);
}

.header__nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    justify-content: center;
}

.header__nav-item {
    position: relative;
}

.header__nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    font-size: 14px;
    color: var(--fg2);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast), background var(--transition-fast);
    cursor: pointer;
}
button.header__nav-link {
    border: 0;
    background: transparent;
    font-family: inherit;
    cursor: default;
}
.header__nav-link:hover,
.header__nav-item[data-open="true"] .header__nav-link {
    color: var(--fg1);
    background: var(--bg-card-hover);
}
html[data-theme="light"] .header__nav-link:hover,
html[data-theme="light"] .header__nav-item[data-open="true"] .header__nav-link {
    background: rgba(13, 15, 24, 0.08);
    color: var(--fg1-light);
}
.header__nav-link .chev {
    width: 12px;
    height: 12px;
    transition: transform var(--transition-fast);
}
.header__nav-item[data-open="true"] .chev { transform: rotate(180deg); }

.header__actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- Megamenu ---------- */
.mega {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-medium);
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base);
    pointer-events: none;
    z-index: 200;
}
html[data-theme="light"] .mega {
    background: #fff;
    border-bottom-color: rgba(13, 15, 24, 0.10);
    box-shadow: 0 20px 60px rgba(13, 15, 24, 0.12);
}
.header__nav-item[data-open="true"] .mega {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.mega__grid {
    display: grid;
    grid-template-columns: 1fr;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-3xl);
}
.mega__grid:has(.mega__preview) {
    grid-template-columns: 1fr 320px;
}

/* Adaptive column layout inside mega */
.mega__cols {
    display: grid;
    gap: var(--space-md);
    padding: var(--space-lg) 0;
}
.mega__cols--2 { grid-template-columns: repeat(2, 1fr); }
.mega__cols--3 { grid-template-columns: repeat(3, 1fr); }
.mega__cols--4 { grid-template-columns: repeat(4, 1fr); }
.mega__cols--5 { grid-template-columns: repeat(5, 1fr); }

.mega__col {
    padding: 0;
}
.mega__col-title {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--fg3);
    margin-bottom: var(--space-md);
    font-weight: 500;
}
.mega__link {
    display: block;
    padding: 0.625rem 0.75rem;
    margin: 0 -0.75rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--fg1);
    transition: background var(--transition-fast);
    cursor: pointer;
}
.mega__link:hover {
    background: var(--bg-card-hover);
    color: var(--fg1);
}
html[data-theme="light"] .mega__link:hover {
    background: rgba(13, 15, 24, 0.04);
}
.mega__link-title {
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.mega__link-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.mega__link-desc {
    font-size: 12px;
    color: var(--fg3);
    margin-top: 2px;
    line-height: 1.45;
}
html[data-theme="light"] .mega__link-desc { color: #7a7f95; }

.mega__preview {
    padding: var(--space-xl) var(--space-xl) var(--space-xl) var(--space-2xl);
    border-left: 1px solid var(--border-subtle);
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
html[data-theme="light"] .mega__preview { background: #fafafb; }
.mega__preview-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 500;
}
.mega__preview-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--fg1);
}
.mega__preview-desc {
    font-size: 13px;
    color: var(--fg2);
    line-height: 1.55;
}
.mega__preview-card {
    margin-top: auto;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
html[data-theme="light"] .mega__preview-card {
    background: #fff;
    border-color: rgba(13, 15, 24, 0.08);
}
.mega__preview-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-family: var(--font-mono);
}
.mega__preview-stat span:first-child { color: var(--fg3); text-transform: uppercase; letter-spacing: 0.1em; }
.mega__preview-stat span:last-child { color: var(--fg1); font-weight: 500; }

.mega__featured {
    padding: var(--space-md) var(--space-3xl);
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}
html[data-theme="light"] .mega__featured {
    background: #f4f4f5;
    border-top-color: rgba(13, 15, 24, 0.06);
}
.mega__featured-text {
    font-size: 13px;
    color: var(--fg2);
}
.mega__featured-cta {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.mega__featured-cta:hover { color: var(--accent-light); gap: 0.5rem; }

/* ---------- Mobile Menu ---------- */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 24px;
    padding: 4px 0;
}

.hamburger__line {
    width: 100%;
    height: 2px;
    background: var(--fg1);
    border-radius: 1px;
    transition: all var(--transition-base);
}

.hamburger--active .hamburger__line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger--active .hamburger__line:nth-child(2) {
    opacity: 0;
}

.hamburger--active .hamburger__line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    overflow-y: auto;
    padding: var(--space-xl);
    z-index: 999;
}

.mobile-menu--open {
    display: block;
}

.mobile-menu__item {
    border-bottom: 1px solid var(--border-subtle);
}

.mobile-menu__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: var(--space-lg) 0;
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    color: var(--fg1);
}

.mobile-menu__trigger svg {
    width: 20px;
    height: 20px;
    transition: transform var(--transition-base);
}

.mobile-menu__item--open .mobile-menu__trigger svg {
    transform: rotate(180deg);
}

.mobile-menu__sub {
    display: none;
    padding-bottom: var(--space-lg);
}

.mobile-menu__item--open .mobile-menu__sub {
    display: block;
}

.mobile-menu__sub-link {
    display: block;
    padding: var(--space-sm) 0;
    padding-left: var(--space-md);
    font-size: var(--text-base);
    color: var(--fg2);
}

.mobile-menu__sub-link:hover {
    color: var(--accent-light);
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    transition: all var(--transition-base);
}

.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card__icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--accent-dim);
    margin-bottom: var(--space-lg);
}
html[data-theme="light"] .card__icon {
    background: #c8ff00;
}

.card__icon svg,
.card__icon i {
    width: 24px;
    height: 24px;
    color: var(--accent-light);
    stroke: currentColor;
}
html[data-theme="light"] .card__icon svg,
html[data-theme="light"] .card__icon i {
    color: #0a0e1a;
    stroke: #0a0e1a;
}

.card__title {
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    margin-bottom: var(--space-sm);
    color: var(--fg1);
}

.card__text {
    font-size: var(--text-sm);
    color: var(--fg2);
    line-height: 1.6;
}

.card__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: var(--space-lg);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--fg2);
    text-decoration: none;
    transition: gap var(--transition-fast), color var(--transition-fast);
}
.card__link i,
.card__link svg {
    color: var(--accent);
    stroke: currentColor;
    transition: transform var(--transition-fast);
}
html[data-theme="light"] .card__link i,
html[data-theme="light"] .card__link svg {
    color: #6b9e00;
}

.card__link:hover {
    gap: 0.6rem;
    color: var(--fg1);
}
html[data-theme="light"] .card__link:hover {
    color: var(--fg1);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    border-radius: var(--radius-full);
    background: var(--accent-dim);
    color: var(--accent-light);
    border: 1px solid rgba(200, 255, 0, 0.2);
}

html[data-theme="light"] .badge {
    background: var(--accent);
    color: #0a0e1a;
    border-color: var(--accent);
}

.badge--blue {
    background: var(--accent-blue-dim);
    color: var(--accent-blue-light);
    border-color: rgba(23, 153, 218, 0.2);
}

html[data-theme="light"] .badge--blue {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--fg2);
    margin-bottom: var(--space-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--fg1);
    font-size: var(--text-base);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--fg3);
}

/* Light mode: forms need stronger borders + placeholder + focus to be visible against light page bg */
html[data-theme="light"] .form-input,
html[data-theme="light"] .form-textarea,
html[data-theme="light"] .form-select {
    background: #ffffff;
    border-color: #d4d4dc;
}
html[data-theme="light"] .form-input:hover,
html[data-theme="light"] .form-textarea:hover,
html[data-theme="light"] .form-select:hover {
    border-color: #b8b8c4;
}
html[data-theme="light"] .form-input:focus,
html[data-theme="light"] .form-textarea:focus,
html[data-theme="light"] .form-select:focus {
    border-color: var(--accent-dark);
    box-shadow: 0 0 0 3px rgba(200, 255, 0, 0.28);
}
html[data-theme="light"] .form-input::placeholder,
html[data-theme="light"] .form-textarea::placeholder {
    color: #9499aa;
}
html[data-theme="light"] .form-label {
    color: var(--fg1-light);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236a6a80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.form-error {
    font-size: var(--text-sm);
    color: var(--danger);
    margin-top: var(--space-xs);
}

.form-success {
    padding: var(--space-lg);
    background: var(--success-dim);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    color: var(--success);
    font-weight: var(--fw-medium);
}

/* ---------- Footer ---------- */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-4xl) 0 var(--space-xl);
}

.footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-2xl);
    margin-bottom: var(--space-3xl);
}
@media (max-width: 760px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 440px) { .footer__grid { grid-template-columns: 1fr; } }

.footer__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--fg1);
    text-decoration: none;
}

.footer__brand:hover {
    color: var(--fg1);
}

.footer__mark {
    width: 22px;
    height: 22px;
    display: block;
}

.footer__brand-desc {
    color: var(--fg2);
    font-size: 14px;
    line-height: 1.65;
    margin-top: var(--space-md);
    max-width: 360px;
}

.footer__heading {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--fg3);
    margin-bottom: var(--space-md);
    font-weight: 500;
}

.footer__link {
    display: block;
    color: var(--fg2);
    text-decoration: none;
    font-size: 14px;
    padding: 0.35rem 0;
    transition: color var(--transition-fast);
}

.footer__link:hover {
    color: var(--accent-light);
}

.footer__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--fg3);
    font-family: var(--font-mono);
}

.footer__legal {
    display: flex;
    gap: var(--space-md);
}

/* ---------- Tweaks panel ---------- */
.tweaks {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    width: 280px;
    padding: 16px;
    background: rgba(18, 23, 41, 0.92);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    font-family: var(--font-body);
    color: #f0f0f5;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: none;
}
.tweaks[data-open="true"] { display: block; }
.tweaks h4 {
    margin: 0 0 14px;
    font-size: 11px;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: #8a8fa8;
    font-weight: 500;
}
.tweaks__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.tweaks__row:first-of-type { border-top: 0; }
.tweaks__label { font-size: 13px; color: #8a8fa8; }
.tweaks__switch {
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: #1c2236;
    border: 1px solid rgba(255, 255, 255, 0.10);
    cursor: pointer;
    position: relative;
    transition: background 180ms ease;
}
.tweaks__switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #8a8fa8;
    transition: transform 180ms ease, background 180ms ease;
}
.tweaks__switch[data-on="true"] { background: #c8ff00; border-color: #c8ff00; }
.tweaks__switch[data-on="true"]::after { transform: translateX(16px); background: #0a0e1a; }

/* ---------- Embed placeholder (Calendly, video, map ecc.) ---------- */
.embed-placeholder {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-4xl);
    text-align: center;
    color: var(--fg2);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .header__nav {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    .footer__bottom {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }

    .embed-placeholder {
        padding: var(--space-2xl);
    }
}
