/*
 * Miracle DPT — the frame. Type, links, buttons, focus, stars and blobs:
 * the calm the loud parts sit on. Element defaults sit in the `base` layer;
 * the rest is not in a layer, so it beats the kit and default's style.css
 * without fighting their specificity.
 */

/* Page transitions (View Transitions): see motion.css for the star wipe. */
@view-transition {
    navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

/* Element defaults go in the kit's `base` layer (after its own, so they win
   there): a component's rule in default's style.css, such as the share bar's
   small title, still beats them. Everything below the layer is unlayered and
   beats both. */
@layer base {
    html {
        background: var(--bg);
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    body {
        font-size: var(--text-base);
    }

    /* Ink on magenta: cream on it is only 3:1. */
    ::selection {
        background: var(--brand-magenta);
        color: var(--ink);
    }

    /* Type ------------------------------------------------------------------ */
    h1,
    h2,
    h3 {
        font-weight: var(--weight-display);
        letter-spacing: var(--tracking-display);
        line-height: var(--leading-tight);
        text-wrap: balance;
        /* A long word at this size must wrap, not be cut off. */
        overflow-wrap: break-word;
        hyphens: auto;
    }

    h1 {
        font-size: var(--text-3xl);
        font-weight: var(--weight-black);
        text-transform: uppercase;
        letter-spacing: var(--tracking-monster);
        margin-bottom: var(--space-5);
    }

    h2 {
        font-size: var(--text-2xl);
        text-transform: uppercase;
    }

    h3 {
        font-size: var(--text-lg);
        line-height: 1.1;
    }

    .eyebrow,
    .section-title {
        margin: 0 0 var(--space-4);
        font-size: var(--text-xs);
        font-weight: var(--weight-strong);
        letter-spacing: var(--tracking-caps);
        text-transform: uppercase;
        color: var(--ink);
    }

    .eyebrow::before,
    .section-title::before {
        content: "";
        display: inline-block;
        width: .9em;
        aspect-ratio: 1;
        margin-right: .5em;
        vertical-align: -.1em;
        background: var(--brand-gradient);
        mask: url("logo-star.svg") center / contain no-repeat;
    }

    .prose {
        font-size: var(--text-md);
        line-height: 1.5;
        text-wrap: pretty;
    }

    /* Lists in an editor's text: the brand's star for a bullet. */
    .prose ul {
        padding-left: 1.4em;
        list-style: none;
    }

    .prose ul > li {
        position: relative;
    }

    .prose ul > li::before {
        content: "";
        position: absolute;
        top: .35em;
        left: -1.3em;
        width: .75em;
        aspect-ratio: 1;
        background: var(--brand-gradient);
        mask: url("logo-star.svg") center / contain no-repeat;
    }

    /* Links: a gradient line under them, thicker under the pointer. */
    .prose a,
    .link,
    .link-back {
        color: inherit;
        text-decoration: none;
        background: var(--brand-gradient) left bottom / 100% 2px no-repeat;
        transition: background-size var(--duration-fast) var(--ease);
    }

    /* Under the pointer the line fills the word: the warm end only, so
       the ink stays readable on it. */
    .prose a:hover,
    .link:hover,
    .link-back:hover {
        background-image: var(--brand-gradient-under-ink);
        background-size: 100% 100%;
        color: var(--ink);
    }
}

/* Focus: a gradient ring, everywhere, never removed. */
:focus-visible {
    outline: var(--focus-width) solid var(--brand-magenta);
    outline-offset: var(--focus-offset);
}

@supports (outline-color: color-mix(in srgb, red, blue)) {
    :focus-visible {
        outline-color: var(--brand-violet);
        box-shadow: 0 0 0 calc(var(--focus-width) + var(--focus-offset)) var(--bg), 0 0 0 calc(var(--focus-width) * 2 + var(--focus-offset)) var(--brand-orange);
    }
}

/* Buttons: an ink box with cream capitals; the gradient floods in. */
.button,
button.button {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: var(--tap);
    padding: var(--space-3) var(--space-5);
    border: 0;
    border-radius: 0;
    background: var(--ink);
    color: var(--on-night);
    font-size: var(--text-sm);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    text-decoration: none;
}

.button::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--brand-gradient-under-ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--duration) var(--ease);
}

.button:hover {
    color: var(--ink);
}

.button:hover::before {
    transform: scaleX(1);
}

.button.is-quiet {
    background: transparent;
    color: var(--ink);
    box-shadow: inset 0 0 0 2px var(--ink);
}

/* A project's tags, as small capitals in a pill of ink (filter chips are
   in pages.css). */
.tags li {
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

.tags li {
    padding: var(--space-1) var(--space-3);
    border: 1.5px solid var(--ink);
    border-radius: 999px;
}

/* The Étoile: the brand's star, as a shape any element can wear. */
.motion-toggle-star {
    display: inline-block;
    aspect-ratio: 1;
    background: var(--brand-gradient);
    mask: url("logo-star.svg") center / contain no-repeat;
}

/* Blobs: huge soft gradient shapes, cropped by the edges. Their outline
   breathes slowly (motion.css); still, they are a fixed soft shape. */
.blob {
    position: absolute;
    z-index: -1;
    aspect-ratio: 1;
    border-radius: 62% 38% 46% 54% / 55% 45% 55% 45%;
    pointer-events: none;
}

.blob-a {
    width: clamp(16rem, 40vw, 40rem);
    top: -16%;
    right: -12%;
    background: var(--brand-gradient-sunrise);
}

.blob-b {
    width: clamp(10rem, 20vw, 20rem);
    bottom: 10%;
    right: -9%;
    background: var(--brand-gradient-ultraviolet);
}

/* A picture in a soft blob (portraits). */
.blob-frame {
    overflow: hidden;
    border-radius: 58% 42% 50% 50% / 48% 56% 44% 52%;
    background: var(--brand-gradient);
}

.blob-frame img,
.blob-frame .media,
.blob-frame picture {
    display: block;
    width: 100%;
    height: 100%;
}

/* The chrome logo: an image, sized by its slot. */
.chrome-logo {
    display: block;
    width: 100%;
    height: auto;
}

/* Media sit on the paper, not on grey. */
.card-media,
.media-frame {
    background: var(--media-bg);
}

/* The scrollbar: a gradient pill on the paper, inset from the edges. Chrome
   and Safari draw it from the ::-webkit-scrollbar parts, which can take a
   gradient (so `scrollbar-color` is left unset for them: it would switch
   those parts off). Firefox only has `scrollbar-color`: an ink thumb on the
   paper. */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    border: 4px solid var(--bg);
    border-radius: 999px;
    background: linear-gradient(180deg, var(--brand-magenta), var(--brand-orange) 55%, var(--brand-yellow)) padding-box;
}

::-webkit-scrollbar-thumb:hover {
    border-width: 3px;
    background: linear-gradient(180deg, var(--brand-violet), var(--brand-magenta) 50%, var(--brand-orange)) padding-box;
}

::-webkit-scrollbar-corner {
    background: var(--bg);
}

@supports (-moz-appearance: none) {
    html {
        scrollbar-color: var(--ink) var(--bg);
        scrollbar-width: thin;
    }
}

/* Form fields: an ink box, square, the gradient ring on focus. */
.input,
.select,
.textarea {
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
}

.field-label {
    color: var(--ink);
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

.check input {
    accent-color: var(--brand-magenta);
}

/* A quotation in an editor's text: big, with the gradient as its rule. */
.prose blockquote {
    margin-inline: 0;
    padding-left: var(--space-5);
    border-left: 0;
    background: var(--brand-gradient-ultraviolet) left top / 4px 100% no-repeat;
    font-size: var(--text-lg);
    font-weight: var(--weight-bold);
    line-height: 1.3;
}

/* The round buttons the parts share: the carousel's arrows, gradient discs. */
.carousel-btn {
    border-radius: 50%;
    background: var(--brand-gradient);
    color: var(--ink);
    transition: scale var(--duration) var(--ease-spring);
}

.carousel-btn:not([disabled]):hover {
    scale: 1.1;
}

.carousel-count {
    color: var(--ink);
    font-weight: var(--weight-strong);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
}

/* A Vimeo or YouTube film's poster: the same gradient play disc as the
   site's own player, sized to the poster. */
.embed {
    container-type: inline-size;
}

.embed-play {
    width: clamp(3.25rem, 13cqi, 5.5rem);
    height: clamp(3.25rem, 13cqi, 5.5rem);
    background: var(--brand-gradient);
    color: var(--ink);
    box-shadow: 0 18px 40px -12px rgb(0 0 0 / .5);
}

.embed-link:hover .embed-play {
    transform: scale(1.12) rotate(-6deg);
}

/* "Watch the film" on any ambient film: the gradient pill. Absolute, as
   the kit places it: .button above would otherwise make it relative. */
.video-ambient-watch {
    position: absolute;
    border-radius: 999px;
    background: var(--brand-gradient-under-ink);
    color: var(--ink);
}

/* Disclosures: capitals, ink rules, the plus turns. */
.disclosure,
.disclosure:first-of-type {
    border-color: var(--ink);
    border-width: 2px;
}

.disclosure > summary {
    font-size: var(--text-md);
    font-weight: var(--weight-black);
    letter-spacing: var(--tracking-display);
    text-transform: uppercase;
}

.disclosure > summary:hover {
    color: transparent;
    background: var(--brand-gradient-on-paper);
    background-clip: text;
}

.disclosure > summary .icon {
    color: var(--ink);
}

/* Rolling up (js/disclosure.js): still open until it is shut, but the
   plus turns back as it starts. */
.disclosure[data-disclosure="closing"] > summary .icon {
    transform: none;
}

/* The logo (_logo.html.twig): its fill, the moving gradient or ink, cut
   to the logo's shape by its SVG. */
.logo {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 256 / 156;
    background: var(--brand-gradient);
    mask: url("brand/logo.svg") center / contain no-repeat;
}

.logo.is-ink {
    background: var(--ink);
}
