/* =========================================================
   JOINLY — LEGAL PAGES
   Matched to main.css graphite design system
   ========================================================= */

/* ---------- Variables ---------- */

:root {
    --background: #08090b;
    --background-light: #0d0f12;
    --card: #111316;
    --card-hover: #17191d;

    --primary: #8b8f98;
    --primary-hover: #b2b6bf;

    --text: #f2f3f5;
    --muted: #92969f;
    --muted-strong: #b7bbc2;

    --border: rgba(255,255,255,.075);
    --border-strong: rgba(255,255,255,.13);

    --radius: 14px;
    --transition: .22s cubic-bezier(.2,.8,.2,1);

    --shadow: 0 24px 70px rgba(0,0,0,.42);
    --shadow-soft: 0 12px 35px rgba(0,0,0,.25);
}

/* ---------- Reset ---------- */

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

html {
    scroll-behavior: smooth;
    background: var(--background);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 50% -12%, rgba(255,255,255,.055), transparent 34%),
        linear-gradient(180deg, #0a0b0d 0%, #08090b 52%, #070809 100%);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(255,255,255,.16);
    color: #fff;
}

::-webkit-scrollbar {
    width: 9px;
}

::-webkit-scrollbar-track {
    background: #08090b;
}

::-webkit-scrollbar-thumb {
    background: #292c31;
    border: 2px solid #08090b;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3b3f46;
}

/* =========================================================
   NAVBAR
   Matches main.css
   ========================================================= */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 72px;
    padding: 0 56px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: rgba(8,9,11,.78);
    border-bottom: 1px solid rgba(255,255,255,.055);

    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);

    z-index: 999;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 30px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 11px;

    color: #f5f5f6;
    text-decoration: none;

    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.025em;
}

.logo img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: 0 0 0 1px rgba(255,255,255,.1);
    transition: transform var(--transition);
}

.logo:hover img {
    transform: translateY(-1px);
}

/* ---------- Navigation dropdowns ---------- */

.dropdown {
    position: relative;
}

.dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;

    padding: 10px 0;

    background: none;
    border: none;

    color: #aeb2b9;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;

    transition: color var(--transition);
}

.dropdown-btn:hover {
    color: #fff;
}

.dropdown-btn svg {
    transition: transform var(--transition);
}

.dropdown.active .dropdown-btn svg,
.dropdown.active > svg {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 55px;
    left: 0;

    width: 340px;
    padding: 7px;

    display: none;

    background: rgba(17,19,22,.97);
    border: 1px solid var(--border-strong);
    border-radius: 13px;

    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);

    animation: dropdown .22s ease;
    z-index: 1000;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu a,
.dropdown-menu > a {
    display: block;
    padding: 12px;

    color: #dfe1e5;
    text-decoration: none;

    border-radius: 9px;
    transition: background var(--transition);
}

.dropdown-menu a:hover,
.dropdown-menu > a:hover {
    background: rgba(255,255,255,.065);
}

.dropdown-menu h4 {
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 650;
    letter-spacing: -.01em;
}

.dropdown-menu p {
    margin-top: 3px;
    color: #777b84;
    font-size: 12px;
    line-height: 1.5;
}

.dropdown-menu > a div {
    display: block;
}

@keyframes dropdown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* =========================================================
   BUTTONS
   Matched exactly to main.css
   ========================================================= */

.invite-btn,
.primary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: #e7e8ea;
    color: #0a0b0d;

    text-decoration: none;
    padding: 11px 18px;
    border: 1px solid #f0f0f1;
    border-radius: 9px;

    font-size: 14px;
    font-weight: 650;

    box-shadow: 0 1px 0 rgba(255,255,255,.4) inset;

    transition:
        background var(--transition),
        color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.invite-btn:hover,
.primary-btn:hover {
    background: #fff;
    color: #050506;
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0,0,0,.3);
}

.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #dfe1e5;
    background: rgba(255,255,255,.025);

    text-decoration: none;
    padding: 11px 18px;
    border: 1px solid var(--border-strong);
    border-radius: 9px;

    font-size: 14px;
    font-weight: 600;

    transition:
        background var(--transition),
        border-color var(--transition),
        transform var(--transition);
}

.secondary-btn:hover {
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.18);
    transform: translateY(-1px);
}

.premium-btn {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 11px 18px;
    border-radius: 9px;

    text-decoration: none;
    font-size: 14px;
    font-weight: 650;

    background: #d7d9dd;
    color: #090a0c;
    border: 1px solid rgba(255,255,255,.3);

    box-shadow: none;

    transition:
        background var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.premium-btn:hover {
    background: #f0f1f2;
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(0,0,0,.3);
}

/* =========================================================
   PAGE HEADERS
   ========================================================= */

.page-header,
.legal-page-header,
.privacy-page-header {
    max-width: 900px;
    margin: auto;
    padding: 145px 30px 0;
    text-align: center;
}

.page-header h1,
.legal-page-header h1,
.privacy-page-header h1 {
    margin: 18px 0;

    color: #f2f3f5;

    font-size: clamp(42px, 5vw, 62px);
    line-height: 1;
    letter-spacing: -.055em;
    font-weight: 760;
}

.page-header p,
.legal-page-header p,
.privacy-page-header p {
    color: #92969e;
    font-size: 16px;
    line-height: 1.7;
}

/* =========================================================
   LEGAL PAGE LAYOUT
   ========================================================= */

.legal-home-layout,
.tos-layout,
.privacy-layout {
    max-width: 1060px;
    margin: auto;
    padding: 60px 30px 100px;
}

.legal-home-layout {
    max-width: 1120px;
    padding: 20px 30px 100px;
}

.legal-home-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- Legal cards ---------- */

.legal-home-card,
.tos-card,
.privacy-card {
    margin-bottom: 14px;
    padding: 28px;

    background:
        linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.008)),
        #111316;

    border: 1px solid rgba(255,255,255,.075);
    border-radius: 14px;

    box-shadow: 0 16px 45px rgba(0,0,0,.2);

    transition:
        transform var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        background var(--transition);
}

.legal-home-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.legal-home-link:hover {
    transform: translateY(-3px);
    background: #15171a;
    border-color: rgba(255,255,255,.14);
    box-shadow: 0 25px 60px rgba(0,0,0,.38);
}

/* ---------- Card headings ---------- */

.legal-home-header,
.tos-card-header,
.privacy-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 15px;
}

.legal-home-header h2 {
    font-size: 23px;
    letter-spacing: -.025em;
}

.legal-home-header span,
.tos-card-header span,
.privacy-card-header span {
    color: #777b83;
    font-size: 12px;
}

.tos-card h2,
.privacy-card h2,
.legal-home-card h2 {
    margin-bottom: 12px;
    font-size: 21px;
    letter-spacing: -.025em;
}

/* ---------- Legal text ---------- */

.tos-card p,
.privacy-card p,
.legal-home-card p,
li {
    color: #92969e;
}

.tos-card p {
    margin-bottom: 20px;
}

.tos-card p:last-child,
.privacy-card p:last-child {
    margin-bottom: 0;
}

ul {
    padding-left: 22px;
}

li {
    margin-bottom: 9px;
}

/* ---------- Data boxes ---------- */

.tos-data-box,
.privacy-box,
.legal-home-box,
.tos-list,
.privacy-list {
    background: #0c0e10;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 10px;
}

.tos-data-box,
.privacy-box {
    margin-top: 18px;
    margin-bottom: 22px;
    padding: 19px;
}

.tos-data-box h3,
.privacy-box h3 {
    margin-bottom: 11px;
    font-size: 16px;
}

.legal-home-box {
    margin-top: 20px;
    padding: 13px 16px;
}

.legal-home-box p {
    color: #d8dade;
    font-weight: 600;
}

.tos-list,
.privacy-list {
    margin: 18px 0;
    padding: 18px 20px 18px 40px;
}

.tos-list li,
.privacy-list li {
    margin-bottom: 10px;
}

.tos-list li:last-child,
.privacy-list li:last-child {
    margin-bottom: 0;
}

/* ---------- Inline code ---------- */

code {
    padding: 3px 7px;

    background: rgba(255,255,255,.065);
    color: #d8dbe0;

    border: 1px solid rgba(255,255,255,.045);
    border-radius: 6px;

    font-family: Consolas, "SFMono-Regular", monospace;
    overflow-wrap: anywhere;
}

/* =========================================================
   LEGAL DIRECTORY
   ========================================================= */

.legal-directory {
    width: min(900px, calc(100% - 40px));
    margin: 10px auto 70px;

    background: #0e1012;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 12px;

    box-shadow: 0 20px 55px rgba(0,0,0,.22);
    overflow: hidden;
}

.legal-directory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;

    padding: 24px 26px;
    border-bottom: 1px solid rgba(255,255,255,.065);
}

.legal-directory-label {
    display: block;
    margin-bottom: 7px;

    color: #696d75;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
}

.legal-directory-header h2 {
    margin: 0;
    color: #f2f3f5;
    font-size: 19px;
    letter-spacing: -.025em;
}

.legal-directory-header p {
    max-width: 620px;
    margin: 6px 0 0;

    color: #777b83;
    font-size: 14px;
    line-height: 1.5;
}

.legal-document-count {
    flex-shrink: 0;
    padding: 7px 11px;

    color: #8b8f97;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 7px;

    font-size: 12px;
    font-weight: 600;
}

.legal-directory-list {
    display: flex;
    flex-direction: column;
}

.legal-directory-item {
    display: flex;
    align-items: center;
    gap: 17px;

    min-height: 74px;
    padding: 14px 20px;

    color: inherit;
    text-decoration: none;

    border-bottom: 1px solid rgba(255,255,255,.05);

    transition:
        background var(--transition),
        padding var(--transition);
}

.legal-directory-item:last-child {
    border-bottom: 0;
}

.legal-directory-item:hover {
    padding-left: 25px;
    background: rgba(255,255,255,.035);
}

.legal-directory-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    flex-shrink: 0;

    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 9px;

    font-size: 19px;
    filter: grayscale(1);
}

.legal-directory-info {
    min-width: 0;
    flex: 1;
}

.legal-directory-info h3 {
    margin: 0 0 4px;

    color: #f2f3f5;
    font-size: 14px;
    font-weight: 650;
}

.legal-directory-info p {
    margin: 0;

    color: #777b83;
    font-size: 13px;
    line-height: 1.45;
}

.legal-directory-arrow {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;
    flex-shrink: 0;

    color: #5f636a;
    font-size: 18px;

    transition:
        color var(--transition),
        transform var(--transition);
}

.legal-directory-item:hover .legal-directory-arrow {
    color: #e1e3e6;
    transform: translateX(3px);
}

/* =========================================================
   DROPDOWN SUBMENUS
   Features / Legal / Status
   ========================================================= */

.features-dropdown,
.dropdown-submenu {
    position: relative;
}

.features-dropdown > a,
.dropdown-submenu > a {
    display: block;
    padding: 12px;

    color: #dfe1e5;
    text-decoration: none;

    border-radius: 9px;
    transition: background var(--transition);
}

.features-dropdown > a:hover,
.dropdown-submenu > a:hover {
    background: rgba(255,255,255,.065);
}

.features-menu,
.dropdown-submenu-menu {
    position: absolute;
    top: -7px;
    left: calc(100% + 14px);

    width: 280px;
    padding: 7px;

    background: rgba(17,19,22,.97);
    border: 1px solid var(--border-strong);
    border-radius: 13px;

    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);

    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);

    transition:
        opacity var(--transition),
        transform var(--transition),
        visibility var(--transition);

    z-index: 1000;
}

/* Invisible bridge keeps the submenu open while moving the cursor. */

.features-menu::before,
.dropdown-submenu-menu::before {
    content: "";
    position: absolute;
    top: 0;
    left: -14px;
    width: 14px;
    height: 100%;
}

.features-dropdown:hover .features-menu,
.dropdown-submenu:hover .dropdown-submenu-menu,
.features-dropdown:focus-within .features-menu,
.dropdown-submenu:focus-within .dropdown-submenu-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.features-menu a,
.dropdown-submenu-menu a {
    display: block;
    padding: 12px;

    color: #dfe1e5;
    text-decoration: none;

    border-radius: 9px;
    transition: background var(--transition);
}

.features-menu a:hover,
.dropdown-submenu-menu a:hover {
    background: rgba(255,255,255,.065);
}

.features-menu a::after,
.dropdown-submenu-menu a::after {
    display: none;
}

.features-menu h4,
.dropdown-submenu-menu h4 {
    margin: 0;
    color: #f3f4f6;
    font-size: 13px;
    font-weight: 650;
}

.features-menu p,
.dropdown-submenu-menu p {
    margin-top: 3px;

    color: #777b84;
    font-size: 12px;
    line-height: 1.5;
}

/* =========================================================
   FOOTER
   ========================================================= */

footer {
    margin-top: 90px;
    padding: 42px 56px;

    background: #08090b;
    border-top: 1px solid rgba(255,255,255,.055);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-links {
    display: flex;
    gap: 22px;
}

.footer-links a {
    color: #747880;
    text-decoration: none;
    font-size: 13px;

    transition: color var(--transition);
}

.footer-links a:hover {
    color: #e1e3e6;
}

/* =========================================================
   RESPONSIVE LAYOUT
   Matches main.css breakpoints
   ========================================================= */

@media (max-width: 1000px) {
    .navbar {
        padding: 0 25px;
    }

    .nav-right {
        gap: 10px;
    }

    .invite-btn {
        display: none;
    }

    .premium-btn {
        display: flex;
    }

    .dropdown-menu {
        width: 300px;
    }

    .page-header,
    .legal-page-header,
    .privacy-page-header {
        padding-left: 25px;
        padding-right: 25px;
    }

    .legal-home-layout,
    .tos-layout,
    .privacy-layout {
        padding-left: 25px;
        padding-right: 25px;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
}

@media (max-width: 700px) {
    /* Navbar */

    .navbar {
        padding: 0 14px;
        height: 66px;
        background: rgba(8,9,11,.9);
    }

    .nav-left {
        width: auto;
        justify-content: flex-start;
        gap: 14px;
    }

    .nav-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .invite-btn {
        display: none;
    }

    .premium-btn {
        display: flex;
        padding: 8px 12px;
        font-size: 13px;
    }

    .dropdown {
        margin-left: 0;
    }

    .dropdown-btn {
        font-size: 15px;
    }

    .dropdown-menu {
        position: fixed;
        top: 72px;
        left: 14px;
        right: 14px;
        width: auto;
        max-width: none;
        max-height: 70vh;
        overflow-y: auto;
        margin: 0;
    }

    .logo {
        font-size: 18px;
    }

    .logo img {
        width: 36px;
        height: 36px;
    }

    /* Page headings */

    .page-header,
    .legal-page-header,
    .privacy-page-header {
        padding: 120px 20px 0;
    }

    .page-header h1,
    .legal-page-header h1,
    .privacy-page-header h1 {
        font-size: 42px;
    }

    .page-header p,
    .legal-page-header p,
    .privacy-page-header p {
        font-size: 15px;
    }

    /* Legal content */

    .legal-home-layout,
    .tos-layout,
    .privacy-layout {
        padding: 45px 20px 70px;
    }

    .legal-home-card,
    .tos-card,
    .privacy-card {
        padding: 22px;
    }

    .legal-home-header,
    .tos-card-header,
    .privacy-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 7px;
    }

    /* Legal directory */

    .legal-directory {
        width: calc(100% - 28px);
        margin-top: 5px;
    }

    .legal-directory-header {
        align-items: flex-start;
        padding: 21px;
    }

    .legal-document-count {
        display: none;
    }

    .legal-directory-item {
        padding: 14px 17px;
    }

    .legal-directory-item:hover {
        padding-left: 20px;
    }

    .legal-directory-icon {
        width: 38px;
        height: 38px;
        font-size: 17px;
    }

    .legal-directory-info p {
        font-size: 12px;
    }

    /* Submenus stay disabled on mobile */

    .features-menu,
    .dropdown-submenu-menu {
        display: none !important;
    }

    .features-dropdown:hover .features-menu,
    .dropdown-submenu:hover .dropdown-submenu-menu,
    .features-dropdown:focus-within .features-menu,
    .dropdown-submenu:focus-within .dropdown-submenu-menu {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    /* Footer */

    footer {
        padding: 40px 20px;
    }

    .footer-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 30px;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .footer-links a {
        display: block;
        width: 100%;
    }
}

@media (max-width: 400px) {
    .navbar {
        padding: 0 12px;
    }

    .nav-left {
        gap: 10px;
    }

    .logo {
        font-size: 16px;
    }

    .logo img {
        width: 32px;
        height: 32px;
    }

    .premium-btn {
        padding: 7px 9px;
        font-size: 12px;
    }

    .page-header h1,
    .legal-page-header h1,
    .privacy-page-header h1 {
        font-size: 38px;
    }

    .legal-home-card,
    .tos-card,
    .privacy-card {
        padding: 18px;
    }
}

/* ---------- Accessibility ---------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
