@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400;0,500;1,400&family=Source+Sans+3:wght@300;400;500&display=swap');

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

:root {
    --bg: #faf8f5;
    --surface: #ffffff;
    --border: #e4ddd4;
    --text: #2a2420;
    --muted: #6d5b4f;
    --accent: #2d6a4f;
    --accent2: #40916c;
    --light: #d8f3dc;
    --red: #c0392b;
    --amber: #d68910;
    --serif: 'Lora', Georgia, serif;
    --sans: 'Source Sans 3', system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-weight: 400;
    min-height: 100vh;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border);
}

::-webkit-scrollbar-thumb {
    background: #a89b8e;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8a7d74;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #a89b8e var(--border);
}

nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 248, 245, 0.93);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 56px;
}

.nav-brand {
    font-family: var(--serif);
    font-size: 1.75rem;
    font-style: italic;
    font-weight: 500;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-brand-sub {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.2;
    margin-left: 8px;
    font-style: italic;
}

.nav-tabs {
    display: flex;
    height: 100%;
}

.nav-tab {
    display: flex;
    align-items: center;
    padding: 0 1.2rem;
    font-size: 0.9rem;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    user-select: none;
    text-decoration: none;
}

.nav-tab:hover {
    color: var(--text);
}

.nav-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

.nav-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.hero {
    max-width: 1080px;
    margin: 0 auto;
    padding: 60px 32px 44px;
    animation: fadeIn 0.4s ease both;
}

.eyebrow {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--accent2);
    margin-bottom: 1rem;
}

h1 {
    font-family: var(--serif);
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 400;
    line-height: 1.25;
    margin-bottom: 1rem;
}

h1 em {
    font-style: italic;
    color: var(--accent);
}

.hero-sub {
    font-weight: 300;
    font-style: italic;
    color: var(--muted);
    line-height: 1.75;
    max-width: 720px;
    margin-bottom: 2rem;
    padding: 10px 0;
}

.cta-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--light);
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid #b7e4c7;
}

.section {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 32px 52px;
    animation: fadeIn 0.4s ease 0.08s both;
}

.section-title {
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.35rem;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 1.2rem;
    line-height: 1.6;
}

.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    max-width: 1080px;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

@media (min-width: 600px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.card {
    background: var(--surface);
    padding: 1rem 1.2rem;
    transition: background 0.12s;
}

.card:hover {
    background: #f5f0eb;
}

.card-name {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
}

.badge-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    color: var(--muted);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--red);
}

.dot.med {
    background: var(--amber);
}

.intents {
    display: grid;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.intent-row {
    background: var(--surface);
    padding: 0.9rem 1.2rem;
    display: grid;
    grid-template-columns: 24px 1fr 2fr;
    gap: 1rem;
    align-items: baseline;
    transition: background 0.12s;
}

.intent-row:hover {
    background: #f5f0eb;
}

.intent-num {
    font-size: 0.8rem;
    color: var(--muted);
}

.intent-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.intent-eg {
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
    line-height: 1.5;
}

.docs {
    max-width: 960px;
    margin: 0 auto;
    padding: 48px 32px 80px;
    animation: fadeIn 0.3s ease both;
}

.docs h2 {
    font-family: var(--serif);
    font-size: 1.55rem;
    font-weight: 400;
    margin: 2.2rem 0 0.6rem;
    color: var(--text);
}

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

.docs h3 {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 400;
    margin: 1.6rem 0 0.5rem;
}

.docs h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 1.3rem 0 0.4rem;
    color: var(--text);
}

.docs p {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #3d3530;
    margin-bottom: 0.8rem;
}

.docs hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.docs table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem !important;
    margin-bottom: 1.2rem;
}

.table-fade-wrap {
    position: relative;
}

.table-fade-wrap.fade-right::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 100%;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    border-radius: 0 6px 6px 0;
    z-index: 2;
}

.table-fade-wrap.fade-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 100%;
    background: linear-gradient(to left, transparent, var(--bg));
    pointer-events: none;
    border-radius: 6px 0 0 6px;
    z-index: 2;
}

.docs th {
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}

.docs td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0ebe4;
    color: var(--text);
    vertical-align: top;
    line-height: 1.5;
}

.docs th, .docs th * {
    font-size: 0.76rem !important;
}
.docs td, .docs td * {
    font-size: inherit !important;
}

.docs tr:last-child td {
    border-bottom: none;
}

.docs code {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    background: #f0ebe4;
    color: var(--accent);
    padding: 1px 5px;
    border-radius: 3px;
}

.docs ul {
    padding-left: 1.4rem;
    margin-bottom: 0.8rem;
}

.docs li {
    font-size: 0.93rem;
    line-height: 1.7;
    color: #3d3530;
    margin-bottom: 0.15rem;
}

.pill {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fde8e8;
    color: var(--red);
}

.pill.med {
    background: #fef3cd;
    color: var(--amber);
}

.docs a {
    color: var(--accent);
    text-decoration: none;
}

.docs a:hover {
    text-decoration: underline;
}

#readme-content h1,
#readme-content h2 {
    font-family: var(--serif);
    font-weight: 400;
    margin: 2rem 0 0.6rem;
    color: var(--text);
}

#readme-content h1 {
    font-size: 1.7rem;
    margin-top: 0;
}

#readme-content h2 {
    font-size: 1.4rem;
}

#readme-content h3 {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-weight: 400;
    margin: 1.5rem 0 0.5rem;
}

#readme-content h4 {
    font-size: 0.88rem;
    font-weight: 600;
    margin: 1.2rem 0 0.4rem;
}

#readme-content p {
    font-size: 0.95rem;
    line-height: 1.75;
    color: #3d3530;
    margin-bottom: 0.8rem;
}

#readme-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

#readme-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem !important;
    margin-bottom: 1.2rem;
}

#readme-content th {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}

#readme-content th, #readme-content th * {
    font-size: 0.76rem !important;
}
#readme-content td, #readme-content td * {
    font-size: inherit !important;
}

#readme-content th[align="center"],
#readme-content td[align="center"] {
    text-align: center;
}

#readme-content th[align="right"],
#readme-content td[align="right"] {
    text-align: right;
}

#readme-content th[align="left"],
#readme-content td[align="left"] {
    text-align: left;
}

#readme-content td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0ebe4;
    color: var(--text);
    vertical-align: top;
    line-height: 1.5;
}

#readme-content tr:last-child td {
    border-bottom: none;
}

#readme-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    background: #f0ebe4;
    color: var(--accent);
    padding: 1px 5px;
    border-radius: 3px;
}

#readme-content pre {
    background: #f0ebe4;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

#readme-content pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
    color: var(--text);
}

#readme-content ul,
#readme-content ol {
    padding-left: 1.4rem;
    margin-bottom: 0.8rem;
}

#readme-content li {
    font-size: 0.93rem;
    line-height: 1.7;
    color: #3d3530;
    margin-bottom: 0.15rem;
}

#readme-content blockquote {
    border-left: 3px solid var(--border);
    padding: 0.6rem 1rem;
    margin: 1rem 0;
    background: #f7f3ef;
    border-radius: 0 4px 4px 0;
}

#readme-content blockquote p {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0;
}

/* Mermaid diagram toolbar */
.mermaid-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
    justify-content: flex-end;
    position: relative;
    z-index: 10;
}
.mermaid-toolbar button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--accent);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.15s;
}
.mermaid-toolbar button:hover {
    background: var(--light);
}
.mermaid-zoomable {
    overflow: auto;
    cursor: grab;
    background: #f7f3ef;
    border-radius: 6px;
    padding: 8px;
    transition: box-shadow 0.2s;
    position: relative;
    z-index: 5;
}
.mermaid-zoomable:active {
    cursor: grabbing;
}

df-messenger {
    --df-messenger-button-titlebar-color: #2d6a4f;
    --df-messenger-chat-background-color: #faf8f5;
    --df-messenger-bot-message: #f0ebe4;
    --df-messenger-user-message: #d8f3dc;
    --df-messenger-font-color: #2a2420;
    z-index: 999;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@media (max-width: 720px) {
    .intent-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .intent-num {
        display: none;
    }

    .nav-meta {
        display: none;
    }

    .nav-brand-sub {
        display: none;
    }

    .hero {
        padding: 80px 25px 30px;
    }

    .section {
        padding: 0 20px 40px;
    }

    .docs,
    #readme-content {
        padding: 20px 12px !important;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* Only tables get horizontal scroll, not the whole docs area */
    .docs .table-scroll,
    #readme-content .table-scroll {
        width: 100%;
        display: block;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        border-radius: 6px;
        margin-bottom: 1.2rem;
        padding-bottom: 2px;
    }
    .docs .table-scroll table,
    #readme-content .table-scroll table {
        width: max-content;
        min-width: 100%;
        border-radius: 6px;
        table-layout: auto;
    }
    .docs table,
    #readme-content table {
        border-radius: 6px;
        table-layout: auto;
    }
    .docs table thead,
    #readme-content table thead {
        display: table-header-group;
        width: auto;
    }
    .docs table tbody,
    #readme-content table tbody {
        display: table-row-group;
        width: auto;
    }
    .docs td,
    .docs th,
    #readme-content td,
    #readme-content th {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
    }
    .docs a,
    #readme-content a {
        word-break: break-all;
        overflow-wrap: anywhere;
    }
    .docs pre,
    #readme-content pre {
        max-width: 100vw;
        overflow-x: auto;
        font-size: 0.8rem;
    }
}