/* ============================================================
   Розумний Олівець — дизайн-система (base.css)
   Один файл для всього сайту: токени, компоненти, утиліти.
   Стилі конкретних генераторів додаються окремими файлами.
   ============================================================ */

/* ---------- Токени ---------- */
:root {
    --brand: #11caa0;
    --brand-600: #0da882;
    --brand-050: #e6faf4;
    --sun: #ffc94d;
    --coral: #ff7a6b;

    --ink: #17313b;
    --muted: #5b7078;
    --line: #e3ecea;
    --bg: #f6faf8;
    --card: #ffffff;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(23, 49, 59, .05), 0 8px 24px -12px rgba(23, 49, 59, .12);
    --shadow-lg: 0 16px 40px -16px rgba(23, 49, 59, .22);

    /* Системні шрифти: нуль завантажень, миттєвий рендеринг */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --container: 1120px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-600); }
h1, h2, h3 { line-height: 1.25; font-weight: 800; }
[hidden] { display: none !important; }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.site-trail { padding-block:.55rem; font-size:.85rem; color:var(--muted); overflow-wrap:anywhere; }
.site-trail a, .guide-nav a, .guide-steps a, .guide-faq a { color:#12665a; }
.guide-nav { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; margin-block:1rem; }
.guide-nav strong { margin-inline-end:.25rem; }
@media screen {
    :where(main, .seo-assist, .site-trail, .breadcrumbs) a[href]:not([class]), .guide-nav a {
        display:inline-block;
        max-width:100%;
        padding:.38em .85em;
        border:1px solid #9acfc3;
        border-radius:999px;
        background:var(--brand-050);
        color:#155e52;
        font-weight:650;
        line-height:1.45;
        text-decoration:none;
        overflow-wrap:anywhere;
    }
    :where(main, .seo-assist, .site-trail, .breadcrumbs) a[href]:not([class]):is(:hover,:focus-visible),
    .guide-nav a:is(:hover,:focus-visible) {
        background:#d2f4e8;
        border-color:var(--brand-600);
        color:var(--ink);
    }
    .site-trail a[href] { font-size:.82rem; padding:.22em .7em; }
    .site-trail [aria-current] { font-weight:650; }
    .guide-steps { padding-inline-start:1.75rem; }
    .guide-steps li::marker { color:#12665a; font-weight:750; }
    .guide-steps li p { margin-top:.4rem; }
}
.guide-steps li, .guide-faq { margin-block:1rem; }
.guide-faq summary { cursor:pointer; font-weight:700; }
@media print { .site-trail, .seo-assist, .guide-nav { display:none !important; } }

:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.container {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: 20px;
}

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    border: 2px solid transparent;
    font-weight: 700;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(17, 202, 160, .55);
}
.btn-primary:hover { background: var(--brand-600); }
.btn-outline {
    background: var(--card);
    border-color: var(--line);
    color: var(--ink);
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand-600); }
.btn-ghost {
    background: transparent;
    border-color: rgba(23, 49, 59, .18);
    color: var(--ink);
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-600); }
.btn-large { padding: 14px 28px; font-size: 1.05rem; }

/* ---------- Бейджі ---------- */
.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    background: var(--brand-050);
    color: var(--brand-600);
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
}
.badge-soft {
    background: color-mix(in srgb, var(--tile, var(--brand)) 12%, white);
    color: color-mix(in srgb, var(--tile, var(--brand)) 75%, black);
}
.badge-hero {
    background: #fff;
    box-shadow: var(--shadow);
    padding: 6px 16px;
    font-size: .85rem;
}
.status-badge {
    display: inline-block;
    margin-top: auto;
    padding: 8px 16px;
    border-radius: 999px;
    background: #fff4d6;
    color: #9a6b00;
    font-weight: 700;
    font-size: .85rem;
    text-align: center;
}

/* ---------- Шапка ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 800;
    font-size: 1.1rem;
}
.logo-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--brand-050);
    font-size: 1.2rem;
}
.main-nav { display: flex; gap: 4px; }
.main-nav a {
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 999px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: .95rem;
    transition: background .15s, color .15s;
}
.main-nav a:is(:hover, :focus-visible, .is-active) { border-color: var(--brand); background: var(--brand-050); color: var(--brand-600); }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: none;
    border: 0;
    cursor: pointer;
}
.nav-toggle span {
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .2s, opacity .2s;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Герой ---------- */
.hero {
    position: relative;
    overflow: hidden;
    padding: 72px 0 64px;
    background:
        radial-gradient(600px 300px at 85% 10%, rgba(255, 201, 77, .25), transparent 70%),
        radial-gradient(700px 400px at 10% 90%, rgba(17, 202, 160, .18), transparent 70%),
        linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}
.hero-content { position: relative; max-width: 760px; }
.hero h1 {
    margin: 18px 0 14px;
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: -.02em;
}
.hero .accent { color: var(--brand-600); }
.hero-sub {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--muted);
    max-width: 560px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    list-style: none;
    padding: 0;
    margin-top: 30px;
    color: var(--muted);
    font-size: .95rem;
}
.hero-facts strong { color: var(--ink); font-size: 1.15rem; margin-right: 6px; }

.hero-decor span {
    position: absolute;
    font-size: 2.2rem;
    opacity: .5;
    animation: float 7s ease-in-out infinite;
    user-select: none;
}
.float-1 { top: 16%; right: 9%; animation-delay: 0s; }
.float-2 { top: 56%; right: 15%; animation-delay: 1.5s; font-size: 1.8rem; }
.float-3 { top: 10%; right: 30%; animation-delay: 3s; font-size: 1.6rem; }
.float-4 { top: 76%; right: 6%; animation-delay: 4.5s; }
@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50% { transform: translateY(-14px) rotate(5deg); }
}

/* ---------- Секції ---------- */
.section { padding: 56px 0; }
.section-alt { background: #fff; border-block: 1px solid var(--line); }
.section-title { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -.01em; }
.section-desc { color: var(--muted); margin-top: 6px; }
.section-head-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

/* ---------- Панель фільтрів ---------- */
.tools-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin: 24px 0 22px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-block;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-600); }
.chip.is-active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--card);
    min-width: 240px;
}
.search:focus-within { border-color: var(--brand); }
.search input {
    border: 0;
    outline: none;
    background: none;
    width: 100%;
    font-size: .92rem;
}

/* ---------- Сітка інструментів ---------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}
.tool-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}
.tool-card.is-soon { opacity: .8; }
.tool-card.is-soon:hover { transform: none; box-shadow: var(--shadow); }
.tool-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    font-size: 1.6rem;
    background: color-mix(in srgb, var(--tile, var(--brand)) 14%, white);
}
.tool-title { font-size: 1.1rem; }
.tool-desc { color: var(--muted); font-size: .92rem; flex-grow: 1; }
.tool-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-link { margin-top: 6px; align-self: flex-start; }
.tools-empty {
    margin-top: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 1.05rem;
}

/* ---------- Пагінація ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    flex-wrap: wrap;
}
.page-btn {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-weight: 700;
    font-size: .92rem;
    text-decoration: none;
    transition: all .15s;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand-600); }
.page-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Кроки ---------- */
.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    list-style: none;
    padding: 0;
    margin-top: 28px;
    counter-reset: step;
}
.steps li {
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.steps h3 { margin: 12px 0 6px; font-size: 1.05rem; }
.steps p { color: var(--muted); font-size: .92rem; }
.step-num {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    font-size: 1.1rem;
}

/* ---------- Блог ---------- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}
.blog-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease;
}
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.blog-icon { font-size: 2rem; }
.blog-card h3 { font-size: 1.05rem; }
.blog-card h3 a { color: var(--ink); text-decoration: none; }
.blog-card h3 a:hover { color: var(--brand-600); }
.blog-card p { color: var(--muted); font-size: .92rem; flex-grow: 1; }
.blog-date { color: var(--muted); font-size: .82rem; }

/* ---------- Про портал ---------- */
.about-block { max-width: 820px; }
.about-block p { color: var(--muted); margin-top: 12px; }
.about-points {
    list-style: none;
    padding: 0;
    margin-top: 18px;
    display: grid;
    gap: 8px;
    font-weight: 600;
}

/* ---------- Підвал ---------- */
.site-footer {
    margin-top: 24px;
    background: var(--ink);
    color: #cfe0e4;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    padding-block: 44px 28px;
}
.footer-brand p { margin-top: 12px; font-size: .9rem; max-width: 320px; color: #9db4bb; }
.logo-light { color: #fff; }
.logo-light .logo-mark { background: rgba(255, 255, 255, .12); }
.footer-col { display: grid; gap: 8px; align-content: start; }
.footer-col h3 { color: #fff; font-size: .95rem; margin-bottom: 4px; }
.footer-col a { justify-self:start; padding:.3rem .8rem; border:1px solid #58757b; border-radius:999px; background:#213f49; color:#e0eeef; text-decoration:none; font-size:.9rem; }
.footer-col a:is(:hover,:focus-visible) { color:#fff; border-color:var(--brand); background:#26554f; }
.footer-bottom {
    padding-block: 16px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    font-size: .82rem;
    color: #9db4bb;
}

/* ---------- Адаптив ---------- */
@media (max-width: 760px) {
    .nav-toggle { display: flex; }
    .main-nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 2px;
        padding: 10px 16px 16px;
        background: #fff;
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow-lg);
        display: none;
    }
    .main-nav.is-open { display: flex; }
    .main-nav a { padding: 12px 14px; }

    .hero { padding: 48px 0 44px; }
    .hero-decor span { font-size: 1.5rem; opacity: .35; }
    .section { padding: 40px 0; }
    .tools-toolbar { flex-direction: column; align-items: stretch; }
    .search { min-width: 0; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ---------- Плавні переходи ---------- */
/* Міжсторінкові переходи (Chrome/Edge); в інших браузерах — м'яка поява контенту */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: .28s;
    animation-timing-function: ease;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}
main > section,
.main-content,
.app-header { animation: rise .45s ease both; }

/* ---------- Доступність і друк ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .site-header, .site-footer, .hero-decor, .tools-toolbar { display: none !important; }
    body { background: #fff; }
}
