/* tos.html — TOS cards, TOC, expandable sections */

#tos.tos-section .tos-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    padding: 1.5rem 1.75rem 1.35rem;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    overflow: hidden;
    margin-bottom: 0;
    scroll-margin-top: 7rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

#tos.tos-section .tos-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb 0%, #6366f1 50%, #818cf8 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

#tos.tos-section .tos-card.tos-toggle {
    cursor: pointer;
    user-select: none;
}

@media (hover: hover) {
    #tos.tos-section .tos-card.tos-toggle:hover {
        transform: translateY(-2px);
        border-color: rgba(59, 130, 246, 0.45);
        box-shadow: 0 12px 28px rgba(59, 130, 246, 0.1);
    }

    #tos.tos-section .tos-card.tos-toggle:hover::before {
        opacity: 1;
    }
}

#tos.tos-section .tos-card.open {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 14px 36px rgba(59, 130, 246, 0.12);
}

#tos.tos-section .tos-card.open::before {
    opacity: 1;
}

html.dark #tos.tos-section .tos-card {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

html.dark #tos.tos-section .tos-card.open {
    border-color: rgba(96, 165, 250, 0.55);
    box-shadow: 0 14px 36px rgba(37, 99, 235, 0.2);
}

/* Header */
#tos.tos-section .tos-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

#tos.tos-section .tos-icon {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    background: linear-gradient(145deg, #f1f5f9 0%, #e2e8f0 100%);
    border: 1px solid #e2e8f0;
    transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

html.dark #tos.tos-section .tos-icon {
    color: #cbd5e1;
    background: linear-gradient(145deg, #334155 0%, #1e293b 100%);
    border-color: #475569;
}

#tos.tos-section .tos-card.open .tos-icon,
#tos.tos-section .tos-card.toc-always-open .tos-icon {
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

#tos.tos-section .tos-card:hover .bitcoin-icon,
#tos.tos-section .tos-card.open .bitcoin-icon {
    color: inherit !important;
}

#tos.tos-section .tos-card:hover .bitcoin-icon svg path[fill="white"],
#tos.tos-section .tos-card.open .bitcoin-icon svg path[fill="white"] {
    fill: white !important;
}

/* Badges */
#tos.tos-section .tos-badge {
    flex-shrink: 0;
    padding: 0.3rem 0.65rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 999px;
    border: 1px solid transparent;
}

#tos.tos-section .tos-badge-high {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

#tos.tos-section .tos-badge-medium {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

#tos.tos-section .tos-badge-low {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

html.dark #tos.tos-section .tos-badge-high {
    color: #fca5a5;
    background: rgba(127, 29, 29, 0.5);
    border-color: #991b1b;
}

html.dark #tos.tos-section .tos-badge-medium {
    color: #fcd34d;
    background: rgba(120, 53, 15, 0.45);
    border-color: #92400e;
}

html.dark #tos.tos-section .tos-badge-low {
    color: #6ee7b7;
    background: rgba(6, 78, 59, 0.45);
    border-color: #166534;
}

/* Card body */
#tos.tos-section .tos-content {
    flex: 1;
    margin-bottom: 0;
}

#tos.tos-section .tos-title {
    margin: 0 0 0.4rem;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
}

html.dark #tos.tos-section .tos-title {
    color: #f8fafc;
}

#tos.tos-section .tos-description {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #64748b;
}

html.dark #tos.tos-section .tos-description {
    color: #94a3b8;
}

#tos.tos-section .tos-card.tos-toggle:not(.open) .tos-description::after {
    content: ' · Tap to expand';
    font-weight: 600;
    color: #2563eb;
}

html.dark #tos.tos-section .tos-card.tos-toggle:not(.open) .tos-description::after {
    color: #93c5fd;
}

/* Expandable body */
#tos.tos-section .tos-dropdown-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        transform 0.3s ease;
}

#tos.tos-section .tos-dropdown-content.open {
    max-height: 12000px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

html.dark #tos.tos-section .tos-dropdown-content.open {
    border-top-color: #334155;
}

#tos.tos-section .tos-details {
    margin: 0;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #3b82f6;
    background: #f8fafc;
    transition: background 0.2s ease, border-color 0.2s ease;
}

html.dark #tos.tos-section .tos-details {
    background: rgba(30, 41, 59, 0.65);
    border-color: #334155;
    border-left-color: #60a5fa;
}

#tos.tos-section .tos-details-title {
    margin: 0 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1e293b;
}

html.dark #tos.tos-section .tos-details-title {
    color: #f1f5f9;
}

#tos.tos-section .tos-details-text {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #475569;
}

html.dark #tos.tos-section .tos-details-text {
    color: #cbd5e1;
}

#tos.tos-section .tos-details ul {
    margin: 0.5rem 0 0;
    padding-left: 1.15rem;
}

#tos.tos-section .tos-details li {
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

#tos.tos-section .tos-details strong {
    font-weight: 600;
    color: #2563eb;
}

html.dark #tos.tos-section .tos-details strong {
    color: #93c5fd;
}

#tos.tos-section .tos-details a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

html.dark #tos.tos-section .tos-details a {
    color: #93c5fd;
}

#tos.tos-section .tos-details-title {
    scroll-margin-top: 7rem;
}

/* Footer */
#tos.tos-section .tos-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #e2e8f0;
}

html.dark #tos.tos-section .tos-footer {
    border-top-color: #334155;
}

#tos.tos-section .tos-number {
    width: 2rem;
    height: 2rem;
    font-size: 0.8125rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

#tos.tos-section .tos-arrow {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: transform 0.3s ease, background 0.2s ease, color 0.2s ease;
}

html.dark #tos.tos-section .tos-arrow {
    color: #94a3b8;
    background: #334155;
    border-color: #475569;
}

#tos.tos-section .tos-card.open .tos-arrow {
    transform: rotate(180deg);
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #6366f1 100%);
    border-color: transparent;
}

@media (hover: hover) {
    #tos.tos-section .tos-card:hover .tos-arrow {
        color: #2563eb;
        border-color: rgba(59, 130, 246, 0.35);
        background: #eff6ff;
    }

    html.dark #tos.tos-section .tos-card:hover .tos-arrow {
        color: #93c5fd;
        background: rgba(37, 99, 235, 0.2);
    }
}

/* TOC card */
#tos.tos-section .tos-card.toc-always-open {
    border-color: rgba(59, 130, 246, 0.35);
    box-shadow: 0 6px 24px rgba(59, 130, 246, 0.1);
}

#tos.tos-section .tos-card.toc-always-open::before {
    opacity: 1;
}

#tos.tos-section .tos-card.toc-always-open .tos-footer {
    display: none;
}

#tos.tos-section #toc-content {
    max-height: none !important;
    overflow: visible !important;
    opacity: 1 !important;
    transform: none !important;
    margin-top: 0.75rem;
    padding-top: 0;
    border-top: none;
}

#tos.tos-section .toc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

@media (min-width: 640px) {
    #tos.tos-section .toc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    #tos.tos-section .toc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.1rem;
    }
}

@media (min-width: 1280px) {
    #tos.tos-section .toc-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.15rem;
    }
}

#tos.tos-section .toc-section {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

html.dark #tos.tos-section .toc-section {
    background: rgba(30, 41, 59, 0.6);
    border-color: #334155;
}

#tos.tos-section .toc-section-title {
    margin: 0 0 0.5rem;
    padding-bottom: 0.45rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    border-bottom: 2px solid #3b82f6;
}

html.dark #tos.tos-section .toc-section-title {
    color: #f1f5f9;
    border-bottom-color: #60a5fa;
}

#tos.tos-section .toc-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

#tos.tos-section .toc-links li {
    margin: 0 0 0.25rem;
}

#tos.tos-section .toc-link {
    display: block;
    padding: 0.45rem 0.6rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #475569;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

html.dark #tos.tos-section .toc-link {
    color: #cbd5e1;
}

@media (hover: hover) {
    #tos.tos-section .toc-link:hover {
        color: #fff;
        background: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
        transform: translateX(3px);
    }
}

#tos.tos-section .toc-link.highlighted {
    color: #fff;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    animation: tos-toc-pulse 2s ease-out;
}

@keyframes tos-toc-pulse {
    0% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

#tos.tos-section .tos-cards-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 100%;
}

#tos.tos-section .tos-cards-stack > .tos-card {
    flex-shrink: 0;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    #tos.tos-section .tos-cards-stack {
        gap: 2.5rem;
    }
}

@media (min-width: 1024px) {
    #tos.tos-section .tos-cards-stack {
        gap: 3rem;
    }
}

@media (min-width: 1280px) {
    #tos.tos-section .tos-cards-stack {
        gap: 3.25rem;
    }
}

/* TOC block above the stack */
#tos.tos-section .tos-toc-wrap {
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    #tos.tos-section .tos-toc-wrap {
        margin-bottom: 2.5rem;
    }
}

@media (min-width: 1024px) {
    #tos.tos-section .tos-toc-wrap {
        margin-bottom: 3rem;
    }
}

@media (min-width: 1024px) {
    #tos.tos-section .tos-card {
        padding: 1.85rem 2.25rem 1.6rem;
    }

    #tos.tos-section .tos-title {
        font-size: 1.25rem;
    }

    #tos.tos-section .tos-description {
        font-size: 1rem;
    }

    #tos.tos-section .tos-details-text {
        font-size: 0.9375rem;
        line-height: 1.6;
    }
}

@media (min-width: 1280px) {
    #tos.tos-section .tos-card {
        padding: 2rem 2.5rem 1.75rem;
    }
}

@media (max-width: 768px) {
    #tos.tos-section .tos-card {
        padding: 1.1rem 1.1rem 1rem;
    }

    #tos.tos-section .tos-dropdown-content.open {
        max-height: none;
    }

    #tos.tos-section .tos-card.tos-toggle:not(.open) .tos-description::after {
        content: ' · Tap to expand';
    }
}

@media (prefers-reduced-motion: reduce) {
    #tos.tos-section .tos-card,
    #tos.tos-section .tos-dropdown-content,
    #tos.tos-section .tos-arrow,
    #tos.tos-section .toc-link {
        transition: none;
    }

    #tos.tos-section .tos-card.tos-toggle:hover {
        transform: none;
    }
}
