/*
  base.css — what Cargo's own code did for this site, written out as plain CSS.

  The look of the site (fonts, colors, text sizes) is in site.css, copied from Cargo as it was; each page's own
  styles come with the page. This file is the machinery underneath: how big one "rem" is, how pages, columns,
  slideshows, pinned bars and icons are laid out. Numbers were measured on the live Cargo site (November 2026).

  "Phone" means Cargo's phone layout: a window taller than it is wide (narrower than 4:5), or a short landscape
  phone. The script in each page's <head> (tools/build.mjs, SIZING) adds the class "mobile" to <html>, the same
  class Cargo used, so site.css's ".mobile ..." rules keep working, and sets --base-size.
*/

/* ---------- Size of 1rem: everything scales with the window, as on Cargo ---------- */
html {
  font-size: var(--base-size, 12.96px);      /* computer: 12.96 px on a 1440 × 900 window */
  --viewport-height: 100vh;
  --pad-scale: 1;                            /* page padding, full size on a computer */
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  touch-action: manipulation;
}
html.mobile {
  font-size: calc(var(--base-size, 8.8px) * var(--mobile-scale, 1.63));   /* --mobile-scale is in site.css */
  --viewport-height: 100svh;
  --pad-scale: 0.3;                          /* Cargo's phone setting: padding at 30% (site.css, --mobile-padding-offset) */
}
html, body { margin: 0; padding: 0; min-height: var(--viewport-height); }
body {
  display: flex; flex-direction: column; width: 100%;
  background: #fff;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
*, *::before, *::after { box-sizing: border-box; }
a { color: inherit; text-decoration: none; }
:where(bodycopy) :is(button, input) { font-family: inherit; }

/* ---------- Text sizes: "--font-scale" on a span makes it that many times its text style ---------- */
/* Measured: the scale passes down (a caption inside a span scaled 0.76 is scaled too), and as it multiplies the
   text style's own size, not the parent's, nested scales don't compound. */
@property --font-scale { syntax: "<number>"; inherits: true; initial-value: 1; }
[style*="--font-scale"] { font-size: calc(var(--font-scale) * var(--font-size, 1em)); }

/* ---------- Pages ---------- */
.pages { width: 100%; flex: 1 0 auto; }
.page { position: relative; isolation: isolate; display: flex; justify-content: center; width: 100%; max-width: 100%; }
html.mobile .page { flex-wrap: wrap; }
.page-layout { position: relative; display: flex; flex-grow: 1; align-items: flex-start; justify-content: flex-start; width: 0%; }
.page-content { position: relative; display: flex; flex-direction: row; align-items: flex-start; width: 100%; height: 100%; }
bodycopy { display: block; position: relative; width: 100%; max-width: 100%; word-wrap: break-word; --font-scale: 1; }
.page.mobile-only, .page.desktop-only { }
html.mobile .desktop-only { display: none !important; }
html:not(.mobile) .mobile-only { display: none !important; }

/* Pinned bars. "Pushing" bars leave room for themselves (the computer menu at the bottom, the phone title at
   the top); "overlay" bars sit over the page (Instagram, top right, scrolls away with the page). */
.pin { position: absolute; left: 0; right: 0; z-index: 2; pointer-events: none; }
.pin.pushes .page-content { pointer-events: auto; }
/* An overlay bar lets the pointer through to the page under it, except on its links (Cargo the same: the empty
   width of the Instagram bar would otherwise cover the Albums / Installation / Design links at the top of a page). */
.pin:not(.pushes) a[href] { pointer-events: auto; }
.pin.top { top: 0; }
.pin.bottom { bottom: 0; }
.pin.fixed { position: fixed; }
.pages { padding-top: var(--pins-top, 0px); padding-bottom: var(--pins-bottom, 0px); }
/* A page that fills the window ("min-height: var(--viewport-height)") fills what the pushing menus leave free. */
.pages > .page { --viewport-height: calc(100vh - var(--pins-top, 0px) - var(--pins-bottom, 0px)); }
html.mobile .pages > .page { --viewport-height: calc(100svh - var(--pins-top, 0px) - var(--pins-bottom, 0px)); }

/* The phone menu (Cargo's "Mobile Menu" overlay): over everything, fading in. */
.overlay { position: fixed; inset: 0; z-index: 1000; overflow-y: auto; display: none; opacity: 0; }
.overlay.open { display: block; animation: overlay-in var(--open-seconds, 0.5s) var(--open-easing, ease-in) forwards; }
.overlay > .page { min-height: 100%; }
/* On iPhones, Safari's address bar floats over the bottom of the page and the page shows beneath it: the menu reaches
   under the bar too (the largest viewport, lvh), on white, with room at its end so its last line can scroll clear of
   the bar (Joseph, 2026-11-23: the menu "doesn't cover the complete screen"). Elsewhere lvh = the window: no change. */
.overlay { bottom: auto; height: 100vh; height: 100lvh; background-color: #ffffff; }
.overlay::after { content: ""; display: block; height: calc(100lvh - 100svh); }
html.menu-covered body > :not(.overlay) { visibility: hidden; }
/* The menu's icon, turning from hamburger to X and back (scripts/site.js, morph): in the hamburger's place, above the
   menu, while the menu is open; the menu's own X and the hamburger wait hidden. */
.icon-morph { position: fixed; z-index: 3000; display: block; }
.icon-morph[hidden] { display: none; }
.icon-morph svg { display: block; width: 100%; height: 100%; overflow: visible; }
.icon-morph rect { transform-origin: 16px 16px; }
html.menu-covered body > .icon-morph { visibility: visible; }
html.icon-toggled [data-open-menu] text-icon, html.icon-toggled #menu [data-close-menu] text-icon { visibility: hidden; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
/* Closing: it fades out (Cargo's setting: 0.19 s, linear), then goes. */
.overlay.open.closing { animation: overlay-out var(--close-seconds, 0.19s) var(--close-easing, linear) forwards; }
@keyframes overlay-out { from { opacity: 1; } to { opacity: 0; } }
html.menu-open, html.menu-open body { overflow: hidden; }

/* ---------- Columns: 12 per row, with a gutter ----------
   As Cargo laid them out: side by side, each as wide as its share of 12 columns, with the gutter as a margin
   after it. The rules are "weak" (:where) so a page's own styles can change them, as they could on Cargo
   (Interviews, Events and Writing do). */
:where(column-set) { display: flex; align-items: stretch; width: 100%; text-align: initial; }
/* Each column set is its own layer, as on Cargo (measured: contain: layout): a row's hover band on Interviews, Events
   and Writing then covers the divider lines above and below it, as it did on Cargo. */
:where(column-set) { contain: layout; }
:where(column-unit) {
  display: block; flex: 0 0 auto; min-width: 0;
  width: calc((100% - 11 * var(--gutter, 1rem)) / 12 * var(--span, 12) + (var(--span, 12) - 1) * var(--gutter, 1rem));
  margin-right: var(--gutter, 1rem);
}
:where(column-unit:last-child) { margin-right: 0; }
/* The next column set, picture grid or slideshow keeps a gutter's distance from the one before. */
:where(column-set, gallery-grid, gallery-slideshow, media-item) + :where(column-set, gallery-grid) { margin-top: var(--gutter, 1rem); }
:where(column-unit) > :where(column-set, gallery-grid):first-child { margin-top: 0; }

/* Phones: columns stack, one under the other, 30% of a gutter apart (Cargo's phone padding setting, measured:
   12.9 px for a 3rem gutter on an iPhone 15 Pro); empty ones disappear. A set marked mobile-stack="false"
   stays side by side, with gaps at 30%. */
:where(html.mobile) :where(column-set) { --gutter-now: calc(var(--gutter, 1rem) * var(--pad-scale)); }
:where(html.mobile) :where(column-set:not([data-mobile-stack="false"])) { flex-wrap: wrap; }
:where(html.mobile) :where(column-set:not([data-mobile-stack="false"])) > :where(column-unit) { width: 100%; margin: 0; }
:where(html.mobile) :where(column-set:not([data-mobile-stack="false"])) > :where(column-unit:not(.empty)) ~ :where(column-unit:not(.empty)) { margin-top: var(--gutter-now); }
:where(html.mobile) :where(column-set[data-mobile-stack="false"]) > :where(column-unit) {
  width: calc((100% - 11 * var(--gutter-now)) / 12 * var(--span, 12) + (var(--span, 12) - 1) * var(--gutter-now));
  margin-right: var(--gutter-now);
}
:where(html.mobile) :where(column-set[data-mobile-stack="false"]) > :where(column-unit:last-child) { margin-right: 0; }
:where(html.mobile) :where(column-set, gallery-grid, gallery-slideshow, media-item) + :where(column-set, gallery-grid) { margin-top: calc(var(--gutter, 1rem) * var(--pad-scale)); }
/* Measured: Cargo hid a column holding only a space on phones even in sets marked mobile-hide-empty="false" (Writing). */
html.mobile column-set > column-unit.empty { display: none; }

/* ---------- Pictures ---------- */
/* A picture sits in the line like a word as wide as its column (so a line break right after it doesn't add an
   empty line), aligned to the top of the line, as on Cargo. */
media-item { display: inline-flex; vertical-align: top; position: relative; width: 100%; }
media-item img { display: block; width: 100%; height: auto; }
media-item[data-placeholder] { aspect-ratio: 16 / 10; background: rgba(0, 0, 0, 0.06); }
media-item.zoomable img { cursor: zoom-in; }

/* ---------- Picture grids (Media, the design projects) ---------- */
gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--columns, 3), minmax(0, 1fr));
  gap: var(--gutter, 1rem);
  align-items: var(--align, start);
}
html.mobile gallery-grid { gap: calc(var(--gutter, 1rem) * var(--pad-scale)); }   /* measured: 30%, like the columns */

/* ---------- Slideshows (each project's pictures) ----------
   As tall as the first picture at the slideshow's width (--ratio, from the build); the others fit inside,
   at the top or centered (vertical-align). They slide sideways, or fade (transition-type="fade"). Arrows
   (Cargo's: grey circles, white chevrons) appear while the pointer is over the slideshow. scripts/site.js runs them. */
gallery-slideshow { display: block; position: relative; width: 100%; aspect-ratio: var(--ratio, 4 / 3); overflow: hidden; }
gallery-slideshow .slides { display: flex; height: 100%; transition: transform var(--speed, 0.8s) var(--slide-easing); }
html { --slide-easing: cubic-bezier(0.4, 0.25, 0.5, 1); }   /* Cargo's slide: 0.8 s, easing fitted to the live site's frames */
gallery-slideshow .slides > media-item { flex: 0 0 100%; height: 100%; }
gallery-slideshow .slides > media-item img { width: 100%; height: 100%; object-fit: contain; object-position: var(--valign, center); }
html.mobile gallery-slideshow .slides > media-item img { object-position: var(--mobile-valign, var(--valign, center)); }
gallery-slideshow[data-fade] .slides { display: grid; }
/* Fading slideshows (Sti.ll): the next picture fades in over the one showing, which stays solid underneath, in about
   half a second, quick at first (measured from the live site's frames, 2026-11-22; Cargo's setting says 0.7 s). */
gallery-slideshow[data-fade] .slides > media-item { grid-area: 1 / 1; opacity: 0; z-index: 0; }
gallery-slideshow[data-fade] .slides > media-item.shown { opacity: 1; }
gallery-slideshow[data-fade] .slides > media-item.under { opacity: 1; z-index: 1; }
gallery-slideshow[data-fade] .slides > media-item.fading-in { z-index: 2; transition: opacity 0.5s cubic-bezier(0.2, 0.3, 0.3, 1); }
gallery-slideshow .arrow {
  position: absolute; top: 50%; z-index: 3; width: 30px; height: 30px; margin-top: -15px;
  border: 0; padding: 0; border-radius: 50%; background: rgba(87, 87, 87, 0.35); color: rgba(255, 255, 255, 0.9);
  cursor: pointer; opacity: 0; transition: opacity 0.2s ease;
}
gallery-slideshow .arrow svg { display: block; width: 100%; height: 100%; }
gallery-slideshow .arrow.previous { left: 15px; }
gallery-slideshow .arrow.next { right: 15px; }
html.mobile gallery-slideshow .arrow.previous { left: 10px; }
html.mobile gallery-slideshow .arrow.next { right: 10px; }
gallery-slideshow:hover .arrow { opacity: 1; }
gallery-slideshow .arrow:active { opacity: 0.7; }

/* ---------- The scroll effect (Cargo's "scroll animation", as this site had it) ----------
   Each picture starts invisible and 40 px low; when it comes into view it rises into place and fades in over
   one second. scripts/site.js decides when (measured on the live site: see docs/DECISIONS.md). */
/* The picture moves inside its place (as on Cargo), so nothing around it shifts. ("translate" works alongside
   the slideshow's own sideways "transform".) */
.scroll-fade > :is(.slides, img) { opacity: 0; translate: 0 40px; }
.scroll-fade.shown > :is(.slides, img) { opacity: 1; translate: none; }
.scroll-fade.animate > :is(.slides, img) { transition: opacity 1s var(--scroll-easing) -17ms, translate 1s var(--scroll-easing) -17ms, transform var(--speed, 0.8s) var(--slide-easing); }   /* Cargo started on the scroll itself, a frame sooner */
html { --scroll-easing: cubic-bezier(0.45, 0, 0.35, 1); }   /* fitted to the live site's frames (docs/DECISIONS.md) */

/* ---------- The home page's picture (Cargo's "wallpaper"): full window, pictures fading one into the next ---------- */
/* Measured on the live site (2026-11-22): the picture fills the whole window, running behind the menu bar (half a pixel
   taller than the window, as on Cargo), cropped to fill. The next picture fades in over the one showing, which stays
   solid underneath: about 1.35 s, quick at first and gentle at the end (fitted to the live site's frames). */
.wallpaper { position: absolute; top: 0; left: 0; width: 100%; height: calc(100vh + 0.5px); z-index: -1; overflow: hidden; }
.wallpaper img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; z-index: 0; }
.wallpaper img.shown { opacity: 1; }
.wallpaper img.under { opacity: 1; z-index: 1; }
.wallpaper img.fading-in { z-index: 2; transition: opacity 1.35s cubic-bezier(0.2, 0.3, 0.3, 1); }

/* ---------- Icons (arrows, the phone menu's lines), as Cargo drew them ---------- */
text-icon {
  display: inline-block;
  position: relative;
  aspect-ratio: 1;
  height: 1.2em;
  width: auto;
  margin-top: -1em;
  margin-bottom: -0.25em;
  vertical-align: baseline;
}
text-icon svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; fill: currentColor; }

/* ---------- Click-to-enlarge (Cargo's "quick view"; its colors are in site.css: .quick-view, .quick-view-background) ---------- */
.zoom-view { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.zoom-view .quick-view { display: flex; align-items: center; justify-content: center; }
.zoom-view .zoom-bg { position: absolute; inset: 0; }
.zoom-view img { position: relative; transform-origin: 0 0; }
.zoom-view img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Its buttons: Cargo's grey circles, 20 px in from the window's edges (10 px on phones' arrows: site.css). */
.zoom-view .arrow {
  position: absolute; width: 30px; height: 30px; border: 0; padding: 0; border-radius: 50%; cursor: pointer;
  background: rgba(87, 87, 87, 0.35); color: rgba(255, 255, 255, 0.9);
}
.zoom-view .arrow svg { display: block; width: 100%; height: 100%; }
.zoom-view .arrow.previous { left: 20px; top: 50%; margin-top: -15px; }
.zoom-view .arrow.next { right: 20px; top: 50%; margin-top: -15px; }
.zoom-view .arrow.close { right: 20px; top: 20px; }
html.mobile .zoom-view .arrow.previous { left: 25px; }
html.mobile .zoom-view .arrow.next { right: 25px; }

/* ---------- Rows that open a link (Interviews, Writing, Events, the lists): Cargo's data-url ---------- */
column-set[data-url] { cursor: pointer; }

/* ---------- Font ----------
   Cargo's "Diatype Variable" is Cargo's own copy, licensed to Cargo sites only. Until Joseph's own file from
   Dinamo is in fonts/, the name falls back to the closest installed sans-serif. */

/* ---------- The contact form (Cargo's pop-up: "Contact", From, message, Cancel / Send) ----------
   Measured on the live site and from Cargo's own stylesheet for it (2026-11-22): a 432 px window on a computer
   (30% of the window, at least 410 px, at most 75% of its height tall), the whole width less 15 px a side on a phone,
   in the system's font. scripts/site.js opens it, checks it and sends it. */
.contact-form {
  --cf-color: rgba(0, 0, 0, 0.85);
  --cf-hr: rgba(0, 0, 0, 0.1);
  --cf-placeholder: #999;
  --cf-enter: cubic-bezier(0.26, 0.27, 0.38, 0.925);
  --cf-exit: cubic-bezier(0.62, 0.075, 0.74, 0.73);
  --cf-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  position: fixed; inset: 0; z-index: 9996;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  font-family: var(--cf-font); font-size: 14.5px; line-height: 1.65; color: #000; text-align: left;
  opacity: 0; transition: opacity 0.28s var(--cf-exit);
}
html.mobile .contact-form { font-size: 16px; line-height: 1.5; }
.contact-form.active { opacity: 1; transition: opacity 0.28s var(--cf-enter); }
.contact-form.sent { opacity: 0; transition: opacity 0.28s var(--cf-exit); }
.contact-form .modal {
  width: 30vw; min-width: 410px; height: 75vh; max-height: 75vh;
  border-radius: 11px; box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translateY(30px); transform-origin: bottom center;
  transition: opacity 0.28s var(--cf-exit), transform 0.28s var(--cf-exit);
}
.contact-form.active .modal { opacity: 1; transform: none; transition: opacity 0.28s var(--cf-enter), transform 0.28s var(--cf-enter); }
.contact-form.sent .modal { opacity: 0; transform: translateY(-30px); }
html.mobile .contact-form .modal { position: fixed; top: 7.5vh; bottom: 7.5vh; left: 15px; right: 15px; width: auto; min-width: 0; height: auto; max-height: none; }
.contact-form .modal-inner {
  display: flex; flex-direction: column; height: 100%; padding: 10px; overflow: auto;
  background: #fff; border-radius: 10px;
}
.contact-form .header { position: relative; display: grid; place-items: center; font-size: 16px; font-weight: 700; user-select: none; -webkit-user-select: none; }
.contact-form .exit { position: absolute; right: 0; line-height: 0; cursor: pointer; border: 0; padding: 0; background: none; }
.contact-form .exit:active, .contact-form button:active { opacity: 0.7; }
.contact-form hr { box-sizing: content-box; height: 0; border: 0; border-top: 1px solid var(--cf-hr); margin: 10px 0; background: none; }
.contact-form .header + hr, .contact-form .email + hr { margin-bottom: 0; }
.contact-form .email + hr, .contact-form .text-area + hr { margin-top: 0; }
.contact-form .email { display: flex; align-items: center; padding: 8px 0 10px; color: var(--cf-placeholder); }
.contact-form .email input {
  width: 100%; margin: 0; padding: 0 10px 0 0; border: 0; outline: none; background: #fff;
  font: inherit; color: var(--cf-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.contact-form .text-area { position: relative; display: flex; flex-direction: column; flex: 1; }
.contact-form textarea {
  flex: 1; margin: 0; padding: 10px 0 30px; border: 0; outline: none; resize: none; background: #fff; box-shadow: none;
  font: inherit; line-height: 1.4; color: var(--cf-color); scrollbar-width: none;
}
.contact-form ::placeholder { color: var(--cf-placeholder); opacity: 1; }
.contact-form .error input, .contact-form .error ::placeholder, .contact-form .error textarea { color: #f00; }
.contact-form .buttons { display: grid; grid-auto-flow: column; gap: 5px; margin-left: auto; }
.contact-form .buttons button {
  position: relative; display: flex; justify-content: flex-start; width: 130px; height: 28.5px;
  padding: 6.5px 12px 7.5px 15px; border: 0; border-radius: 100px; cursor: pointer;
  font-family: var(--cf-font); font-size: 14.5px; font-weight: 500; line-height: 1; white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.contact-form .cancel { background: #e3e3e3; color: #5d5d5d; }
.contact-form .send { background: #262626; color: #fff; padding-right: 5px; overflow: hidden; }
/* While sending: "Sending", with moving stripes across the button (Cargo's). */
.contact-form .send.sending::after {
  content: ""; position: absolute; inset: 0; border-radius: 100px;
  background-size: 60px 60px; animation: cf-stripes 1.2s linear infinite;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.08) 25%, transparent 25%, transparent 50%,
    rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.08) 75%, transparent 75%, transparent);
}
@keyframes cf-stripes { from { background-position: 120px 60px; } to { background-position: 0 0; } }
/* "Message sent" (and the failure notice): Cargo's grey notice in the middle of the window, for two seconds. */
.cf-notice { position: fixed; inset: 0; z-index: 9997; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cf-notice div {
  padding: 11px 45px 13px; border-radius: 11px; background: rgba(120, 115, 115, 0.75); color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 18px; font-weight: 600; line-height: 1.3;
  text-align: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
html.contact-open, html.contact-open body { overflow: hidden; }
