/* ============================================================
   LEX VEENHOVEN — Portfolio
   1. Design system (tokens)
   2. Base & typography
   3. Layout
   4. Navigation
   5. Hero
   6. Work index
   7. About
   8. Project pages
   9. Next page & footer
   10. Contact
   11. Scroll reveal
   12. Responsive
   ============================================================ */

/* ==========================================
   1. Design system
   ========================================== */
:root {
    /* Paper white with a warm undertone — softer than pure white */
    --paper:     #fcfcfa;
    --paper-2:   #f3f3ef;
    --ink:       #121214;
    --muted:     #6e6e75;
    --line:      rgba(18, 18, 20, 0.14);
    --line-soft: rgba(18, 18, 20, 0.07);

    /* Accent — overridden per project, used sparingly */
    --accent:    #d81f6a;

    /* Lex' own brand colours, from the first design */
    --brand-pink: #ec008c;
    --brand-blue: #25408f;
    --brand-gradient: linear-gradient(100deg, var(--brand-pink), var(--brand-blue));
    /* Space above and below the title in the coloured band */
    --band-top: clamp(7rem, 13vw, 11rem);
    --band-bottom: clamp(3.5rem, 7vw, 6rem);

    --font-display: "Bricolage Grotesque", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-body:    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

    --pad:       clamp(1.25rem, 4vw, 4rem);
    --container: 1400px;
    --section:   clamp(4.5rem, 9vw, 8rem);
    --radius:    4px;

    --ease:      cubic-bezier(0.22, 1, 0.36, 1);
}

/* ==========================================
   2. Base & typography
   ========================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    position: relative;
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.035em;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; height: auto; }

::selection { background: var(--ink); color: var(--paper); }

/* Small label above a section or block */
.label {
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.lede {
    font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem);
    line-height: 1.45;
    letter-spacing: -0.015em;
}

.muted { color: var(--muted); }

/* Text link with an underline that fills in on hover */
.link {
    position: relative;
    display: inline-block;
    padding-bottom: 1px;
    background-image: linear-gradient(var(--ink), var(--ink));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 100% 1px;
    transition: background-size 0.4s var(--ease), color 0.3s ease;
}

.link:hover {
    color: var(--accent);
    background-image: linear-gradient(var(--accent), var(--accent));
}

/* ==========================================
   3. Layout
   ========================================== */
.wrap {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--pad);
}

.section { padding-block: var(--section); }

.rule { height: 1px; background: var(--line); border: 0; }


/* ==========================================
   4. Navigation
   ========================================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.35rem var(--pad);
    background: transparent;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

/* Over the coloured band: white text on a thin layer of glass */
.nav:not(.is-stuck) {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(10px) saturate(130%);
    -webkit-backdrop-filter: blur(10px) saturate(130%);
    border-bottom-color: rgba(255, 255, 255, 0.12);
}

.nav:not(.is-stuck) .nav-logo,
.nav:not(.is-stuck) .nav-links a {
    color: #fff;
}

.nav:not(.is-stuck) .nav-links a:hover {
    color: #fff;
    opacity: 0.75;
}

.nav.is-stuck {
    background: color-mix(in srgb, var(--paper) 85%, transparent);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom-color: var(--line-soft);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: clamp(1.25rem, 3vw, 2.25rem);
    font-size: 0.9rem;
}

.nav-links a {
    color: var(--muted);
    transition: color 0.25s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"],
.nav-links a.is-current { color: var(--ink); }

/* Over the coloured band everything is white, so the current page gets
   an underline instead of a colour difference */
.nav:not(.is-stuck) .nav-links a.is-current,
.nav:not(.is-stuck) .nav-links a[aria-current="page"] {
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
}

/* ==========================================
   5. Hero
   ========================================== */
.hero {
    /* The band itself: full width, title in white */
    background: var(--brand-gradient);
    color: #fff;
    padding-top: var(--band-top);
    padding-bottom: var(--band-bottom);
    /* The paper below casts a shadow onto the band, which makes it look
       like it sits in front rather than being attached to it */
    box-shadow: inset 0 -16px 20px -16px rgba(0, 0, 0, 0.32);
}

.hero .hero-title { color: #fff; }

/* The intro sits below it, on the paper */
.hero-meta {
    margin-top: 0;
    padding-top: clamp(2.5rem, 5vw, 4rem);
    padding-bottom: clamp(3rem, 6vw, 5rem);
}


.hero-title {
    font-size: clamp(3.2rem, 13vw, 12rem);
    font-weight: 600;
    letter-spacing: -0.05em;
    line-height: 0.88;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 4rem;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
}

.hero-meta p { max-width: 46ch; }

/* ==========================================
   6. Work index
   ========================================== */
.work-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem);
}

/* The first project gets the full width — that is the strongest work */
.work-item.is-wide { grid-column: 1 / -1; }

.work-figure {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--paper-2);
    aspect-ratio: 4 / 3;
}

.work-item.is-wide .work-figure { aspect-ratio: 16 / 9; }

.work-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease);
}

@media (hover: hover) {
    .work-item:hover .work-figure img { transform: scale(1.025); }
}

/* For images wider than the tile: fit instead of crop, so no logos or
   text get cut off */
.work-figure.is-contain { background: var(--paper); }

.work-figure.is-contain img {
    object-fit: contain;
    transform-origin: center;
}

.work-caption {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}

.work-title {
    font-size: clamp(1.35rem, 2.2vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    transition: color 0.3s ease;
}

.work-item:hover .work-title { color: var(--accent); }

.work-tags {
    font-size: 0.85rem;
    color: var(--muted);
    text-align: right;
    flex: none;
}

/* ==========================================
   7. About
   ========================================== */
.about {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: clamp(2rem, 5vw, 5rem);
    align-items: start;
}

.about-text p + p { margin-top: 1.25rem; }

.facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 2rem;
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.facts dt {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
}

.facts dd { line-height: 1.5; }

/* ==========================================
   8. Project pages
   ========================================== */
/* Project pages: the same band, with the project title in it */
.project-hero {
    background: var(--brand-gradient);
    color: #fff;
    padding-top: var(--band-top);
    padding-bottom: var(--band-bottom);
    box-shadow: inset 0 -16px 20px -16px rgba(0, 0, 0, 0.32);
}

/* Back button on the coloured band: the same glass as the navigation,
   so it reads as a button and does not vanish into the gradient */
.project-hero .back-link {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5rem 1rem 0.5rem 0.85rem;
    border-radius: 999px;
    font-weight: 500;
    gap: 0.5rem;
}

.project-hero .back-link:hover {
    /* Stays white: the general hover rule would otherwise turn it black on the gradient */
    color: #fff;
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.45);
    gap: 0.8rem;
}

/* What sits below the band: intro and details */
.project-details {
    padding-top: clamp(2.5rem, 5vw, 4rem);
    padding-bottom: clamp(1rem, 2vw, 2rem);
}

.project-details .project-intro { margin-top: 0; }

/* On a standalone page the text follows straight after the band. Without
   this it sticks to the coloured area. */
.project-body.after-hero { padding-top: clamp(2.5rem, 5vw, 4rem); }

.project-title {
    font-size: clamp(2.6rem, 9vw, 8rem);
    font-weight: 600;
    letter-spacing: -0.05em;
    line-height: 0.9;
    margin-top: 1rem;
}

.project-intro {
    max-width: 58ch;
    margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

.project-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1.75rem;
    margin-top: clamp(2.5rem, 5vw, 3.5rem);
    padding-top: 1.75rem;
    border-top: 1px solid var(--line);
}

.project-meta dt {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.project-meta dd { line-height: 1.5; }

/* Media blocks */
.media-stack {
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 5vw, 4.5rem);
}

.media {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-2);
}

.media img { width: 100%; }

.media-caption {
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--muted);
    max-width: 62ch;
}

.media-duo,
.media-trio {
    display: grid;
    gap: clamp(1rem, 2vw, 1.75rem);
    /* Do not stretch to the tallest in the row: the background of the
       shorter image would otherwise stick out below it */
    align-items: start;
}

.media-duo  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.media-trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Cut-out products already sit on a light surface — a thin frame keeps
   them separate from the paper */
.media-cutout {
    border: 1px solid var(--line-soft);
    background: var(--paper-2);
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    padding: clamp(1rem, 3vw, 2rem);
}

.media-cutout img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

/* Logo on a solid panel */
.media-brand {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid var(--line-soft);
}

.media-brand img { width: min(360px, 65%); }


/* Text block inside a project */
.project-note {
    max-width: 62ch;
}

.project-note h2 {
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    margin-bottom: 1rem;
}

.project-note p + p { margin-top: 1.1rem; }

/* YouTube: the player only loads after a click */
.yt {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-2);
    aspect-ratio: 16 / 9;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.yt img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease);
}

@media (hover: hover) {
    .yt:hover img { transform: scale(1.025); }
}

.yt iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.yt-play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}

.yt-play span {
    width: clamp(56px, 6vw, 76px);
    height: clamp(56px, 6vw, 76px);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--paper);
    color: var(--ink);
    font-size: 1.1rem;
    padding-left: 4px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    transition: transform 0.4s var(--ease);
}

.yt:hover .yt-play span { transform: scale(1.08); }

.yt-label {
    position: absolute;
    left: 1rem;
    bottom: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--paper);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    pointer-events: none;
}

/* Waiting state for as long as no video ID has been filled in */
.yt.is-pending { cursor: default; }
.yt.is-pending .yt-play span { background: color-mix(in srgb, var(--paper) 75%, transparent); }
.yt.is-pending:hover img { transform: none; }

.yt-pending {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: var(--paper);
    color: var(--muted);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    pointer-events: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
    transition: color 0.25s ease, gap 0.35s var(--ease);
}

/* The arrow lives in the CSS and not in the text: that way it lands exactly
   on the optical centre of the word, and a screen reader only says "Werk" */
.back-link::before {
    content: "←";
    display: block;
    line-height: 1;
    transform: translateY(-0.07em);
}

.back-link:hover { color: var(--ink); gap: 1rem; }

/* ==========================================
   9. Next page & footer
   ========================================== */
.next {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.55fr);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: center;
    padding-block: clamp(3rem, 7vw, 5.5rem);
    border-top: 1px solid var(--line);
}

.next-body { display: flex; flex-direction: column; gap: 0.9rem; }

.next h2 {
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    transition: color 0.3s ease;
}

.next:hover h2 { color: var(--accent); }

.next-figure {
    overflow: hidden;
    border-radius: var(--radius);
    /* 16:9 matches the thumbnails, so there is hardly any cropping */
    aspect-ratio: 16 / 9;
    background: var(--paper-2);
}

.next-figure img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease);
}

@media (hover: hover) {
    .next:hover .next-figure img { transform: scale(1.04); }
}

.footer {
    border-top: 1px solid var(--line);
    padding-block: 2.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.footer-links { display: flex; gap: 1.5rem; }
.footer-links a:hover { color: var(--ink); }

/* ==========================================
   10. Contact
   ========================================== */
.contact-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--line);
}

.contact-list dt {
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.6rem;
}

.contact-list dd {
    font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.3rem);
    letter-spacing: -0.02em;
    line-height: 1.5;
}

.mail-big {
    display: inline-block;
    max-width: 100%;
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 5.6vw, 4.75rem);
    font-weight: 600;
    letter-spacing: -0.045em;
    line-height: 1.05;
    transition: color 0.3s ease;
    /* Breaking stays allowed as a last resort — an email address has no
       spaces, so without this a long one runs off the screen. Thanks to the
       smaller type above it does not happen in practice. */
    overflow-wrap: anywhere;
}

.mail-big:hover { color: var(--accent); }

/* ==========================================
   11. Scroll reveal — one gentle movement, nothing more
   ========================================== */
[data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    transition-delay: var(--delay, 0ms);
}

[data-reveal].is-in { opacity: 1; transform: none; }

/* ==========================================
   12. Responsive
   ========================================== */
@media (max-width: 1024px) {
    .about { grid-template-columns: 1fr; }
    .media-trio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .work-grid { grid-template-columns: 1fr; }

    .work-caption {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .work-tags { text-align: left; }

    .media-duo,
    .media-trio { grid-template-columns: 1fr; }

    .next { grid-template-columns: 1fr; }
    .next-figure { order: -1; aspect-ratio: 16 / 9; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1; transform: none; }
}

@media print {
    .nav, .next { display: none !important; }
    body { background: #fff; }
}


/* ============================================================
   14. Publii — making the editor's output look like our design
   ============================================================
   Lex adds images and galleries in the editor. Those come with
   their own classes; below we hook them up to the styling the
   hand-built pages already had.
   ============================================================ */

/* Standalone image in the text = our .media */
.project-body figure {
    /* No background on the figure itself: the grey area would otherwise
       run on behind the caption */
    margin-block: clamp(2rem, 4vw, 3.5rem);
}

.project-body figure img {
    border-radius: var(--radius);
    background: var(--paper-2);
}

.project-body figure img { width: 100%; }

/* A gallery item is a <figure> too, but the grid already handles the space
   around it. Without this there is well over a hundred pixels between rows. */
.project-body .gallery__item { margin-block: 0; }

.project-body figcaption,
.project-body .media-caption {
    margin-top: 0.85rem;
    font-size: 0.85rem;
    color: var(--muted);
    max-width: 62ch;
}

/* The caption belongs outside the rounded area */
/* Text blocks inside a project */
.project-body > p,
.project-body > h2,
.project-body > h3 { max-width: 62ch; }

/* The reading width above is for running text. The email address is a
   heading, not a paragraph, and may use the full width. */
.project-body > p.mail-line { max-width: none; }

.project-body > h2 {
    font-size: clamp(1.4rem, 2.6vw, 2rem);
    margin-top: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1rem;
}

.project-body > p + p { margin-top: 1.1rem; }

.project-body > p.label {
    margin-top: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 1.25rem;
}

/* A small heading belongs to what sits below it. The margin of the next
   image would otherwise exceed the space above it, leaving it floating. */
.project-body > p.label + figure,
.project-body > p.label + .gallery-wrapper .gallery { margin-top: 0; }

/* A paragraph with the class "knop" becomes a button in the brand gradient.
   Publii has no button block, and a plain link in running text is invisible
   here — the base style strips colour and underline. A link plus one class
   in the block's advanced settings is the closest Lex can get without HTML. */
.project-body > p.knop {
    max-width: none;
    margin-block: clamp(2rem, 4vw, 3rem);
}

.project-body > p.knop a {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.5rem;
    border-radius: 999px;
    background: var(--brand-gradient);
    color: #fff;
    font-weight: 500;
    line-height: 1.2;
    transition: gap 0.3s var(--ease),
                transform 0.3s var(--ease),
                box-shadow 0.3s var(--ease);
}

/* The arrow belongs to the styling, so Lex only types the words */
.project-body > p.knop a::after {
    content: "\2192";
    font-size: 1.1em;
    line-height: 1;
}

.project-body > p.knop a:hover {
    color: #fff;   /* the general hover rule would turn it black on the gradient */
    gap: 0.95rem;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -12px rgba(18, 18, 20, 0.55);
}

.project-body > p.knop a:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}

/* No address filled in yet. Better an honest placeholder than a button that
   looks fine and goes nowhere — the same choice as "Video volgt" on Assen. */
.project-body > p.knop a:not([href]),
.project-body > p.knop a[href=""],
.project-body > p.knop a[href="#"] {
    background: var(--paper-2);
    color: var(--muted);
    cursor: default;
    pointer-events: none;
}

/* Say why it is grey, in the same voice as "Video volgt" on Assen */
.project-body > p.knop a:not([href])::after,
.project-body > p.knop a[href=""]::after,
.project-body > p.knop a[href="#"]::after {
    content: "(link volgt)";
    font-size: 0.85em;
}

/* And when there is no link element at all — the editor can drop an empty
   one the moment Lex touches the block — the paragraph itself takes the
   unfinished look, so the button never falls back into running text. */
.project-body > p.knop:not(:has(a)) {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.85rem 1.5rem;
    border-radius: 999px;
    background: var(--paper-2);
    color: var(--muted);
    font-weight: 500;
    line-height: 1.2;
}

.project-body > p.knop:not(:has(a))::after {
    content: "(link volgt)";
    font-size: 0.85em;
}

/* Gallery — Lex sets the number of columns in the editor.
   Two columns matches the old .media-duo, three the old .media-trio. */
.gallery {
    display: grid;
    gap: clamp(1rem, 2vw, 1.75rem);
    margin-block: clamp(2rem, 4vw, 3.5rem);
    padding: 0;
    /* Do not stretch to the tallest in the row: every image keeps its
       own proportions, just like on the hand-built site */
    align-items: start;
}

.gallery[data-columns="1"] { grid-template-columns: 1fr; }
.gallery[data-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery[data-columns="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery[data-columns="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.gallery__item {
    margin: 0;
    padding: 0;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--paper-2);
}

.gallery__item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Gallery wider than the text column */
.gallery-wrapper--wide  { margin-inline: calc(var(--pad) * -0.5); }
.gallery-wrapper--full  { margin-inline: calc(var(--pad) * -1); }

/* Styles Lex picks from the dropdown ------------------------ */

/* Cut-out product: light card underneath, nothing cropped.
   The card has a fixed ratio; the product scales along inside it and is
   never cut off. Careful: the image has to respect the height of the card,
   and for that the height must actually be passed down to the link around
   it. */
figure.is-cutout,
.gallery__item.is-cutout,
.is-cutout .gallery__item {
    border: 1px solid var(--line-soft);
    background: var(--paper-2);
    display: block;
    aspect-ratio: 4 / 3;
    padding: clamp(1rem, 3vw, 2rem);
}

figure.is-cutout > a,
.is-cutout .gallery__item > a {
    display: block;
    width: 100%;
    height: 100%;
}

.project-body figure.is-cutout img,
.is-cutout .gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* A standalone card need not fill the text width: the logo would be lost
   in a huge empty area. As wide as it would be in a two-column gallery. */
.project-body > figure.is-brand,
.project-body > figure.is-cutout {
    max-width: 640px;
    border-radius: var(--radius);
}

/* Masonry: every image keeps its own height and the spacing is the same
   everywhere. The columns therefore do not end level, and that is intended.
   Careful: a gallery like this reads per column from top to bottom, not
   from left to right. */
.is-masonry .gallery {
    display: block;
    columns: 2;
    column-gap: clamp(1rem, 2vw, 1.75rem);
    /* The bottom item in each column keeps its margin; we subtract it here
       again, otherwise there is double white space at the bottom. */
    margin-bottom: calc(clamp(2rem, 4vw, 3.5rem) - clamp(1rem, 2vw, 1.75rem));
}

.is-masonry .gallery__item {
    break-inside: avoid;
    margin-bottom: clamp(1rem, 2vw, 1.75rem);
}

@media (max-width: 760px) {
    .is-masonry .gallery { columns: 1; }
}

/* Logo on a solid panel */
figure.is-brand,
.is-brand .gallery__item {
    display: grid;
    place-items: center;
    aspect-ratio: 16 / 10;
    padding: clamp(2rem, 6vw, 4rem);
    border: 1px solid var(--line-soft);
    background: transparent;
}

.project-body figure.is-brand img,
.is-brand .gallery__item img {
    width: min(360px, 65%);
    height: auto;
    object-fit: contain;
}

@media (max-width: 1024px) {
    .gallery[data-columns="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gallery[data-columns="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .gallery[data-columns="2"],
    .gallery[data-columns="3"],
    .gallery[data-columns="4"] { grid-template-columns: 1fr; }

    .gallery-wrapper--wide,
    .gallery-wrapper--full { margin-inline: 0; }
}



/* ============================================================
   15. Output of the block editor
   ------------------------------------------------------------
   The image block produces <figure class="post__image post__image--center">,
   the gallery block a .gallery-wrapper with the images inside an <a> for
   the lightbox. Below, those hook into the existing styling.
   ============================================================ */

.project-body .post__image {
    margin-block: clamp(2rem, 4vw, 3.5rem);
}

.project-body .post__image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    background: var(--paper-2);
}

/* Wider than the text column */
.project-body .post__image--wide { margin-inline: calc(var(--pad) * -0.5); }
.project-body .post__image--full { margin-inline: calc(var(--pad) * -1); }

/* The link around a gallery image must not get in the way of the layout */
.gallery__item a {
    display: block;
    line-height: 0;
}

.gallery__item a img {
    border-radius: var(--radius);
}

/* Logos: the class sits on the wrapper. Cut-out products already handle
   their link above. */
.is-brand .gallery__item a {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
}

@media (max-width: 760px) {
    .project-body .post__image--wide,
    .project-body .post__image--full { margin-inline: 0; }
}

/* Custom HTML blocks get the same breathing room as the rest */
.project-body > div:not(.gallery-wrapper) {
    margin-block: clamp(2rem, 4vw, 3.5rem);
}

/* An HTML block with the class media-duo becomes a two-column grid */
.project-body > div.media-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1rem, 2vw, 1.75rem);
}

@media (max-width: 760px) {
    .project-body > div.media-duo { grid-template-columns: 1fr; }
}
