/* ═══ DESIGN LAYER - Terms, Privacy, FAQ and About (loaded with pages/legal.css; see design.css for
   the rules of the layer) ═══
   Markup this file expects:
     all             .legal-container[.legal-container-narrow] > a.legal-back + .legal-header
                     (.section-eyebrow on FAQ and About, h1, p.last-updated or p.legal-intro)
     Terms, Privacy  .legal-layout > nav.legal-toc (.legal-toc-title, ol > li > a) + .legal-body > section.legal-section
     FAQ             .faq-list > .faq-item > button.faq-question (span, svg.faq-icon) + .faq-answer > .faq-answer-inner > p
     About           .legal-body > section.legal-section; About and FAQ end with .faq-cta
   States set by scripts, kept and mirrored: .faq-item.open (faq.php), .legal-toc a.active (legal.js).
   These pages carry no ad units. */

/* ─── Head ─── */
html[data-design] .legal-back {
    margin-bottom: 28px;
    font-size: 15px;
}
html[data-design] .legal-back:hover {
    color: var(--text-primary);
}
html[data-design] .legal-header,
html[data-design] .legal-container-narrow .legal-header {
    margin-bottom: 40px;
    text-align: left;
}
html[data-design] .legal-header h1 {
    margin: 0 0 14px;
    line-height: 1;
    text-wrap: balance;
}
html[data-design] .legal-header .section-eyebrow {
    margin: 0 0 16px;
    letter-spacing: 0;
    text-transform: none;
}
html[data-design] .legal-header .last-updated {
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}
html[data-design] .legal-intro {
    max-width: 36em;
    margin: 0;
    font-size: 18px;
    line-height: 1.5;
    color: var(--text-secondary);
}
html[data-design] .legal-header a,
html[data-design] .legal-section a,
html[data-design] .legal-footnote a {
    color: var(--blue-400);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
html[data-design] .legal-header a:hover,
html[data-design] .legal-section a:hover,
html[data-design] .legal-footnote a:hover {
    color: var(--text-primary);
}

/* ─── Legal text: 17px on 1.65, text blocks at most about 70 characters wide ─── */
html[data-design] .legal-section {
    padding: 36px 0;
}
html[data-design] .legal-section h2 {
    margin-bottom: 14px;
    font-size: clamp(22px, 4.6vw, 26px);
    line-height: 1.15;
}
html[data-design] .legal-section h3 {
    margin: 26px 0 8px;
    font-size: 19px;
    line-height: 1.25;
}
html[data-design] .legal-section p,
html[data-design] .legal-section ul,
html[data-design] .legal-section ol {
    max-width: 35em;
    font-size: 17px;
    line-height: 1.65;
}
html[data-design] .legal-section p {
    margin-bottom: 16px;
}
html[data-design] .legal-section p:last-child {
    margin-bottom: 0;
}
html[data-design] .legal-section ul,
html[data-design] .legal-section ol {
    margin: 8px 0 16px;
    padding-left: 1.3em;
}
html[data-design] .legal-section li {
    margin-bottom: 8px;
    padding-left: 4px;
}
html[data-design] .legal-section li::marker {
    color: var(--text-muted);
}
html[data-design] .legal-footnote {
    margin-top: 32px;
    font-size: 15px;
}
html[data-design] .legal-toc-title {
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
}
/* legacy card, not used by a page at the moment */
html[data-design] .legal-card {
    background: var(--d-surface);
    border: var(--d-panel-border);
    border-radius: var(--d-r-lg);
    box-shadow: var(--d-panel-shadow) !important;
}
html[data-design] .legal-card p,
html[data-design] .legal-card li {
    font-size: 16px;
    line-height: 1.65;
}

/* ─── FAQ and the closing box ─── */
html[data-design] .faq-item.open::before {
    display: none;
}
html[data-design] .faq-question:focus-visible {
    outline-offset: -2px;
}
html[data-design] .faq-answer-inner p {
    max-width: 35em;
    font-size: 17px;
    line-height: 1.6;
}
html[data-design] .faq-cta {
    margin-top: 48px;
}
html[data-design] .faq-cta strong {
    margin-bottom: 4px;
    font-size: 20px;
    letter-spacing: -0.02em;
}
html[data-design] .faq-cta p {
    font-size: 15px;
}

/* the contents list as a row of chips on small screens (the old layout); .active follows the scroll */
@media (max-width: 900px) {
    html[data-design] .legal-toc a {
        background: transparent;
        border: var(--d-btn2-border);
        border-radius: var(--d-r-sm);
        font-size: 14px;
        color: var(--text-secondary);
    }
    html[data-design] .legal-toc a:hover {
        color: var(--text-primary);
    }
    html[data-design] .legal-toc a.active {
        background: var(--d-btn-bg);
        border-color: var(--d-btn-bg);
        color: var(--d-btn-fg);
        font-weight: var(--d-btn-weight);
    }
    html[data-design="brutal"] .legal-toc a.active {
        border-color: var(--d-ink);
    }
}
@media (max-width: 768px) {
    html[data-design] .legal-section {
        padding: 28px 0;
    }
}

/* ═══════════════════════ A · Swiss grid ═══════════════════════ */
html[data-design="swiss"] .legal-header h1 {
    font-size: clamp(40px, 6vw, 72px);
}
html[data-design="swiss"] .legal-header .section-eyebrow {
    display: block;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-muted);
}
html[data-design="swiss"] .legal-toc-title {
    font-weight: 400;
}
/* no boxes: a strong rule on top of each column, hairlines between the sections */
html[data-design="swiss"] .legal-body,
html[data-design="swiss"] .faq-list {
    position: relative;
    padding: 0;
    background: none;
    border: 0;
}
html[data-design="swiss"] .legal-body::before,
html[data-design="swiss"] .faq-list::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--d-ink);
    transform-origin: left center;
}
html[data-design="swiss"] .legal-section:first-child {
    padding-top: 22px;
}
html[data-design="swiss"] .legal-section strong {
    font-weight: 600;
}
/* questions: ruled rows with a plus that turns into a minus (as on the homepage) */
html[data-design="swiss"] .faq-list {
    border-bottom: 1px solid var(--d-line);
}
html[data-design="swiss"] .faq-item.open {
    background: none;
}
html[data-design="swiss"] .faq-question {
    position: relative;
    padding: 20px 44px 20px 0;
    font-size: 20px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
html[data-design="swiss"] .faq-question .faq-icon {
    display: none;
}
html[data-design="swiss"] .faq-question::before,
html[data-design="swiss"] .faq-question::after {
    content: '';
    position: absolute;
    right: 2px;
    top: 50%;
    width: 16px;
    height: 1.5px;
    background: var(--text-muted);
    transition: transform 0.3s var(--d-ease), background 0.2s ease;
}
html[data-design="swiss"] .faq-question::after {
    transform: rotate(90deg);
}
html[data-design="swiss"] .faq-item.open .faq-question::after {
    transform: rotate(0deg);
}
html[data-design="swiss"] .faq-question:hover::before,
html[data-design="swiss"] .faq-question:hover::after {
    background: var(--blue-400);
}
html[data-design="swiss"] .faq-answer-inner {
    padding: 0;
}
html[data-design="swiss"] .faq-answer-inner p {
    padding-bottom: 24px;
}
html[data-design="swiss"] .faq-cta {
    padding: 22px 0 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--d-ink);
}
@media (min-width: 901px) {
    /* contents column: a strong rule on top, the current section underlined in blue */
    html[data-design="swiss"] .legal-toc {
        padding-top: 16px;
    }
    html[data-design="swiss"] .legal-toc::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 1px;
        background: var(--d-ink);
        transform-origin: left center;
    }
    html[data-design="swiss"] .legal-toc ol {
        border-left: 0;
    }
    html[data-design="swiss"] .legal-toc a {
        margin: 0;
        padding: 6px 0;
        border-left: 0;
        font-size: 14px;
    }
    html[data-design="swiss"] .legal-toc a.active {
        color: var(--text-primary);
        text-decoration: underline;
        text-decoration-color: var(--blue-500);
        text-decoration-thickness: 2px;
        text-underline-offset: 5px;
    }
}
@media (max-width: 640px) {
    html[data-design="swiss"] .faq-question {
        padding: 16px 40px 16px 0;
        font-size: 18px;
    }
}

/* ═══════════════════════ D · Neo-brutalist ═══════════════════════ */
html[data-design="brutal"] .legal-back {
    font-weight: 700;
    color: var(--text-primary);
}
html[data-design="brutal"] .legal-back:hover {
    color: var(--blue-400);
}
html[data-design="brutal"] .legal-header h1 {
    font-size: clamp(38px, 5.5vw, 68px);
}
html[data-design="brutal"] .legal-header .section-eyebrow {
    padding: 2px 10px;
    background: var(--blue-500);
    border: 2px solid var(--d-ink);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 800;
    color: #0a0f1a;
    transform: rotate(-2deg);
}
html[data-design="brutal"] .legal-toc-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}
html[data-design="brutal"] .legal-body {
    padding: 4px 32px;
    background: var(--d-surface);
    border: var(--d-panel-border);
    border-radius: var(--d-r-lg);
    box-shadow: var(--d-panel-shadow) !important;
}
html[data-design="brutal"] .legal-section + .legal-section {
    border-top: 2px solid var(--d-line);
}
/* questions: stacked boxes; the open one stands on a shadow */
html[data-design="brutal"] .faq-list {
    display: grid;
    gap: 12px;
    overflow: visible;
    background: none;
    border: 0;
}
html[data-design="brutal"] .faq-item,
html[data-design="brutal"] .faq-item.open {
    background: var(--d-surface);
    border: var(--d-panel-border);
    border-radius: 12px;
    transition: box-shadow 0.2s var(--d-ease);
}
html[data-design="brutal"] .faq-item.open {
    box-shadow: 6px 6px 0 #3b82f6 !important;
}
html[data-design="brutal"] .faq-question {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}
html[data-design="brutal"] .faq-question .faq-icon {
    width: 20px;
    height: 20px;
    color: var(--d-ink);
    stroke-width: 3;
}
html[data-design="brutal"] .faq-answer-inner {
    padding: 0 20px;
}
/* the closing box: a flat deep-blue block */
html[data-design="brutal"] .faq-cta {
    background: var(--blue-700);
    border: var(--d-panel-border);
    border-radius: var(--d-r-lg);
    box-shadow: 6px 6px 0 var(--d-ink) !important;
}
html[data-design="brutal"] .faq-cta strong {
    color: #ffffff;
}
html[data-design="brutal"] .faq-cta p {
    color: var(--text-primary);
}
@media (min-width: 901px) {
    /* contents column: a box of its own, the current section a blue block */
    html[data-design="brutal"] .legal-toc {
        padding: 16px 12px;
        background: var(--d-surface);
        border: var(--d-panel-border);
        border-radius: var(--d-r-lg);
        box-shadow: var(--d-item-shadow) !important;
    }
    html[data-design="brutal"] .legal-toc-title {
        padding: 0 10px;
    }
    html[data-design="brutal"] .legal-toc ol {
        border-left: 0;
    }
    html[data-design="brutal"] .legal-toc a {
        margin: 0;
        padding: 6px 10px;
        border: 0;
        border-radius: 6px;
        font-size: 14px;
        font-weight: 600;
        color: var(--text-secondary);
    }
    html[data-design="brutal"] .legal-toc a:hover {
        background: var(--d-raised);
        color: var(--text-primary);
    }
    html[data-design="brutal"] .legal-toc a.active {
        background: var(--blue-500);
        color: #0a0f1a;
        font-weight: 800;
    }
}
@media (max-width: 768px) {
    html[data-design="brutal"] .legal-body {
        padding: 0 18px;
        box-shadow: 6px 6px 0 #3b82f6 !important;
    }
    html[data-design="brutal"] .faq-question {
        padding: 14px 16px;
        font-size: 17px;
    }
    html[data-design="brutal"] .faq-answer-inner {
        padding: 0 16px;
    }
}

/* ═══════════════════════ Motion ═══════════════════════
   A short entrance for the title and the first block; the legal text gets one short rise. */
@media (prefers-reduced-motion: no-preference) {
    /* A: the head rises, the strong rules are drawn from the left */
    html[data-design="swiss"] .legal-header .section-eyebrow {
        animation: d-fade 0.6s ease both;
    }
    html[data-design="swiss"] .legal-header h1 {
        animation: d-rise 0.7s var(--d-ease) both;
    }
    html[data-design="swiss"] .legal-header p {
        animation: d-rise 0.7s var(--d-ease) 0.08s both;
    }
    html[data-design="swiss"] .legal-toc,
    html[data-design="swiss"] .faq-list {
        animation: d-rise 0.7s var(--d-ease) 0.16s both;
    }
    html[data-design="swiss"] .legal-body {
        animation: d-rise 0.6s var(--d-ease) 0.22s both;
    }
    html[data-design="swiss"] .legal-toc::before,
    html[data-design="swiss"] .legal-body::before,
    html[data-design="swiss"] .faq-list::before {
        animation: d-draw-x 0.7s var(--d-ease) 0.2s both;
    }
    html[data-design="swiss"] .faq-item.open .faq-answer-inner p {
        animation: d-rise 0.35s var(--d-ease) both;
    }

    /* D: the title pops in, the sticker wobbles, the boxes arrive one after another */
    html[data-design="brutal"] .legal-header h1 {
        animation: d-pop-in 0.5s var(--d-pop) both;
    }
    html[data-design="brutal"] .legal-header .section-eyebrow {
        animation: d-fade 0.4s ease 0.15s both, d-wobble 5s ease-in-out 1s infinite;
    }
    html[data-design="brutal"] .legal-header p {
        animation: d-rise 0.5s var(--d-ease) 0.1s both;
    }
    html[data-design="brutal"] .legal-toc {
        animation: d-drop-in 0.5s var(--d-pop) 0.16s both;
    }
    html[data-design="brutal"] .legal-body {
        animation: d-rise 0.5s var(--d-ease) 0.22s both;
    }
    html[data-design="brutal"] .faq-item {
        animation: d-pop-in 0.45s var(--d-pop) 0.4s backwards;
    }
    html[data-design="brutal"] .faq-item:nth-child(1) { animation-delay: 0.16s; }
    html[data-design="brutal"] .faq-item:nth-child(2) { animation-delay: 0.22s; }
    html[data-design="brutal"] .faq-item:nth-child(3) { animation-delay: 0.28s; }
    html[data-design="brutal"] .faq-item:nth-child(4) { animation-delay: 0.34s; }
}
