/* ==========================================================================
   ФинКальк — стили
   ========================================================================== */

:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --border: #e4eaf1;
    --text: #1b2a3a;
    --text-muted: #64748b;
    --accent: #1d5d8c;
    --accent-dark: #14476b;
    --accent-soft: #e8f0f8;
    --warm: #e08a3c;
    --shadow-sm: 0 1px 2px rgba(16, 36, 56, 0.04);
    --shadow-md: 0 4px 14px rgba(16, 36, 56, 0.06);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

.wrapper {
    max-width: 1180px;
    width: 100%;
    padding: 1rem;
}

h1, h2, h3, h4 {
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

/* ---------- РЕКЛАМНЫЕ МЕСТА ---------- */
.ad-slot {
    width: 100%;
    background: repeating-linear-gradient(
        45deg,
        #eef3f8,
        #eef3f8 12px,
        #e6edf4 12px,
        #e6edf4 24px
    );
    border: 1px dashed #c3d2e0;
    border-radius: var(--radius-md);
    color: #8ba0b5;
    font-size: 0.8rem;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 1rem 0;
    padding: 0 1rem;
    min-height: 90px;
}

.ad-slot--top { min-height: 90px; }
.ad-slot--inline { min-height: 100px; }
.ad-slot--footer { min-height: 120px; }

/* ---------- ШАПКА ---------- */
header {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.75rem;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1::before {
    content: "₽";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    background: var(--accent);
    color: #fff;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.logo p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 0.35rem;
    padding-left: 2.7rem;
}

nav ul {
    display: flex;
    gap: 0.35rem;
    list-style: none;
    flex-wrap: wrap;
}

nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 550;
    font-size: 0.95rem;
    padding: 0.55rem 1.1rem;
    border-radius: 40px;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

nav a:hover,
nav a:focus-visible {
    background: var(--accent-soft);
    color: var(--accent-dark);
    outline: none;
}

/* ---------- СЕКЦИИ ---------- */
section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    scroll-margin-top: 1rem;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.section-head .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.5rem;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-size: 0.95rem;
    font-weight: 700;
    flex-shrink: 0;
}

.section-head h2 {
    font-size: 1.55rem;
    color: var(--accent-dark);
}

.lead {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    max-width: 720px;
}

/* ---------- СЕТКА КАЛЬКУЛЯТОРА ---------- */
.calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.field label {
    font-size: 0.87rem;
    font-weight: 550;
    color: var(--text-muted);
}

.field input,
.field select {
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    min-height: 48px;
}

.field input:disabled,
.field select:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(29, 93, 140, 0.12);
}

.field .hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    transition: opacity 0.15s;
}

.field--checkbox {
    padding: 0.6rem 0.8rem;
    background: var(--surface-soft);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.95rem 1.6rem;
    border-radius: var(--radius-sm);
    font-weight: 650;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
    margin-top: 0.4rem;
    box-shadow: 0 4px 12px rgba(29, 93, 140, 0.25);
    min-height: 50px;
}

.btn:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 16px rgba(29, 93, 140, 0.3);
}

.btn:active {
    transform: scale(0.98);
}

.btn--ghost {
    background: transparent;
    color: var(--accent-dark);
    border: 1.5px solid var(--accent);
    box-shadow: none;
    margin-top: 0;
}

.btn--ghost:hover {
    background: var(--accent-soft);
    box-shadow: none;
}

/* ---------- РЕЗУЛЬТАТЫ ---------- */
.results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.result-card {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.result-card .label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

.result-card .value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent-dark);
    line-height: 1.25;
    word-break: break-word;
}

.result-card .sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.verdict {
    background: linear-gradient(135deg, #e8f0f8, #f0f6fc);
    border-left: 4px solid var(--accent);
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 550;
    font-size: 0.95rem;
    color: var(--accent-dark);
    margin-bottom: 0.5rem;
}

/* ---------- ГРАФИК ---------- */
.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
    margin-top: 1.25rem;
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    border: 1px solid var(--border);
}

/* ---------- ПОЯСНЕНИЯ ---------- */
.explanation {
    background: var(--surface-soft);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.4rem;
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    font-size: 0.92rem;
    color: #33465a;
}

.explanation h4 {
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--accent-dark);
    margin-bottom: 0.6rem;
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.explanation h4:first-child {
    margin-top: 0;
}

.explanation h4::before {
    content: "?";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    background: var(--accent-soft);
    color: var(--accent-dark);
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.explanation p {
    margin-bottom: 0.7rem;
}

.explanation p:last-child {
    margin-bottom: 0;
}

.formula {
    display: inline-block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.15rem 0.5rem;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85rem;
    color: var(--accent-dark);
    white-space: nowrap;
    margin: 0.15rem 0;
}

/* ---------- ФУТЕР ---------- */
footer {
    text-align: center;
    padding: 1.5rem 1rem 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    max-width: 720px;
    margin: 0 auto;
}

footer .disclaimer {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* ---------- АДАПТИВНОСТЬ ---------- */
@media (max-width: 860px) {
    .calc-grid {
        grid-template-columns: 1fr;
    }
    section {
        padding: 1.5rem;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }
    .wrapper {
        padding: 0.6rem;
    }
    header {
        padding: 1.25rem;
        gap: 1rem;
    }
    .logo h1 {
        font-size: 1.45rem;
    }
    .logo h1::before {
        width: 1.9rem;
        height: 1.9rem;
        font-size: 1rem;
    }
    .logo p {
        padding-left: 2.4rem;
        font-size: 0.85rem;
    }
    nav {
        width: 100%;
    }
    nav ul {
        justify-content: space-between;
        gap: 0.25rem;
    }
    nav a {
        flex: 1;
        text-align: center;
        padding: 0.6rem 0.5rem;
        font-size: 0.88rem;
        background: var(--surface-soft);
    }
    section {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    .section-head h2 {
        font-size: 1.25rem;
    }
    .section-head .badge {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
        border-radius: 10px;
    }
    .result-card .value {
        font-size: 1.2rem;
    }
    .chart-container {
        height: 260px;
        padding: 0.5rem;
    }
    .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.02rem;
    }
    .ad-slot {
        min-height: 70px;
        font-size: 0.7rem;
        margin: 0.75rem 0;
    }
    .ad-slot--top { min-height: 70px; }
    .ad-slot--inline { min-height: 80px; }
    .ad-slot--footer { min-height: 90px; }
    .explanation {
        padding: 1rem 1.1rem;
        font-size: 0.88rem;
    }
}

@media (max-width: 380px) {
    .results {
        grid-template-columns: 1fr;
    }
    nav a {
        font-size: 0.8rem;
        padding: 0.55rem 0.3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
.hero {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 620px;
    object-fit: contain;
    border-radius: calc(var(--radius-lg) - 8px);
}

@media (max-width: 640px) {
    .hero {
        padding: 0.4rem;
        border-radius: var(--radius-md);
        margin-bottom: 1rem;
    }

    .hero img {
        max-height: 360px;
        border-radius: calc(var(--radius-md) - 4px);
    }
}
/* ---------- СТРАНИЦА «СОВЕТЫ» ---------- */
.tips-group-title {
    font-size: 1.15rem;
    font-weight: 650;
    color: var(--accent-dark);
    margin: 1.75rem 0 0.9rem;
    padding-left: 0.9rem;
    border-left: 4px solid var(--accent);
}

.tips-group-title:first-of-type {
    margin-top: 0.5rem;
}

.tip {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: box-shadow 0.18s, border-color 0.18s;
    overflow: hidden;
}

.tip[open] {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.tip summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}

.tip summary::-webkit-details-marker {
    display: none;
}

.tip summary:hover {
    background: rgba(29, 93, 140, 0.04);
}

.tip-title {
    flex: 1;
    line-height: 1.35;
}

.tip-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent-dark);
    flex-shrink: 0;
    position: relative;
    transition: transform 0.2s, background 0.2s;
}

.tip-arrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px;
    transition: transform 0.2s;
}

.tip[open] .tip-arrow {
    background: var(--accent);
    color: #fff;
}

.tip[open] .tip-arrow::before {
    transform: rotate(-135deg);
    margin-top: 3px;
}

.tip-body {
    padding: 0 1.25rem 1.25rem;
    color: #33465a;
    font-size: 0.95rem;
    line-height: 1.6;
    animation: tipReveal 0.25s ease-out;
}

.tip-body p {
    margin-bottom: 0.75rem;
}

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

.tip-body a {
    color: var(--accent-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

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

/* Видео 16:9 внутри статьи */
.tip-video {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    margin-top: 1rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
}

.tip-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@keyframes tipReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tip-body {
        animation: none;
    }
}

@media (max-width: 640px) {
    .tip summary {
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
    }

    .tip-body {
        padding: 0 1rem 1rem;
        font-size: 0.92rem;
    }

    .tips-group-title {
        font-size: 1.05rem;
    }
}