:root {
    /* Mapped from design/design-guidelines.md */
    --primary: #17C2B8;
    --on-primary: #FFFFFF;
    --secondary: #8E7BFF;
    --tertiary: #FF9A5A;
    --on-surface: #1F2937;
    --surface: #F5F7FA;
    --card: #FFFFFF;
    --input-fill: #F1F5F9;
    --border: #E2E8F0;

    --mint-tint: #E6F7F5;
    --violet-tint: #F3F0FF;
    --peach-tint: #FFF3EC;
    --sky-tint: #EAF7FF;
    --green-tint: #E8F5EC;
    --gold-tint: #FFF5E6;
    --pink-tint: #FFE6F1;

    --success: #22C55E;
    --warning: #F59E0B;
    --error: #EF4444;
    --info: #3B82F6;

    --pink-accent: #F472B6;

    --muted-text: #64748B;
    --subtitle-text: #94A3B8;

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-button: 9999px;

    --shadow: 0 4px 12px rgba(23, 194, 184, 0.06);
}

[data-theme="dark"] {
    --primary: #17C2B8;
    --secondary: #8E7BFF;
    --tertiary: #FF9A5A;
    --on-surface: #E6EAF2;
    --surface: #0B1220;
    --card: #1E2433;
    --input-fill: #243041;
    --border: #334155;

    --mint-tint: #0D2625;
    --violet-tint: #1C1833;
    --peach-tint: #332116;
    --sky-tint: #0B243D;
    --pink-tint: #2D1426;

    --muted-text: #94A3B8;
    --subtitle-text: #64748B;

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--surface);
    color: var(--on-surface);
    line-height: 1.5;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
    position: relative;
}

/* Typography */
.display-lg { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.display-md { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.title-lg { font-size: 17px; font-weight: 700; }
.body-md { font-size: 13px; font-weight: 500; color: var(--muted-text); }
.body-small { font-size: 12px; font-weight: 500; color: var(--subtitle-text); }
.subtitle { font-size: 15px; font-weight: 500; color: var(--muted-text); }

/* Layout & Utils */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 800px; }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.mb-xl { margin-bottom: 48px; }
.mt-xl { margin-top: 48px; }
.flex { display: flex; }
.gap-sm { gap: 8px; }

/* Header */
header {
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(245, 247, 250, 0.8);
    backdrop-filter: blur(10px);
}

[data-theme="dark"] header {
    background-color: rgba(11, 18, 32, 0.8);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--on-surface);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-link {
    color: var(--muted-text);
    font-size: 14px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
}

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

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--on-surface);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background-color: var(--input-fill);
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Hero */
.hero {
    padding: 80px 0;
}

.cta-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 24px;
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 14px 28px;
    border-radius: var(--radius-button);
    background-color: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    color: var(--primary);
    font-size: 16px;
    font-weight: 800;
}

/* Buttons */
.btn {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    padding: 16px 28px;
    border-radius: var(--radius-button);
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(23, 194, 184, 0.3);
}

.btn.lg {
    padding: 18px 32px;
    font-size: 16px;
}

/* Cards */
.card {
    background-color: var(--card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.icon-container {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.success-tint { background-color: var(--green-tint); color: var(--success); }
.info-tint { background-color: var(--sky-tint); color: var(--info); }
.pink-tint { background-color: var(--pink-tint); color: var(--pink-accent); }
.secondary-tint { background-color: var(--violet-tint); color: var(--secondary); }
.tertiary-tint { background-color: var(--peach-tint); color: var(--tertiary); }
.sky-tint { background-color: var(--sky-tint); color: var(--info); }
.warning-tint { background-color: var(--gold-tint); color: var(--warning); }
.primary-tint { background-color: var(--mint-tint); color: var(--primary); }

/* Chat Preview */
.chat-card {
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--mint-tint);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chat-bubble {
    background-color: var(--surface);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border-bottom-left-radius: 4px;
    font-size: 14px;
    color: var(--on-surface);
}

.chat-message.user .chat-bubble {
    background-color: var(--primary);
    color: var(--on-primary);
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: 4px;
}

.chat-chips {
    display: flex;
    gap: 8px;
    margin-left: 44px;
}

.chip {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background-color: transparent;
    border: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

/* Typing indicator */
.typing .dot {
    width: 6px;
    height: 6px;
    background-color: var(--muted-text);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing .dot:nth-child(1) { animation-delay: 0s; }
.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Footer */
footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}

.footer-links a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* Legal pages */
.legal-main {
    padding-bottom: 56px;
}

.legal-hero {
    padding: 56px 0 28px;
}

.legal-container {
    max-width: 980px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 18px;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.legal-eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.legal-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.15;
}

.legal-subtitle {
    color: var(--muted-text);
    font-size: 16px;
    margin-top: 12px;
    max-width: 760px;
}

.legal-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.legal-meta-item {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}

.legal-meta-label {
    color: var(--subtitle-text);
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.legal-meta-value {
    color: var(--on-surface);
    font-size: 14px;
    font-weight: 800;
}

.legal-controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.language-switcher {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-button);
    display: inline-flex;
    padding: 4px;
}

.language-tab {
    background: transparent;
    border: 0;
    border-radius: var(--radius-button);
    color: var(--muted-text);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 800;
    min-width: 56px;
    padding: 10px 14px;
}

.language-tab.is-active,
.language-tab[aria-selected="true"] {
    background-color: var(--primary);
    color: var(--on-primary);
}

.version-control {
    align-items: center;
    display: inline-flex;
    gap: 10px;
}

.version-control label {
    color: var(--muted-text);
    font-size: 13px;
    font-weight: 800;
}

.version-select {
    background-color: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--on-surface);
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    min-height: 44px;
    padding: 10px 12px;
}

.legal-layout {
    align-items: start;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 280px;
}

.legal-document {
    padding: 32px;
}

.legal-document[hidden] {
    display: none;
}

.legal-document h2 {
    font-size: 21px;
    font-weight: 800;
    margin: 28px 0 10px;
}

.legal-document h2:first-child {
    margin-top: 0;
}

.legal-document h3 {
    font-size: 17px;
    font-weight: 800;
    margin: 20px 0 8px;
}

.legal-document p,
.legal-document li {
    color: var(--muted-text);
    font-size: 14px;
}

.legal-document p + p,
.legal-document ul + p,
.legal-document p + ul {
    margin-top: 10px;
}

.legal-document ul {
    margin-left: 20px;
}

.legal-document li + li {
    margin-top: 6px;
}

.legal-note {
    background-color: var(--input-fill);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    color: var(--on-surface);
    margin-bottom: 24px;
    padding: 14px 16px;
}

.legal-note strong {
    color: var(--on-surface);
}

.legal-aside {
    position: sticky;
    top: 104px;
}

.legal-aside .title-lg {
    line-height: 1.25;
    margin-bottom: 12px;
    overflow-wrap: anywhere;
}

.legal-version-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-version-list li {
    border-top: 1px solid var(--border);
    padding: 12px 0;
}

.legal-version-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.legal-version-list strong {
    color: var(--on-surface);
    display: block;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.legal-version-list span {
    color: var(--muted-text);
    display: block;
    font-size: 12px;
    margin-top: 2px;
}

.legal-version-list p {
    color: var(--muted-text);
    font-size: 13px;
    margin-top: 6px;
}

.legal-highlight {
    margin: 20px 0;
    padding: 18px 20px;
    border-left: 4px solid var(--primary);
    background-color: var(--mint-tint);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.legal-highlight p {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--on-surface);
}

.legal-highlight p:last-child {
    margin-bottom: 0;
}

.legal-highlight a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.legal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 48px 20px;
}

.legal-loading .dot {
    width: 8px;
    height: 8px;
    background-color: var(--muted-text);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.legal-loading .dot:nth-child(1) { animation-delay: 0s; }
.legal-loading .dot:nth-child(2) { animation-delay: 0.2s; }
.legal-loading .dot:nth-child(3) { animation-delay: 0.4s; }

.legal-error {
    padding: 32px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--error);
}

@media (max-width: 760px) {
    .header-container {
        align-items: flex-start;
        gap: 14px;
    }

    .header-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .nav-link {
        font-size: 12px;
        padding: 6px 8px;
    }

    .legal-title {
        font-size: 26px;
    }

    .legal-meta,
    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-document {
        padding: 22px;
    }

    .legal-aside {
        position: static;
    }

    .version-control {
        align-items: flex-start;
        flex-direction: column;
        width: 100%;
    }

    .version-select {
        width: 100%;
    }
}

/* Paw Animation Background */
#paw-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.paw-print {
    position: absolute;
    width: 82px;
    height: 82px;
    opacity: 0;
    color: var(--primary);
    transform: translate(-50%, -50%) rotate(var(--paw-rotation, 0deg)) scale(var(--paw-scale, 1));
    transform-origin: 50% 50%;
    will-change: opacity, transform;
}

.paw-shape {
    display: block;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    -webkit-mask: url("../img/paw-print.svg") center / contain no-repeat;
    mask: url("../img/paw-print.svg") center / contain no-repeat;
}

[data-theme="dark"] .paw-print {
    opacity: 0; /* JS handles animation, but we just set base state here */
}

@keyframes fadePaw {
    0% { opacity: 0; }
    20% { opacity: 0.16; }
    80% { opacity: 0.16; }
    100% { opacity: 0; }
}
