/*
 * IN2E — design system v2
 * Distinctive, editorial, Persian-first. Light theme by default.
 */

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/vazirmatn/Vazirmatn-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/vazirmatn/Vazirmatn-Medium.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/vazirmatn/Vazirmatn-SemiBold.woff2") format("woff2");
}

@font-face {
    font-family: "Vazirmatn";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/vazirmatn/Vazirmatn-Bold.woff2") format("woff2");
}

/* ---------------------------------------------------------------- tokens */

:root {
    --font-sans: "Vazirmatn", "Segoe UI", Tahoma, "Noto Sans Arabic", sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, "Cascadia Code", Consolas, monospace;

    /* Surfaces */
    --bg: #f5f6f8;
    --bg-soft: #eceef2;
    --bg-tint: #f0f2f6;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --surface-3: #f1f3f6;

    /* Text */
    --text: #0f1419;
    --text-2: #3d4654;
    --text-3: #6b7280;
    --text-4: #9ca3af;

    /* Lines */
    --line: #e5e7eb;
    --line-strong: #d1d5db;

    /* Brand — deep indigo, distinctive */
    --primary: #1e3a8a;
    --primary-strong: #172554;
    --primary-soft: #eff2fa;
    --primary-ink: #ffffff;
    --primary-glow: rgba(30, 58, 138, 0.08);

    /* Accent — warm amber */
    --accent: #c2410c;
    --accent-soft: #fef3e8;

    /* Status */
    --success: #059669;
    --success-soft: #ecfdf5;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --warning: #d97706;
    --warning-soft: #fffbeb;

    /* Radius */
    --r-xs: 4px;
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 24px;

    /* Shadow — subtle, border-first */
    --sh-xs: 0 1px 2px rgba(15, 20, 25, 0.04);
    --sh-sm: 0 2px 8px -2px rgba(15, 20, 25, 0.06);
    --sh: 0 8px 24px -12px rgba(15, 20, 25, 0.12);

    /* Layout */
    --container: 1200px;
    --gutter: clamp(16px, 3vw, 24px);

    /* Type scale */
    --step--2: 0.75rem;
    --step--1: 0.875rem;
    --step-0: 1rem;
    --step-1: 1.125rem;
    --step-2: 1.25rem;
    --step-3: 1.5rem;
    --step-4: 2rem;
    --step-5: 2.5rem;
    --step-6: 3.25rem;

    --leading-tight: 1.3;
    --leading: 1.75;
}

html[data-theme="dark"] {
    --brand-mark: #93a9ff;
    --bg: #0c0f14;
    --bg-soft: #13171e;
    --bg-tint: #11151c;
    --surface: #151a22;
    --surface-2: #1a2029;
    --surface-3: #1f2630;

    --text: #e8eaed;
    --text-2: #a8adb5;
    --text-3: #7c838d;
    --text-4: #5a6169;

    --line: #252b35;
    --line-strong: #333a45;

    --primary: #6b8cff;
    --primary-strong: #93a9ff;
    --primary-soft: #1a2340;
    --primary-ink: #0c0f14;
    --primary-glow: rgba(107, 140, 255, 0.1);

    --accent: #f0a060;
    --accent-soft: #2a1f14;

    --success: #34d399;
    --success-soft: #0f2619;
    --danger: #f87171;
    --danger-soft: #2a1414;
    --warning: #fbbf24;
    --warning-soft: #2a2310;

    --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --sh-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
    --sh: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) {
        --bg: #0c0f14;
        --bg-soft: #13171e;
        --bg-tint: #11151c;
        --surface: #151a22;
        --surface-2: #1a2029;
        --surface-3: #1f2630;
        --text: #e8eaed;
        --text-2: #a8adb5;
        --text-3: #7c838d;
        --text-4: #5a6169;
        --line: #252b35;
        --line-strong: #333a45;
        --primary: #6b8cff;
        --primary-strong: #93a9ff;
        --primary-soft: #1a2340;
        --primary-ink: #0c0f14;
        --primary-glow: rgba(107, 140, 255, 0.1);
        --accent: #f0a060;
        --accent-soft: #2a1f14;
        --success: #34d399;
        --success-soft: #0f2619;
        --danger: #f87171;
        --danger-soft: #2a1414;
        --warning: #fbbf24;
        --warning-soft: #2a2310;
        --sh-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
        --sh-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.4);
        --sh: 0 8px 24px -12px rgba(0, 0, 0, 0.6);
    }
}

/* ---------------------------------------------------------------- base */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: hidden !important; max-width: 100vw; }
body { overflow-x: hidden !important; max-width: 100vw; }

body {
    margin: 0;
    background: var(--bg);
    overflow-x: hidden;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: var(--leading);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
h1, h2, h3, h4 {
    margin: 0 0 0.5em;
    line-height: var(--leading-tight);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { margin: 0 0 1em; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }

img, svg, video, iframe, table, pre, code { max-width: 100%; word-break: break-word; overflow-wrap: break-word; }
.flex-shrink { min-width: 0; }

code, pre, .mono {
    font-family: var(--font-mono);
    font-size: 0.875em;
    direction: ltr;
    unicode-bidi: embed;
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; inset-inline-start: -9999px; top: 0;
    background: var(--primary); color: var(--primary-ink);
    padding: 10px 16px; z-index: 100; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { inset-inline-start: 0; }

.muted { color: var(--text-3); font-size: var(--step--1); }

/* ----------------------------------------------------------- breadcrumb */

.breadcrumb {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-block: 10px;
}

.breadcrumb ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    font-size: var(--step--1);
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-3);
}

.breadcrumb a {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb a:hover { color: var(--primary); text-decoration: none; }

.breadcrumb span[aria-current="page"] {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb__sep {
    color: var(--text-4);
    font-size: 0.7rem;
    margin-inline: 2px;
}

/* --------------------------------------------------------------- layout */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
    overflow: hidden;
    box-sizing: border-box;
}

.site-main { min-height: 50vh; padding-bottom: var(--step-5); overflow: hidden; max-width: 100%; }

.section { padding-block: clamp(40px, 6vw, 80px); }
.section--top { padding-top: clamp(20px, 3vw, 36px); }
.section--tint { background: var(--bg-soft); }

.section__head { margin-bottom: var(--step-3); max-width: 62ch; }
.section__title { margin-bottom: 0.25em; }
.section__lead { color: var(--text-2); margin: 0; font-size: var(--step-0); }
.section__count { color: var(--text-3); font-size: var(--step--1); margin: 0.4em 0 0; }
.section__more { margin-top: var(--step-3); text-align: center; }

/* --------------------------------------------------------------- header */

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    max-width: 100vw;
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: var(--step-2);
    min-height: 60px;
    flex-wrap: wrap;
    min-width: 0;
    overflow: hidden;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    flex-shrink: 0;
    text-decoration: none;
}
.brand:hover { color: var(--text); text-decoration: none; }

.brand__mark { color: var(--primary); display: inline-flex; width: 28px; height: 28px; flex-shrink: 0; transition: color 0.2s; }
html[data-theme="dark"] .brand__mark { color: var(--primary-strong); }

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-weight: 700; font-size: var(--step-1); letter-spacing: -0.03em; }
.brand__tagline { font-size: 0.7rem; color: var(--text-3); letter-spacing: 0.01em; }

@media (max-width: 640px) {
    .brand__tagline { display: none; }
    .brand__name { font-size: var(--step-0); }
}

.site-nav {
    order: 3;
    width: 100%;
    border-top: 1px solid var(--line);
    padding-block: 4px;
}

@media (max-width: 640px) {
    .site-nav.is-open {
        display: block;
    }
    .site-nav:not(.is-open) {
        display: none;
    }
}

.site-nav__list {
    display: flex;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    overflow-x: hidden;
    scrollbar-width: none;
}
.site-nav__list::-webkit-scrollbar { display: none; }

.site-nav__list a {
    display: block;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: var(--step--1);
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.15s, color 0.15s;
}
.site-nav__list a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.site-nav__list a[aria-current="page"] {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 600;
}

.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-inline-start: auto;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
}

.nav-toggle__bar, .nav-toggle__bar::before, .nav-toggle__bar::after {
    display: block; width: 18px; height: 2px;
    background: var(--text); border-radius: 2px; position: relative;
}
.nav-toggle__bar::before, .nav-toggle__bar::after { content: ""; position: absolute; inset-inline-start: 0; }
.nav-toggle__bar::before { top: -6px; }
.nav-toggle__bar::after { top: 6px; }

.header-search {
    display: none;
    position: relative;
    margin-inline-start: auto;
}
.header-search input {
    width: 280px;
    padding: 10px 14px 10px 42px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: var(--step--1);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s, width 0.2s;
}
.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
    width: 320px;
}
.header-search button {
    position: absolute;
    inset-inline-start: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none; border: 0;
    color: var(--text-3);
    cursor: pointer;
    display: flex; padding: 4px;
}

@media (min-width: 900px) {
    .site-nav { order: 0; width: auto; border-top: 0; padding-block: 0; margin-inline-start: var(--step-2); }
    .nav-toggle { display: none; }
    .header-search { display: block; }
}

/* ----------------------------------------------------------------- hero */

.hero {
    position: relative;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-block: clamp(48px, 8vw, 96px);
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 90% -10%, var(--primary-glow), transparent 60%),
        radial-gradient(ellipse 60% 40% at 10% 110%, var(--accent-soft), transparent 50%);
    pointer-events: none;
}

.hero__inner {
    position: relative;
    width: 100%;
    max-width: min(720px, 100%);
}

.hero__grid {
    display: grid;
    gap: var(--step-3);
    align-items: start;
}

@media (min-width: 768px) {
    .hero__grid {
        grid-template-columns: 1.2fr 1fr;
        gap: var(--step-4);
    }
}

.hero__hint-label {
    font-size: var(--step--1);
    color: var(--text-3);
    font-weight: 600;
    margin: 0 0 8px;
}

.hero__hint-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.hero__hint-grid a {
    color: var(--text-2);
    text-decoration: none;
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-size: var(--step--2);
    text-align: center;
    transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}

.hero__hint-grid a:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
    text-decoration: none;
}

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

.hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 999px;
    font-size: var(--step--1);
    font-weight: 600;
    margin-bottom: var(--step-2);
}

.hero__title {
    font-size: clamp(1.875rem, 5.5vw, 3rem);
    margin-bottom: 0.3em;
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.hero__text {
    color: var(--text-2);
    font-size: var(--step-1);
    max-width: min(58ch, 100%);
    line-height: 1.7;
}

.search-box {
    display: flex;
    gap: 8px;
    margin-top: var(--step-3);
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--sh-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 12px 14px;
    font: inherit;
    font-size: var(--step-1);
    color: var(--text);
}

.search-box input:focus { outline: none; }

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow), var(--sh-sm);
}

.hero__hint {
    margin-top: var(--step-2);
    color: var(--text-3);
    font-size: var(--step--1);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.hero__hint a {
    color: var(--text-3);
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.75rem;
    transition: border-color 0.15s, color 0.15s;
}
.hero__hint a:hover { border-color: var(--primary); color: var(--primary); }

/* --------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font: inherit;
    font-weight: 600;
    font-size: var(--step-0);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    line-height: 1.4;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn--primary {
    background: var(--primary);
    color: var(--primary-ink);
    border-color: var(--primary);
}
.btn--primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: var(--primary-ink); }

.btn--ghost {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--text);
}
.btn--ghost:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--text); }

.btn--danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }

.btn--sm { padding: 7px 14px; font-size: var(--step--1); }
.btn--xs { padding: 4px 10px; font-size: 0.78rem; border-radius: var(--r-xs); }
.btn--block { width: 100%; }

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    box-shadow: var(--sh-xs);
}

.grid { display: grid; gap: var(--step-2); }

@media (min-width: 640px) {
    .grid--tools { grid-template-columns: repeat(2, 1fr); }
    .grid--categories { grid-template-columns: repeat(2, 1fr); }
    .grid--articles { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
    .grid--tools { grid-template-columns: repeat(3, 1fr); }
    .grid--categories { grid-template-columns: repeat(3, 1fr); }
    .grid--articles { grid-template-columns: repeat(3, 1fr); }
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.tool-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--sh-sm);
    transform: translateY(-3px);
}
.tool-card:hover::before { opacity: 1; }

.tool-card__head { display: flex; gap: 12px; align-items: flex-start; }

.tool-card__badge {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: var(--primary-soft);
    color: var(--primary);
}

.tool-card__title { margin: 0; font-size: var(--step-1); font-weight: 600; }
.tool-card__title a { color: var(--text); }
.tool-card__title a:hover { color: var(--primary); text-decoration: none; }

.tool-card__category {
    margin: 2px 0 0;
    font-size: var(--step--2);
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-card__desc {
    margin: 0;
    color: var(--text-2);
    font-size: var(--step--1);
    flex: 1;
    line-height: 1.6;
}

.tool-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: var(--step--1);
    color: var(--primary);
    margin-top: auto;
}
.tool-card__link:hover { text-decoration: none; }
.tool-card__link svg { transition: transform 0.15s; }
.tool-card:hover .tool-card__link svg { transform: translateX(-3px); }

.category-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    color: var(--text);
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
    text-decoration: none;
}

.category-card:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
    text-decoration: none;
    color: var(--text);
    transform: translateY(-2px);
}

.category-card__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--text-2);
    transition: background-color 0.2s, color 0.2s;
}
.category-card:hover .category-card__icon {
    background: var(--primary);
    color: var(--primary-ink);
}

.category-card__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.category-card__title { font-weight: 600; font-size: var(--step-1); }
.category-card__desc { color: var(--text-3); font-size: var(--step--1); margin-top: 2px; }
.category-card__count { font-size: var(--step--1); color: var(--text-3); white-space: nowrap; font-weight: 500; }

.article-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    transition: border-color 0.2s, transform 0.2s;
}
.article-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.article-card__category { margin: 0 0 6px; font-size: var(--step--2); color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.article-card__title { margin: 0 0 8px; font-size: var(--step-1); font-weight: 600; }
.article-card__title a { color: var(--text); }
.article-card__title a:hover { color: var(--primary); text-decoration: none; }
.article-card__excerpt { margin: 0 0 10px; color: var(--text-2); font-size: var(--step--1); line-height: 1.6; }
.article-card__meta { margin: 0; color: var(--text-3); font-size: var(--step--2); display: flex; gap: 6px; align-items: center; }

/* -------------------------------------------------------------- filters */

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--step-2); }
.filter-bar input[type="search"] {
    flex: 1; min-width: 0; max-width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--step-3); }
.chip {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--step--1);
    font-weight: 500;
    transition: all 0.15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); text-decoration: none; }
.chip--active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }

/* --------------------------------------------------------------- about */

.about-panel {
    display: grid;
    gap: var(--step-3);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: clamp(24px, 4vw, 48px);
}
@media (min-width: 860px) { .about-panel { grid-template-columns: 1.35fr 1fr; } }
.about-panel p { color: var(--text-2); line-height: 1.75; }
.about-panel__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: var(--step-2); }
.about-panel__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; align-content: start; }
.about-panel__facts li {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.about-panel__facts strong { font-size: var(--step-0); font-weight: 600; }
.about-panel__facts span { color: var(--text-3); font-size: var(--step--1); }

/* ------------------------------------------------------------ tool page */

.tool-layout, .article-layout {
    display: grid;
    gap: var(--step-3);
}
@media (min-width: 940px) {
    .tool-layout { grid-template-columns: minmax(0, 1fr) 300px; }
    .article-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}
@media (max-width: 939px) {
    .tool-aside, .article__aside { position: static; }
}

.tool-header { margin-bottom: var(--step-3); }
.tool-header__title {
    font-size: clamp(1.5rem, 4vw, 2.125rem);
    margin-bottom: 0.3em;
    letter-spacing: -0.03em;
}
.tool-header__lead { color: var(--text-2); font-size: var(--step-1); margin-bottom: 0.4em; line-height: 1.6; }
.tool-header__category { margin: 0; font-size: var(--step--1); }
.tool-header__category a { color: var(--text-3); }
.tool-header__category a:hover { color: var(--primary); }

.tool-calculator {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--step-3);
    margin-bottom: var(--step-3);
    box-shadow: var(--sh-xs);
}

.tool-aside, .article__aside { display: grid; gap: var(--step-2); align-content: start; position: sticky; top: 80px; align-self: start; }

.aside-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
}
.aside-block__title {
    font-size: var(--step-0);
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}
.aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--step--1); }
.aside-list--bullets { padding-inline-start: 18px; list-style: disc; }
.aside-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: var(--step--1); color: var(--text-2); }

.content-block { margin-top: var(--step-3); }
.content-block h2 {
    font-size: var(--step-2);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    margin-bottom: var(--step-2);
}

.prose { color: var(--text-2); line-height: 1.8; }
.prose h2, .prose h3 { color: var(--text); margin-top: 1.5em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-inline-start: 22px; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose code { background: var(--surface-3); padding: 2px 6px; border-radius: var(--r-xs); font-size: 0.85em; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1em; font-size: var(--step--1); }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: start; }
.prose th { background: var(--surface-2); color: var(--text); font-weight: 600; }

.faq { display: grid; gap: 8px; }
.faq__item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 14px 16px;
    transition: border-color 0.15s;
}
.faq__item:hover { border-color: var(--line-strong); }
.faq__item summary { cursor: pointer; font-weight: 600; color: var(--text); list-style: none; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::before { content: "+"; margin-inline-end: 8px; color: var(--primary); font-weight: 700; }
.faq__item[open] summary::before { content: "−"; }
.faq__item[open] summary { margin-bottom: 8px; }

/* --------------------------------------------------------------- forms */

.field { display: grid; gap: 6px; margin-bottom: var(--step-2); }
.field label { font-weight: 600; font-size: var(--step--1); color: var(--text-2); }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: var(--step-0);
    transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.field textarea { resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--surface);
}

.field-row { display: grid; gap: var(--step-2); }
@media (min-width: 720px) {
    .field-row { grid-template-columns: repeat(2, 1fr); }
    .field-row--3 { grid-template-columns: repeat(3, 1fr); }
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--step--1);
    color: var(--text-2);
    margin-bottom: var(--step-2);
    cursor: pointer;
}

.fieldset {
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: var(--step-2);
    margin: 0 0 var(--step-2);
}
.fieldset legend { padding-inline: 8px; font-weight: 600; font-size: var(--step--1); color: var(--text-2); }

.alert {
    border-radius: var(--r-sm);
    padding: 12px 16px;
    margin-bottom: var(--step-2);
    border: 1px solid transparent;
    font-size: var(--step--1);
}
.alert--success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.alert--error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert--warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 20%, transparent); }
.alert--info { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 20%, transparent); }

/* ----------------------------------------------------------- empty/error */

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r);
    padding: var(--step-4) var(--step-2);
    text-align: center;
    color: var(--text-2);
}
.empty-state h2 { font-size: var(--step-2); }

.error-page { text-align: center; padding-block: clamp(30px, 8vw, 90px); }
.error-page__code {
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    line-height: 1;
    letter-spacing: -0.04em;
}
.error-page__title { margin: 0.3em 0 0.5em; }
.error-page__text { color: var(--text-2); max-width: min(52ch, 100%); margin-inline: auto; }
.error-page__actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: var(--step-3); }

/* ------------------------------------------------------------- articles */

.prose-page { max-width: min(72ch, 100%); }
.prose-page .lead { font-size: var(--step-1); color: var(--text-2); line-height: 1.7; }

.article {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: clamp(20px, 3vw, 40px);
}
.article__category { margin: 0 0 6px; color: var(--primary); font-size: var(--step--1); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.article__title { font-size: clamp(1.375rem, 3.5vw, 2rem); letter-spacing: -0.02em; }
.article__meta {
    color: var(--text-3);
    font-size: var(--step--1);
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: var(--step-3);
    padding-bottom: var(--step-2);
    border-bottom: 1px solid var(--line);
}
.article__content { color: var(--text-2); }
.article__content h2 { color: var(--text); margin-top: 1.6em; letter-spacing: -0.01em; }
.article__content h3 { color: var(--text); margin-top: 1.3em; }
.article__content ul, .article__content ol { padding-inline-start: 22px; }
.article__content pre {
    background: var(--surface-3);
    padding: 14px;
    border-radius: var(--r-sm);
    overflow-x: auto;
    font-size: 0.85em;
}

/* ----------------------------------------------------------- pagination */

.pagination ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    padding: 0;
    margin: var(--step-3) 0 0;
}
.pagination a, .pagination span {
    display: inline-block;
    min-width: 38px;
    text-align: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: var(--step--1);
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination span[aria-current="page"] {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-ink);
}

/* -------------------------------------------------------------- support */

.support-grid {
    display: grid;
    gap: var(--step-2);
    grid-template-columns: 1fr;
    margin: var(--step-2) 0;
}
@media (min-width: 640px) { .support-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .support-grid { grid-template-columns: repeat(4, 1fr); } }

.support-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.support-card h3 { margin: 0; font-size: var(--step-1); }
.support-card p { margin: 0; color: var(--text-2); font-size: var(--step--1); flex: 1; }

.crypto-list { display: grid; gap: 10px; margin: var(--step-2) 0; }
.crypto-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.crypto-item__label { font-size: var(--step--1); font-weight: 600; color: var(--text-2); }
.crypto-item__address {
    font-size: 0.8rem;
    color: var(--text);
    background: var(--surface-3);
    padding: 6px 10px;
    border-radius: var(--r-xs);
    word-break: break-all;
    user-select: all;
}

/* -------------------------------------------------------------- contact */

.contact-layout { display: grid; gap: var(--step-3); margin-top: var(--step-3); }
@media (min-width: 860px) { .contact-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.contact-form .btn { margin-top: 4px; }
.contact-aside { display: grid; gap: var(--step-2); align-content: start; }

/* ----------------------------------------------------------------- ads */

.ad-slot {
    margin-block: var(--step-3);
    min-height: 0;
    display: block;
    overflow: hidden;
    max-width: 100%;
}
.ad-slot:empty, .ad-slot__inner:empty {
    display: none;
}
.ad-slot__inner { width: 100%; text-align: center; max-width: 100%; overflow: hidden; }
.tool-inline-ad, .article-inline-ad { margin-block: var(--step-2); }
.yn-bnr { max-width: 100%; overflow: hidden; display: block; }
.yn-bnr img, .yn-bnr iframe { max-width: 100%; height: auto; }

/* --------------------------------------------------------------- footer */

.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-top: var(--step-4);
    margin-top: var(--step-4);
    overflow: hidden;
    max-width: 100vw;
}
.site-footer__grid {
    display: grid;
    gap: var(--step-3);
    padding-bottom: var(--step-3);
}
@media (min-width: 700px) { .site-footer__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .site-footer__grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }

.site-footer__title { font-size: var(--step-0); font-weight: 600; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: var(--step--1); }
.site-footer a { color: var(--text-2); transition: color 0.15s; }
.site-footer a:hover { color: var(--primary); }
.site-footer__about { color: var(--text-3); font-size: var(--step--1); max-width: 46ch; margin-top: 12px; line-height: 1.6; }
.brand--footer { margin-bottom: 4px; }
.site-footer__bottom {
    border-top: 1px solid var(--line);
    padding-block: var(--step-2);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    color: var(--text-3);
    font-size: var(--step--1);
    max-width: 100%;
    overflow: hidden;
}
.site-footer__bottom p { margin: 0; }

/* ---------------------------------------------------------- theme toggle */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-soft);
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }
.theme-toggle__moon { display: none; }
html[data-theme="dark"] .theme-toggle__sun { display: none; }
html[data-theme="dark"] .theme-toggle__moon { display: block; }
@media (prefers-color-scheme: dark) {
    html:not([data-theme="light"]) .theme-toggle__sun { display: none; }
    html:not([data-theme="light"]) .theme-toggle__moon { display: block; }
    html:not([data-theme="light"]) .brand__mark { color: var(--primary-strong); }
}

/* --------------------------------------------------------------- admin */

.admin-body { background: var(--bg); }
.admin-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-header__inner {
    max-width: 1400px;
    margin-inline: auto;
    padding: 12px var(--gutter);
    display: flex;
    align-items: center;
    gap: var(--step-2);
}
.admin-header__actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.admin-header__logout { margin: 0; }

.admin-layout {
    max-width: 1400px;
    margin-inline: auto;
    padding: var(--step-3) var(--gutter);
    display: grid;
    gap: var(--step-3);
}
@media (min-width: 900px) { .admin-layout { grid-template-columns: 220px minmax(0, 1fr); } }

.admin-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; }
.admin-nav a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    color: var(--text-2);
    font-size: var(--step--1);
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
}
.admin-nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.admin-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

.admin-page { display: grid; gap: var(--step-2); }
.admin-page__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--step-2); }
.admin-page__head h1 { margin: 0; font-size: var(--step-3); }
.admin-page__head p { margin: 0; }

.stat-grid { display: grid; gap: var(--step-2); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
    display: grid;
    gap: 2px;
}
.stat-card__label { color: var(--text-3); font-size: var(--step--1); }
.stat-card__value { font-size: var(--step-4); font-weight: 700; line-height: 1.2; }
.stat-card__note { color: var(--text-3); font-size: 0.78rem; }

.admin-grid { display: grid; gap: var(--step-2); }
@media (min-width: 1000px) { .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--step-2); margin-bottom: var(--step-2); }
.card__head h2 { margin: 0; font-size: var(--step-1); }

.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th, .table td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--text-3); font-weight: 600; white-space: nowrap; }
.table__actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.table__actions form { margin: 0; }

.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--text-2);
    font-size: 0.75rem;
    white-space: nowrap;
    font-weight: 500;
}
.pill--published, .pill--active, .pill--answered { background: var(--success-soft); color: var(--success); }
.pill--draft, .pill--read { background: var(--warning-soft); color: var(--warning); }
.pill--archived, .pill--inactive, .pill--spam { background: var(--surface-3); color: var(--text-3); }
.pill--new { background: var(--primary-soft); color: var(--primary); }

.admin-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.admin-feed__title { display: block; font-weight: 600; }
.admin-feed__meta { display: block; color: var(--text-3); font-size: 0.78rem; }

.admin-form { display: grid; }
.admin-form--flat { padding: 0; border: 0; background: transparent; box-shadow: none; }
.admin-form__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.admin-login { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.admin-login__card {
    width: 100%;
    max-width: min(400px, 100%);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--step-3);
    box-shadow: var(--sh-sm);
}
.admin-login__title { font-size: var(--step-3); margin-bottom: 6px; }
.admin-login__lead { color: var(--text-3); font-size: var(--step--1); margin-bottom: var(--step-2); }
.admin-login__back { margin: var(--step-2) 0 0; text-align: center; font-size: var(--step--1); }

/* ------------------------------------------------------------- a11y */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

@media print {
    .site-header, .site-footer, .theme-toggle, .ad-slot, .tool-aside { display: none !important; }
    body { background: #fff; color: #000; }
}

/* ----------------------------------------------------------- calculator result */

.calc-result {
    margin-top: var(--step-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: var(--step-2);
}
.calc-result__grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr;
}
@media (min-width: 640px) {
    .calc-result__grid { grid-template-columns: repeat(2, 1fr); }
}
.calc-result__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.calc-result__label { font-size: var(--step--2); color: var(--text-3); font-weight: 500; }
.calc-result__value { font-size: var(--step-0); font-weight: 600; color: var(--text); word-break: break-all; }
.calc-result__actions { margin-top: var(--step-2); display: flex; gap: 8px; }
.calc-result__pre {
    background: var(--surface-3);
    padding: 14px;
    border-radius: var(--r-sm);
    overflow-x: auto;
    font-size: 0.85em;
    line-height: 1.6;
    max-height: 400px;
}
.calc-error {
    margin-top: var(--step-2);
    padding: 12px 16px;
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
    border-radius: var(--r-sm);
    font-size: var(--step--1);
}
.calc-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.calc-table th, .calc-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: start; }
.calc-table th { background: var(--surface-2); font-weight: 600; }
.vlsm-table-wrap { overflow-x: auto; }
.qr-output { text-align: center; padding: var(--step-2); }
.qr-output img { max-width: 100%; height: auto; border-radius: var(--r-sm); }
