/* ============================================================
   IRANCheat Team — Terms & Conditions
   Long-form legal page: sticky table of contents, numbered
   sections, callouts, scroll progress and reveal-on-scroll.

   Loaded after styles.css; only this page uses it.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

.terms-page {
    --t-bg: #070a08;
    --t-panel: rgba(16, 21, 17, 0.82);
    --t-panel-2: rgba(21, 27, 22, 0.9);
    --t-line: rgba(61, 255, 122, 0.13);
    --t-line-soft: rgba(255, 255, 255, 0.055);
    --t-text: #e9f5ea;
    --t-dim: #9bb3a1;
    --t-muted: #6f8f74;
    --t-accent: #3dff7a;
    --t-accent-soft: rgba(61, 255, 122, 0.1);
    --t-amber: #ffb020;
    --t-danger: #ff5d5d;

    padding-bottom: 0;

    font-family: 'Vazirmatn', 'IBM Plex Sans', Tahoma, sans-serif;
    background-color: var(--t-bg);
    background-image:
        radial-gradient(90% 60% at 85% 0%, rgba(61, 255, 122, 0.09), transparent 58%),
        radial-gradient(70% 50% at 5% 100%, rgba(34, 211, 238, 0.055), transparent 60%),
        linear-gradient(180deg, #070a08 0%, #060906 100%);
    color: var(--t-text);
}

/* The legal page scrolls; a fixed footer would eat the last section. */
.terms-page footer {
    position: static;
    margin-top: 56px;
}

.terms-page nav a[href='/termsAndService'] {
    color: var(--t-accent);
    background-color: rgba(61, 255, 122, 0.09);
}

/* ============================================================
   Scroll progress
   ============================================================ */

.legal-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;

    width: 100%;
    height: 3px;

    background: transparent;
    pointer-events: none;
}

.legal-progress span {
    display: block;

    width: 0;
    height: 100%;

    background: linear-gradient(90deg, #1f7a3f, var(--t-accent), #9af668);
    box-shadow: 0 0 14px rgba(61, 255, 122, 0.55);

    transition: width 0.12s linear;
}

/* ============================================================
   Layout
   ============================================================ */

.legal {
    display: block;

    width: 100%;
    max-width: 1180px;

    margin: 0 auto;
    padding: 48px 24px 0;

    min-height: 0;

    direction: rtl;
    text-align: right;
}

/* ============================================================
   Hero
   ============================================================ */

.legal-hero {
    position: relative;

    display: block;

    margin: 0 0 34px;
    padding: 34px 34px 30px;

    border: 1px solid var(--t-line);
    border-radius: 22px;

    background:
        linear-gradient(150deg, rgba(20, 27, 21, 0.9), rgba(8, 11, 9, 0.94));

    box-shadow:
        0 34px 80px -40px rgba(0, 0, 0, 0.9),
        0 0 60px -34px rgba(61, 255, 122, 0.55);

    overflow: hidden;

    animation: legal-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.legal-hero::before {
    content: '';
    position: absolute;
    inset: 0;

    background:
        radial-gradient(520px circle at 88% -10%, rgba(61, 255, 122, 0.16), transparent 62%),
        linear-gradient(90deg, rgba(61, 255, 122, 0.05) 1px, transparent 1px);

    background-size: auto, 46px 46px;

    opacity: 0.65;
    pointer-events: none;

    -webkit-mask-image: linear-gradient(180deg, #000, transparent 88%);
    mask-image: linear-gradient(180deg, #000, transparent 88%);
}

.legal-hero > * {
    position: relative;
}

.legal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 14px;

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--t-accent);

    direction: ltr;
}

.legal-eyebrow::before {
    content: '';

    width: 22px;
    height: 1px;

    background: linear-gradient(90deg, transparent, var(--t-accent));
}

.legal-hero h1 {
    margin: 0 0 10px;

    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.01em;

    background: linear-gradient(100deg, #ffffff 8%, #d8ffca 54%, #8ef0ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.legal-lede {
    max-width: 720px;
    margin: 0;

    font-size: 0.97rem;
    line-height: 2;
    color: var(--t-dim);
}

.legal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    margin-top: 20px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 6px 12px;

    border: 1px solid var(--t-line-soft);
    border-radius: 999px;

    background: rgba(255, 255, 255, 0.03);

    font-size: 0.72rem;
    color: var(--t-dim);

    white-space: nowrap;
}

.chip b {
    font-weight: 600;
    color: var(--t-text);
}

.chip--accent {
    border-color: rgba(61, 255, 122, 0.26);
    background: rgba(61, 255, 122, 0.07);
    color: #c8ffb5;
}

.chip .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--t-accent);
    box-shadow: 0 0 8px rgba(61, 255, 122, 0.9);
}

/* Key points, four cards under the hero copy */
.legal-keypoints {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;

    margin-top: 24px;
}

.keypoint {
    padding: 15px 16px;

    border: 1px solid var(--t-line-soft);
    border-radius: 14px;

    background: rgba(255, 255, 255, 0.026);

    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;

    animation: legal-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.keypoint:nth-child(2) {
    animation-delay: 0.06s;
}

.keypoint:nth-child(3) {
    animation-delay: 0.12s;
}

.keypoint:nth-child(4) {
    animation-delay: 0.18s;
}

.keypoint:hover {
    border-color: rgba(61, 255, 122, 0.28);
    background: rgba(61, 255, 122, 0.05);
    transform: translateY(-2px);
}

.keypoint span {
    display: block;

    margin-bottom: 5px;

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--t-muted);
}

.keypoint strong {
    display: block;

    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.6;
    color: var(--t-text);
}

/* ============================================================
   Two column: TOC + document
   ============================================================ */

.legal-grid {
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

/* ---------- TOC ---------- */

.legal-toc {
    position: sticky;
    top: 18px;

    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 20px 18px;

    border: 1px solid var(--t-line);
    border-radius: 16px;

    background: var(--t-panel);

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    scrollbar-width: thin;
    scrollbar-color: rgba(61, 255, 122, 0.3) transparent;
}

.legal-toc::-webkit-scrollbar {
    width: 6px;
}

.legal-toc::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: rgba(61, 255, 122, 0.28);
}

.toc-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 12px;
    padding-bottom: 12px;

    border-bottom: 1px solid var(--t-line-soft);

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.64rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--t-muted);
}

.toc-title b {
    color: var(--t-accent);
    font-weight: 600;
}

.legal-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;

    counter-reset: toc;
}

.legal-toc li {
    counter-increment: toc;
}

.legal-toc a {
    position: relative;

    display: flex;
    align-items: baseline;
    gap: 9px;

    margin: 1px 0;
    padding: 7px 9px 7px 6px;

    border-radius: 9px;
    border-right: 2px solid transparent;

    font-size: 0.79rem;
    line-height: 1.55;
    color: var(--t-dim);
    text-decoration: none;

    transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.legal-toc a::before {
    content: counter(toc, decimal-leading-zero);

    flex: 0 0 auto;

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    color: var(--t-muted);
    direction: ltr;
}

.legal-toc a:hover {
    color: var(--t-text);
    background: rgba(255, 255, 255, 0.04);
}

.legal-toc a.is-active {
    color: #d9ffcc;
    background: rgba(61, 255, 122, 0.09);
    border-right-color: var(--t-accent);
}

.legal-toc a.is-active::before {
    color: var(--t-accent);
}

.toc-hint {
    margin-top: 12px;
    padding-top: 12px;

    border-top: 1px solid var(--t-line-soft);

    font-size: 0.68rem;
    line-height: 1.8;
    color: var(--t-muted);
}

/* ---------- Document ---------- */

.legal-doc {
    padding: 30px 34px 34px;

    border: 1px solid var(--t-line);
    border-radius: 20px;

    background:
        linear-gradient(165deg, rgba(17, 22, 18, 0.9), rgba(9, 12, 10, 0.95));

    box-shadow: 0 30px 70px -45px rgba(0, 0, 0, 0.95);

    animation: legal-rise 0.7s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.legal-doc > .callout:first-child {
    margin-top: 0;
}

/* ============================================================
   Sections
   ============================================================ */

.legal-section {
    padding: 26px 0;

    border-bottom: 1px dashed var(--t-line-soft);

    scroll-margin-top: 22px;
}

.legal-section:first-of-type {
    padding-top: 0;
}

.legal-section:last-of-type {
    padding-bottom: 4px;
    border-bottom: 0;
}

.legal-head {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 12px;
}

.legal-num {
    display: grid;
    place-items: center;
    flex: 0 0 auto;

    min-width: 34px;
    height: 30px;
    padding: 0 7px;

    border: 1px solid rgba(61, 255, 122, 0.28);
    border-radius: 9px;

    background: rgba(61, 255, 122, 0.07);

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--t-accent);

    direction: ltr;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.legal-section:hover .legal-num {
    background: rgba(61, 255, 122, 0.14);
    border-color: rgba(61, 255, 122, 0.5);
}

.legal-head h2 {
    margin: 0;

    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--t-text);
}

.legal-head h2::before {
    content: none;
}

.legal-section p {
    margin: 10px 0;

    font-size: 0.92rem;
    line-height: 2.05;
    color: #d5e4d8;
}

.legal-section p.lead {
    font-size: 0.95rem;
    color: var(--t-text);
}

.legal-section strong {
    font-weight: 700;
    color: #ffffff;
}

.legal-section a {
    color: var(--t-accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(61, 255, 122, 0.35);

    transition: color 0.2s ease, border-color 0.2s ease;
}

.legal-section a:hover {
    color: #ffffff;
    border-color: #ffffff;
}

.legal-list {
    margin: 12px 0;
    padding: 0;

    list-style: none;
}

.legal-list li {
    position: relative;

    margin: 8px 0;
    padding-right: 20px;

    font-size: 0.9rem;
    line-height: 1.95;
    color: #d5e4d8;
}

.legal-list li::before {
    content: '';

    position: absolute;
    right: 4px;
    top: 0.82em;

    width: 6px;
    height: 6px;

    border-radius: 2px;
    transform: rotate(45deg);

    background: rgba(61, 255, 122, 0.7);
    box-shadow: 0 0 8px rgba(61, 255, 122, 0.35);
}

.legal-list li b {
    color: #ffffff;
    font-weight: 600;
}

/* ============================================================
   Callouts
   ============================================================ */

.callout {
    position: relative;

    margin: 20px 0;
    padding: 15px 18px;

    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 13px;

    background: rgba(255, 255, 255, 0.028);

    font-size: 0.88rem;
    line-height: 1.95;
    color: #d5e4d8;
}

.callout::before {
    content: '';

    position: absolute;
    inset-block: 12px;
    inset-inline-start: 0;

    width: 2px;

    border-radius: 99px;
    background: var(--t-accent);
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 8px;

    margin-bottom: 5px;

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.64rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;

    color: var(--t-accent);
}

.callout-title::before {
    content: '';

    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px currentColor;
}

.callout p {
    margin: 4px 0;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

.callout a {
    color: inherit;
    text-decoration: underline;
}

/* ============================================================
   Acceptance block
   ============================================================ */

.legal-accept {
    position: relative;

    margin-top: 26px;
    padding: 22px 24px;

    border: 1px solid rgba(61, 255, 122, 0.24);
    border-radius: 16px;

    background:
        radial-gradient(400px circle at 90% 0%, rgba(61, 255, 122, 0.12), transparent 60%),
        rgba(61, 255, 122, 0.045);

    text-align: right;
}

.legal-accept h2 {
    margin: 0 0 8px;

    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 1.02rem;
    font-weight: 700;
    color: #ffffff;
}

.legal-accept p {
    margin: 6px 0;

    font-size: 0.88rem;
    line-height: 1.95;
    color: #cfe6d3;
}

.legal-sign {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;

    margin-top: 16px;
    padding-top: 14px;

    border-top: 1px solid rgba(61, 255, 122, 0.16);

    font-family: 'JetBrains Mono', monospace;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    color: var(--t-muted);
}

.legal-sign b {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    font-size: 0.86rem;
    letter-spacing: 0;
    color: var(--t-accent);
}

/* ============================================================
   Back to top
   ============================================================ */

.to-top {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 40;

    display: grid;
    place-items: center;

    width: 44px;
    height: 44px;

    border: 1px solid rgba(61, 255, 122, 0.3);
    border-radius: 13px;

    background: rgba(12, 17, 13, 0.9);
    color: var(--t-accent);

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    box-shadow: 0 16px 34px -18px rgba(0, 0, 0, 0.9);

    cursor: pointer;
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;

    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
}

.to-top.show {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.to-top:hover {
    background: rgba(61, 255, 122, 0.14);
}

.to-top svg {
    width: 18px;
    height: 18px;
}

/* ============================================================
   Reveal on scroll
   JS arms only the sections that start below the fold, so the
   first screen is never blank if the observer misfires.
   ============================================================ */

.js .legal-section.will-reveal {
    opacity: 0;
    transform: translateY(16px);
}

.js .legal-section {
    transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.js .legal-section.in {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .js .legal-section.will-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

@keyframes legal-rise {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1040px) {
    .legal-grid {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;

        max-height: none;
        overflow: visible;

        padding: 18px;
    }

    .legal-toc ol {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 2px 10px;
    }

    .legal-keypoints {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .legal {
        padding: 28px 14px 0;
    }

    .legal-hero {
        padding: 24px 20px 22px;
    }

    .legal-lede {
        font-size: 0.9rem;
    }

    .legal-toc ol {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legal-doc {
        padding: 22px 18px 24px;
    }

    .legal-section {
        padding: 22px 0;
    }

    .legal-head h2 {
        font-size: 1rem;
    }

    .legal-section p {
        font-size: 0.88rem;
        line-height: 2;
    }

    .to-top {
        left: 14px;
        bottom: 14px;
    }
}

@media (max-width: 460px) {
    .legal-keypoints {
        grid-template-columns: 1fr;
    }

    .legal-toc ol {
        grid-template-columns: 1fr;
    }

    .legal-accept {
        padding: 18px;
    }
}
