.terms-hero {
    position: relative;
    isolation: isolate;
    border-bottom: 1px solid var(--line);
    background: #09090b;
}

.terms-hero::before,
.terms-hero::after {
    position: absolute;
    inset: 0;
    content: "";
    pointer-events: none;
}

.terms-hero::before {
    left: auto;
    z-index: -2;
    width: min(100%, 50rem);
    background: url("../assets/backrooms-descent-feature.jpg") center 38% / cover no-repeat;
    mask-image: linear-gradient(90deg, transparent, #000 64%);
}

.terms-hero::after {
    z-index: -1;
    background:
        linear-gradient(0deg, #09090b, rgba(9, 9, 11, 0.4) 60%),
        linear-gradient(115deg, rgba(245, 49, 82, 0.13), transparent 48%),
        repeating-linear-gradient(0deg, transparent 0 4px, rgba(255, 255, 255, 0.035) 4px 5px);
}

.terms-hero-content {
    padding-block: clamp(8rem, 14vw, 12rem) clamp(2.5rem, 7vw, 5.5rem);
}

.terms-hero h1 {
    font-size: clamp(3rem, 8.2vw, 6.5rem);
    line-height: 1;
    text-shadow: 0 0 30px rgba(245, 49, 82, 0.36), 0 8px 36px #000;
}

.terms-hero h1 + p {
    max-width: 57ch;
    margin-top: 1.15rem;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.125rem);
    line-height: 1.65;
}

.terms-layout {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    align-items: start;
    gap: clamp(2rem, 5vw, 4.5rem);
    padding-block: clamp(2rem, 5vw, 4rem);
}

.terms-nav {
    position: sticky;
    top: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-strong);
}

.terms-nav h2 {
    font-size: 1.25rem;
    line-height: 1.1;
}

.terms-nav ul,
.terms-games {
    margin: 0;
    padding: 0;
    list-style: none;
}

.terms-nav ul {
    display: grid;
    gap: 0.2rem;
    margin-top: 0.75rem;
}

.terms-nav a {
    display: block;
    padding: 0.45rem 0;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 700;
}

.terms-nav a:hover,
.terms-nav a:focus-visible,
.terms-content a:hover,
.terms-content a:focus-visible {
    color: var(--cyan);
}

.terms-section,
.terms-games li {
    scroll-margin-top: 1.25rem;
}

.terms-section + .terms-section {
    margin-top: clamp(1.75rem, 5vw, 3rem);
    padding-top: clamp(1.75rem, 5vw, 3rem);
    border-top: 1px solid var(--line);
}

.terms-section h2 {
    margin-bottom: 1rem;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    line-height: 1.12;
}

.terms-section p,
.terms-section ul:not(.terms-games) {
    max-width: 72ch;
    color: var(--muted);
    line-height: 1.75;
}

.terms-section p + p {
    margin-top: 0.9rem;
}

.terms-section ul:not(.terms-games) {
    padding-inline-start: 1.25rem;
}

.terms-section ul:not(.terms-games) li + li {
    margin-top: 0.4rem;
}

.terms-section p a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 0.2em;
    overflow-wrap: anywhere;
}

.terms-games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.terms-games a {
    display: flex;
    height: 100%;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-strong);
}

.terms-games a:hover,
.terms-games li:target a {
    border-color: var(--cyan);
    background: #0a1b20;
}

.terms-games li:target a {
    box-shadow: inset 3px 0 0 var(--cyan);
}

.terms-games code {
    color: var(--muted);
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.terms-content a:focus-visible,
.terms-nav a:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.terms-section.terms-contact {
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--line);
    border-left: 3px solid var(--cyan);
    border-radius: var(--radius);
    background: var(--panel-strong);
}

@media (max-width: 850px) {
    .terms-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .terms-nav {
        position: static;
    }

    .terms-nav ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 0.85rem;
    }
}

@media (max-width: 520px) {
    .terms-hero::before {
        background-position: 62% center;
        mask-image: linear-gradient(90deg, transparent, #000 82%);
    }

    .terms-nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 380px) {
    .terms-page .topbar {
        gap: 0.5rem;
    }

    .terms-page .nav-links {
        max-width: none;
    }

    .terms-page .nav-links a {
        padding-inline: 0.45rem;
        font-size: 0.85rem;
    }
}
