@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Hairline-5e1789c612117a1573bcb48552b85e673b12796c2a2e942d64335c74bbaece90.woff2) format('woff2');
        font-weight: 100;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-HairlineItalic-9f44487a55db041769c55e4f50e37124721e2b8da5ad54ee7b76c533d65554fd.woff2) format('woff2');
        font-weight: 100;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Thin-59a3997aa00a5d865fba32725ce4a67919af182a5da61d3eb669ef52b50e8d4e.woff2) format('woff2');
        font-weight: 200;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-ThinItalic-9a4f77ed177a1aef7984e39bdd04d105fbd7046e7e0a4ca9eca5fdec329cf9c7.woff2) format('woff2');
        font-weight: 200;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Light-93813a84eb00d68b29464274dba8116fd7c2e3644ee8da37fcf0fec35dbddd29.woff2) format('woff2');
        font-weight: 300;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-LightItalic-867171bba57e526fdba4f5f5af0f18f548a9f31706339d0f4c1887c9ff00b749.woff2) format('woff2');
        font-weight: 300;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Regular-f9815326242e147b6277202ff08517632cec514b7ac10dc31179f7751774a5a0.woff2) format('woff2');
        font-weight: 400;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Italic-a1075aedb4299fb09edf4f57fb9d3bb457f3555abbea645a08688f8c3c07d433.woff2) format('woff2');
        font-weight: 400;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Semibold-2dd11a0c8674461bd8dec357640d6fbb33d8924b995091219facc1e360335971.woff2) format('woff2');
        font-weight: 500;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-SemiboldItalic-e6e3422158c5f7f7f82ebcf107135de95f99dfe2ed0a9864f40c3087e6c6f12e.woff2) format('woff2');
        font-weight: 500;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Bold-e7f7c3e48518297f854281f03d16689ea06bc8cc058c76c2b9960852e0ccdee5.woff2) format('woff2');
        font-weight: 600;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-BoldItalic-fa0174b8701497b5144556a93f5b3dc0990c0d5f74bae0cebcb015bba1ec7f7e.woff2) format('woff2');
        font-weight: 600;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Black-d153a816ec0817e43bad791b7c3557e4466cc27f3315de81bc7e8ea186cf9f25.woff2) format('woff2');
        font-weight: 700;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-BlackItalic-9df9444b78aeffec3eb1c2c6bfb9f68a21cbe4ed8c138b235352f3705bc19686.woff2) format('woff2');
        font-weight: 700;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Extra-Black-44d801f9c51f4080a6faf437bdd0d4f3b482e8974d195d6e59b6193c69e4bb12.woff2) format('woff2');
        font-weight: 800;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Extra-BlackItalic-7a3054380cb9ad7ca4a86f3d297e3842bfb8137014d2e793838f4690942c65bc.woff2) format('woff2');
        font-weight: 800;
        font-style: italic;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-Ultra-82bce6335808ddf35c198bfa00b40da435982be2b3dd3b7863ee652895295ded.woff2) format('woff2');
        font-weight: 900;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: 'ReallySans';
        src: url(/assets/ReallySansLarge-UltraItalic-c93e0dec8103c6d1a713aa6efc0ff0fc325bc57f6e00a65b6132b7b8793740d5.woff2) format('woff2');
        font-weight: 900;
        font-style: italic;
        font-display: swap;
    }
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

select[multiple] option:checked {
    @apply bg-pink-400;
}

/* pagination.css */
@media (max-width: 768px) { .pagination a[aria-label*='Page'] { display: none; } .pagination .current, .pagination .previous_page, .pagination .next_page { display: inline-block; } }

.mav-file-input-btn[type=file]::file-selector-button {
    border:none;
    padding:10px;
    color:white;
    font-size: .875rem;
    font-weight: 500;
    background:linear-gradient(135deg,#fa8169 0,#b903ff 100%)
}

.daterangepicker {
    table {
        color: black;
    }

    .ranges {
        li {
            @apply hover:bg-pink-100 !important;
            @apply hover:text-black !important;
        }
        li.active {
            background:linear-gradient(135deg,#fa8169 0,#b903ff 100%) !important;
            @apply text-white !important;
        }
    }

    td {
        @apply hover:bg-pink-50 !important;
    }

    td.in-range {
        @apply bg-pink-100 !important;
        @apply hover:bg-pink-50 !important;
    }

    td.active {
        @apply bg-pink-400 !important;
        @apply hover:bg-pink-50 !important;
    }

    td.off.start-date, td.off.end-date {
        @apply bg-pink-400 !important;
        @apply hover:bg-pink-50 !important;
        @apply text-gray-500 !important;
    }
}

body {
    font-family: ReallySans, sans-serif;
    letter-spacing: 0.025em;
    h1,h2,h3,h4,h5,h6 {
        letter-spacing: 0.04em;
    }
}

@layer utilities {
    /* Keyframes used by our animation utilities */
    @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
    }

    @keyframes slide-up {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
    }

    .animate-fade-in {
    animation: var(--fade-in, fade-in 0.7s ease-out both);
    }

    .animate-slide-up {
    animation: var(--slide-up, slide-up 0.5s ease-out both);
    }

    @keyframes wiggle {
        0%, 100% { transform: rotate(-3deg); }
        50% { transform: rotate(3deg); }
    }

    /* A row that scrolls sideways on small screens (jump navs, FAQ topic
       tabs) fades out at its right edge, so a half-cut last item reads as
       "there's more" rather than as a layout bug. Off once the row fits. */
    .scroll-cue-x {
        mask-image: linear-gradient(to right, #000 calc(100% - 3rem), transparent);
        scrollbar-width: none;
    }
    .scroll-cue-x::-webkit-scrollbar { display: none; }
    @media (min-width: 1024px) {
        .scroll-cue-x { mask-image: none; }
    }
}

/* Visual counterpart to admin-only Pundit policies; the URL endpoint is the real gate. */
body:not(.admin-viewer) .admin-only {
    display: none;
}

/* The marketing sticker sprite (MarketingStickerHelper): let a sticker draw
   past its box, which a symbol crops to by default, so a stroke added at the
   call site keeps its outer edge (the menu's globe keyline, icons/_menu_glyph). */
symbol[id^="sticker-"] {
    overflow: visible;
}

/* Next contenteditable variable editor + {{var}} autocomplete pill.
   Pill markup is JS-injected by variable_autocomplete_controller, so the
   classes need real CSS (not inline utilities). */
@layer components {
    /* Text input for the brand (marketing + auth) forms. Matches the inline
       inputs on the marketing pages; use this instead of copying that string. */
    .marketing-input {
        @apply w-full rounded-xl border-2 border-brand-ink/25 bg-white px-4 py-3 text-base text-brand-ink transition
               placeholder:text-brand-ink/40 focus:border-brand-ink focus:outline-none focus:ring-0;
    }

    /* Native <select> in the same family: the input's box with the chevron
       drawn in, since the browser's own arrow doesn't match anything. */
    .marketing-select {
        @apply w-full appearance-none rounded-xl border-2 border-brand-ink/25 bg-white py-3 pl-4 pr-11 text-base
               text-brand-ink transition focus:border-brand-ink focus:outline-none focus:ring-0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23170834' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        background-size: 1rem 1rem;
    }

    /* The marketing page container. The designs are drawn on a 1780 canvas
       with a 1320 content column starting at x=230; 1400 less the lg gutters
       gives exactly that. Section wrappers use this rather than max-w-7xl. */
    .mav-container {
        @apply mx-auto w-full max-w-[1400px] px-6 lg:px-10;
    }

    /* The headline gradient as the frames draw it: one sweep, left to right,
       across the whole heading box, which each accent word shows its own
       slice of (so an accent at the end of a line reads teal to blue, not the
       full green to violet squeezed into one word). Put this on the heading
       and make the accent `text-transparent`; the rest of the heading keeps
       its colour over it. The frames stop cyan at 25%, the feature pages at
       51.4%. */
    .mav-headline-gradient {
        background-image: linear-gradient(to right, #8fe34f 0%, #37ded6 var(--headline-mid, 25%), #5a3dfd 100%);
        -webkit-background-clip: text;
        background-clip: text;
    }

    /* A gradient keyline with a see-through middle, so the section's own
       ground shows inside the card (the frames draw several like this). The
       ring sits outside the box, as the frames' 12px strokes do, so its outer
       corners are the box's radius plus the ring. Set the ring width with
       --ring and the box's corner radius with --ring-radius (default 20px). */
    .mav-gradient-ring {
        position: relative;
    }
    .mav-gradient-ring::before {
        content: "";
        position: absolute;
        inset: calc(var(--ring, 8px) * -1);
        border-radius: calc(var(--ring-radius, 20px) + var(--ring, 8px));
        padding: var(--ring, 8px);
        /* The frames' stroke gradient runs from 23.6% to 81.3% of its stops
           top to bottom, so the ring opens partway into the violet-to-cyan
           blend and ends short of full green; hence the stops outside 0-100. */
        background: linear-gradient(to bottom, #7731ff -40.9%, #3dc3dd 31.9%, #8fe350 132.4%);
        -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
        -webkit-mask-composite: xor;
        mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
        pointer-events: none;
    }

    /* Long-form article body on the brand layout (Contentful rich text). The
       legacy `.prose` rules live in old_styles.css, which the brand layout does
       not load — this is its replacement, on paper instead of black. */
    .marketing-prose {
        @apply text-lg leading-relaxed text-brand-ink;
    }
    .marketing-prose > :first-child { @apply mt-0; }
    .marketing-prose p { @apply my-6; }
    .marketing-prose h1,
    .marketing-prose h2 { @apply mb-5 mt-12 text-3xl leading-tight; }
    .marketing-prose h3 { @apply mb-4 mt-10 text-2xl leading-snug; }
    .marketing-prose h4,
    .marketing-prose h5,
    .marketing-prose h6 { @apply mb-3 mt-8 text-xl font-bold leading-snug; }
    .marketing-prose a,
    .marketing-notes a {
        @apply font-semibold text-brand-violet underline decoration-brand-violet/40 underline-offset-2 transition
               hover:decoration-brand-violet;
    }
    .marketing-prose b,
    .marketing-prose strong { @apply font-bold; }
    .marketing-prose ul { @apply my-6 list-disc space-y-2 pl-6; }
    .marketing-prose ol { @apply my-6 list-decimal space-y-2 pl-6; }
    .marketing-prose li p { @apply my-0; }
    .marketing-prose li::marker { @apply font-bold text-brand-violet; }
    .marketing-prose blockquote {
        @apply my-8 rounded-2xl border-2 border-brand-ink bg-brand-green/20 px-6 py-5 text-xl font-medium leading-snug
               shadow-[6px_6px_0_#170834];
    }
    .marketing-prose blockquote p { @apply my-0; }
    .marketing-prose img { @apply my-8 w-full rounded-2xl border-2 border-brand-ink shadow-[8px_8px_0_#170834]; }
    .marketing-prose iframe { @apply my-8 w-full rounded-2xl border-2 border-brand-ink; }
    .marketing-prose hr { @apply my-12 border-0 border-t-2 border-brand-ink/15; }
    .marketing-prose table { @apply my-8 w-full border-2 border-brand-ink text-base; }
    .marketing-prose th { @apply bg-brand-ink px-4 py-3 text-left text-sm font-bold uppercase tracking-wide text-brand-paper; }
    .marketing-prose td { @apply border-t border-brand-ink/15 px-4 py-3 align-top; }
    .marketing-prose th p,
    .marketing-prose td p { @apply my-0; }
    /* Code on the brand site (the blog, the API docs). Not font-mono: the theme's font
       families replace Tailwind's defaults, so that utility doesn't exist. */
    .mav-code {
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    }

    /* The Knowledge index's cards morph between the two-column grid and one
       card across the full width (knowledge_search_controller#animate, via the
       View Transitions API). Cards that leave fade and shrink into the paper;
       the one that stays slides and grows into place. */
    ::view-transition-group(*) {
        animation-duration: 420ms;
        animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    }
    ::view-transition-old(*):only-child {
        animation: 320ms ease-in both knowledge-card-leave;
    }
    ::view-transition-new(*):only-child {
        animation: 420ms cubic-bezier(0.22, 1, 0.36, 1) both knowledge-card-enter;
    }
    @keyframes knowledge-card-leave {
        to { opacity: 0; transform: scale(0.94); }
    }
    @keyframes knowledge-card-enter {
        from { opacity: 0; transform: scale(0.94); }
    }

    /* .marketing-notes: a changelog entry's grouped notes, one line each. */
    .marketing-prose code,
    .marketing-notes code {
        @apply mav-code rounded bg-brand-ink/10 px-1.5 py-0.5;
        font-size: 0.9em;
    }
    .marketing-prose pre {
        @apply my-8 overflow-x-auto rounded-2xl border-2 border-brand-ink bg-brand-ink p-5 text-sm leading-relaxed text-brand-paper;
    }
    .marketing-prose pre code { @apply bg-transparent p-0; color: inherit; font-size: inherit; }

    .next-var-editor {
        display: block;
        width: 100%;
        min-height: 4.5rem;
        padding: 0.5rem 0.75rem;
        border-radius: 0.375rem;
        @apply bg-white text-brand-ink ring-1 ring-inset ring-brand-grey;
        font-size: 0.875rem;
        line-height: 1.25rem;
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
        outline: none;
        cursor: text;
    }
    .next-var-editor:focus {
        @apply ring-2 ring-brand-violet/50;
    }
    .next-var-editor:empty::before,
    .next-var-editor[data-empty="true"]::before {
        content: attr(data-placeholder);
        @apply text-brand-ink/60;
        pointer-events: none;
    }
    .next-var-editor.is-mono {
        font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
        font-size: 13px;
        line-height: 1.5rem;
        min-height: 14rem;
    }
    /* Confetti around a Sold badge on the home dashboard. */
    .next-confetti {
        position: relative;
        isolation: isolate;
    }
    .next-confetti::before {
        content: "";
        position: absolute;
        inset: -16px -34px;
        z-index: -1;
        pointer-events: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='90' opacity='0.9'%3E%3Crect x='8' y='10' width='7' height='3' rx='1' fill='%238FE34F' transform='rotate(20 11.5 11.5)'/%3E%3Ccircle cx='34' cy='22' r='2' fill='%23661AFF'/%3E%3Crect x='58' y='8' width='7' height='3' rx='1' fill='%2322DDF5' transform='rotate(-25 61.5 9.5)'/%3E%3Crect x='86' y='26' width='7' height='3' rx='1' fill='%23661AFF' transform='rotate(35 89.5 27.5)'/%3E%3Ccircle cx='112' cy='12' r='2' fill='%238FE34F'/%3E%3Crect x='138' y='20' width='7' height='3' rx='1' fill='%23170834' transform='rotate(-15 141.5 21.5)'/%3E%3Crect x='162' y='6' width='7' height='3' rx='1' fill='%238FE34F' transform='rotate(50 165.5 7.5)'/%3E%3Ccircle cx='20' cy='58' r='2' fill='%2322DDF5'/%3E%3Crect x='46' y='70' width='7' height='3' rx='1' fill='%238FE34F' transform='rotate(-40 49.5 71.5)'/%3E%3Crect x='74' y='54' width='7' height='3' rx='1' fill='%23661AFF' transform='rotate(15 77.5 55.5)'/%3E%3Ccircle cx='98' cy='76' r='2' fill='%23170834'/%3E%3Crect x='124' y='60' width='7' height='3' rx='1' fill='%2322DDF5' transform='rotate(30 127.5 61.5)'/%3E%3Ccircle cx='150' cy='72' r='2' fill='%23661AFF'/%3E%3Crect x='172' y='50' width='7' height='3' rx='1' fill='%238FE34F' transform='rotate(-20 175.5 51.5)'/%3E%3C/svg%3E");
        background-size: 140px 70px;
        -webkit-mask-image: radial-gradient(closest-side, #000 70%, transparent);
        mask-image: radial-gradient(closest-side, #000 70%, transparent);
        animation: next-confetti-drift 14s linear infinite;
    }
    @keyframes next-confetti-drift {
        to { background-position: 140px 70px; }
    }
    @media (prefers-reduced-motion: reduce) {
        .next-confetti::before { animation: none; }
    }
    .next-variable-pill {
        display: inline-block;
        padding: 0.0625rem 0.5rem;
        margin: 0 0.0625rem;
        @apply border border-brand-violet/30 bg-brand-violet/[0.08] text-brand-violet;
        border-radius: 0.25rem;
        font-size: 0.8125rem;
        white-space: nowrap;
        user-select: all;
        vertical-align: baseline;
        @apply font-sans;
    }
    .next-variable-pill-label {
        font-weight: 700;
    }
    .next-variable-pill-sep {
        opacity: 0.45;
        font-weight: 400;
    }
    .next-variable-pill-example {
        font-weight: 300;
        font-style: italic;
        opacity: 0.85;
    }
}
