/* ==========================================================================
   Page head — the dark band that opens every inner page
   (template-parts/page-head.php). Loaded by kxp_redesign_assets() on every
   redesigned template, so legal pages, the journal, wholesale and the shop
   pages all open the same way.
   ========================================================================== */

/* <main> normally pads itself clear of the fixed header with a generous clamp.
   With a band it clears the header exactly and the band brings its own space.
   main.kxp-has-phead (0,1,1) outranks .kxp-doc / .kxp-shop-main, which load
   after this file. */
main.kxp-has-phead { padding-top: var(--kxp-hdr-h, 113px); }
@media (max-width: 899px) {
    main.kxp-has-phead { padding-top: var(--kxp-hdr-h, 76px); }
}

.kxp-phead {
    /* The brand red is 4.2:1 on black — too faint for small type. This is the
       same lifted red the campaign hero uses on dark backgrounds (5.9:1). */
    --kxp-phead-red: #ff3b30;

    position: relative;
    overflow: hidden;
    isolation: isolate;
    margin-bottom: clamp(3rem, 6vw, 5rem);
    padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4.25rem);
    background: var(--kxp-black);
    color: var(--kxp-white);
    border-bottom: 4px solid var(--kxp-accent);
}

/* The red X from the wordmark, cropped off the right edge. The letter, not the
   × glyph — × is far too thin at this size. */
.kxp-phead::after {
    content: "X";
    position: absolute;
    z-index: -1;
    right: -0.06em;
    bottom: -0.3em;
    font-family: var(--kxp-font-display);
    font-weight: 800;
    font-size: clamp(13rem, 30vw, 28rem);
    line-height: 1;
    color: var(--kxp-accent);
    opacity: 0.18;
    pointer-events: none;
}

.kxp-phead__crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    font-size: var(--kxp-step--1);
    color: var(--kxp-grey-500);
}
.kxp-phead__crumbs a { color: var(--kxp-grey-300); transition: color 0.3s var(--kxp-ease); }
.kxp-phead__crumbs a:hover { color: var(--kxp-white); }
.kxp-phead__sep { color: var(--kxp-phead-red); }
.kxp-phead__here { color: var(--kxp-white); }

.kxp-phead__eyebrow {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-top: clamp(1.75rem, 3.5vw, 2.75rem);
    font-family: var(--kxp-font-display);
    font-size: var(--kxp-step--1);
    font-weight: 600;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--kxp-phead-red);
}
.kxp-phead__eyebrow::before {
    content: "";
    flex: none;
    width: 2.25rem;
    height: 2px;
    background: currentColor;
}

.kxp-phead__title {
    max-width: 22ch;
    margin-top: clamp(1.75rem, 3.5vw, 2.75rem);
    font-size: var(--kxp-step-3);
    text-transform: uppercase;
    text-wrap: balance;
    color: var(--kxp-white);
}
.kxp-phead__eyebrow + .kxp-phead__title { margin-top: 1rem; }

.kxp-phead__lead {
    max-width: var(--kxp-max-text);
    margin-top: 1.5rem;
    font-size: var(--kxp-step-1);
    line-height: 1.5;
    color: var(--kxp-grey-300);
}

.kxp-phead__meta {
    margin-top: 1.25rem;
    font-size: var(--kxp-step--1);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kxp-grey-500);
}

/* ── Artwork variant ────────────────────────────────────────────────────────
   A page can bring its own artwork instead of the X watermark — /enixytil/
   shows the two caffeine molecules (client feedback #121). The image is
   decorative, so it is an empty-alt <img> rather than a CSS background: it
   then gets lazy decoding and the browser's normal image handling.

   Both sit on negative z-index, which paints them above the band's black
   background but below the text. The gradient keeps the headline legible
   where the art is busiest. */
.kxp-phead--bg::after { content: none; }

/* Taller than a text-only band, and the content is centred in it: the cage
   shots are 3:1 and a short band cropped them to a dark strip. */
.kxp-phead--bg {
    display: grid;
    align-content: center;
    min-height: clamp(19rem, 30vw, 26rem);
}

.kxp-phead__bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right center;
    pointer-events: none;
}
.kxp-phead--bg::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    /* Softer than it was: the molecule artwork is bright and could take a heavy
       shade, but the cage photographs are already dark and disappeared under
       it. The left end stays solid, which is where the headline sits. */
    background: linear-gradient(
        90deg,
        var(--kxp-black) 0%,
        rgba(10, 10, 10, 0.92) 26%,
        rgba(10, 10, 10, 0.38) 58%,
        rgba(10, 10, 10, 0) 88%
    );
}

/* Narrow screens: the art ends up behind the words, so the shade runs down
   the band instead of across it. */
@media (max-width: 899px) {
    /* Dimmer here than on desktop: stacked, the artwork's own labels sit right
       behind the lead paragraph and competed with it. */
    .kxp-phead__bg { opacity: 0.55; }
    .kxp-phead--bg::before {
        background: linear-gradient(
            180deg,
            rgba(10, 10, 10, 0.93) 0%,
            rgba(10, 10, 10, 0.8) 55%,
            rgba(10, 10, 10, 0.6) 100%
        );
    }
}
