*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--surface-raised);
    color: var(--text-strong);
    font-size: clamp(0.9375rem, 0.8779rem + 0.2545vw, 1rem); /* 768px = 16px 375 = 15px */

    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    
    -webkit-tap-highlight-color: transparent;

    scroll-behavior: smooth;
}

/* ====================DECLARE VARIABLES==================== */

:root {
    --sidepadding: clamp(1rem, 0.7928rem + 0.884vw, 1.5rem); /* default = 24px */
    --lockedvw: 1280px;
}

:root {
    /* Surfaces */
    --surface-base: #f7f8fa;       /* page/app background (was --surface-base) */
    --surface-raised: #eef0f2;     /* cards, panels, inputs (was --surface-raised) */

    /* Text */
    --text-muted: #a8a8a8;         /* placeholders, captions (was --text-muted) */
    --text-default: #4a4a4a;       /* body text (was --text-default) */
    --text-strong: #0e0e0e;        /* headings, emphasis (was --text-strong) */

    /* Interactive */
    --interactive-hover: #2a2a2a;  /* hover states (was --interactive-hover) */
    --accent: #2281f7;             /* primary action color — unchanged */
    --accent-subtle: #d6e6fb;      /* accent tints, badges (was --accent-subtle) */

    /* Status */
    --status-success: #059a3b;     /* (was --status-success) */
    --status-danger: #d93030;      /* (was --status-danger) */
    --status-warning: #e68900;     /* (was --status-warning) */
    --status-info: #8e44d9;        /* (was --status-info) */
}

/* ─── Dark Mode Overrides ─── */
[data-theme="dark"] {
    /* Surfaces — deep neutral, slight warm tint */
    --surface-base: #111110;
    --surface-raised: #1c1c1a;

    /* Text */
    --text-muted: #555550;
    --text-default: #a8a8a0;
    --text-strong: #f0efe8;

    /* Interactive */
    --interactive-hover: #d8d8cc;
    --accent: #3d8ef0;           /* desaturated, less punchy blue */
    --accent-subtle: #193457;    /* very muted, barely-there tint */

    /* Status */
    --status-success: #0db84a;
    --status-danger: #f04040;
    --status-warning: #f5a020;
    --status-info: #a55fe8;
}

/* ====================BASIC CALLING==================== */

h1, h2, h3 { 
    font-weight: 600; 
    color: var(--text-strong); 
    letter-spacing: -.5px;
}

p {
    font-family: inherit;
    font-weight: 400;
}

a {
    font-family: inherit;
    font-weight: 450;
    text-decoration: none;
    color: inherit;
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--text-strong);
    outline-offset: 2px;
}

input { all: unset; }
button { all: unset; cursor: pointer; text-align: center; }

hr {
    border: none;
    border-top: 1px solid hsl(from var(--text-muted) h s l / 0.5);
}

.monospace { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 470; }
.tab-8 { display: inline-block; margin-left: 10px; }
.tab-20 { display: inline-block; margin-left: 20px; }

svg { fill: var(--text-strong); }

/* ====================NAVBAR==================== */

nav {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);

    width: 100%;
    max-width: var(--lockedvw);

    z-index: 1000;
    padding: 0 var(--sidepadding);

    border-bottom: 1px solid hsl(from var(--text-muted) h s l / 0.5);
    background-color: hsl(from var(--surface-raised) h s l / .64);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

nav a:active { scale: .98; }

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 16px 0;
}

.nav-left, .nav-right { display: flex; align-items: center; }
.nav-left { gap: clamp(1.125rem, 0.6588rem + 1.989vw, 2.25rem); }
.nav-right { gap: clamp(0.75rem, 0.4191rem + 0.8824vw, 1.125rem); white-space: nowrap;}
.nav-left a:not(:first-child) { display: none; }
@media (min-width: 600px) { .nav-left a:not(:first-child) { display: block; } }

.nav-left a, .nav-right a {
    transition: color .2s ease;
    color: var(--text-default);
}

.nav-left a:first-child {
    font-size: 18px;
    font-weight: 600;
    color: initial;
}

.nav-left a:not(:first-child):hover,
.nav-right a:first-child:hover {
    color: var(--interactive-hover);
}

#nav-get-started {
    background-color: var(--accent);
    color: var(--surface-base);

    padding: 5px 10px;
    border-radius: 5px;

    transition: opacity .2s ease;
    &:hover { opacity: .8; }
}

/* ====================PLANS==================== */

.pricing-container {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 39px;
}

.pricing-plans-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;

    padding: 0 clamp(0rem, -12.069rem + 27.5862vw, 10rem);
}

@media (min-width: 768px) { .pricing-plans-wrapper { grid-template-columns: 1fr 1fr; } }

.pricing-plan {
    display: flex;
    flex-direction: column;
    gap: 24px;

    width: 100%;
    padding: 28px 24px;

    border-radius: 10px;

    border: 1px solid hsl(from var(--text-muted) h s l / 0.5);
    background-color: var(--surface-base);

    padding-bottom: 40px;
    min-width: 0; /* prevent grid/flex blowout */
}

.plan-name {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.plan-prices {
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-prices p {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -.7px;
}

.plan-prices .discounted {
    font-size: 38px;
    text-decoration: line-through;
    opacity: .36;
    font-weight: 500;
}

.plan-tag {
    background-color: var(--accent-subtle);

    color: var(--accent);
    font-weight: 500;
    font-size: 15px;

    width: fit-content;
    padding: 1px 4px;
    border-radius: 2px;
}

.plan-features {
    list-style: none;
    margin: 0;
    padding: 0;

    & ul {
        list-style: none;
        padding-left: 20px;

        font-weight: 450;

        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    & ul li::before {
        content: '✓';
        color: var(--status-success);
        display: inline-block;
        width: 1em;
        margin-left: -1em;
    }
}

.plan-features ul li:not(:nth-last-of-type(n+3))::before {
    content: 'X';
    color: var(--text-default);
}

.overage-enabled ul li:last-of-type:before {
    content: '✓';
    color: var(--status-success);
}

.bot-detection-enabled ul li:nth-last-of-type(2):before {
    content: '✓';
    color: var(--status-success);
}

.plan-cta {
    width: 100%;

    padding: 11px 0;
    border-radius: 6px;

    background-color: var(--text-strong);
    color: var(--surface-base);

    font-weight: 500;
    text-align: center;
    transition: background-color .3s ease;

    &:hover { background-color: var(--interactive-hover); }
    &:active { scale: .99; }
}

.plan-cta a:hover { background-color: var(--interactive-hover); }

/* ====================MISC==================== */

.progress {
    width: 100%;
    height: 9px;
    position: relative;

    background-color: var(--text-muted);
    border-radius: 50vw;
}

.progress .bar {
    width: 57.23%;
    height: 100%;
    position: absolute;
 
    background-color: var(--text-default);
    border-radius: 50vw;
}

.switch {
    --w: 40px;
    --h: 22px;
    --pad: 3px;

    position: relative;
    display: inline-block;
    width: var(--w);
    height: var(--h);

    cursor: pointer;

    flex-shrink: 0;
}

.switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    margin: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background-color: var(--text-muted);
    border-radius: var(--h);
    transition: background-color 0.25s ease;
}

.slider::before {
    content: "";
    position: absolute;
    height: calc(var(--h) - var(--pad) * 2);
    width: calc(var(--h) - var(--pad) * 2);
    left: var(--pad);
    top: var(--pad);
    background: var(--surface-base);
    border-radius: 50%;
    transition: transform 0.25s ease;
}

.switch input:checked + .slider {
    background-color: var(--accent, #4caf50);
}

.switch input:checked + .slider::before {
    transform: translateX(calc(var(--w) - var(--h)));
}

.switch input:focus-visible + .slider {
    outline: 2px solid var(--accent, #4caf50);
    outline-offset: 2px;
}

.switch input:disabled + .slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.preference-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.side-by-side-buttons {
    display: flex;
    flex-direction: row;
    gap: 6px;
    font-size: 15px;

    & button, a {
        padding: 8px 16px;
        border-radius: 6px;

        background-color: var(--text-strong);
        color: var(--surface-base);

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

        &:active { scale: .99; }
    }
}

.bar-graph {
    display: flex;
    margin-top: 16px;
    padding-top: 12px;
    gap: 6px;
}

.column-bar {
    width: 100%;
    margin-top: auto;

    position: relative;

    background-color: hsl(from var(--accent) h s l / 0.3);
    border: 1px solid var(--accent);
    border-radius: 5px 5px 1px 1px;

    font-size: 12px;
    color: var(--text-default);

    display: flex;
    flex-direction: column;

    transition: background-color .3s ease;

    & p {
        color: var(--text-muted);
        transition: color .3s ease;

        position: absolute; 
        left: 50%;
        top: -16px;
        transform: translate(-50%, -50%);

        pointer-events: none;
        -webkit-user-select: none;
        -ms-user-select: none; 
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none; 
    }

    &:hover {
        background-color: hsl(from var(--accent) h s l / 0.6);
        & p { color: var(--text-default); }
    }
}

.side-by-side-buttons .stroked {
    background-color: inherit; 
    color: var(--text-default); 
    border: 1px solid var(--text-muted);

    transition: color .2s ease, border-color .2s ease;

    &:hover {
        color: var(--interactive-hover);
        border-color: var(--interactive-hover);
    }
}

.stroked {
    border-radius: 5px;

    font-weight: 500;
    font-size: 15px;

    background-color: inherit; 
    color: var(--text-default); 
    border: 1px solid var(--text-muted);

    transition: color .2s ease, border-color .2s ease;

    & a:hover {
        color: var(--interactive-hover);
        border-color: var(--interactive-hover);
    }
}

.stroked-red {
    border-radius: 5px;

    font-weight: 500;
    font-size: 15px;

    background-color: inherit; 
    color: var(--status-danger); 
    border: 1px solid var(--status-danger);

    transition: background-color .2s ease;

    &:hover { background-color: rgba(239, 68, 68, .2); }
}

.multi-button-switcher {
    border-radius: 5px;
    padding: 4px;
    position: relative;
    display: inline-flex;
    background-color: hsl(from var(--text-muted) h s l / 0.3);
    box-sizing: border-box;
}

/* SLIDING BACKGROUND */
.multi-button-switcher .slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: 0;
    background: var(--surface-base);
    box-shadow: 0 1px 3px hsl(from black h s l / 0.21);
    border-radius: 4px;
    transition: transform 0.3s ease, width 0.3s ease, height 0.3s ease;
    z-index: 0;
    pointer-events: none;
}

.multi-button-switcher button {
    padding: 6px 16px;
    border-radius: 4px;
    position: relative;
    background: transparent;
    border: none;
    cursor: pointer;
    flex: 1;
    font-size: 15px;
    color: var(--text-strong);
    font-weight: 500;
    transition: color 0.25s ease, font-weight 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.multi-button-switcher button.active {
    font-weight: 520;
}

/* ── Column variant ── */
.multi-button-switcher#column {
    flex-direction: column;
}

.multi-button-switcher#column .slider {
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
    height: 0; /* driven by JS */
}

.multi-button-switcher#column button {
    width: 100%;
    text-align: center;
}

/* ====================MODAL==================== */

.modal-mode {
    position: fixed;
    inset: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal {
    position: fixed;
    inset: 0;

    padding: 12px var(--sidepadding);

    background-color: hsl(from #0e0e0e h s l / .9);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);

    display: none;
    visibility: hidden;

    place-items: center;

    overflow-y: auto;                  /* ← was: overflow: hidden */
    overscroll-behavior: contain;      /* ← moved out of media query */
    align-items: flex-start;           /* ← moved out of media query */
}

/* Allow scroll on mobile/touch devices */
@media (hover: none) and (pointer: coarse) {
    .modal {
        overflow-y: auto;
        overscroll-behavior: contain;
        align-items: flex-start;
    }
}

.modal.active { display: grid; visibility: visible; }

.modal-container {
    width: 100%;
    margin: auto;

    background-color: var(--surface-base);
    border-radius: 10px;
    padding: 20px 24px;

    border: 1px solid hsl(from var(--text-muted) h s l / 0.75);
    background-color: var(--surface-base);

    display: flex;
    flex-direction: column;
    gap: 18px;

    padding-bottom: 40px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    & h3 { font-size: 18px; }
    & button { margin: 0; padding: 0; box-sizing: 0; padding: 2px 5px; }
    & button:active { scale: .98; }
    & svg { width: 19px; fill: var(--text-default); }
}