/* ============================================================
   GreenExchange — стили правовых страниц (оферта, политика, AML/KYC)
   Общий файл для oferta.html, privacy-policy.html, aml-kyc.html
   ============================================================ */

:root {
    --green: #3BA688;
    --green-dark: #1D5D52;
    --ink: #333;
    --text: #444;
    --muted: #666;
    --bg: #ffffff;
    --bg-soft: #f8fafc;
    --border: #e2e8f0;
    --header-h: 82px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== ХЕДЕР ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
    margin: 0;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 1rem;
    font-family: inherit;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--green);
}

.nav-link.active {
    color: var(--green);
}

/* ===== ДРОПДАУН «ПРАВИЛА» ===== */
.has-dropdown {
    position: relative;
}

.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dropdown-toggle .caret {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.3s ease;
}

.has-dropdown:hover .dropdown-toggle .caret,
.has-dropdown:focus-within .dropdown-toggle .caret,
.has-dropdown.open .dropdown-toggle .caret {
    transform: rotate(-135deg) translateY(1px);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    min-width: 250px;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12);
    padding: 0.5rem;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* невидимый «мост», чтобы дропдаун не закрывался в зазоре при наведении */
.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.has-dropdown:hover .dropdown-menu,
.has-dropdown:focus-within .dropdown-menu,
.has-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.7rem 0.9rem;
    border-radius: 9px;
    color: #333;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-menu a:hover {
    background: var(--bg-soft);
    color: var(--green);
}

.dropdown-menu a.active {
    color: var(--green);
    background: rgba(59, 166, 136, 0.08);
}

/* ===== КНОПКА AML-ПРОВЕРКИ ===== */
.aml-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.05rem;
    background: linear-gradient(45deg, var(--green), var(--green-dark));
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.aml-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 166, 136, 0.35);
    color: #fff;
}

.aml-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ===== БУРГЕР ===== */
.burger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
}

.burger span {
    width: 25px;
    height: 3px;
    background: #333;
    border-radius: 2px;
    transition: 0.3s;
}

/* ===== ШАПКА ДОКУМЕНТА ===== */
.legal-hero {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    padding: calc(var(--header-h) + 48px) 0 48px;
    text-align: center;
}

.legal-hero h1 {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.legal-hero p {
    opacity: 0.92;
    max-width: 680px;
    margin: 0 auto;
    font-size: 1.05rem;
}

.doc-meta {
    display: inline-flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.3rem;
}

.doc-meta span {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
}

/* ===== МАКЕТ: ОГЛАВЛЕНИЕ + КОНТЕНТ ===== */
.legal-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 3rem;
    align-items: start;
    padding: 48px 0 72px;
}

/* Оглавление (sticky на десктопе, сворачиваемое на мобильных через <details>) */
.legal-toc {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    align-self: start;
}

.legal-toc > summary {
    list-style: none;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 1rem;
    cursor: default;
}

.legal-toc > summary::-webkit-details-marker {
    display: none;
}

.legal-toc nav {
    border-left: 2px solid var(--border);
}

.legal-toc a {
    display: block;
    padding: 0.4rem 0 0.4rem 1rem;
    margin-left: -2px;
    border-left: 2px solid transparent;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-toc a:hover {
    color: var(--green);
}

.legal-toc a.active {
    color: var(--green-dark);
    border-left-color: var(--green);
}

/* ===== КОНТЕНТ ДОКУМЕНТА ===== */
.legal-content {
    max-width: 800px;
}

.legal-content section {
    scroll-margin-top: calc(var(--header-h) + 16px);
}

.legal-intro {
    font-size: 1.05rem;
    color: var(--muted);
    margin-bottom: 2rem;
    padding: 1.1rem 1.3rem;
    background: var(--bg-soft);
    border-left: 3px solid var(--green);
    border-radius: 12px;
}

.legal-content h2 {
    font-size: 1.5rem;
    color: var(--green-dark);
    font-weight: 700;
    margin: 2.6rem 0 1.1rem;
}

.legal-content section:first-of-type h2 {
    margin-top: 0;
}

.legal-content h2::after {
    content: '';
    display: block;
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, var(--green), var(--green-dark));
    border-radius: 2px;
    margin-top: 0.6rem;
}

.legal-content h3 {
    font-size: 1.1rem;
    color: var(--ink);
    margin: 1.5rem 0 0.6rem;
}

.legal-content p {
    margin-bottom: 1rem;
    color: var(--text);
}

/* Пункт с номером (1.1, 2.3 и т.п.) */
.clause {
    margin-bottom: 0.9rem;
    color: var(--text);
}

.clause .cn {
    font-weight: 600;
    color: var(--green-dark);
    margin-right: 0.35rem;
}

.legal-content ul {
    margin: 0 0 1rem 1.4rem;
}

.legal-content li {
    margin-bottom: 0.5rem;
    color: var(--text);
}

/* Список понятий «термин — определение» */
.term-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.term-list li {
    margin-bottom: 0.7rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
}

.term-list .term {
    font-weight: 600;
    color: var(--green-dark);
}

/* Многоколоночный список стран */
.country-list {
    columns: 3;
    column-gap: 2rem;
    margin: 0.4rem 0 1.2rem;
    padding-left: 1.2rem;
}

.country-list li {
    margin-bottom: 0.4rem;
    break-inside: avoid;
    color: var(--text);
}

/* Выделенная сноска / важный блок */
.legal-note {
    margin: 1.2rem 0;
    padding: 1rem 1.2rem;
    background: rgba(59, 166, 136, 0.06);
    border: 1px solid rgba(59, 166, 136, 0.2);
    border-radius: 12px;
    color: var(--text);
}

/* ===== FAQ-АККОРДЕОН ===== */
.faq-list {
    max-width: 820px;
    margin: 0 auto;
}

.faq-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.faq-item[open] {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    border-color: rgba(59, 166, 136, 0.4);
}

.faq-item > summary {
    list-style: none;
    cursor: pointer;
    padding: 1.25rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: color 0.2s ease;
}

.faq-item > summary::-webkit-details-marker {
    display: none;
}

.faq-item > summary:hover {
    color: var(--green);
}

.faq-item[open] > summary {
    color: var(--green-dark);
}

.faq-item > summary::after {
    content: '';
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.faq-item[open] > summary::after {
    transform: rotate(-135deg);
}

.faq-answer {
    padding: 0 1.5rem 1.4rem;
    color: var(--text);
}

.faq-answer > p:first-child {
    margin-top: 0;
}

.faq-answer p {
    margin-bottom: 0.9rem;
}

.faq-answer ul {
    margin: 0 0 1rem 0;
}

/* Группы уровней риска */
.risk-group {
    margin: 1.4rem 0;
}

.risk-group:first-child {
    margin-top: 0.4rem;
}

.risk-group h4 {
    font-size: 1.05rem;
    margin-bottom: 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.risk-group h4::before {
    content: '';
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
}

.risk-high {
    color: #c0392b;
}

.risk-high::before {
    background: #c0392b;
}

.risk-medium {
    color: #b9770e;
}

.risk-medium::before {
    background: #e0962b;
}

.risk-low {
    color: var(--green-dark);
}

.risk-low::before {
    background: var(--green);
}

/* Шаги предварительной AML-проверки */
.faq-steps {
    counter-reset: step;
    list-style: none;
    margin: 0.5rem 0 1rem;
    padding: 0;
}

.faq-steps li {
    position: relative;
    padding-left: 2.8rem;
    padding-top: 0.2rem;
    margin-bottom: 1rem;
    min-height: 1.9rem;
}

.faq-steps li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.9rem;
    height: 1.9rem;
    background: linear-gradient(45deg, var(--green), var(--green-dark));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.faq-note {
    margin-top: 1.2rem;
    padding: 1rem 1.2rem;
    background: rgba(59, 166, 136, 0.06);
    border: 1px solid rgba(59, 166, 136, 0.2);
    border-radius: 12px;
}

/* ===== КНОПКА «НАВЕРХ» ===== */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--green), var(--green-dark));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(59, 166, 136, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 900;
}

.to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.to-top:hover {
    transform: translateY(-3px);
}

.to-top svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== ФУТЕР ===== */
.footer {
    background: #1a202c;
    color: #fff;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--green);
}

.footer-section p,
.footer-section li {
    color: #cbd5e0;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #cbd5e0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--green);
}

.footer-bottom {
    border-top: 1px solid #2d3748;
    padding-top: 1rem;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 900px) {
    .legal-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 32px 0 56px;
    }

    /* Оглавление становится сворачиваемым блоком */
    .legal-toc {
        position: static;
        background: var(--bg-soft);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 0.5rem;
    }

    .legal-toc > summary {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
        padding: 1rem 1.2rem;
        margin-bottom: 0;
        font-size: 0.95rem;
        text-transform: none;
        letter-spacing: 0;
        color: var(--green-dark);
    }

    .legal-toc > summary::after {
        content: '';
        width: 8px;
        height: 8px;
        border-right: 2px solid currentColor;
        border-bottom: 2px solid currentColor;
        transform: rotate(45deg);
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    .legal-toc[open] > summary::after {
        transform: rotate(-135deg);
    }

    .legal-toc nav {
        padding: 0 1.2rem 1rem;
        border-left: none;
    }

    .legal-hero h1 {
        font-size: 2rem;
    }

    .country-list {
        columns: 2;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: var(--header-h);
        left: -100%;
        width: 100%;
        height: calc(100vh - var(--header-h));
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 2rem;
        gap: 1.4rem;
        overflow-y: auto;
        transition: left 0.3s ease;
    }

    .nav-menu.active {
        left: 0;
    }

    .burger {
        display: flex;
    }

    /* Дропдаун на мобильных — аккордеон */
    .has-dropdown {
        width: 100%;
        text-align: center;
    }

    .dropdown-menu {
        position: static;
        transform: none;
        min-width: auto;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    }

    .dropdown-menu::before {
        display: none;
    }

    /* На мобильных раскрываем только по клику (.open), а не по hover */
    .has-dropdown:hover .dropdown-menu,
    .has-dropdown:focus-within .dropdown-menu {
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        transform: none;
    }

    .has-dropdown.open .dropdown-menu {
        max-height: 320px;
        opacity: 1;
        visibility: visible;
        padding: 0.4rem 0 0.2rem;
        transform: none;
    }

    .dropdown-menu a {
        text-align: center;
        color: var(--muted);
    }

    .aml-btn {
        margin-top: 0.6rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .legal-hero h1 {
        font-size: 1.6rem;
    }

    .country-list {
        columns: 1;
    }
}
