/*
 * Theme: Kontrast – bold, clean and playful. Lots of white, condensed heavy headings,
 * an apricot "marker" behind accent words, black pill buttons, big rounded image cards with
 * frosted labels, centred section intros and a light footer with the name set huge.
 * (Inspired by the clarity of klarna.com, in Scapa Media's own warm colours.)
 */
:root {
    --palette-ink: #121212;
    --palette-ink-soft: #2a2826;
    --palette-cream: #f4f2ef;   /* light warm grey */
    --palette-blush: #ffe6da;   /* light apricot */
    --palette-rose: #ffd3bf;
    --palette-sand: #e9e6e2;
    --palette-clay: #ffb996;    /* apricot – the marker */
    --palette-cocoa: #ffb996;   /* the "colour block" surface is apricot too */
    --palette-white: #ffffff;

    --bg: var(--palette-white);
    --fg: var(--palette-ink);
    --accent: var(--palette-ink);
    --accent-contrast: var(--palette-white);
    --highlight: var(--palette-clay);
    --marker: var(--palette-clay);
    --card: var(--palette-cream);
    --button-bg: var(--palette-ink);
    --button-fg: var(--palette-white);

    --font-body: 'Inter', ui-sans-serif, system-ui, sans-serif;
    --font-display: 'Archivo', 'Arial Narrow', ui-sans-serif, sans-serif;
    --display-stretch: 72%;
    --heading-weight: 800;
    --heading-accent-weight: 800;
    --leading-tight: 1.04;
    --leading-snug: 1.1;
    --leading-body: 1.6;
    --tracking-tight: -0.01em;
    --tracking-wide: 0.02em;

    --radius-s: 0.875rem;
    --radius-m: 1.25rem;
    --radius-l: 1.75rem;
    --radius-pill: 999px;
    --shadow-soft: none;
    --shadow-lift: 0 18px 40px -22px rgb(18 18 18 / 0.35);

    --heading-em-style: normal;
    --eyebrow-color: var(--fg);
    --eyebrow-rule-width: 0;
    --eyebrow-rule-height: 0;
    --eyebrow-rule-color: currentColor;
    --button-radius: var(--radius-pill);
    --button-padding: 0.9rem 1.5rem;
    --button-case: none;
    --button-tracking: normal;
    --button-weight: 600;
    --glow-display: none;
    --reel-radius: 1.5rem;
    --logo-weight: 800;
    --header-scrolled-bg: color-mix(in oklab, var(--palette-white) 90%, transparent);
    --dropdown-bg: var(--palette-white);
    --dropdown-hover: var(--palette-cream);
    --header-height: 4.5rem;
}

/* ───── Surfaces ───── */
[data-surface="cream"] { --bg: var(--palette-cream); --card: var(--palette-white); }
[data-surface="white"] { --bg: var(--palette-white); --card: var(--palette-cream); }
[data-surface="blush"] { --bg: var(--palette-blush); --card: var(--palette-white); --marker: var(--palette-white); }
[data-surface="sand"]  { --bg: var(--palette-sand); --card: var(--palette-white); }
[data-surface="cocoa"] {
    --bg: var(--palette-cocoa); --fg: var(--palette-ink); --marker: var(--palette-white);
    --accent: var(--palette-ink); --highlight: var(--palette-ink);
    --card: color-mix(in oklab, var(--palette-cocoa) 55%, white); --button-bg: var(--palette-ink); --button-fg: var(--palette-white);
}
[data-surface="ink"] {
    --bg: var(--palette-ink); --fg: #f6f4f1; --marker: var(--palette-clay);
    --accent: var(--palette-clay); --accent-contrast: var(--palette-ink); --highlight: var(--palette-clay);
    --card: var(--palette-ink-soft); --button-bg: var(--palette-white); --button-fg: var(--palette-ink);
}

/* ───── Signature styles ───── */
.theme-kontrast {
    /* Condensed heavy headings; *word* gets an apricot marker instead of italics */
    & :is(.heading, .site-logo, .marquee__word, .contact-list__value, .steps__number) { font-stretch: var(--display-stretch); }
    & .heading em, & .site-logo em {
        color: inherit; font-style: normal;
        background: var(--marker); padding: 0 .14em; margin-inline: -.04em; border-radius: .14em;
        -webkit-box-decoration-break: clone; box-decoration-break: clone;
    }
    /* In headings the marker is a rounded band centred on the capitals (Archivo: cap height
       .686em, descent .21em): from just above the caps to just below the baseline, so the
       descenders (j, g, p) poke out below it and it never reaches the line above. The band
       is shorter than the em's box, so border-radius can't round it; the corners are drawn
       as four dots plus two crossed rectangles. */
    & .heading em {
        --mb: .07em; --mh: .92em; --mr: .12em; --md: calc(2 * var(--mr));
        --dot: radial-gradient(circle closest-side, var(--marker) 97%, #0000);
        border-radius: 0;
        background:
            var(--dot) left 0 bottom var(--mb) / var(--md) var(--md) no-repeat,
            var(--dot) right 0 bottom var(--mb) / var(--md) var(--md) no-repeat,
            var(--dot) left 0 bottom calc(var(--mb) + var(--mh) - var(--md)) / var(--md) var(--md) no-repeat,
            var(--dot) right 0 bottom calc(var(--mb) + var(--mh) - var(--md)) / var(--md) var(--md) no-repeat,
            linear-gradient(var(--marker), var(--marker)) left 0 bottom calc(var(--mb) + var(--mr)) / 100% calc(var(--mh) - var(--md)) no-repeat,
            linear-gradient(var(--marker), var(--marker)) left var(--mr) bottom var(--mb) / calc(100% - var(--md)) var(--mh) no-repeat;
    }
    /* The marker sits behind all of the heading's text, so on a two-line heading the
       descenders (j, g, p) of the line above stay on top of it */
    & .heading { isolation: isolate; }
    & .heading em { position: relative; z-index: -1; }
    & .heading--h3, & .heading--h4 { letter-spacing: 0; }
    & .lead { color: color-mix(in oklab, var(--fg) 72%, var(--bg)); }

    /* Section intros are centred, like a clean product page */
    & :is(.section > .container, .section > .container > .max-w-2xl) > header.stack-m.max-w-3xl { margin-inline: auto; text-align: center; & .eyebrow { margin-inline: auto; } }
    & .section > .container > .max-w-2xl:has(> header.stack-m) { max-width: none; }

    /* Eyebrow = small grey label pill */
    & .eyebrow {
        width: fit-content; padding: .45rem .9rem; border-radius: var(--radius-pill);
        background: color-mix(in oklab, var(--fg) 7%, transparent);
        font-size: .75rem; font-weight: 600; text-transform: none; letter-spacing: 0;
        &::before { display: none; }
    }

    /* Frosted label used on image cards and the hero stage */
    & .chip { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1rem; border-radius: var(--radius-pill); font-family: var(--font-body); font-size: .875rem; font-weight: 600; line-height: 1.1; letter-spacing: 0; }
    & .chip--glass { background: rgb(255 255 255 / .72); color: var(--palette-ink); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); }

    /* Header: logo and menu together on the left, button on the right */
    & .site-logo { font-size: 1.625rem; letter-spacing: -0.02em; gap: .15em; }
    & .site-logo em { --marker: var(--palette-clay); padding: 0 .16em; color: var(--palette-ink); font-weight: 800; }
    & .site-header[data-tone="light"] .site-logo em, & .menu-open .site-logo em { color: var(--palette-ink); }
    @media (width >= 64rem) {
        & .site-header > .container > nav { flex: 1; justify-content: flex-start; margin-left: 1.5rem; }
        & .site-header > .container > nav > :last-child { margin-left: auto; }
    }
    & .nav-link { font-weight: 500; }
    & .nav-link::after { height: 2px; bottom: .2rem; }
    & .burger { width: 3rem; height: 2.25rem; border-radius: var(--radius-pill); background: var(--palette-clay); }
    & .menu-open .site-header { --header-fg: var(--palette-ink); }
    & .mobile-menu__link { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 800; font-style: normal; }
    & .mobile-menu__link:hover { font-style: normal; text-decoration: underline; text-decoration-thickness: 3px; }

    /* Buttons: black pills, apricot on hover */
    & .button--primary:hover { box-shadow: none; background: var(--palette-clay); color: var(--palette-ink); }
    & [data-surface="cocoa"] .button--primary:hover, & [data-surface="ink"] .button--primary:hover { background: var(--palette-white); color: var(--palette-ink); }
    & .button--outline { box-shadow: inset 0 0 0 1.5px var(--fg); }

    /* Hero "stage": text above, a big rounded media card below */
    & .hero-stage { padding-bottom: clamp(1rem, 3vw, 2rem); }
    & .hero-stage__media { position: relative; margin-top: clamp(2.5rem, 5vw, 4rem); height: clamp(20rem, 62vw, 46rem); max-height: 75svh; overflow: hidden; border-radius: var(--radius-l); background: var(--palette-cream); & > :first-child { position: absolute; inset: 0; } }
    & .hero-stage__media :is(video, img) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
    & .hero-stage__chip { position: absolute; left: 50%; bottom: 1.25rem; translate: -50% 0; z-index: 1; white-space: nowrap; }
    & .hero-stage .heading--display { font-size: clamp(3rem, 1.6rem + 7vw, 9rem); }
    /* Classic background heroes (centred or left) get a softer overlay */
    & .hero__media::after { background: linear-gradient(180deg, rgb(18 18 18 / .1), rgb(18 18 18 / .55)); }

    /* Cards: flat, grey, generously rounded */
    & .card { box-shadow: none; border-radius: var(--radius-l); }
    & a.service-card:hover { transform: translateY(-4px); box-shadow: none; background: color-mix(in oklab, var(--card) 85%, var(--palette-clay)); }
    & .service-card--image .service-card__media { border-radius: var(--radius-m); }
    & :is(.service-card__arrow, .reels__arrow) { box-shadow: none; background: var(--bg); }
    & a.service-card:hover .service-card__arrow { background: var(--palette-ink); color: #fff; }
    & .service-card ul li::before, & .prose li::before { background: var(--palette-ink); width: .375rem; height: .375rem; }
    & .media-frame { border-radius: var(--radius-l); }

    /* Image links with frosted title chips */
    & .image-links--chips .image-link { gap: .75rem; text-align: center; }
    & .image-links--chips .image-link__media { aspect-ratio: 4 / 5; border-radius: var(--radius-l); }
    & .image-link__chip { position: absolute; inset: auto auto 1rem 50%; translate: -50% 0; z-index: 1; max-width: calc(100% - 2rem); width: max-content; & .image-link__arrow svg { width: .9em; height: .9em; } }
    & .image-links--chips .image-link__text { margin: 0 auto; max-width: 28ch; font-size: var(--text-sm); }
    & .image-link__cta {
        display: inline-flex; align-items: center; gap: .3rem; overflow: hidden; white-space: nowrap;
        max-width: 0; padding: .35rem 0; margin-left: 0; border-radius: var(--radius-pill);
        background: var(--palette-ink); color: #fff; font-size: .8125rem; opacity: 0;
        transition: max-width var(--duration) var(--ease-out), padding var(--duration) var(--ease-out), margin var(--duration) var(--ease-out), opacity var(--duration-fast);
        & svg { width: .9em; height: .9em; }
    }
    & .image-link__chip { transition: padding var(--duration) var(--ease-out); }
    & a.image-link:is(:hover, :focus-visible) .image-link__chip { padding-right: .4rem; }
    & a.image-link:is(:hover, :focus-visible) .image-link__cta { max-width: 9rem; padding-inline: .75rem; margin-left: .5rem; opacity: 1; }
    & .image-links--chips .image-link__media img { transition: transform var(--duration-slow) var(--ease-out); }

    /* Wide screens with a mouse: the cards share one row and the hovered one widens */
    @media (width >= 64rem) and (hover: hover) {
        & .image-links--chips { display: flex; gap: 1.25rem; }
        & .image-links--chips > .image-link { flex: 1 1 0; min-width: 0; transition: flex-grow .7s var(--ease-out); }
        & .image-links--chips .image-link__media { aspect-ratio: auto; height: clamp(26rem, 38vw, 36rem); }
        & .image-links--chips:has(> a.image-link:hover) > .image-link:hover { flex-grow: 2.3; }
        & .image-links--chips .image-link__text { transition: opacity var(--duration-fast); }
        & .image-links--chips:has(> a.image-link:hover) > .image-link:not(:hover) .image-link__text { opacity: .45; }
    }

    /* Scroll story (Fördelar, "Runt en bild"): picture pinned left, titles step on the right */
    & .story__stage { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
    & .story__dots { display: none; }
    & .story__media { position: relative; aspect-ratio: var(--story-ratio, 4 / 5); overflow: hidden; border-radius: var(--radius-l); background: var(--card); }
    /* A chosen format (mobile 9:16 etc.) keeps its shape: never taller than the screen, centred */
    & .story--ratio .story__media { width: min(100%, calc(80svh * (var(--story-ratio)))); justify-self: center; }
    & .story__picture { position: absolute; inset: 0; opacity: 0; transition: opacity .6s var(--ease-out); & > :first-child { position: absolute; inset: 0; } & :is(img, video) { width: 100%; height: 100%; object-fit: cover; } }
    & .story__picture.is-active { opacity: 1; }
    & .story__picture:not(.is-active) { pointer-events: none; }
    & .story:not(.is-pinned) .story__chip { display: none; }
    & .story__chip { position: absolute; left: 50%; bottom: 1rem; translate: -50% 0; z-index: 1; white-space: nowrap; }
    & .story__items { display: grid; gap: clamp(1.25rem, 2.5vw, 2rem); }
    & .story__title { font-family: var(--font-display); font-stretch: var(--display-stretch); font-weight: 800; font-size: var(--text-h2); line-height: 1; letter-spacing: var(--tracking-tight); }
    & .story__title button { text-align: left; cursor: pointer; color: inherit; }
    & .story__text { margin-top: .75rem; max-width: 34rem; color: var(--fg-muted); }

    @media (width >= 64rem) and (prefers-reduced-motion: no-preference) {
        /* The section gets one screen of scrolling per step; the stage sticks meanwhile */
        & .story.is-pinned { height: calc(var(--story-steps) * 55svh + 100svh - var(--header-height)); }
        & .story.is-pinned .story__stage { position: sticky; top: var(--header-height); height: calc(100svh - var(--header-height)); grid-template-columns: auto minmax(0, 5fr) minmax(0, 6fr); }
        & .story.is-pinned .story__media { aspect-ratio: auto; height: min(78svh, 46rem); }
        & .story.is-pinned.story--ratio .story__media { aspect-ratio: var(--story-ratio); height: auto; width: min(100%, calc(min(78svh, 46rem) * (var(--story-ratio)))); }
        & .story.is-pinned .story__dots { display: grid; gap: .5rem; }
        & .story__dot { width: .375rem; height: .375rem; border-radius: 999px; background: color-mix(in oklab, var(--fg) 25%, transparent); transition: height var(--duration) var(--ease-out), background-color var(--duration); }
        & .story__dot.is-active { height: 1.75rem; background: var(--fg); }
        & .story.is-pinned .story__title { color: color-mix(in oklab, var(--fg) 32%, var(--bg)); transition: color var(--duration) var(--ease-out); }
        & .story.is-pinned .story__title button:hover { color: color-mix(in oklab, var(--fg) 60%, var(--bg)); }
        & .story.is-pinned .story__item.is-active .story__title { color: var(--fg); }
        & .story.is-pinned .story__text { display: grid; grid-template-rows: 0fr; margin-top: 0; opacity: 0; transition: grid-template-rows var(--duration) var(--ease-out), opacity var(--duration), margin var(--duration); & > p { overflow: hidden; } }
        & .story.is-pinned .story__item.is-active .story__text { grid-template-rows: 1fr; margin-top: 1rem; opacity: 1; }
        & .story.is-pinned .story__title { font-size: clamp(2.5rem, 1.2rem + 3vw, 4.75rem); }
    }

    /* Features and steps: numbered apricot dots instead of ornaments */
    & .feature { border-top: 0; padding: clamp(1.5rem, 3vw, 2rem); border-radius: var(--radius-l); background: var(--card); }
    & .feature__mark { width: .75rem; height: .75rem; background: var(--palette-clay); }
    & .marquee__sep { background: var(--palette-ink); }
    & .steps__item { border-top: 0; padding: clamp(1.5rem, 3vw, 2rem); border-radius: var(--radius-l); background: var(--card); }
    & .steps__number { font-style: normal; font-weight: 800; color: var(--fg); font-size: var(--text-h1); }
    & .steps--timeline::before { display: none; }
    & .steps--timeline .steps__number { background: var(--palette-clay); box-shadow: none; }

    /* Stats: big condensed numbers; a suffix like "+" is plain, not marked */
    & .stats__item dt em { background: none; padding: 0; margin: 0; }
    & .stats--divided .stats__item + .stats__item { border-left-color: var(--line); }

    /* FAQ: each question its own rounded grey card */
    & .faq { border-top: 0; display: grid; gap: .75rem; }
    & .faq__item { border-bottom: 0; border-radius: var(--radius-m); background: var(--card); padding-inline: clamp(1.25rem, 3vw, 2rem); }
    & .faq__question { font-weight: 600; }
    & .faq__icon { width: 1rem; height: 1rem; }

    /* Forms */
    & .field__input { border-radius: var(--radius-m); background: var(--card); border-color: transparent; }
    & .field__input:focus { border-color: var(--palette-ink); box-shadow: 0 0 0 3px var(--palette-clay); }
    & .field__input:focus + .field__label, & .field__input:not(:placeholder-shown) + .field__label { color: var(--fg); }

    /* Reels, marquee, social */
    & .reel { box-shadow: none; }
    /* A short row of reels sits centred under the centred heading; a long one still scrolls from the start */
    & .reels__track { justify-content: safe center; }
    & .marquee__word { font-weight: 800; }
    & .marquee__word:nth-child(4n+3) { font-style: normal; color: inherit; background: var(--marker); padding-inline: .15em; border-radius: .14em; }
    & .social-link { box-shadow: none; background: color-mix(in oklab, var(--fg) 8%, transparent); }

    /* Custom cursor off; links get an apricot underline */
    & .prose a { text-decoration-color: var(--palette-clay); text-decoration-thickness: 2px; }

    /* Footer: a grey panel with rounded top corners, the name set huge */
    /* The panel slides up over the last section, so its rounded corners show that section, not a white gap */
    & .footer-kontrast { position: relative; z-index: 1; margin-top: calc(-1 * var(--radius-l)); }
    & .footer-kontrast__panel { border-radius: var(--radius-l) var(--radius-l) 0 0; }
    & .footer-kontrast__title { margin-bottom: 1rem; font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); }
}
