/* =========================
   CSS CUSTOM PROPERTIES — ACCENT + BACKGROUND
========================= */

:root {
    /* Default accent: blue */
    --accent:       #6ea8ff;
    --accent-end:   #7f6bff;
    --accent-rgb:   110, 168, 255;
    --accent-dim:   rgba(110, 168, 255, 0.1);
    --accent-glow:  rgba(91, 140, 255, 0.45);
    --accent-border: rgba(110, 168, 255, 0.25);
}

/* Accent variants */
body.accent-blue   { --accent: #6ea8ff; --accent-end: #7f6bff; --accent-rgb: 110,168,255; --accent-dim: rgba(110,168,255,.10); --accent-glow: rgba(91,140,255,.45); --accent-border: rgba(110,168,255,.25); }
body.accent-purple { --accent: #b57bff; --accent-end: #8b5cf6; --accent-rgb: 181,123,255; --accent-dim: rgba(181,123,255,.10); --accent-glow: rgba(139,92,246,.45); --accent-border: rgba(181,123,255,.25); }
body.accent-teal   { --accent: #2dd4bf; --accent-end: #06b6d4; --accent-rgb: 45,212,191;  --accent-dim: rgba(45,212,191,.10);  --accent-glow: rgba(6,182,212,.40);  --accent-border: rgba(45,212,191,.25); }
body.accent-green  { --accent: #4ade80; --accent-end: #22c55e; --accent-rgb: 74,222,128;  --accent-dim: rgba(74,222,128,.10);  --accent-glow: rgba(34,197,94,.40);  --accent-border: rgba(74,222,128,.25); }
body.accent-orange { --accent: #fb923c; --accent-end: #f97316; --accent-rgb: 251,146,60;  --accent-dim: rgba(251,146,60,.10);  --accent-glow: rgba(249,115,22,.40);  --accent-border: rgba(251,146,60,.25); }
body.accent-red    { --accent: #f87171; --accent-end: #ef4444; --accent-rgb: 248,113,113; --accent-dim: rgba(248,113,113,.10); --accent-glow: rgba(239,68,68,.40);  --accent-border: rgba(248,113,113,.25); }

/* Background variants — use .ai-bg.bg-* for higher specificity than .ai-bg alone */
body.ai-bg.bg-midnight {
    background:
        radial-gradient(circle at 15% 25%, #0a0f1e, transparent 45%),
        radial-gradient(circle at 85% 75%, #050810, transparent 45%),
        #02040d;
}
body.ai-bg.bg-cosmic {
    background:
        radial-gradient(circle at 20% 20%, #1a0a2e, transparent 50%),
        radial-gradient(circle at 80% 80%, #0a1a2e, transparent 50%),
        #080410;
}
body.ai-bg.bg-forest {
    background:
        radial-gradient(circle at 10% 30%, #0a1f0f, transparent 45%),
        radial-gradient(circle at 85% 70%, #051209, transparent 45%),
        #030d05;
}
body.ai-bg.bg-ember {
    background:
        radial-gradient(circle at 20% 20%, #1f0a05, transparent 50%),
        radial-gradient(circle at 80% 80%, #120503, transparent 50%),
        #0d0302;
}
body.ai-bg.bg-void {
    background: #000000;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f7f9fc;
}

.hero-section {
    background: white;
}

.service-card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    transition: 0.3s;
    border: 1px solid #eee;
    height: 100%;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.main-header {
    background: white;
    z-index: 1030;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: #555;
    margin-right: 18px;
}

.navbar-nav .nav-link:hover {
    color: #0d6efd;
}

.main-footer {
    background: #1f2937;
    color: white;
}

.footer-title {
    color: white;
    font-weight: 600;
    margin-bottom: 15px;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    text-decoration: none;
    color: #9ca3af;
    transition: 0.2s;
}

.footer-links a:hover {
    color: white;
}

.footer-divider {
    border-color: rgba(255,255,255,0.1);
}
/* =========================
   GLOBAL
========================= */

body.ai-bg {
    background:
        radial-gradient(circle at 10% 20%, #1a2335, transparent 40%),
        radial-gradient(circle at 90% 80%, #162040, transparent 40%),
        #0c111b;
    color: #e6edf3;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

/* Removed global * { transition: all } — caused text rendering/spacing issues */


/* =========================
   TOPBAR
========================= */

.ai-topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(16px);
    background: rgba(12, 17, 27, 0.75);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 14px 0;
}

.ai-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 40px;
    padding-right: 40px;
    flex-wrap: nowrap;
    position: relative;
}

.ai-brand {
    font-weight: 600;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ai-brand-name {
    color: inherit;
    text-decoration: none;
}

.ai-brand i {
    font-size: 18px;
    color: var(--accent);
}

/* Desktop nav */
.ai-nav {
    display: flex;
    align-items: center;
}

.ai-nav a {
    margin-left: 28px;
    text-decoration: none;
    color: #9aa4b2;
    font-size: 14px;
}

.ai-nav a:hover {
    color: #ffffff;
}

/* Hamburger button — hidden on desktop */
.ai-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ai-hamburger:hover,
.ai-hamburger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
}

.ai-hamburger__bar {
    display: block;
    width: 18px;
    height: 2px;
    background: #9aa4b2;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease, background 0.2s ease;
}

.ai-hamburger[aria-expanded="true"] .ai-hamburger__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: #ffffff;
}

.ai-hamburger[aria-expanded="true"] .ai-hamburger__bar:nth-child(2) {
    opacity: 0;
}

.ai-hamburger[aria-expanded="true"] .ai-hamburger__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: #ffffff;
}


/* =========================
   MAIN LAYOUT
========================= */

.ai-main {
    margin-top: 20px;
    padding-left: 20px;
    padding-right: 20px;
}


/* =========================
   CARDS
========================= */

.ai-card {
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    padding: 28px;
    border: 1px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(18px);
    overflow-wrap: break-word;
    min-width: 0;
}



/* =========================
   AVATAR
========================= */

.ai-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.08);
}


/* =========================
   TEXT STYLES
========================= */

.ai-role {
    color: #8b949e;
    font-size: 14px;
}

.ai-muted {
    color: #8b949e;
    font-size: 14px;
}

.ai-section-title {
    font-weight: 600;
    margin-bottom: 18px;
    font-size: 14px;
    color: #9aa4b2;
    text-transform: uppercase;
    letter-spacing: 1px;
}


/* =========================
   STATUS
========================= */

.ai-status {
    font-size: 13px;
    color: #8b949e;
}

.ai-dot {
    width: 8px;
    height: 8px;
    background: #3ddc84;
    display: inline-block;
    border-radius: 50%;
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: .5; }
    50% { opacity: 1; }
    100% { opacity: .5; }
}


/* =========================
   BUTTONS
========================= */

.ai-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #e6edf3;
}

.ai-btn:hover {
    background: rgba(255,255,255,0.05);
}

.ai-btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    border: none;
    color: white;
}

.ai-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px var(--accent-glow);
}


/* =========================
   STREAM
========================= */

.ai-stream {
    border-left: 2px solid rgba(255,255,255,0.05);
    padding-left: 20px;
}

.ai-stream-item {
    margin-bottom: 18px;
    position: relative;
    color: #c9d1d9;
    font-size: 14px;
}

.ai-stream-dot {
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    position: absolute;
    left: -26px;
    top: 5px;
}


/* =========================
   SKILLS
========================= */

.ai-skill {
    margin-bottom: 18px;
}

.ai-bar {
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-top: 6px;
    overflow: hidden;
}

.ai-bar div {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-end));
}


/* =========================
   EXPERIENCE TIMELINE
========================= */

.ai-timeline {
    position: relative;
    padding-left: 24px;
}

.ai-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 0;
    width: 2px;
    background: rgba(var(--accent-rgb), 0.15);
    border-radius: 2px;
}

.ai-timeline-item {
    position: relative;
    margin-bottom: 32px;
}

.ai-timeline-item:last-child {
    margin-bottom: 0;
}

.ai-timeline-dot {
    position: absolute;
    left: -21px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    border: 2px solid rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
    flex-shrink: 0;
}

.ai-timeline-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 18px 20px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.ai-timeline-content:hover {
    background: rgba(var(--accent-rgb), 0.04);
    border-color: rgba(var(--accent-rgb), 0.2);
}

.ai-timeline-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.ai-timeline-role {
    font-size: 15px;
    font-weight: 600;
    color: #e6edf3;
}

.ai-timeline-period {
    font-size: 12px;
    color: var(--accent);
    white-space: nowrap;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    padding: 2px 10px;
}

.ai-timeline-company {
    font-size: 13px;
    font-weight: 500;
    color: #9aa4b2;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-timeline-company .bi {
    color: var(--accent);
    font-size: 13px;
}

.ai-timeline-meta {
    font-size: 12px;
    color: #6b7a8d;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ai-timeline-meta .bi {
    color: var(--accent);
    margin-right: 3px;
}

.ai-timeline-desc {
    font-size: 13px;
    color: #8b949e;
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 576px) {
    .ai-timeline {
        padding-left: 18px;
    }

    .ai-timeline-dot {
        left: -16px;
        width: 12px;
        height: 12px;
    }

    .ai-timeline-content {
        padding: 14px 14px;
    }

    .ai-timeline-header {
        flex-direction: column;
        gap: 4px;
    }

    .ai-timeline-role {
        font-size: 14px;
    }
}


/* =========================
   FOOTER
========================= */

.ai-footer {
    margin-top: 60px;
    padding: 30px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    color: #8b949e;
    font-size: 13px;
}

.normal-link {
    color: inherit;
    text-decoration: none;
}

.normal-link:hover {
    color: blue;             /* Color on hover */
    text-decoration: underline; /* Underline on hover */
}


/* =========================
   LANGUAGE SWITCHER
========================= */

.lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 28px;
}

.lang-switcher__trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 4px 10px;
    color: #9aa4b2;
    font-size: 13px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
}

.lang-switcher__trigger:hover,
.lang-switcher__trigger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.lang-switcher__flag {
    font-size: 16px;
    line-height: 1;
}

.lang-switcher__code {
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lang-switcher__caret {
    font-size: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.lang-switcher__trigger[aria-expanded="true"] .lang-switcher__caret {
    transform: rotate(180deg);
}

.lang-switcher__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    background: rgba(18, 24, 38, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.lang-switcher__dropdown.is-open {
    display: block;
}

.lang-switcher__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    text-decoration: none;
    color: #9aa4b2;
    font-size: 13px;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-switcher__option:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.lang-switcher__option--active {
    color: var(--accent);
    font-weight: 600;
}


/* =========================
   CHAT PAGE — CLAUDE-STYLE
========================= */

.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px - 80px); /* viewport minus topbar and footer */
    max-width: 100%;
    margin: 0;
    padding: 0 24px;
}

/* Empty state — centered vertically */
.chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-bottom: 40px;
}

.chat-empty-title {
    font-size: 28px;
    font-weight: 700;
    color: #e6edf3;
    margin-bottom: 8px;
}

.chat-empty-sub {
    font-size: 15px;
    color: #6b7a8d;
    max-width: 420px;
    line-height: 1.5;
    margin: 0;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 0 16px;
    max-width: 740px;
    width: 100%;
    margin: 0 auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--accent-rgb), 0.15) transparent;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(var(--accent-rgb), 0.2); border-radius: 4px; }

.chat-msg {
    animation: chatFadeIn 0.2s ease;
}

.chat-msg-user {
    display: flex;
    justify-content: flex-end;
}

.chat-msg-user .chat-msg-content {
    background: rgba(var(--accent-rgb), 0.15);
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px;
    max-width: 80%;
    color: #dce4ed;
    font-size: 14px;
    line-height: 1.55;
}

.chat-msg-bot {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    color: #fff;
    margin-top: 2px;
}

.chat-msg-bot .chat-msg-content {
    color: #c8d6e5;
    font-size: 14px;
    line-height: 1.6;
    max-width: 85%;
}

@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typing dots */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chat-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    opacity: 0.4;
    animation: typingBounce 1.2s infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}


/* =========================
   CHAT DOCK (bottom input)
========================= */

.chat-dock {
    flex-shrink: 0;
    padding-bottom: 12px;
    max-width: 740px;
    width: 100%;
    margin: 0 auto;
}

/* Suggestion chips */
.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.chat-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    color: #9aa4b2;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.chat-chip:hover {
    background: var(--accent-dim);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* Input box */
.chat-input-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 12px 14px 8px;
    transition: border-color 0.2s;
}

.chat-input-box:focus-within {
    border-color: rgba(var(--accent-rgb), 0.4);
}

.chat-textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #e0e6ed;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
}

.chat-textarea::placeholder {
    color: #555e6d;
}

/* Actions row below textarea */
.chat-input-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.chat-input-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Model selector */
.chat-model-select {
    position: relative;
}

.chat-model-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 4px 10px;
    color: #8b949e;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chat-model-trigger:hover,
.chat-model-trigger[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: #c9d1d9;
}

.chat-model-caret {
    font-size: 9px;
    transition: transform 0.2s;
}

.chat-model-trigger[aria-expanded="true"] .chat-model-caret {
    transform: rotate(180deg);
}

.chat-model-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    background: rgba(18, 24, 38, 0.97);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.chat-model-dropdown.is-open {
    display: block;
}

.chat-model-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.12s;
}

.chat-model-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.chat-model-option.is-active {
    background: var(--accent-dim);
}

.chat-model-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #e0e6ed;
}

.chat-model-desc {
    display: block;
    font-size: 11px;
    color: #6b7a8d;
    margin-top: 1px;
}

/* Voice button */
.chat-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #8b949e;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.chat-voice-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #c9d1d9;
}

.chat-voice-btn.is-recording {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

/* Send button */
.chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.15s;
}

.chat-send-btn:disabled {
    opacity: 0.3;
    cursor: default;
    transform: none;
}

.chat-send-btn:not(:disabled):hover {
    transform: scale(1.08);
}


/* =========================
   CHAT PAGE — RESPONSIVE
========================= */

@media (max-width: 768px) {
    .chat-page {
        padding: 0 8px;
        height: calc(100vh - 54px - 70px);
    }

    .chat-empty-title {
        font-size: 22px;
    }

    .chat-empty-sub {
        font-size: 13px;
    }

    .chat-chips {
        gap: 6px;
    }

    .chat-chip {
        font-size: 12px;
        padding: 6px 11px;
    }

    .chat-msg-user .chat-msg-content {
        max-width: 90%;
    }
}

@media (max-width: 576px) {
    .chat-page {
        height: calc(100vh - 50px - 60px);
    }

    .chat-empty-title {
        font-size: 20px;
    }

    .chat-input-box {
        border-radius: 12px;
        padding: 10px 12px 6px;
    }

    .chat-textarea {
        font-size: 14px;
    }
}




/* =========================
   RESPONSIVE — GENERAL
========================= */

/* Prevent any element from causing horizontal scroll */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

.ai-main {
    box-sizing: border-box;
}


/* =========================
   RESPONSIVE — TOPBAR (≤768px)
========================= */

@media (max-width: 768px) {
    /* Reduce topbar padding on tablet/mobile */
    .ai-topbar-inner {
        padding-left: 16px;
        padding-right: 16px;
        flex-wrap: wrap;
        align-items: center;
    }

    /* Show the hamburger button */
    .ai-hamburger {
        display: flex;
    }

    /* Hide the nav by default; shown as a slide-down panel */
    .ai-nav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        order: 3; /* brand=1 (default), hamburger=2 (default), nav=3 */
        margin-top: 12px;
        padding: 12px 0 8px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
        gap: 0;
        animation: navSlideDown 0.22s ease;
    }

    .ai-nav.is-open {
        display: flex;
    }

    /* Each nav link becomes a full-width row */
    .ai-nav a {
        margin-left: 0;
        padding: 10px 4px;
        width: 100%;
        font-size: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.04);
        color: #c9d1d9;
    }

    .ai-nav a:last-of-type {
        border-bottom: none;
    }

    .ai-nav a:hover {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.03);
    }

    /* Language switcher inside mobile nav */
    .lang-switcher {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }

    .lang-switcher__trigger {
        width: 100%;
        justify-content: flex-start;
        padding: 8px 10px;
        font-size: 14px;
    }

    .lang-switcher__dropdown {
        position: static;
        display: none;
        width: 100%;
        margin-top: 4px;
        box-shadow: none;
        border-radius: 8px;
    }

    .lang-switcher__dropdown.is-open {
        display: block;
    }

    .lang-switcher__option {
        font-size: 14px;
        padding: 10px 14px;
    }
}

@keyframes navSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================
   RESPONSIVE — LAYOUT GRID (≤991px)
========================= */

/* Bootstrap col-lg-* kicks in at 992px; below that columns stack.
   Add spacing and min-width protection for stacked columns. */
@media (max-width: 991px) {
    .ai-main {
        padding-left: 12px;
        padding-right: 12px;
        margin-top: 16px;
    }

    /* Stacked cards should not have the hover tilt on touch */
    .ai-card:hover {
        transform: none;
        box-shadow: none;
    }
}


/* =========================
   RESPONSIVE — MOBILE (≤576px)
========================= */

@media (max-width: 576px) {
    /* Main content padding */
    .ai-main {
        padding-left: 8px;
        padding-right: 8px;
        margin-top: 12px;
    }

    /* Cards — tighter padding, no overflow */
    .ai-card {
        padding: 18px 16px;
        border-radius: 12px;
    }

    /* Avatar video — responsive, do not overflow card */
    .ai-avatar {
        width: 120px;
        height: 120px;
    }

    /* Profile action buttons — stack vertically, full width */
    .ai-card .mt-4 .ai-btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-left: 0;
        margin-right: 0;
    }

    .ai-card .mt-4 .ai-btn + .ai-btn {
        margin-top: 8px;
    }

    /* Standalone buttons in content area (not inside chat) */
    .ai-btn-primary:not(.ai-chat-send) {
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Chat send button — keep compact */
    .ai-chat-send {
        display: inline-flex;
        width: auto;
        padding: 10px 14px;
    }

    /* Section titles */
    .ai-section-title {
        font-size: 12px;
    }

    /* Stream items */
    .ai-stream-item {
        font-size: 13px;
    }

    /* Footer */
    .ai-footer {
        margin-top: 32px;
        padding: 20px 0;
        font-size: 12px;
    }
}


/* =========================
   THEME SETTINGS PANEL
========================= */

/* Floating gear toggle button */
.ts-toggle-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px 0 0 8px;
    background: rgba(18, 24, 38, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-right: none;
    color: #9aa4b2;
    font-size: 17px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    backdrop-filter: blur(12px);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.35);
}

.ts-toggle-btn:hover,
.ts-toggle-btn[aria-expanded="true"] {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.25);
}

/* Panel overlay area (full-height anchor) */
.ts-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1090;
    pointer-events: none;
}

/* The slide-in drawer */
.ts-panel__drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: rgba(10, 14, 24, 0.97);
    border-left: 1px solid rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.07) transparent;
}

.ts-panel__drawer.is-open {
    transform: translateX(0);
}

/* Header row */
.ts-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.ts-panel__title {
    font-size: 13px;
    font-weight: 600;
    color: #e6edf3;
    letter-spacing: 0.3px;
}

.ts-panel__close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #9aa4b2;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.ts-panel__close:hover {
    background: rgba(255,255,255,0.07);
    color: #ffffff;
}

/* Body */
.ts-panel__body {
    padding: 16px;
    flex: 1;
}

/* Section */
.ts-section {
    margin-bottom: 24px;
}

.ts-section:last-child {
    margin-bottom: 0;
}

.ts-section__label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7a8d;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

/* Colour swatches grid */
.ts-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.ts-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
    outline: none;
}

.ts-color-swatch:hover {
    transform: scale(1.15);
}

.ts-color-swatch.is-active {
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.ts-color-swatch--blue   { background: linear-gradient(135deg, #6ea8ff, #7f6bff); }
.ts-color-swatch--purple { background: linear-gradient(135deg, #b57bff, #8b5cf6); }
.ts-color-swatch--teal   { background: linear-gradient(135deg, #2dd4bf, #06b6d4); }
.ts-color-swatch--green  { background: linear-gradient(135deg, #4ade80, #22c55e); }
.ts-color-swatch--orange { background: linear-gradient(135deg, #fb923c, #f97316); }
.ts-color-swatch--red    { background: linear-gradient(135deg, #f87171, #ef4444); }

/* Checkmark on active swatch */
.ts-color-swatch.is-active::after {
    content: '\F26B';
    font-family: 'bootstrap-icons';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    font-style: normal;
    line-height: 1;
}

/* Background thumbnails grid */
.ts-bg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ts-bg-thumb {
    border: 2px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    aspect-ratio: 16/9;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
    outline: none;
}

.ts-bg-thumb:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
    transform: scale(1.03);
}

.ts-bg-thumb.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.ts-bg-thumb span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 9px;
    font-weight: 600;
    text-align: center;
    color: rgba(255,255,255,0.7);
    padding: 3px 2px;
    background: rgba(0,0,0,0.5);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Thumb background previews */
.ts-bg-thumb--default {
    background:
        radial-gradient(circle at 10% 20%, #1a2335, transparent 60%),
        radial-gradient(circle at 90% 80%, #162040, transparent 60%),
        #0c111b;
}
.ts-bg-thumb--midnight {
    background:
        radial-gradient(circle at 15% 25%, #0a0f1e, transparent 60%),
        radial-gradient(circle at 85% 75%, #050810, transparent 60%),
        #02040d;
}
.ts-bg-thumb--cosmic {
    background:
        radial-gradient(circle at 20% 20%, #1a0a2e, transparent 60%),
        radial-gradient(circle at 80% 80%, #0a1a2e, transparent 60%),
        #080410;
}
.ts-bg-thumb--forest {
    background:
        radial-gradient(circle at 10% 30%, #0a1f0f, transparent 60%),
        radial-gradient(circle at 85% 70%, #051209, transparent 60%),
        #030d05;
}
.ts-bg-thumb--ember {
    background:
        radial-gradient(circle at 20% 20%, #1f0a05, transparent 60%),
        radial-gradient(circle at 80% 80%, #120503, transparent 60%),
        #0d0302;
}
.ts-bg-thumb--void {
    background: #000000;
}

/* Checkmark on active bg thumb */
.ts-bg-thumb.is-active::after {
    content: '\F26B';
    font-family: 'bootstrap-icons';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--accent);
    background: rgba(0,0,0,0.35);
    font-style: normal;
    line-height: 1;
}

/* Mobile: shrink drawer slightly */
@media (max-width: 480px) {
    .ts-panel__drawer {
        width: 220px;
    }

    .ts-toggle-btn {
        top: auto;
        bottom: 80px;
        transform: none;
    }
}

/* =========================
   FAMILY LANDING (krstev.me)
   The apex domain is a landing page: the family name types itself out with the
   tagline beneath. This site has no footer, so the page is laid out as a
   full-height column - otherwise the body box is shorter than the viewport and
   the .ai-bg radial gradients get cut off partway down the screen.
========================= */

body.family-site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.family-site .ai-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.family-landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px 72px;
}

.family-landing__title {
    margin: 0;
    font-size: clamp(2.25rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    max-width: 100%;
}

/* Gradient follows the accent chosen in the theme panel. */
.family-landing__shown,
.family-landing__rest {
    background: linear-gradient(135deg, var(--accent), var(--accent-end));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/*
 * Untyped remainder: hidden, but still occupying its space so the heading keeps
 * its final size from the first frame. Without JS it stays visible and the
 * caret is never rendered.
 */
.has-js-typing .family-landing__rest {
    visibility: hidden;
}

.family-landing__caret {
    display: none;
}

.has-js-typing .family-landing__caret {
    display: inline-block;
    width: 0.055em;
    height: 0.82em;
    margin: 0 0.02em;
    vertical-align: -0.06em;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    animation: familyCaretBlink 1.05s steps(1, end) infinite;
}

/* Once typing is done the caret settles rather than blinking forever. */
.family-landing.is-typed .family-landing__caret {
    animation: familyCaretFade 2.4s ease forwards;
}

@keyframes familyCaretBlink {
    0%, 50%      { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

@keyframes familyCaretFade {
    0%, 60% { opacity: 1; }
    100%    { opacity: 0; }
}

.family-landing__tagline {
    margin: 22px 0 0;
    color: #8b949e;
    font-size: clamp(0.95rem, 2.2vw, 1.15rem);
}

.has-js-typing .family-landing__tagline {
    opacity: 0;
    transform: translateY(10px);
}

.has-js-typing .family-landing__tagline.is-revealed {
    opacity: 1;
    transform: none;
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (prefers-reduced-motion: reduce) {
    .has-js-typing .family-landing__caret { animation: none; }

    .has-js-typing .family-landing__tagline {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
