/* ──────────────────────────────────────────────────────────
   Computer Angel — creative
   One world, read in the order it formed — orbit, ground, settlement,
   life — one page each. The ground colour warms from page to page as
   the world gets lived in: space, night, dusk, day.
────────────────────────────────────────────────────────── */

html.creative-page {
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --dusk: #100c09;
  --day: #ece6da;
  --day-ink: #1c1b18;
  --day-muted: #6e685d;
}
html.inner, html.inner body { height: auto; overflow: auto; }
html.creative-page body::before, html.creative-page body::after { display: none; }
html.creative-page body { min-height: 100svh; display: flex; flex-direction: column; }
#world { flex: 1; }

/* each page its own light */
html.tone-dusk { background: var(--dusk); }
html.tone-dusk .veil { background: linear-gradient(var(--dusk) 45%, rgba(16,12,9,0)); }
html.tone-day { background: var(--day); color: var(--day-ink); --muted: var(--day-muted); }
html.tone-day body { color: var(--day-ink); }
html.tone-day .veil { background: linear-gradient(var(--day) 45%, rgba(236,230,218,0)); }
html.tone-day .brand, html.tone-day .menu-btn { color: var(--day-ink); }
html.tone-day.menu-open .brand, html.tone-day.menu-open .menu-btn { color: #eeede9; }
html.tone-day .menu { --muted: #a3a3a8; }
html.tone-day .pager a:hover { color: #2a6f95; }

.noscript { padding: 30vh var(--pad); color: var(--muted); }

/* ── overview ──────────────────────────────────────────────────────── */
.world-head {
  min-height: 62svh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--icon) * 6) var(--pad) clamp(48px, 8vh, 96px);
}
.world-head > * { margin-left: 0; }
.world-head h1 { margin-left: 0; }
.world-head h1 .line2 { margin-left: 0; }   /* O and C are both round: flush, they line up */
.chapter-index { padding: 0 var(--pad) clamp(100px, 16vh, 180px); max-width: calc(1320px + 2 * var(--pad)); }
.chapters .sys-img img { aspect-ratio: 16 / 9; object-position: 50% 50%; }
.chapters .status { font-family: var(--mono); letter-spacing: .08em; }
.chapters .sys-title { font-size: clamp(30px, 3vw, 52px); }

/* ── a chapter ─────────────────────────────────────────────────────── */
.chapter-head { padding: calc(var(--icon) * 6.5) var(--pad) clamp(40px, 7vh, 80px) calc(var(--pad) + var(--axis)); display: grid; gap: 14px; }
.chapter-num { display: flex; gap: 1.4em; font-family: var(--mono); font-size: calc(var(--brand) * .9); letter-spacing: .12em; color: var(--muted); }
.chapter-head h1 { font-size: clamp(48px, 7vw, 128px); line-height: 1; letter-spacing: -.035em; margin-left: -.05em; color: inherit; }
.chapter-note { font-size: var(--link); line-height: 1.5; color: var(--muted); max-width: 30em; }

.plates, .guide { margin: 0 var(--pad); max-width: 1320px; }

/* ── plates ────────────────────────────────────────────────────────── */
.plates { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(18px, 2.4vw, 36px) clamp(14px, 2vw, 28px); }
.plate { position: relative; min-width: 0; }
.plate a { display: block; overflow: hidden; border-radius: 3px; background: rgba(128,128,128,.12); cursor: zoom-in; }
.plate img {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  transition: transform 1s cubic-bezier(.22,1,.36,1);
}
.plate a:hover img { transform: scale(1.015); }

/* rising in: set up by creative.js (not while editing, not with reduced motion) */
.reveals .plates > .plate, .reveals .guide > .specimen {
  opacity: 0; transform: translateY(16px);
  transition: opacity .6s ease, transform .7s cubic-bezier(.2,.8,.2,1);
}
.reveals .plates > .plate.in, .reveals .guide > .specimen.in { opacity: 1; transform: none; }
.reveals .plate img { opacity: 0; transition: opacity .5s ease, transform 1s cubic-bezier(.22,1,.36,1); }
.reveals .plate img.loaded { opacity: 1; }
.plate figcaption { margin-top: 10px; font-size: calc(var(--link) * .78); line-height: 1.45; color: var(--muted); max-width: 40em; }
.pnum { font-family: var(--mono); font-size: .85em; letter-spacing: .04em; opacity: .8; margin-right: 1em; }

/* the story chapters run as one reel down the middle — a film cut like a
   comic: a wide letterboxed scene, two quick panels side by side, a held
   frame, again. the story sits under each shot like a subtitle */
.reel { margin-inline: max(var(--pad), calc((100% - 1320px) / 2)); row-gap: clamp(56px, 11vh, 120px); column-gap: clamp(10px, 1.2vw, 16px); }
.beat-wide { grid-column: 1 / -1; }
.beat-wide img { aspect-ratio: 2 / 1; object-position: 50% 50%; }
.beat-frame { grid-column: 3 / span 8; }
.beat-panel { grid-column: span 6; }
.beat-panel img { aspect-ratio: 4 / 3; }
.reel .beat-wide figcaption, .reel .beat-frame figcaption {
  margin: 18px auto 0; max-width: 34em; text-align: center;
  font-size: calc(var(--link) * .92); color: inherit; opacity: .86;
}
.reel .beat-wide .pnum, .reel .beat-frame .pnum { display: block; margin: 0 0 6px; color: var(--muted); }

/* ── the field guide: machine → what it became ────────────────────────
   laid out like the other chapters (two across), and set like the
   chapter boxes: a small mono line, the name, a muted note */
.guide { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(40px, 6vh, 72px) clamp(14px, 2vw, 28px); }
.specimen { position: relative; display: flex; flex-direction: column; min-width: 0; }
.shots { display: grid; gap: 8px; }
/* more than one image: one of five swipers (see creative.js) */
.shots-wrap { position: relative; }
.carousel .shots { touch-action: pan-y; }
.carousel .plate img { -webkit-user-drag: none; }

/* slide & peek: a row that scrolls sideways and snaps */
.car-slide .shots, .car-peek .shots {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; touch-action: pan-x pan-y;
}
.car-slide .shots::-webkit-scrollbar, .car-peek .shots::-webkit-scrollbar { display: none; }
.car-slide .shots { gap: 0; border-radius: 3px; }
.car-slide .plate { flex: 0 0 100%; scroll-snap-align: start; }
.car-slide .plate a { border-radius: 0; }
.car-peek .shots { gap: 10px; }
.car-peek .plate { flex: 0 0 84%; scroll-snap-align: start; }
.car-peek .plate:not(.on) img { filter: brightness(.6); }
.car-peek .plate img { transition: filter .4s ease, transform 1s cubic-bezier(.22,1,.36,1); }
.carousel.dragging .shots { scroll-snap-type: none; cursor: grabbing; }

/* fade, stack, hover: the images lie on top of each other */
.car-fade .shots, .car-stack .shots, .car-hover .shots { display: grid; }
.car-fade .plate, .car-stack .plate, .car-hover .plate { grid-area: 1 / 1; }
.car-fade .plate, .car-hover .plate { opacity: 0; transition: opacity .7s ease; }
.car-hover .plate { transition-duration: .25s; }
.car-fade .plate.on, .car-hover .plate.on { opacity: 1; z-index: 1; }
.car-hover .shots { cursor: ew-resize; }

/* stack: prints in a pile, the next one peeking out up and to the right */
.car-stack .shots { padding: 18px 18px 0 0; }
.car-stack .plate { transition: transform .5s cubic-bezier(.22,1,.36,1), filter .5s ease; transform-origin: 50% 100%; }
.car-stack .plate[data-pos="0"] { z-index: 3; }
.car-stack .plate[data-pos="1"] { z-index: 2; transform: translate(18px, -18px) rotate(1.2deg); filter: brightness(.75); cursor: pointer; }
.car-stack .plate:not([data-pos="0"]):not([data-pos="1"]) { z-index: 1; transform: translate(14px, -14px); opacity: 0; }
.car-stack .plate[data-pos="0"] a { box-shadow: 0 10px 30px rgba(0,0,0,.45); }

/* slide: arrows and a counter on the image */
.car-nav {
  position: absolute; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: 3px; background: rgba(5,5,6,.72); color: #eeede9;
}
.car-count { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; padding: 0 8px; }
.car-btn {
  width: 28px; height: 26px; border: 0; border-radius: 2px; background: none; color: inherit; cursor: pointer;
  font: 20px/1 'Jost', sans-serif;
}
.car-btn:hover:not(:disabled), .car-btn:focus-visible { background: rgba(255,255,255,.12); }
.car-btn:disabled { opacity: .3; cursor: default; }

/* the others: thin bars under the image, one per image */
.car-bars { display: flex; gap: 6px; margin-top: 10px; }
.car-bar { flex: 0 0 34px; height: 14px; padding: 6px 0; border: 0; background: none; cursor: pointer; }
.car-bar::before { content: ''; display: block; height: 2px; background: currentColor; opacity: .25; transition: opacity .3s ease; }
.car-bar.on::before, .car-bar:hover::before { opacity: .9; }
.car-bar { color: inherit; }

/* editing: every image side by side, so each can be dragged */
.editing .carousel .shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; overflow: visible; padding: 0; }
.editing .carousel .plate { grid-area: auto; opacity: 1; transform: none; filter: none; flex: none; }
.editing .car-nav, .editing .car-bars { display: none; }

.sp-from { margin-top: 18px; font-size: clamp(22px, 2vw, 34px); line-height: 1.12; letter-spacing: -.015em; }
.sp-to { color: var(--ink); }
html.tone-day .sp-to { color: var(--day-ink); }
.sp-note { margin-top: 8px; font-size: calc(var(--link) * .9); line-height: 1.55; color: var(--muted); max-width: 30em; }

/* ── previous · all · next ─────────────────────────────────────────── */
.pager {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px;
  margin: clamp(80px, 14vh, 160px) var(--pad) 0; padding: 28px 0 clamp(60px, 10vh, 110px) var(--axis);
  border-top: 1px solid rgba(128,128,128,.28); max-width: 1320px;
  font-size: var(--link);
}
.pager a { color: inherit; text-decoration: none; opacity: .8; transition: opacity .25s ease, color .25s ease; }
.pager a:hover, .pager a:focus-visible { opacity: 1; color: var(--blue); }
.pager-all { font-weight: 300; font-size: var(--brand); letter-spacing: .24em; text-transform: uppercase; }
.pager-next { justify-self: end; }

.creative-page .foot-row { padding-top: 0; }
html.tone-day .foot-row a { color: var(--day-ink); }

/* ── lightbox ──────────────────────────────────────────────────────── */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; margin: auto; cursor: zoom-out; overflow: visible; }
.lightbox::backdrop { background: rgba(5,5,6,.95); }
.lightbox img { display: block; max-width: 94vw; max-height: 86vh; border-radius: 3px; }
.lb-cap { margin-top: 12px; font-size: calc(var(--link) * .8); color: #a3a3a8; }

@media (max-width: 760px) {
  /* phones: one picture per row with its words, like every other chapter */
  .reel { row-gap: 48px; }
  .beat-wide, .beat-frame, .beat-panel { grid-column: 1 / -1; }
  .beat-wide img, .beat-panel img { aspect-ratio: 16 / 9; }
  .guide { grid-template-columns: 1fr; }
  .pager { grid-template-columns: 1fr 1fr; }
  .pager-all { grid-column: 1 / -1; grid-row: 2; }
}

/* ── edit mode (?edit) ─────────────────────────────────────────────── */
.editing [data-item] { cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.editing [data-item].lifted { transform: scale(.97); transition: transform .15s ease; }
.editing .plate a { cursor: grab; }
.editing .specimen { outline: 1px dashed rgba(128,160,190,.35); outline-offset: 10px; }
.editing [data-list] { min-height: 60px; }
.editing .shots { min-height: 80px; background: rgba(128,128,128,.06); border-radius: 3px; }
.is-dragging, .is-dragging * { cursor: grabbing !important; }
[data-item].dragging { opacity: .3; }
[data-list].over { outline: 1px dashed var(--blue); outline-offset: 6px; }
.ghost {
  position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; margin: 0;
  opacity: .92; box-shadow: 0 18px 50px rgba(0,0,0,.55); transform-origin: 0 0;
}
.ghost figcaption, .ghost .x, .ghost .move { display: none; }

.x, .move {
  position: absolute; z-index: 2; border: 0; border-radius: 3px; cursor: pointer;
  background: rgba(5,5,6,.82); color: #eeede9;
}
.x { top: 8px; right: 8px; width: 30px; height: 30px; font: 18px/1 'Jost', sans-serif; }
.x:hover, .x:focus-visible { background: #c23b2b; }
.move { top: 8px; left: 8px; height: 30px; max-width: calc(100% - 54px); padding: 0 8px; font: 13px 'Jost', sans-serif; }
.move:hover, .move:focus-visible { background: #1d4a63; }
.shots .move { max-width: calc(100% - 50px); }
.specimen > .x { top: -26px; right: -18px; width: 26px; height: 26px; font-size: 16px; background: #26262a; }

.edit-bar {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100vw - 32px);
  padding: 10px 12px; border-radius: 4px; background: rgba(12,12,14,.95); border: 1px solid rgba(255,255,255,.12);
  font: 14px 'Jost', sans-serif; color: #eeede9; box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.eb-msg { color: #a3a3a8; margin-right: 6px; }
.edit-bar button {
  border: 1px solid rgba(255,255,255,.18); border-radius: 3px; background: none; color: #eeede9;
  font: inherit; padding: 7px 12px; cursor: pointer;
}
.edit-bar button.primary { background: #eeede9; color: #050506; border-color: #eeede9; }
.edit-bar button:hover { border-color: var(--blue); }

.tray {
  position: fixed; right: 16px; bottom: 80px; z-index: 39; width: min(320px, calc(100vw - 32px)); max-height: 46vh; overflow: auto;
  padding: 12px; border-radius: 4px; background: rgba(12,12,14,.95); border: 1px solid rgba(255,255,255,.12); color: #eeede9;
  --muted: #a3a3a8;
}
.tray:not(.has) { display: none; }
.tray > p { font: 13px/1.4 'Jost', sans-serif; color: #a3a3a8; margin-bottom: 10px; }
.tray-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tray-list + .tray-list { margin-top: 10px; }
.tray .plate figcaption, .tray .move, .tray .shots .x { display: none; }
.tray .specimen { outline: none; grid-column: 1 / -1; }
.tray .specimen > .x { top: 4px; right: 4px; }
.tray .sp-from { font-size: 15px; margin-top: 6px; }
.tray .sp-note { display: none; }
.tray .x { width: 26px; height: 26px; top: 4px; right: 4px; font-size: 15px; }

/* ── the portfolio: the whole world in one row, read sideways ─────── */
html.pf-page, html.pf-page body { height: 100%; overflow: hidden; }
html.pf-page .veil { display: none; }
html.pf-page body { display: flex; flex-direction: column; }
.pf-page #world { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.pf-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px 40px; flex-wrap: wrap;
  padding: calc(var(--icon) * 4.4) var(--pad) clamp(18px, 3.5vh, 36px) calc(var(--pad) + var(--axis));
}
.pf-head h1 { font-size: clamp(22px, 2.4vw, 38px); line-height: 1.2; letter-spacing: -.01em; font-weight: 400; margin: 0; opacity: 1; animation: none; color: inherit; }
.pf-head h1 span { display: block; }
.pf-made { margin: 0 0 12px; font-family: var(--mono); font-size: calc(var(--brand) * .9); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pf-chapters { display: flex; gap: clamp(14px, 2vw, 28px); font-family: var(--mono); font-size: calc(var(--brand) * .9); letter-spacing: .12em; text-transform: uppercase; }
.pf-chapters a { color: var(--muted); text-decoration: none; padding: 4px 0; border-bottom: 1px solid transparent; transition: color .25s ease, border-color .25s ease; }
.pf-chapters a:hover, .pf-chapters a:focus-visible { color: var(--ink); }
.pf-chapters a.on { color: var(--ink); border-bottom-color: var(--blue); }

/* the row: every image the same height, its own width */
.pf-track {
  --row: min(44svh, 470px);
  /* one grid row: every image's top on the same line, the row itself centred in the space */
  flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: max-content;
  align-content: center; align-items: start; gap: clamp(16px, 2vw, 28px);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  padding: 0 var(--pad) 18px calc(var(--pad) + var(--axis));
  scroll-padding-left: calc(var(--pad) + var(--axis));
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.22) transparent;
}
.pf-track:focus-visible { outline: none; }
.pf-track::-webkit-scrollbar { height: 6px; }
.pf-track::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 3px; }
/* every image the same height, shown whole at its own width: tops and bottoms
   all on the same two lines, the wide ones simply wider */
.pf-track .plate { margin: 0; width: calc(var(--row) * var(--ar, 1.78)); }
.pf-track .plate a { background: none; border-radius: 3px; }
/* cover: a frame whose "ar" is narrower than the file (black bars baked into the render) loses the bars */
.pf-track .plate img { width: 100%; height: auto; aspect-ratio: var(--ar, 1.78); object-fit: cover; border-radius: 3px; opacity: 0; transition: opacity .5s ease, transform 1s cubic-bezier(.22,1,.36,1); }
.pf-track .plate img.loaded { opacity: 1; }
/* an entry with two images: the second lies over the first and fades in and out */
.pf-track .pf-fade a { position: relative; }
.pf-track .pf-fade img.alt { position: absolute; inset: 0; height: 100%; aspect-ratio: auto; object-fit: cover; opacity: 0; transition: opacity 1.4s ease, transform 1s cubic-bezier(.22,1,.36,1); }
.pf-track .pf-fade img.alt.on { opacity: 1; }
.pf-track .plate figcaption { max-width: 34em; }

/* each chapter opens with its name, set in the row like a title page */
.pf-mark {
  width: clamp(200px, 19vw, 280px); min-height: var(--row);
  display: flex; flex-direction: column; justify-content: flex-start; gap: 10px;
  padding-right: clamp(8px, 1.5vw, 24px); border-left: 1px solid rgba(255,255,255,.14); padding-left: clamp(16px, 1.6vw, 24px);
}
.pf-mark:first-child { border-left: 0; padding-left: 0; }
.pf-n { font-family: var(--mono); font-size: calc(var(--brand) * .9); letter-spacing: .12em; color: var(--muted); margin: 0; }
.pf-mark h2 { font-size: clamp(36px, 4vw, 64px); line-height: 1; letter-spacing: -.03em; font-weight: 400; margin: 0; }
.pf-note { font-size: calc(var(--link) * .82); line-height: 1.5; color: var(--muted); margin: 0; }

html.pf-page .foot-row { padding-top: 6px; }

@media (max-width: 760px) {
  .pf-head { padding-left: var(--pad); }
  /* phones: two by two, so the four chapters never break three-and-one */
  .pf-chapters { display: grid; grid-template-columns: repeat(2, max-content); gap: 6px 28px; }
  .pf-chapters a { justify-self: start; }
  /* phones: low enough that even the widest image fits the screen, so the heights still match */
  .pf-track { --row: min(40svh, calc(88vw / 2.36)); padding-left: var(--pad); scroll-padding-left: var(--pad); scroll-snap-type: x proximity; }
  .pf-track .plate, .pf-mark { scroll-snap-align: start; }
  .pf-mark { width: 62vw; }
}
@media (prefers-reduced-motion: reduce) {
  .pf-track .plate img { transition: none; }
}
