/* DOT-Chain KB — visual language adapted from dot.gov.ua */

:root {
    /* From dot.gov.ua computed styles */
    --dot-text: #1D1D1B;       /* primary near-black */
    --dot-text-muted: #68757B; /* secondary slate grey */
    --dot-bg: #FFFFFF;
    --dot-bg-soft: #F5F6F7;
    --dot-panel: #D9E4EA;      /* icy-blue card background */
    --dot-panel-2: #EFF2F4;
    --dot-border: rgba(29, 29, 27, 0.12);
    --dot-border-strong: rgba(29, 29, 27, 0.25);
    --dot-accent: #1D1D1B;      /* the brand uses dark as accent */
    --dot-accent-inverse: #FFFFFF;
    --dot-danger: #B23B3B;
    --dot-warning: #B27A1A;
    --dot-success: #2E7D5B;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    background: var(--dot-bg);
    color: var(--dot-text);
    line-height: 1.55;
}
a { color: var(--dot-text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code { background: #f3f4f6; padding: 1px 6px; font-size: .9em; }

h1, h2, h3, h4 {
    font-family: 'Tektur', 'Geologica', sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0 0 16px;
}
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 20px; }

/* ============ HEADER ============ */
.dot-header {
    background: #FFFFFF;
    border-bottom: 1px solid var(--dot-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.dot-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 18px 32px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.dot-header__brand { display: flex; align-items: center; gap: 16px; color: var(--dot-text); text-decoration: none; }
.dot-header__brand:hover { text-decoration: none; }
.dot-header__logo {
    color: var(--dot-text);
    display: inline-flex;
    align-items: center;
}
.dot-header__logo svg { display: block; height: 36px; width: auto; }
.dot-header__brand-text {
    border-left: 1px solid var(--dot-border);
    padding-left: 16px;
    line-height: 1.2;
}
.dot-header__brand-text strong {
    font-family: 'Tektur', sans-serif;
    font-size: 14px;
    font-weight: 600;
    display: block;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.dot-header__brand-text small {
    color: var(--dot-text-muted);
    font-size: 12px;
}
.dot-header__search { flex: 1; display: flex; gap: 0; max-width: 520px; }
.dot-header__search input {
    flex: 1; padding: 10px 14px; border-radius: 0; border: 1px solid var(--dot-border-strong);
    font-size: 14px; background: #FFFFFF; font-family: inherit; color: var(--dot-text);
}
.dot-header__search input:focus { outline: none; border-color: var(--dot-text); }
.dot-header__search button {
    background: var(--dot-text); color: #FFFFFF;
    border: none; padding: 0 22px; border-radius: 0;
    font-family: 'Tektur', sans-serif;
    font-weight: 600; cursor: pointer; letter-spacing: 0.04em;
    text-transform: uppercase; font-size: 13px;
}
.dot-header__search button:hover { background: #000; }
.dot-header__nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.dot-header__nav a:not(.dot-btn) { color: var(--dot-text-muted); text-decoration: none; }
.dot-header__nav a:not(.dot-btn):hover { color: var(--dot-text); }

.dot-btn,
.dot-header__nav a.dot-btn {
    display: inline-block;
    background: var(--dot-text); color: #FFFFFF;
    padding: 10px 28px; border-radius: 0; border: none; cursor: pointer;
    font-family: 'Tektur', sans-serif; font-weight: 600; font-size: 14px;
    letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
}
.dot-btn:hover,
.dot-header__nav a.dot-btn:hover { background: #000; color: #FFFFFF; text-decoration: none; }

.dot-chip {
    background: var(--dot-panel); color: var(--dot-text);
    padding: 4px 10px; border-radius: 0; font-size: 12px; font-family: 'Tektur', sans-serif;
    letter-spacing: 0.02em;
}

/* ============ MAIN LAYOUT ============ */
.dot-main { max-width: 1180px; margin: 32px auto 64px; padding: 0 32px; }

.dot-hero {
    background: var(--dot-panel);
    padding: 48px 56px;
    margin-bottom: 40px;
    position: relative;
}
.dot-hero h1 { margin-top: 0; max-width: 720px; }
.dot-hero p { font-size: 17px; max-width: 760px; color: var(--dot-text); }

/* Modules grid (like dot.gov.ua "Напрями забезпечення") */
.dot-modules { margin-bottom: 40px; }
.dot-modules h2 { margin: 0 0 24px; }
.dot-modules__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.dot-card {
    background: var(--dot-panel-2); padding: 28px;
    transition: background .15s, transform .15s;
    display: flex; flex-direction: column; gap: 12px;
    color: var(--dot-text); text-decoration: none;
    border: 1px solid transparent;
    min-height: 200px;
}
.dot-card:hover { background: var(--dot-panel); text-decoration: none; transform: translateY(-2px); }
.dot-card__icon { font-size: 36px; line-height: 1; }
.dot-card h3 { margin: 0; font-size: 20px; }
.dot-card p { margin: 0; color: var(--dot-text-muted); font-size: 14px; }

/* Breadcrumbs */
.dot-breadcrumbs {
    color: var(--dot-text-muted); font-size: 13px; margin-bottom: 20px;
    font-family: 'Tektur', sans-serif; letter-spacing: 0.02em; text-transform: uppercase;
}
.dot-breadcrumbs a { color: var(--dot-text-muted); text-decoration: none; }
.dot-breadcrumbs a:hover { color: var(--dot-text); text-decoration: underline; }

/* Module header */
.dot-module-header {
    display: flex; align-items: center; gap: 24px;
    background: var(--dot-panel); padding: 36px 40px;
    margin-bottom: 24px;
}
.dot-module-header__icon { font-size: 56px; line-height: 1; }
.dot-module-header h1 { margin: 0; }
.dot-module-header p { margin: 6px 0 0; color: var(--dot-text); }

/* Content */
.dot-content, .dot-article {
    background: #FFFFFF; padding: 0;
    margin-bottom: 32px;
    max-width: 820px;
}
.dot-article h1 { font-size: 36px; margin-bottom: 12px; }
.dot-article__summary { color: var(--dot-text-muted); font-style: italic; font-size: 18px; margin-bottom: 24px; }
.dot-article__meta { margin-top: 40px; color: var(--dot-text-muted); border-top: 1px solid var(--dot-border); padding-top: 16px; font-size: 13px; }
.dot-content img, .dot-article img { max-width: 100%; height: auto; }

.dot-children { background: var(--dot-bg-soft); padding: 28px 32px; }
.dot-children h2 { margin-top: 0; }
.dot-children__list { list-style: none; padding: 0; margin: 0; }
.dot-children__list li {
    padding: 16px 0; border-bottom: 1px solid var(--dot-border);
    font-family: 'Tektur', sans-serif; font-weight: 500;
}
.dot-children__list li:last-child { border-bottom: none; }
.dot-children__list a { text-decoration: none; color: var(--dot-text); }
.dot-children__list a:hover { text-decoration: underline; }

/* Banner block */
.dot-banner {
    border-left: 3px solid var(--dot-text); padding: 16px 20px;
    background: var(--dot-bg-soft); margin: 24px 0;
}
.dot-banner--warning { border-color: var(--dot-warning); }
.dot-banner--success { border-color: var(--dot-success); }
.dot-banner--danger { border-color: var(--dot-danger); }
.dot-banner strong {
    display: block; margin-bottom: 6px;
    font-family: 'Tektur', sans-serif; letter-spacing: 0.02em; text-transform: uppercase; font-size: 13px;
}

/* Video block */
.dot-video video { width: 100%; }
.dot-video figcaption { color: var(--dot-text-muted); font-size: 13px; margin-top: 6px; }

/* File block */
.dot-file {
    display: flex; align-items: center; gap: 14px;
    background: var(--dot-bg-soft); padding: 14px 18px; margin: 14px 0;
    color: var(--dot-text); text-decoration: none;
    border: 1px solid var(--dot-border);
}
.dot-file:hover { background: var(--dot-panel-2); text-decoration: none; }
.dot-file__icon { font-size: 28px; line-height: 1; }
.dot-file__meta strong { display: block; font-family: 'Tektur', sans-serif; font-size: 14px; }
.dot-file__meta small { color: var(--dot-text-muted); font-size: 13px; }

/* Login */
.dot-login { background: var(--dot-panel); padding: 48px 56px; }
.dot-login h1 { margin-top: 0; }
.dot-login p code { background: rgba(29,29,27,.08); }
.dot-login__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; margin-top: 24px; }
.dot-login__card {
    background: #FFFFFF; border: 1px solid var(--dot-border-strong); border-radius: 0;
    padding: 24px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 10px;
    font-family: inherit; color: var(--dot-text); transition: border-color .15s, background .15s;
}
.dot-login__card:hover { border-color: var(--dot-text); background: var(--dot-bg-soft); }
.dot-login__card strong {
    font-family: 'Tektur', sans-serif; font-size: 16px;
    letter-spacing: 0.02em; text-transform: uppercase;
}
.dot-login__card small { color: var(--dot-text-muted); }
.dot-login__card p { margin: 0; font-size: 14px; color: var(--dot-text-muted); }
.dot-login__card .dot-chip { align-self: flex-start; background: var(--dot-text); color: #FFFFFF; }

/* Panels */
.dot-panel { background: #FFFFFF; padding: 32px 40px; border: 1px solid var(--dot-border); }
.dot-panel--danger { border-left: 3px solid var(--dot-danger); }
.dot-empty { color: var(--dot-text-muted); }

/* Footer */
.dot-footer {
    border-top: 1px solid var(--dot-border);
    padding: 32px;
    color: var(--dot-text-muted);
    text-align: center;
    font-size: 13px;
    font-family: 'Tektur', sans-serif; letter-spacing: 0.02em;
}

/* AI chat */
.ai-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 1000;
    background: var(--dot-text); color: #FFFFFF; border: none; border-radius: 0;
    padding: 14px 24px; font-family: 'Tektur', sans-serif; font-weight: 600;
    cursor: pointer; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px;
}
.ai-fab:hover { background: #000; }
.ai-panel {
    position: fixed; bottom: 90px; right: 24px; width: 400px; max-height: 70vh;
    background: #FFFFFF; border: 1px solid var(--dot-border-strong);
    display: flex; flex-direction: column; z-index: 1000; box-shadow: 0 12px 36px rgba(0,0,0,.12);
}
.ai-panel header {
    background: var(--dot-text); color: #FFFFFF; padding: 14px 18px;
    display: flex; justify-content: space-between; align-items: center;
    font-family: 'Tektur', sans-serif; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 13px;
}
.ai-panel header button { background: transparent; color: #FFFFFF; border: none; font-size: 22px; cursor: pointer; }
.ai-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--dot-bg-soft); }
.ai-bubble { padding: 12px 14px; max-width: 90%; font-size: 14px; line-height: 1.5; }
.ai-bubble--user { background: var(--dot-text); color: #FFFFFF; align-self: flex-end; white-space: pre-wrap; }
.ai-bubble--assistant { background: #FFFFFF; align-self: flex-start; border: 1px solid var(--dot-border); }
.ai-bubble--thinking { font-style: italic; color: var(--dot-text-muted); }
.ai-bubble--assistant p { margin: 0 0 8px; }
.ai-bubble--assistant p:last-child { margin-bottom: 0; }
.ai-bubble--assistant h3, .ai-bubble--assistant h4, .ai-bubble--assistant h5, .ai-bubble--assistant h6 {
    font-family: 'Tektur', sans-serif; font-weight: 600;
    margin: 12px 0 6px; line-height: 1.25;
}
.ai-bubble--assistant h3 { font-size: 15px; }
.ai-bubble--assistant h4, .ai-bubble--assistant h5, .ai-bubble--assistant h6 { font-size: 14px; }
.ai-bubble--assistant ul, .ai-bubble--assistant ol {
    margin: 6px 0 8px; padding-left: 22px;
}
.ai-bubble--assistant li { margin-bottom: 4px; }
.ai-bubble--assistant code {
    background: var(--dot-panel-2); padding: 1px 5px; font-size: 12px;
    font-family: 'SF Mono', Menlo, monospace;
}
.ai-bubble--assistant strong { font-weight: 700; }
.ai-bubble--assistant em { font-style: italic; }
.ai-bubble--assistant a { color: var(--dot-text); text-decoration: underline; }
.ai-bubble--assistant hr { border: none; border-top: 1px solid var(--dot-border); margin: 10px 0; }
.ai-citations { margin: 10px 0 0; padding-left: 18px; font-size: 13px; }
.ai-form { display: flex; padding: 10px; border-top: 1px solid var(--dot-border); gap: 0; background: #FFFFFF; }
.ai-form input {
    flex: 1; padding: 10px 12px; border: 1px solid var(--dot-border-strong); font-size: 14px;
    font-family: inherit;
}
.ai-form input:focus { outline: none; border-color: var(--dot-text); }
.ai-form button {
    background: var(--dot-text); color: #FFFFFF; border: none; padding: 0 16px;
    cursor: pointer; font-family: 'Tektur', sans-serif; font-weight: 600;
}

/* Search */
.dot-search-form { display: flex; gap: 0; margin-bottom: 24px; max-width: 640px; }
.dot-search-form input { flex: 1; padding: 12px 16px; border: 1px solid var(--dot-border-strong); border-radius: 0; font-size: 15px; font-family: inherit; }
.dot-search-form button {
    padding: 12px 24px; background: var(--dot-text); color: #FFFFFF; border: none;
    cursor: pointer; font-family: 'Tektur', sans-serif; letter-spacing: 0.04em;
    text-transform: uppercase; font-size: 13px; font-weight: 600;
}
.dot-search-results { list-style: none; padding: 0; }
.dot-search-results li {
    background: var(--dot-bg-soft); padding: 20px 24px; margin-bottom: 12px;
    border-left: 3px solid var(--dot-text);
}
.dot-search-results li a {
    text-decoration: none; font-family: 'Tektur', sans-serif;
    font-weight: 600; font-size: 17px; color: var(--dot-text);
}
.dot-search-results li a:hover { text-decoration: underline; }
.dot-search-results li p { margin: 8px 0 0; color: var(--dot-text-muted); font-size: 14px; }

/* Wagtail userbar tuning (small visual fix) */
.wagtail-userbar { right: 16px !important; bottom: 90px !important; }
