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

:root {
    --bg-page: #eae7e0;
    --bg-card: #ffffff;
    --text-main: #2c2c2c;
    --text-soft: #6a6a6a;
    --accent: #7a6e5d;
    --accent-light: #9c8e7a;
    --divider: #d1cdc5;
    --shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    --radius: 6px;
    --font-heading: Georgia, 'Times New Roman', 'Palatino Linotype', serif;
    --font-body: Georgia, 'Times New Roman', 'Palatino Linotype', serif;
}

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

body.legal-page {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-main);
    background-color: var(--bg-page);
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 49px,
            rgba(0, 0, 0, 0.018) 49px,
            rgba(0, 0, 0, 0.018) 50px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 49px,
            rgba(0, 0, 0, 0.012) 49px,
            rgba(0, 0, 0, 0.012) 50px
        ),
        radial-gradient(ellipse at 20% 50%, rgba(59, 89, 152, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(120, 90, 60, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(59, 89, 152, 0.02) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-variant-numeric: lining-nums tabular-nums;
}

/* ── Shell ── */

.legal-shell {
    width: 100%;
    max-width: 780px;
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px) clamp(12px, 3vw, 20px);
}

/* ── Header ── */

.legal-header {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--divider);
    padding: clamp(16px, 3vw, 24px) clamp(20px, 4vw, 36px) clamp(16px, 3vw, 24px) clamp(10px, 2vw, 18px);
    margin-bottom: clamp(16px, 2.5vw, 24px);
    display: flex;
    align-items: center;
}

.legal-header::after {
    content: '';
    flex: 0 0 auto;
    min-width: 88px;
}

.back-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 7px 12px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    margin-right: 6px;
    margin-left: 12px;
}

.back-btn:hover {
    background: var(--accent);
    color: #fff;
}

.back-btn:active {
    opacity: 0.8;
}

.back-btn.is-hidden {
    visibility: hidden;
}

.legal-header h1 {
    font-family: var(--font-heading);
    font-size: clamp(19px, 3.5vw, 27px);
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-main);
    margin: 0;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    white-space: nowrap;
}

.legal-header h1 small {
    display: block;
    font-family: var(--font-body);
    font-size: clamp(11px, 1.3vw, 13px);
    font-weight: 400;
    font-style: italic;
    color: var(--text-soft);
    margin-top: 6px;
    line-height: 1.5;
}

/* ── Body ── */

.legal-body {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--divider);
    padding: clamp(24px, 4vw, 40px) clamp(20px, 4vw, 36px);
    margin-bottom: clamp(16px, 2.5vw, 24px);
}

.legal-section {
    margin-bottom: 28px;
}

.legal-section:last-child {
    margin-bottom: 0;
}

.legal-section h2 {
    font-family: var(--font-heading);
    font-size: clamp(16px, 2.2vw, 19px);
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 14px;
    line-height: 1.35;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--divider);
}

.legal-section h3 {
    font-family: var(--font-heading);
    font-size: clamp(14px, 1.8vw, 16px);
    font-weight: 700;
    font-style: italic;
    color: var(--text-main);
    margin-top: 20px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.legal-section p {
    margin-bottom: 10px;
    color: var(--text-main);
    text-align: justify;
    hyphens: auto;
    text-indent: 1.5em;
}

.legal-section p:first-child {
    text-indent: 0;
}

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

.legal-section ul,
.legal-section ol {
    padding-left: 2em;
    margin-bottom: 10px;
}

.legal-section li {
    margin-bottom: 4px;
    color: var(--text-main);
}

.legal-section li em {
    font-style: italic;
}

.legal-section a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.legal-section a:hover {
    color: var(--accent-light);
}

.legal-section p > a:only-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 9px 24px;
    color: var(--text-main);
    background: rgba(122, 110, 93, 0.04);
    text-indent: 0;
    text-align: center;
    margin: 14px auto 0;
    font-family: var(--font-body);
    font-size: 13px;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.legal-section p > a:only-child::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232c2c2c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
}

.legal-section p > a:only-child:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.legal-section p > a:only-child:hover::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
}

.legal-section p:has(> a:only-child) {
    text-align: center;
    text-indent: 0;
}

.legal-intro {
    font-size: 14px;
    color: var(--text-soft);
    line-height: 1.75;
    margin-bottom: 20px;
    text-align: center;
    font-style: italic;
    text-indent: 0;
}

.legal-note {
    background: rgba(122, 110, 93, 0.04);
    border-left: 2px solid var(--accent);
    border-radius: 0 4px 4px 0;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    color: var(--text-soft);
    line-height: 1.65;
}

p.legal-closing {
    text-align: center !important;
    font-style: italic;
    color: var(--text-soft);
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--divider);
    text-indent: 0 !important;
}

/* ── Divider ── */

hr.legal-divider {
    border: none;
    height: auto;
    background: none;
    margin: 28px 0;
    text-align: center;
    line-height: 1;
    overflow: visible;
}

hr.legal-divider::before {
    content: '\00a0\2727\00a0\00a0\2727\00a0\00a0\2727\00a0';
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--divider);
    display: inline-block;
}

/* ── Footer ── */

.legal-footer {
    text-align: center;
    padding: clamp(16px, 2.5vw, 24px) clamp(12px, 2vw, 20px);
    color: var(--text-soft);
    font-size: 12px;
    line-height: 1.6;
}

.legal-footer p {
    margin: 2px 0;
}

/* ── Scroll-to-top ── */

.scroll-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease;
}

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

.scroll-top.hiding {
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
}

.scroll-top:hover {
    background: rgba(122, 110, 93, 0.06);
}

.scroll-top:active {
    transform: scale(0.95);
}

.scroll-top svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Responsive ── */

@media (max-width: 600px) {
    .scroll-top {
        bottom: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
    }

    .legal-header::after {
        min-width: 0;
    }

    .legal-header h1 {
        font-size: clamp(15px, 5vw, 19px);
        text-align: left;
        white-space: normal;
    }

    .legal-header h1 small {
        font-size: clamp(10px, 2.5vw, 12px);
    }

    .back-btn {
        padding: 6px 10px;
        font-size: 11px;
        margin-right: 6px;
        margin-left: 6px;
    }
}
