/* styles.css — kabotagka.com.ua · світла тема «м'ятний туман + темний бірюзовий», акцент — тепла мідь */
:root {
    color-scheme: light;
    --bg: #f2f5f1;
    --surface: #ffffff;
    --surface-2: #f7faf7;
    --header-bg: rgba(242, 245, 241, 0.94);
    --text: #1d2927;
    --heading: #12312f;
    --muted: #55635e;
    --border: #d5dfd9;
    --border-strong: #bccbc4;
    --accent: #0f5e63;
    --accent-hover: #0a4347;
    --accent-soft: #dcebe8;
    --accent-line: rgba(15, 94, 99, 0.35);
    --on-accent: #ffffff;
    --accent2: #9c4a25;
    --accent2-soft: #f6e6dc;
    --font-body: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
    --font-head: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --radius: 16px;
    --radius-sm: 6px;
    --container: 1120px;
    --measure: 70ch;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    min-width: 320px;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--accent-hover);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

::selection {
    background: var(--accent-soft);
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    -webkit-backdrop-filter: saturate(1.2) blur(8px);
    backdrop-filter: saturate(1.2) blur(8px);
}

.header-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    color: var(--heading);
    text-decoration: none;
}

.logo:hover {
    color: var(--heading);
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--heading);
}

.logo-text svg {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.logo-sub {
    color: var(--accent);
    font-weight: 500;
}

.lang-switcher {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.lang-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 32px;
    padding: 4px 10px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--muted);
    text-decoration: none;
}

.lang-switcher a:hover {
    color: var(--heading);
    background: var(--accent-soft);
}

.lang-switcher a.active {
    background: var(--accent);
    color: var(--on-accent);
}

/* ---------- Layout ---------- */
main {
    max-width: var(--container);
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.article-title {
    margin: 8px 0 20px;
    max-width: 40ch;
    font-family: var(--font-head);
    font-size: clamp(1.5rem, 5.2vw, 2.4rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--heading);
    overflow-wrap: break-word;
}

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-bottom: 36px;
}

.hero-content,
.hero-visual {
    min-width: 0;
}

.lead {
    margin: 0 0 20px;
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--text);
}

.meta-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.meta-item {
    display: flex;
    flex: 1 1 130px;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.meta-item .label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.meta-item .value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--heading);
    overflow-wrap: break-word;
}

.hero-visual img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    object-position: center top;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

@media (min-width: 900px) {
    .hero {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        align-items: start;
        gap: 40px;
    }
}

/* ---------- Article ---------- */
.content-body {
    max-width: var(--measure);
    font-size: 1.0625rem;
    overflow-wrap: break-word;
}

.content-body p {
    margin: 0 0 1.1em;
}

.content-body h2 {
    margin: 1.9em 0 0.6em;
    font-family: var(--font-head);
    font-size: clamp(1.3rem, 3.6vw, 1.6rem);
    line-height: 1.3;
    color: var(--heading);
}

.content-body h3 {
    margin: 1.5em 0 0.4em;
    font-family: var(--font-head);
    font-size: 1.15rem;
    line-height: 1.35;
    color: var(--heading);
}

.content-body strong {
    color: var(--heading);
}

.content-body a {
    word-break: break-word;
}

.content-body .note {
    margin-top: 2em;
    padding-top: 12px;
    border-top: 1px dashed var(--border-strong);
    font-size: 0.875rem;
    color: var(--muted);
}

.info-box {
    margin: 1.2em 0 1.6em;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
}

.info-box ul {
    margin: 0;
    padding-left: 1.15em;
}

.info-box li + li {
    margin-top: 0.55em;
}

.info-box li::marker {
    color: var(--accent);
}

/* ---------- Related sections & cards ---------- */
.related-section {
    margin-top: 56px;
}

.related-section + .related-section {
    margin-top: 48px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h3 {
    flex: 0 1 auto;
    margin: 0;
    font-family: var(--font-head);
    font-size: 1.25rem;
    line-height: 1.3;
    color: var(--heading);
}

.decoder-line {
    flex: 1 1 40px;
    min-width: 24px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent-line), transparent);
}

.cards-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
}

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

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

.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.16s ease;
}

.card:hover {
    border-color: var(--accent-line);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge {
    display: inline-block;
    max-width: 100%;
    padding: 3px 8px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius-sm);
    overflow-wrap: anywhere;
}

.badge.warning {
    color: var(--accent2);
    background: var(--accent2-soft);
    border-color: var(--accent2);
}

.card h4 {
    margin: 0;
    font-family: var(--font-head);
    font-size: 1.05rem;
    line-height: 1.35;
    color: var(--heading);
    overflow-wrap: break-word;
}

.card p {
    flex: 1 1 auto;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--muted);
}

.card-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--muted);
}

.status-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.card-top:has(.badge.warning) ~ .card-status .status-dot {
    background: var(--accent2);
    box-shadow: 0 0 0 3px var(--accent2-soft);
}

/* ---------- Footer ---------- */
footer {
    margin-top: 64px;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 28px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 64ch;
}

.footer-left .brand {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--heading);
}

.footer-left .copy {
    display: block;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--muted);
}

.footer-center {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.footer-center a {
    color: var(--text);
    text-decoration: none;
}

.footer-center a:hover {
    color: var(--accent);
}

.footer-center a[aria-current] {
    color: var(--accent);
    font-weight: 600;
}

.footer-center .sep {
    color: var(--border-strong);
}

.dmca-badge {
    display: inline-block;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

@media (min-width: 900px) {
    .footer-inner {
        flex-direction: row;
        align-items: flex-start;
        justify-content: space-between;
        gap: 32px;
    }

    .footer-center {
        flex: 0 0 auto;
    }

    .footer-right {
        flex: 0 0 auto;
    }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

@media print {
    .site-header {
        position: static;
        background: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .lang-switcher,
    .footer-center,
    .dmca-badge {
        display: none;
    }

    body,
    .card,
    .info-box,
    footer {
        background: #fff !important;
        color: #000 !important;
    }

    .article-title,
    .content-body h2,
    .content-body h3,
    .card h4 {
        color: #000 !important;
        -webkit-text-fill-color: #000;
    }

    .card,
    .info-box {
        break-inside: avoid;
        border-color: #999 !important;
    }

    .content-body h2,
    .content-body h3 {
        break-after: avoid;
    }
}

/* ---------- Site variant ---------- */
.site-header {
    border-bottom: 2px solid var(--accent2);
}

.card {
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(18, 49, 47, 0.06), 0 10px 24px -14px rgba(15, 94, 99, 0.35);
}

.card p,
.footer-left .copy,
.meta-item .value {
    font-family: var(--font-ui);
}
