/* OpenEndedGroup main-site layer on top of the field4 theme (extra.css, copied verbatim).
   Keep site-specific changes here so extra.css can be re-synced from ~/field4/public. */

:root, [data-md-color-scheme="slate"] {
    /* a lighter grey than field4's #0e0e0e */
    --mono-bg: #1d1d1f;
    --mono-panel: #141416;
}

/* banner images at the top of an artwork page */
.oe-banners { display: grid; gap: .6rem; margin: 0 0 1.6rem; }
.oe-banners img { width: 100%; height: auto; display: block; border-radius: 2px; }
.oe-banners img:not(:first-child) { display: none; }   /* first one as hero; lightbox shows the rest */

/* embeds */
.oe-embed { position: relative; aspect-ratio: 16 / 9; margin: 1.2rem 0; }
.oe-embed iframe, .oe-embed video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* the artworks index */
.md-typeset .oe-artworks.grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }   /* auto-fill: a lone card stays one column wide */
.oe-meta { color: var(--mono-text-faint); font-size: 85%; margin-left: .3em; }

/* banners cycle (assets/oe-banners.js); without JS only the first shows */
.oe-banners { position: relative; aspect-ratio: 16 / 7; overflow: hidden; display: block; }
.oe-banners img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
                  opacity: 0; transition: opacity 1.6s ease; display: block !important; }
.oe-banners img:first-child, .oe-banners img.is-on { opacity: 1; }
.oe-banners.is-cycling img:first-child:not(.is-on) { opacity: 0; }

/* thumbnails: all the same width and 3:2 shape, whatever their native size */
.oe-artworks.grid.cards > ul > li > p:first-child:has(img) { text-align: center; }
.md-typeset .oe-artworks.grid.cards img { width: 100%; max-width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; margin: 0; padding-left: 0; box-sizing: border-box; }
/* card labels (title line + description) at 80% */
.oe-artworks.grid.cards > ul > li > p:not(:first-child) { font-size: 80%; }

.md-typeset .oe-banners { width: 100%; }
.md-typeset .oe-banners img { max-width: none; }

/* home page: the header already names the site, so hide the theme's auto H1 (kept for screen readers) */
.md-typeset:has(.oe-home) > h1 {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* one-line header: site name followed by the four sections */
.md-header .md-header__title { display: flex; align-items: center; }
.md-header__title .md-header__ellipsis { flex: 0 0 auto; width: auto; position: static; display: flex; align-items: center; }
/* always show the site name, never the scrolled-to page title */
.md-header__title .md-header__topic:first-child { position: static; opacity: 1 !important; transform: none !important; pointer-events: auto; }
.md-header__title .md-header__topic + .md-header__topic { display: none; }
.oe-header-links { display: flex; gap: 1.1rem; margin-left: 1.6rem; pointer-events: auto; font-size: .72rem; }
.oe-header-links a { color: var(--mono-text-faint); text-decoration: none; }
.oe-header-links a:hover, .oe-header-links a.is-active { color: var(--mono-text); }
@media (max-width: 40em) { .oe-header-links { display: none; } }   /* phones: use the burger */

/* breathing room under the one-line header */
.md-main__inner { padding-top: 1.6rem; }

/* writings index: text-only cards */
.oe-writings.grid.cards > ul { grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.oe-writings.grid.cards > ul > li > p:first-child { margin-top: 0; }
.oe-writings.grid.cards > ul > li > p:last-child { margin-bottom: 0; }
/* same type as the artworks cards */
.oe-writings.grid.cards > ul > li > p:not(:has(img)) { font-size: 80%; }

/* ───────────── artwork pages: hero + text + gallery ─────────────
   Layout is chosen by html[data-hero] (set by assets/oe-hero-layout.js; default "wide").
     column – hero sits in the reading column
     wide   – hero breaks out of the column, ~90% of the window
     full   – edge-to-edge, tall, the title laid over its bottom edge
     split  – like the PDF: text on the left, images stacked on the right            */
/* by-line after an artwork title: "(2013 DOWNIE KAISER)" or the year — half size, half opacity */
.oe-byline { font-size: 50%; opacity: .5; margin-left: .35em; white-space: nowrap; }
/* hero position: every image of the piece stacked in one frame, cross-faded by assets/oe-banners.js */
.oe-hero { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #000; margin: 0 0 2.4rem; }
.oe-hero img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
    opacity: 0; transition: opacity 1.8s ease;
}
.oe-hero img:first-child, .oe-hero img.is-on { opacity: 1; }
.oe-hero.is-cycling img:first-child:not(.is-on) { opacity: 0; }
.md-typeset .oe-hero img { max-width: none; padding-left: 0; margin-left: 0; }

/* dots under the hero: which image, and click to jump */
.oe-dots { display: flex; gap: .45rem; justify-content: center; margin: -1.8rem 0 2rem; position: relative; z-index: 3; }
.oe-dots button { width: .42rem; height: .42rem; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
                  background: var(--mono-text-faint); opacity: .5; transition: opacity .3s; }
.oe-dots button.is-on { opacity: 1; background: var(--mono-text); }

.oe-gallery { display: none; gap: .8rem; }
.oe-gallery img { width: 100%; height: auto; display: block; }
.md-typeset .oe-gallery img { max-width: none; padding-left: 0; margin-left: 0; }
.oe-archive { margin-top: 3rem; border-top: 1px solid var(--mono-border); padding-top: 1rem; }
.oe-archive > summary { cursor: pointer; color: var(--mono-text-faint); }

/* wide: break out of the 52rem column (the column is centred on the viewport) */
html[data-hero="wide"] .oe-hero {
    --w: min(92vw, 1600px);
    width: var(--w); margin-left: calc(50% - var(--w) / 2); max-height: 82vh;
}

/* full: edge to edge behind the title, fading into the page; anchored to .md-main */
html[data-hero="full"] .md-main { position: relative; }
html[data-hero="full"] .md-main__inner, html[data-hero="full"] .md-content,
html[data-hero="full"] .md-content__inner { position: static; }
html[data-hero="full"] .oe-hero {
    position: absolute; top: 0; left: 0; width: 100vw; height: 80vh; aspect-ratio: auto; z-index: 0; margin: 0;
}
html[data-hero="full"] .oe-hero::after {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(to bottom, transparent 50%, var(--mono-bg) 100%);
}
html[data-hero="full"] .md-content__inner:has(.oe-hero) > h1:first-of-type {
    position: relative; z-index: 2; margin-top: calc(80vh - 5rem);
    text-shadow: 0 2px 24px rgba(0,0,0,.8);
}
html[data-hero="full"] .oe-dots { position: absolute; top: calc(80vh - 2.2rem); right: 2rem; left: auto; margin: 0; }
html[data-hero="full"] .oe-piece { position: relative; z-index: 2; }

/* split: widen the page and put text and images side by side */
html[data-hero="split"] .oe-hero, html[data-hero="split"] .oe-dots { display: none; }
html[data-hero="split"] .oe-gallery { display: grid; }
html[data-hero="split"] .oe-piece {
    position: relative; left: 50%; transform: translateX(-50%);
    width: min(92vw, 1400px);
    display: grid; grid-template-columns: minmax(18rem, 2fr) 3fr; gap: 2.4rem; align-items: start;
}
html[data-hero="split"] .oe-gallery { margin: 0; }
html[data-hero="split"] .oe-gallery::before { content: none; }
html[data-hero="split"] .oe-text { position: sticky; top: 4rem; }
html[data-hero="split"] .oe-piece .oe-gallery { order: 2; }
@media (max-width: 60em) { html[data-hero="split"] .oe-piece { display: block; width: auto; left: 0; transform: none; } }



html[data-hero="full"] body { overflow-x: clip; }


/* home page: the same full-bleed hero. Its H1 is invisible (the header already names the site) but
   keeps the full-hero top margin, which is what pushes the text below the hero — so no extra padding. */
html[data-hero="full"] .md-content__inner:has(.oe-home):has(.oe-hero) > h1:first-of-type {
    position: relative; width: auto; height: 1px; margin-bottom: 0; overflow: hidden;
    clip: auto; clip-path: inset(50%); border: 0;
}

/* a banner too small for the full-bleed hero, shown at its own size */
.oe-inline-banner img { max-width: 100%; height: auto; }

/* "Back to top" only once you've reached the bottom of the page (assets/oe-back-to-top.js) */
html:not(.oe-at-bottom) .md-top { opacity: 0 !important; pointer-events: none !important; }
html.oe-at-bottom .md-top { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }

/* pages whose title is already the highlighted header link (Artworks): hide the H1, keep it for screen readers */
.md-typeset:has(.oe-hide-h1) > h1,
.md-typeset:has(.oe-artworks) > h1,
.md-typeset:has(.oe-writings) > h1 {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* image-lightbox.js tags small images "native-sized" and extra.css caps them at their natural width;
   in the hero every image must fill the frame */
.md-typeset .oe-hero img, .md-typeset .oe-hero img.field-docs-image-native-sized { width: 100% !important; height: 100% !important; }
html[data-hero="full"] .md-content__inner:has(.oe-home):has(.oe-hero) > h1:first-of-type { margin-top: calc(80vh - 3rem); }
html[data-hero="full"] .md-content__inner:has(.oe-home) > :not(.oe-hero):not(.oe-dots) { position: relative; z-index: 2; }

/* the site name in the header links home */
.oe-brand-link { color: inherit !important; text-decoration: none; pointer-events: auto; }
.oe-brand-link:hover { opacity: .85; }

/* jumps to a heading (#virtual-reality etc.) stop below the frosted header, with room to breathe */
.md-typeset :is(h1, h2, h3, h4)[id] { scroll-margin-top: 5.5rem; }

/* margin note: the legacy "watch an excerpt" links before an artwork's title, as embedded players.
   Wide screens: hangs in the right margin beside the text. Narrow: a box at the start of the text. */
.oe-margin { position: relative; z-index: 2; margin: 0 0 1.6rem; padding: .8rem; border: 1px solid var(--mono-border);
             border-radius: 4px; background: rgba(0,0,0,.25); }
.oe-margin figure { margin: 0 0 .9rem; }
.oe-margin figure:last-child { margin-bottom: 0; }
.oe-margin .oe-embed { margin: 0; }
.oe-margin figcaption { font-size: .62rem; color: var(--mono-text-faint); margin-top: .3rem; text-align: left; }
.md-typeset .oe-margin img { max-width: 100%; padding-left: 0; margin-left: 0; }
@media screen and (min-width: 76.25em) {
    .oe-margin { float: right; clear: right; width: 15rem; margin: .2rem -17.5rem 1rem 1rem; padding: 0; border: 0; background: none; }
}
.oe-margin figure, .oe-margin .oe-embed { display: block; width: 100%; }
.oe-margin .oe-embed { aspect-ratio: 16 / 9; position: relative; }
.oe-margin .oe-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* artworks + writings indexes: no outline on the cards */
.md-typeset :is(.oe-artworks, .oe-writings).grid.cards > ul > li,
.md-typeset :is(.oe-artworks, .oe-writings).grid.cards > ul > li:hover { border: 0; box-shadow: none; }

/* writings: images uniformly at full column width (see oe-writing-images.js) */
.md-typeset img.oe-writing-img {
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0; margin-left: 0;
}

/* margin notes reconstructed from the Encircling Self layout: thumbnail + Gill Sans aside */
.md-typeset aside.oe-note { font-size: .62rem; line-height: 1.5; opacity: .8; }
.md-typeset aside.oe-note img { max-width: 100%; height: auto; padding-left: 0; margin: 0 0 .4rem; image-rendering: auto; }
.md-typeset aside.oe-note p { margin: 0 0 .6rem; }
@media screen and (max-width: 76.234375em) {
  .md-typeset aside.oe-note { float: right; width: 40%; margin: 0 0 1rem 1rem; }
}

/* book pages: Paul's inline page images at a readable, not column-filling, size */
.md-typeset figure.oe-book-fig { margin: 2rem auto; max-width: 26rem; }
.md-typeset figure.oe-book-fig img { width: 100%; height: auto; }

/* book pages: the banner opens on the front cover, so anchor it at the left edge — the cover is never cropped */
.md-typeset .oe-hero-book img { object-position: left center; }

/* margin videos (assets/oe-videos.js): frame sized to the video, caption in the text colour,
   expanded over the page while playing */
.oe-margin .oe-vimeo { background: #000; }
.oe-margin .oe-vimeo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.md-typeset .oe-margin figcaption { color: var(--mono-text); }
.oe-video-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.85); opacity: 0;
                     pointer-events: none; transition: opacity .35s ease; }
.oe-video-open .oe-video-backdrop { opacity: 1; pointer-events: auto; cursor: zoom-out; }
.oe-margin figure.is-expanded { position: fixed; z-index: 901; left: 50%; top: 50%; transform: translate(-50%, -50%);
                                width: min(92vw, calc(85vh * var(--ar, 1.7778))); margin: 0; }
.oe-margin figure.is-expanded figcaption { text-align: center; margin-top: .6rem; }
.oe-video-open .oe-margin:has(figure.is-expanded) { z-index: 1000; }   /* its stacking context above the backdrop */
/* Vimeo leaves a sub-pixel gap at some sizes, showing a hairline of the frame's light background:
   overscan the iframe by a pixel each side and clip it */
.oe-margin .oe-vimeo { overflow: hidden; }
.md-typeset .oe-margin .oe-vimeo iframe { inset: -2px; width: calc(100% + 4px); height: calc(100% + 4px); max-width: none; }

/* 500ms crossfade between pages (cross-document view transitions; browsers without support just navigate) */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: 500ms; animation-timing-function: ease-in-out; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
