/* Gallery geometry and lightbox styles from the published Circuit Garden ads page. */
.ads-page { --paper:var(--page); --paper-2:#dce6f5; --ink:#172743; --muted:#455a79; --line:#cad7e9; --spot:#1a56db; --c-spot-night:#a9c5ff; --rule:1px; --gutter:clamp(20px,4vw,56px); --s-section:clamp(72px,10vw,144px); --f-pixel:Jakarta,sans-serif; --t-h2:clamp(2.5rem,5.4vw,4.75rem); --t-h3:clamp(1.75rem,2.4vw,2.25rem); background:var(--paper); color:var(--ink); }
.ads-page .sub-content { max-width:1280px; padding:0 0 100px; }
.ads-page .cs-main { padding-inline:var(--gutter); }
.ads-page .cs-top h1 { font-weight:700; letter-spacing:-.05em; }
.ads-page .cs-brand-head h2 { font-weight:700; letter-spacing:-.04em; }
.ads-page .quiet { color:var(--muted); font-size:.94rem; }
.ads-page .cs-cta .btn { display:inline-flex; align-items:center; gap:10px; padding:13px 18px; border-radius:12px; background:#1a56db; color:white; text-decoration:none; font-size:.85rem; font-weight:700; }
.ads-page .cs-cta .glyph { flex:none; }
/* css/sections/ads.css */
/* The ad portfolio pages at /ads/: see ads.mjs. The ads carry the page, so the frame stays quiet.
   Every ad has its own colours, so the ground is neutral: light grey, or near black, with no warm tint. The tokens are
   set again here, since --line and the dark ground were worked out from the warm ones. */
body.cases { --paper: #e5e5e5; --paper-2: #d8d8d8; --ink: #141414; --on-ink: #e5e5e5; --muted: #5b5b5b; --line: color-mix(in srgb, #141414 22%, transparent); }
:root[data-theme="dark"] body.cases { --paper: #121212; --paper-2: #1d1d1d; --ink: #e5e5e5; --on-ink: #121212; --muted: #a2a2a2; --line: color-mix(in srgb, #e5e5e5 24%, transparent); }
/* The header: no heavy rule and no warm tint over the ads. A hairline and the same grey. */
body.cases .top { background: color-mix(in srgb, var(--paper) 90%, transparent); border-bottom: 1px solid var(--line); }
.cs-main { padding-block: clamp(40px, 7vw, 88px) var(--s-section); }
.cs-top { margin-bottom: clamp(32px, 5vw, 64px); }
.cs-top h1 { font-size: var(--t-h2); margin: 0; }
.cs-top .lede { margin: 16px 0 0; }
.cs-top .quiet { margin: 10px 0 0; }

/* Filters: shown only once there are enough cases to sort. */
.cs-filters { display: grid; gap: 14px; margin-bottom: 32px; }
.cs-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.cs-filter legend { float: left; margin-right: 6px; font: 400 var(--t-label)/1 var(--f-pixel); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); min-width: 8ch; }
.cs-filter button, .cs-clear { min-height: 40px; padding: 0 14px; border: 1px solid var(--line); background: none; font: 400 1.125rem/1 var(--f-pixel); letter-spacing: .04em; cursor: pointer; }
.cs-filter button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cs-empty[hidden], .cs-clear[hidden] { display: none; }

/* The disclaimer, small and last. */
.cs-fine { margin: clamp(56px, 8vw, 104px) 0 0; max-width: 70ch; font-size: .8125rem; line-height: 1.5; color: var(--muted); }

/* One brand, one strip: its five ads side by side at one height, the brand and one line above. */
.cs-brands { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(48px, 6vw, 88px); }
.cs-brand { min-width: 0; }
.cs-brand[hidden] { display: none; }
/* Only the row in view is lit. The script marks it; without the script every row is lit. */
.cs-brand { transition: opacity 450ms ease-out; }
.cs-brands.is-tracking .cs-brand:not(.is-here):not(:focus-within) { opacity: .72; }
@media (hover: hover) { .cs-brands.is-tracking .cs-brand:hover { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cs-brand { transition: none; } }
.cs-brand-head > div { min-width: 0; }
.cs-brand-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.cs-brand-head h2 { font-size: var(--t-h3); margin: 0 0 4px; transition: color 350ms ease-out; }
.cs-brands.is-tracking .cs-brand.is-here .cs-brand-head h2 { color: var(--blue); }
@media (prefers-reduced-motion: reduce) { .cs-brand-head h2 { transition: none; } }
.cs-brand-head .quiet { margin: 0; }
.cs-strip { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(10px, 1.4vw, 20px); align-items: flex-start; }
.cs-strip li { flex: calc(var(--r) * 100) 1 0; min-width: 0; }
.cs-tile { display: block; border-radius: 10px; overflow: hidden; aspect-ratio: var(--r); background: var(--paper-2); cursor: zoom-in; outline: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); outline-offset: -1px; transition: transform 260ms cubic-bezier(.25, 1, .5, 1); }
.cs-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cs-tile:focus-visible { outline: 3px solid var(--spot); outline-offset: 3px; }
@media (hover: hover) { .cs-tile:hover { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .cs-tile { transition: none; } }
/* Too narrow for five in a row: the strip keeps its height and scrolls sideways, and the next ad shows at the edge. */
@media (max-width: 899px) {
  .cs-strip { overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); margin-inline: calc(-1 * var(--gutter)); padding: 4px var(--gutter) 14px; scrollbar-width: thin; }
  .cs-strip li { flex: none; width: calc(140px * var(--r)); scroll-snap-align: start; }
  .cs-strip .cs-tile { height: 140px; aspect-ratio: auto; }
}

/* The large view. The ad, and what it is, over the dark backdrop of the photo galleries. */
.cslb { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0 max(0px, (100vw - 1500px) / 2); border: 0; background: transparent; color: #ececec; overscroll-behavior: contain; touch-action: pan-y; opacity: 0; transition: opacity 260ms ease-out; }
.cslb.is-in { opacity: 1; }
.cslb::backdrop { background: #101010; opacity: 0; transition: opacity 260ms ease-out; }
.cslb.is-in::backdrop { opacity: 1; }
.cslb[open] { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.cslb-fig { display: grid; justify-items: center; gap: 14px; margin: 0; padding: 56px 0 24px; max-height: 100dvh; min-width: 0; }
.cslb-img { max-width: 100%; max-height: calc(100dvh - 150px); width: auto; height: auto; object-fit: contain; opacity: 0; transition: opacity 280ms ease-out; }
.cslb-img.is-ready { opacity: 1; }
.cslb figcaption { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 14px; text-align: center; padding: 0 12px; font-size: 14px; }
.cslb-title { font: 400 1.5rem/1 var(--f-pixel); letter-spacing: .04em; }
.cslb-count { color: color-mix(in srgb, #ececec 62%, transparent); font: 400 1.0625rem/1 var(--f-pixel); letter-spacing: .08em; text-transform: uppercase; }
.cslb-credit { flex-basis: 100%; color: color-mix(in srgb, #ececec 70%, transparent); }
.cslb-credit:empty { display: none; }
.cslb-credit a { color: inherit; }
.cslb-close, .cslb-nav { width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border: var(--rule) solid #ececec; background: none; color: #ececec; cursor: pointer; }
.cslb-close:hover, .cslb-nav:hover { background: #ececec; color: #141414; }
.cslb-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.cslb-nav { justify-self: center; }
.cslb-prev .glyph { transform: scaleX(-1); }
.cslb :focus-visible { outline: 3px solid var(--c-spot-night); outline-offset: 3px; }
body:has(.cslb[open]) { overflow: hidden; }
@media (max-width: 720px) { .cslb[open] { grid-template-columns: 1fr; } .cslb-nav { position: absolute; bottom: 18px; z-index: 2; } .cslb-prev { left: calc(50% - 54px); } .cslb-next { left: calc(50% + 8px); } .cslb-fig { padding: 60px 0 84px; } .cslb-img { max-height: calc(100dvh - 230px); } }
@media (prefers-reduced-motion: reduce) { .cslb, .cslb::backdrop, .cslb-img { transition: none; } }

/* Case page. */
.cs-back { margin: 0 0 24px; }
.cs-back a { display: inline-flex; align-items: center; gap: 8px; font: 400 1.125rem/1 var(--f-pixel); letter-spacing: .06em; text-transform: uppercase; }
.cs-back-i { transform: scaleX(-1); }
/* Each row shares one height, set by the screen's height so the ads are no bigger than a laptop screen can hold: an ad is as wide
   as its width-to-height ratio says. The rows sit in the middle, like the button under them. The lightbox shows an ad large. */
.cs-set { --rh: clamp(180px, 31vh, 300px); display: grid; gap: clamp(20px, 3vw, 36px); justify-items: center; margin-bottom: clamp(40px, 6vw, 72px); }
.cs-row { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(14px, 2vw, 28px); align-items: flex-start; }
.cs-item { margin: 0; flex: none; width: min(100%, calc(var(--r) * var(--rh))); }
.cs-item-pic { display: block; background: var(--paper-2); }
.cs-item-pic img { display: block; width: 100%; height: auto; outline: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); outline-offset: -1px; }
@media (max-width: 760px) { .cs-set { --rh: min(55vh, 420px); } .cs-row { flex-direction: column; align-items: center; } }
.cs-src { margin: 0; max-width: 60ch; font-size: .6875rem; line-height: 1.45; color: var(--muted); }
.cs-src a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.cs-cta { margin-top: clamp(40px, 6vw, 72px); }
.cs-cta p { margin: 0; }
/* The button block, the sources and the disclaimer sit in the middle on the gallery and on every case page. */
.cs-cta { text-align: center; display: grid; justify-items: center; gap: 18px; }
.cs-cta .btn { box-shadow: 4px 4px 0 var(--spot); }
.cs-cta .btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--spot); }
/* The line under the button is Adam's own wording. */
.cs-cta-note { max-width: 46ch; font-size: .9375rem; line-height: 1.5; color: var(--muted); text-wrap: balance; }
@media (max-width: 560px) { .cs-cta .btn { width: 100%; } }
.case-page .cs-src { margin-inline: auto; text-align: center; }
.cs-fine { margin-inline: auto; text-align: center; }


/* Arriving at the gallery: the ads of the first two brands slide in from the right one after another, left to right, the
   way the strip is read and, on a phone, scrolled. The first brand starts at once and the second a moment later. Only
   the start is animated (backwards fill), so the dimming of rows above and below the one in view is not held by it. */
@media (prefers-reduced-motion: no-preference) {
  .cs-brands .cs-brand:nth-child(-n+2) .cs-strip li { animation: cs-in 620ms cubic-bezier(.2, .7, .2, 1) backwards; animation-delay: calc(var(--row, 0) * 260ms + var(--k, 0) * 90ms + 150ms); }
  .cs-brands .cs-brand:nth-child(2) { --row: 1; }
  .cs-strip li:nth-child(2) { --k: 1; } .cs-strip li:nth-child(3) { --k: 2; } .cs-strip li:nth-child(4) { --k: 3; } .cs-strip li:nth-child(5) { --k: 4; }
}
@keyframes cs-in { from { opacity: 0; transform: translateX(36px); } }
