/* styles.css — finbase.com.ua — dark editorial: warm graphite + brass */

:root {
    color-scheme: dark;

    /* Palette: warm graphite surfaces */
    --bg: #121315;
    --bg-soft: #151619;
    --surface: #1a1b1f;
    --raised: #212227;
    --raised-2: #282a30;

    /* Text */
    --text: #dedcd6;
    --text-strong: #efede8;
    --muted: #a8a49b;
    --faint: #8c887f;

    /* Accent: muted brass, secondary: sage */
    --accent: #d4a45e;
    --accent-strong: #e2b877;
    --accent-visited: #c4ab86;
    --accent-soft: rgba(212, 164, 94, 0.12);
    --accent-line: rgba(212, 164, 94, 0.42);
    --accent2: #92b5a2;
    --accent2-soft: rgba(146, 181, 162, 0.12);

    /* Borders */
    --border: #2c2e34;
    --border-strong: #3a3d44;
    --bw: 1px;

    /* Typography */
    --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: "Source Serif Pro", "Georgia", "Times New Roman", serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --fs-base: 1rem;
    --fs-sm: 0.875rem;
    --fs-xs: 0.75rem;
    --lh-body: 1.72;
    --lh-head: 1.3;
    --measure: 70ch;

    /* Spacing scale */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;

    /* Radii */
    --r-sm: 4px;
    --r: 8px;
    --r-lg: 12px;

    --container: 1120px;
    --gutter: var(--s-4);
    --header-h: 60px;

    --ease: 160ms ease;
}

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + var(--s-4));
    background-color: var(--bg);
    scrollbar-color: var(--border-strong) var(--bg);
    scrollbar-width: thin;
}

body {
    min-height: 100vh;
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 40% at 50% -10%, rgba(212, 164, 94, 0.05), transparent 70%),
        linear-gradient(var(--bg), var(--bg-soft));
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-main);
    font-size: var(--fs-base);
    font-weight: 400;
    line-height: var(--lh-body);
    overflow-x: hidden;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(212, 164, 94, 0.32);
    color: var(--text-strong);
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
    background: #4a4d55;
}

img, picture, video, canvas, svg, iframe {
    display: block;
    max-width: 100%;
    height: auto;
}

img, video {
    border-radius: var(--r);
    filter: brightness(0.92);
}

ul, ol {
    list-style: none;
}

/* ---------- Links ---------- */
a {
    color: inherit;
    text-decoration: none;
    transition: color var(--ease), background-color var(--ease), border-color var(--ease), text-decoration-color var(--ease);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--accent-strong);
    outline-offset: 3px;
    border-radius: var(--r-sm);
}

:focus:not(:focus-visible) {
    outline: none;
}

/* ---------- Headings ---------- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: 650;
    line-height: var(--lh-head);
    letter-spacing: -0.012em;
    overflow-wrap: break-word;
    hyphens: auto;
}

h1 { font-size: 1.375rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.075rem; }
h4 { font-size: 1rem; }
h5, h6 { font-size: 0.9375rem; }

strong, b {
    font-weight: 650;
    color: var(--text-strong);
}

small {
    font-size: var(--fs-sm);
    color: var(--muted);
}

mark {
    background: rgba(212, 164, 94, 0.22);
    color: var(--text-strong);
    padding: 0 0.2em;
    border-radius: 2px;
}

abbr[title] {
    text-decoration: underline dotted var(--faint);
    cursor: help;
}

hr {
    border: 0;
    height: var(--bw);
    background: var(--border);
    margin: var(--s-7) 0;
}

/* ---------- Code ---------- */
code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.875em;
}

code {
    background: var(--raised);
    border: var(--bw) solid var(--border);
    color: var(--accent-strong);
    padding: 0.1em 0.4em;
    border-radius: var(--r-sm);
    overflow-wrap: anywhere;
}

pre {
    background: #0f1012;
    border: var(--bw) solid var(--border);
    border-radius: var(--r);
    padding: var(--s-4);
    margin: var(--s-5) 0;
    overflow-x: auto;
    line-height: 1.6;
    color: var(--text);
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

pre code {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font-size: inherit;
    overflow-wrap: normal;
    white-space: pre;
}

kbd {
    display: inline-block;
    background: var(--raised-2);
    border: var(--bw) solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: var(--r-sm);
    padding: 0.05em 0.45em;
    color: var(--text-strong);
    font-size: 0.8em;
    line-height: 1.5;
}

/* ---------- Forms ---------- */
input, textarea, select, button {
    font: inherit;
    color: inherit;
}

input, textarea, select {
    background: var(--surface);
    color: var(--text);
    border: var(--bw) solid var(--border-strong);
    border-radius: var(--r);
    padding: var(--s-3) var(--s-4);
    min-height: 44px;
    width: 100%;
    max-width: 100%;
    transition: border-color var(--ease), background-color var(--ease);
}

input::placeholder,
textarea::placeholder {
    color: var(--faint);
    opacity: 1;
}

input:hover, textarea:hover, select:hover {
    border-color: #4a4d55;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    background: var(--raised);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    min-height: 44px;
    width: auto;
    padding: var(--s-2) var(--s-5);
    background: var(--raised);
    color: var(--text-strong);
    border: var(--bw) solid var(--border-strong);
    border-radius: var(--r);
    font-weight: 600;
    cursor: pointer;
    transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
    border-color: var(--accent);
    color: var(--accent-strong);
}

button:active,
input[type="submit"]:active {
    background: var(--accent);
    border-color: var(--accent);
    color: #15130f;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(18, 19, 21, 0.94);
    border-bottom: var(--bw) solid var(--border);
}

.header-inner {
    max-width: var(--container);
    margin: 0 auto;
    min-height: var(--header-h);
    padding: var(--s-2) var(--gutter);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-4);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    min-height: 44px;
    color: var(--text-strong);
    font-weight: 700;
    font-size: 1.0625rem;
    letter-spacing: 0.02em;
    min-width: 0;
}

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

.logo img,
.logo svg {
    width: auto;
    max-height: 32px;
    border-radius: var(--r-sm);
    filter: none;
    flex-shrink: 0;
}

.lang-switcher {
    display: flex;
    align-items: center;
    gap: var(--s-1);
    font-size: var(--fs-sm);
    font-weight: 500;
    flex-shrink: 0;
}

.lang-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 var(--s-2);
    color: var(--muted);
    border-radius: var(--r);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: relative;
}

.lang-switcher a:hover {
    color: var(--text-strong);
    background: var(--surface);
}

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

.lang-switcher a.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: 16px;
    height: 2px;
    margin-left: -8px;
    background: var(--accent);
    border-radius: 2px;
}

/* ---------- Main ---------- */
main {
    display: block;
    max-width: var(--container);
    margin: 0 auto;
    padding: var(--s-6) var(--gutter) var(--s-7);
}

.article-title {
    font-size: 1.375rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--text-strong);
    max-width: 38ch;
    margin-bottom: var(--s-5);
    padding-bottom: var(--s-4);
    border-bottom: var(--bw) solid var(--border);
    position: relative;
}

.article-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 56px;
    height: 2px;
    background: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
    display: grid;
    gap: var(--s-5);
    margin-bottom: var(--s-7);
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.hero-content .lead {
    font-family: var(--font-serif);
    font-size: 1.125rem;
    line-height: 1.65;
    color: var(--text);
    margin-bottom: var(--s-5);
    max-width: var(--measure);
}

.meta-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-2) var(--s-3);
    font-size: var(--fs-sm);
    color: var(--muted);
    padding-top: var(--s-4);
    border-top: var(--bw) solid var(--border);
}

.meta-info svg,
.meta-info img {
    width: 16px;
    height: 16px;
    color: var(--accent);
    filter: none;
    border-radius: 0;
}

.hero-visual {
    width: 100%;
    height: 220px;
    background: var(--surface);
    border: var(--bw) solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    position: relative;
}

.visual-texture {
    width: 100%;
    height: 100%;
    background-color: var(--surface);
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(160deg, rgba(212, 164, 94, 0.08), transparent 60%);
    background-size: 24px 24px, 24px 24px, 100% 100%;
}

.hero-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    border-radius: 0;
    filter: brightness(0.9) saturate(0.95);
}

/* ---------- Article content ---------- */
.content-body {
    max-width: var(--measure);
    margin: 0 auto var(--s-7);
    font-size: 1em;
}

.content-body > *:first-child {
    margin-top: 0;
}

.content-body p {
    margin-bottom: var(--s-5);
    color: var(--text);
}

.content-body h2 {
    font-size: 1.2rem;
    margin-top: var(--s-7);
    margin-bottom: var(--s-4);
    padding-left: var(--s-3);
    border-left: 2px solid var(--accent);
    color: var(--text-strong);
}

.content-body h3 {
    font-size: 1.075rem;
    margin-top: var(--s-6);
    margin-bottom: var(--s-3);
    color: var(--text-strong);
}

.content-body h4 {
    margin-top: var(--s-5);
    margin-bottom: var(--s-2);
    color: var(--text-strong);
}

.content-body a {
    color: var(--accent-strong);
    text-decoration: underline;
    text-decoration-color: var(--accent-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
}

.content-body a:visited {
    color: var(--accent-visited);
}

.content-body a:hover {
    color: var(--text-strong);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
}

.content-body blockquote {
    margin: var(--s-6) 0;
    padding: var(--s-4) var(--s-5);
    background: var(--surface);
    border: var(--bw) solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--r) var(--r) 0;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--muted);
}

.content-body blockquote p {
    color: var(--muted);
}

.content-body blockquote p:last-child {
    margin-bottom: 0;
}

.content-body blockquote cite {
    display: block;
    margin-top: var(--s-3);
    font-family: var(--font-main);
    font-style: normal;
    font-size: var(--fs-sm);
    color: var(--faint);
}

.content-body ul,
.content-body ol {
    margin: 0 0 var(--s-5);
    padding-left: var(--s-5);
}

.content-body ul li,
.content-body ol li {
    color: var(--text);
    margin-bottom: var(--s-2);
    padding-left: var(--s-1);
}

.content-body ul li {
    list-style-type: none;
    position: relative;
}

.content-body ul li::before {
    content: "";
    position: absolute;
    left: calc(var(--s-4) * -1);
    top: 0.72em;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 1px;
    transform: rotate(45deg);
}

.content-body ol {
    list-style: decimal;
}

.content-body ol li::marker {
    color: var(--accent);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.content-body li > ul,
.content-body li > ol {
    margin-top: var(--s-2);
    margin-bottom: var(--s-2);
}

.content-body li > ul li::before {
    background: transparent;
    border: 1px solid var(--accent);
}

.content-body ul li strong {
    color: var(--text-strong);
}

/* Tables */
.content-body table,
table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-collapse: collapse;
    margin: var(--s-6) 0;
    font-size: 0.9375em;
    border: var(--bw) solid var(--border);
    border-radius: var(--r);
    background: var(--surface);
}

th, td {
    padding: var(--s-3) var(--s-4);
    text-align: left;
    vertical-align: top;
    border-bottom: var(--bw) solid var(--border);
    min-width: 120px;
}

thead th,
th {
    background: var(--raised);
    color: var(--text-strong);
    font-weight: 600;
    font-size: var(--fs-sm);
    letter-spacing: 0.02em;
}

tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.015);
}

tbody tr:hover td {
    background: var(--accent-soft);
}

tbody tr:last-child td {
    border-bottom: 0;
}

caption {
    caption-side: bottom;
    padding: var(--s-2) var(--s-4);
    font-size: var(--fs-sm);
    color: var(--muted);
    text-align: left;
}

/* Figures */
figure {
    margin: var(--s-6) 0;
}

figure img {
    width: 100%;
    border: var(--bw) solid var(--border);
}

figcaption {
    margin-top: var(--s-2);
    font-size: var(--fs-sm);
    color: var(--muted);
    line-height: 1.55;
    padding-left: var(--s-3);
    border-left: 2px solid var(--border-strong);
}

/* ---------- Related materials ---------- */
.related-materials {
    margin-top: var(--s-8);
    padding-top: var(--s-6);
    border-top: var(--bw) solid var(--border);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}

.section-header h2,
.section-header h3 {
    font-size: var(--fs-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
    white-space: nowrap;
}

.divider-line {
    flex: 1 1 auto;
    height: var(--bw);
    background: var(--border);
    min-width: 24px;
}

.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-4);
}

.card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--surface);
    border: var(--bw) solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--s-5);
    color: var(--text);
    position: relative;
    overflow: hidden;
    transition: border-color var(--ease), background-color var(--ease);
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: var(--s-5);
    right: var(--s-5);
    height: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--ease);
}

.card:hover {
    background: var(--raised);
    border-color: var(--border-strong);
}

.card:hover::before {
    opacity: 1;
}

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

.card-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--s-2);
    margin-bottom: var(--s-4);
    font-size: var(--fs-xs);
}

.badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: var(--bw) solid rgba(212, 164, 94, 0.25);
    padding: 2px var(--s-2);
    border-radius: var(--r-sm);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    line-height: 1.6;
}

.badge.accent-badge {
    background: var(--accent2-soft);
    color: var(--accent2);
    border-color: rgba(146, 181, 162, 0.25);
}

.date {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.card h4 {
    font-size: 1.0625rem;
    line-height: 1.4;
    margin-bottom: var(--s-2);
    color: var(--text-strong);
}

.card h4 a:hover,
.card:hover h4 {
    color: var(--accent-strong);
}

.card p {
    flex-grow: 1;
    font-size: 0.9375rem;
    line-height: 1.65;
    color: var(--muted);
    margin-bottom: var(--s-4);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding-top: var(--s-3);
    border-top: var(--bw) solid var(--border);
    color: var(--faint);
    transition: color var(--ease);
}

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

.card-footer svg {
    width: 18px;
    height: 18px;
}

/* ---------- Footer ---------- */
footer {
    margin-top: var(--s-7);
    background: var(--surface);
    border-top: var(--bw) solid var(--border);
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: var(--s-6) var(--gutter);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--s-4);
}

.footer-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    color: var(--muted);
    font-size: var(--fs-sm);
}

.footer-center {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 var(--s-2);
}

.footer-center a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--s-3);
    color: var(--muted);
    font-size: var(--fs-sm);
    border-radius: var(--r);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 0.25em;
}

.footer-center a:hover {
    color: var(--accent-strong);
    text-decoration-color: var(--accent-line);
}

.dmca-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    min-height: 32px;
    padding: var(--s-1) var(--s-3);
    background: var(--raised);
    border: var(--bw) solid var(--border);
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
    color: var(--muted);
    letter-spacing: 0.04em;
    cursor: default;
}

.dmca-badge img,
.dmca-badge svg {
    max-height: 16px;
    width: auto;
    border-radius: 0;
}

/* ---------- Breakpoints ---------- */
@media (min-width: 480px) {
    :root {
        --gutter: 20px;
    }

    .article-title {
        font-size: 1.5rem;
    }

    .hero-visual {
        height: 260px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }

    th, td {
        min-width: 0;
    }
}

@media (min-width: 768px) {
    :root {
        --gutter: var(--s-6);
        --header-h: 64px;
    }

    body {
        font-size: 1.0625rem;
    }

    h1 { font-size: 1.625rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.125rem; }

    main {
        padding-top: var(--s-7);
        padding-bottom: var(--s-8);
    }

    .article-title {
        font-size: 1.75rem;
        margin-bottom: var(--s-6);
    }

    .hero-visual {
        height: 320px;
    }

    .content-body h2 {
        font-size: 1.3rem;
    }

    .content-body h3 {
        font-size: 1.125rem;
    }

    .content-body blockquote {
        padding: var(--s-5) var(--s-6);
    }

    pre {
        padding: var(--s-5);
    }

    .cards-grid {
        gap: var(--s-5);
    }

    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .footer-left {
        justify-content: flex-start;
    }
}

@media (min-width: 1024px) {
    body {
        font-size: 1.125rem;
    }

    h1 { font-size: 1.875rem; }

    .article-title {
        font-size: 1.875rem;
        line-height: 1.28;
    }

    .hero {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        gap: var(--s-7);
        align-items: stretch;
        margin-bottom: var(--s-8);
    }

    .hero-visual {
        height: 100%;
        min-height: 380px;
    }

    .hero-content .lead {
        font-size: 1.1875rem;
    }

    .content-body h2 {
        font-size: 1.375rem;
        margin-top: var(--s-8);
    }

    .content-body h3 {
        font-size: 1.1875rem;
    }

    .cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .hero-visual {
        min-height: 420px;
    }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media print {
    body {
        background: #fff;
        color: #111;
    }

    .site-header,
    .related-materials,
    footer {
        display: none;
    }

    img, video {
        filter: none;
    }
}