/* Cookie consent (partials/consent.blade.php, js/consent.js).
   Built from the site's own tokens (see the --nxc-* variables below): surface, accent
   for the one action and the switches, the 20px dialog corner of the spam
   popup, white 12px option rows, and the .cta button (uppercase, 10px). */

/* ————— Buttons ————— */
/* The banner and dialog appear on two kinds of page with different colour names: the Blade pages
   (site.css: --primary-color, --secondary-color, --accent-color, --font-body) and the built pages
   (design/v2 tokens.css: --surface, --text, --action, --on-action, --font). Each --nxc-* below takes
   the Blade name when it exists, else the built page's, else a plain value, so neither ends up with
   an undefined (transparent) background. */
:root
{
    --nxc-bg: var(--primary-color, var(--surface, #ffffff));
    --nxc-ink: var(--secondary-color, var(--text, #14201a));
    --nxc-action: var(--accent-color, var(--action, #1f6b34));
    --nxc-on-action: var(--on-action, var(--primary-color, #ffffff));
    --nxc-font: var(--font-body, var(--font, 'Helvetica Neue', Helvetica, sans-serif));
}

.nxc-btn
{
    padding: 13px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    background-color: transparent;
    color: var(--nxc-ink);
    font-family: var(--nxc-font);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: -0.5px;
    line-height: 1;
    text-transform: uppercase;
    cursor: pointer;
    transition: 0.3s;
}
.nxc-btn:focus { outline: none; }
.nxc-btn:focus-visible
{
    outline: 2px solid var(--nxc-action);
    outline-offset: 2px;
}
.nxc-btn-primary
{
    background-color: var(--nxc-action);
    color: var(--nxc-on-action);
}
.nxc-btn-primary:hover
{
    background-color: var(--nxc-ink);
}
.nxc-btn-ghost
{
    border-color: rgba(16, 16, 16, 0.18);
}
.nxc-btn-ghost:hover
{
    background-color: var(--nxc-ink);
    border-color: var(--nxc-ink);
    color: var(--nxc-bg);
}

/* ————— First-visit banner ————— */
.nxc-banner
{
    position: fixed;
    right: 24px;                         /* the right side: the hero copy and its buttons sit bottom-left */
    bottom: 24px;
    z-index: 60;
    width: min(440px, calc(100% - 48px));
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);     /* landscape phones: scrolls inside instead of running off screen */
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
    border: 1px solid rgba(16, 16, 16, 0.08);
    border-radius: 20px;
    background-color: var(--nxc-bg);
    color: var(--nxc-ink);
    font-family: var(--nxc-font);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
    animation: nxc-in 0.3s ease;
    transition: transform 0.3s ease, opacity 0.2s ease, visibility 0s;
}
/* Tucked away while an enquiry form is on screen (js/consent.js); visibility
   also drops it from the tab order so keyboard users never land on it unseen. */
.nxc-banner.is-away
{
    transform: translateY(calc(100% + 40px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.2s ease, visibility 0s 0.3s;
}
.nxc-banner[hidden] { display: none; }
.nxc-short { display: none; }           /* phone wording, see Small screens */
.nxc-banner h2
{
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.nxc-banner p
{
    margin: 0 0 18px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: rgba(16, 16, 16, 0.7);
}
.nxc-actions
{
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "reject accept" "custom custom";
    gap: 8px;
}
.nxc-actions [data-cc="reject"]    { grid-area: reject; }
.nxc-actions [data-cc="accept"]    { grid-area: accept; }
.nxc-actions [data-cc="customise"] { grid-area: custom; }

@keyframes nxc-in
{
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
}

/* ————— Settings dialog ————— */
.nxc-modal
{
    width: min(600px, calc(100% - 32px));
    max-height: min(88vh, 780px);
    max-height: min(88dvh, 780px);       /* dvh: the screen actually visible, so iOS toolbars never cut it off */
    margin: auto;                        /* the global * { margin: 0 } reset un-centres <dialog> */
    padding: 0;
    border: 0;
    border-radius: 20px;
    background-color: var(--nxc-bg);
    color: var(--nxc-ink);
    font-family: var(--nxc-font);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}
.nxc-modal[open]
{
    display: flex;
    flex-direction: column;
    animation: nxc-in 0.25s ease;
}
.nxc-modal::backdrop
{
    background-color: rgba(16, 16, 16, 0.6);
    backdrop-filter: blur(3px);
}
.nxc-modal svg { display: block; }
/* The page behind stays put while the dialog is open */
html:has(.nxc-modal[open]),
html:has(.nxc-modal[open]) body { overflow: hidden; }

.nxc-close
{
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(16, 16, 16, 0.06);
    color: var(--nxc-ink);
    cursor: pointer;
}
.nxc-close:focus { outline: none; }
.nxc-close:focus-visible
{
    outline: 2px solid var(--nxc-action);
    outline-offset: 2px;
}
.nxc-close svg { width: 16px; height: 16px; }

.nxc-modal-body
{
    flex: 1;
    min-height: 0;
    padding: 32px 28px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.nxc-modal h2
{
    margin: 0 0 10px;
    padding-right: 36px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.nxc-intro
{
    margin: 0;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    color: rgba(16, 16, 16, 0.7);
}

.nxc-cat { margin-top: 26px; }
.nxc-cat-head
{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}
.nxc-cat-head h3
{
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
}
.nxc-cat-head p
{
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: rgba(16, 16, 16, 0.7);
}
.nxc-always
{
    flex: none;
    padding: 5px 10px;
    border-radius: 999px;
    background-color: rgba(244, 156, 32, 0.15);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

/* Text for screen readers only (switch labels). The Blade pages' site.css has .visually-hidden;
   the built pages do not, so the consent styles carry their own. */
.nxc-banner .visually-hidden, .nxc-modal .visually-hidden
{
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* On/off switch: a real checkbox laid over the track, so it keeps native
   keyboard and screen-reader behaviour. */
.nxc-switch
{
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
}
.nxc-switch input
{
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.nxc-switch-track
{
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background-color: rgba(16, 16, 16, 0.22);
    transition: background-color 0.2s ease;
}
.nxc-switch-track::after
{
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease;
}
.nxc-switch input:checked + .nxc-switch-track { background-color: var(--nxc-action); }
.nxc-switch input:checked + .nxc-switch-track::after { transform: translateX(20px); }
.nxc-switch input:focus-visible + .nxc-switch-track
{
    outline: 2px solid var(--nxc-action);
    outline-offset: 3px;
}

/* One row per service; its details open in place. */
.nxc-services
{
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}
.nxc-services li
{
    margin-top: 8px;
    border: 1px solid rgba(16, 16, 16, 0.12);
    border-radius: 12px;
    background-color: #fff;
    transition: border-color 0.2s ease;
}
.nxc-services li:hover,
.nxc-services li:has(details[open]) { border-color: var(--nxc-action); }

.nxc-services summary
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
    border-radius: 12px;
}
.nxc-services summary::-webkit-details-marker { display: none; }
.nxc-services summary::after
{
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    margin-left: 4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}
.nxc-services details[open] > summary::after { transform: rotate(-135deg); }
.nxc-services summary:focus { outline: none; }
.nxc-services summary:focus-visible
{
    outline: 2px solid var(--nxc-action);
    outline-offset: -2px;
}
.nxc-svc-name
{
    flex: 1;
    font-size: 14px;
    font-weight: 700;
}
.nxc-svc-provider
{
    font-size: 13px;
    font-weight: 400;
    color: rgba(16, 16, 16, 0.55);
    text-align: right;
}
.nxc-svc-body
{
    padding: 0 16px 16px;
}
.nxc-svc-body p
{
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: rgba(16, 16, 16, 0.75);
}
.nxc-cookies
{
    width: 100%;
    margin: 4px 0 12px;
    border-collapse: collapse;
    font-size: 13px;
    font-weight: 400;
}
.nxc-cookies th
{
    padding: 0 0 6px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: rgba(16, 16, 16, 0.55);
}
.nxc-cookies td
{
    padding: 7px 0;
    border-top: 1px solid rgba(16, 16, 16, 0.08);
    word-break: break-all;
}
.nxc-cookies td + td,
.nxc-cookies th + th
{
    width: 30%;
    word-break: normal;
}

.nxc-fine
{
    margin: 26px 0 20px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.55;
    color: rgba(16, 16, 16, 0.6);
}
.nxc-modal a,
.nxc-banner a
{
    color: var(--nxc-ink);
    text-decoration: underline;
    text-decoration-color: rgba(244, 156, 32, 0.9);
    text-underline-offset: 3px;
}
.nxc-modal a:hover,
.nxc-banner a:hover { color: var(--nxc-action); }

.nxc-modal-actions
{
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 28px 24px;
    border-top: 1px solid rgba(16, 16, 16, 0.08);
}

/* ————— Footer "Cookie settings" link: same look as the links beside it ————— */
.credits .nxc-link
{
    padding: 0;
    border: 0;
    background: none;
    color: var(--nxc-bg);
    font: inherit;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    opacity: 0.55;
    cursor: pointer;
}
.credits .nxc-link:hover { opacity: 1; color: var(--nxc-action); }
.credits .nxc-link:focus-visible
{
    outline: 2px solid var(--nxc-action);
    outline-offset: 3px;
    opacity: 1;
}

/* ————— Small screens ————— */
@media (max-width: 700px)
{
    .credits .nxc-link { font-size: 10px; }
}
@media (max-width: 560px)
{
    .nxc-banner
    {
        left: 12px;
        right: 12px;
        bottom: 12px;
        width: auto;
        padding: 20px;
    }
    /* Phones: well short of the screen. svh is the height with Safari's
       toolbars showing, the smallest the screen gets, so the dialog never
       runs past it; its body scrolls inside. */
    .nxc-modal
    {
        width: calc(100% - 32px);
        max-height: 72vh;
        max-height: 72svh;
        border-radius: 16px;
    }
    .nxc-modal-body
    {
        padding: 22px 16px 4px;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    .nxc-modal h2 { font-size: 18px; }
    .nxc-intro { font-size: 13px; }
    .nxc-cat { margin-top: 18px; }
    .nxc-close { top: 10px; right: 10px; width: 30px; height: 30px; }
    .nxc-fine { margin: 18px 0 14px; font-size: 12px; }
    /* Accept on its own row, Reject and Save side by side under it */
    .nxc-modal-actions
    {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 10px 16px 14px;
    }
    .nxc-modal-actions [data-cc="accept"] { grid-column: 1 / -1; order: -1; }
    .nxc-modal-actions .nxc-btn { padding: 12px 6px; font-size: 12px; }
    .nxc-btn { padding: 15px 18px; }
    .nxc-svc-provider { display: none; }

    /* Phones: a strip with the short text and one row of buttons, so it
       covers as little of the page as possible. */
    .nxc-banner { padding: 16px 16px 14px; border-radius: 16px; }
    .nxc-banner h2 { margin-bottom: 4px; font-size: 16px; }
    .nxc-banner p { margin-bottom: 12px; font-size: 13px; line-height: 1.45; }
    .nxc-banner .nxc-long { display: none; }
    .nxc-banner .nxc-short { display: inline; }
    .nxc-actions
    {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas: "custom reject accept";
        gap: 6px;
    }
    .nxc-actions .nxc-btn { padding: 13px 6px; }
}

/* While the banner is up, the hero's text and buttons (bottom-left) move up
   above it instead of sitting underneath, and so does the sticky quote bar.
   --nxc-h is the banner's height, kept current by js/consent.js. Above
   1000px the banner sits to the right of the hero buttons, so nothing moves. */
@media (max-width: 1000px) and (min-height: 540px)
{
    .hero .content-wrapper { transition: padding-bottom 0.3s ease; }
    body.has-cc-banner .hero .content-wrapper { padding-bottom: calc(var(--nxc-h, 0px) + 36px); }
    body.has-cc-banner .sticky-cta { bottom: calc(var(--nxc-h, 0px) + 24px); }
}

@media (prefers-reduced-motion: reduce)
{
    .nxc-banner,
    .nxc-modal[open] { animation: none; }
    .nxc-banner,
    .nxc-banner.is-away { transition: none; }
    .nxc-btn,
    .nxc-switch-track,
    .nxc-switch-track::after,
    .nxc-services li,
    .nxc-services summary::after { transition: none; }
}

@media print
{
    .nxc-banner,
    .nxc-modal { display: none !important; }
}
