/* Neo Image: a dark room where the pictures are the only light.
   Surfaces are lit from inside (inset glow), never outlined or drop-shadowed. */

:root {
  --black: #000;
  --pearl: #ece8e1;
  --pearl-dim: #9a958d;
  --pearl-faint: #5f5b55;
  --lit: rgba(236, 232, 225, .055);
  --glow: inset 0 1px 0 rgba(236, 232, 225, .14), inset 0 0 28px rgba(236, 232, 225, .05);
  --glow-strong: inset 0 1px 0 rgba(236, 232, 225, .26), inset 0 0 40px rgba(236, 232, 225, .11);
  /* The one loud colour: ultraviolet, lit from inside like everything else. */
  --uv: #5a35ff;
  --uv-hi: #b3a2ff;
  --uv-fill: linear-gradient(180deg, #6d4bff, #4a26f0);
  --uv-glow: inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 18px rgba(190, 172, 255, .65), inset 0 -6px 14px rgba(40, 10, 170, .55);
  --uv-glow-soft: inset 0 1px 0 rgba(179, 162, 255, .5), inset 0 0 44px rgba(90, 53, 255, .38);
  --r-lg: 26px;
  --r-md: 14px;
  --r-sm: 6px;
  --pad: clamp(16px, 3.2vw, 44px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--black); }
body {
  margin: 0;
  font: 400 16px/1.5 "Bricolage Grotesque", system-ui, sans-serif;
  color: var(--pearl);
  background: var(--black);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 150px;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--uv-hi); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---------- top ---------- */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--pad) 22px;
}
.mark {
  font-weight: 600; font-size: 17px; letter-spacing: -.02em;
  color: var(--pearl); text-decoration: none;
}
.mark span { color: var(--pearl-dim); font-weight: 400; }
.credits, .pill {
  color: var(--pearl); text-decoration: none;
  border: 0; border-radius: 999px; padding: 8px 16px;
  background: var(--lit); box-shadow: var(--glow);
  font-size: 14px; font-variant-numeric: tabular-nums;
  transition: box-shadow .2s;
}
.credits:hover, .pill:hover { box-shadow: var(--glow-strong); }
.credits span:first-child { color: var(--uv-hi); font-weight: 600; }
.credits span:last-child { color: var(--pearl-dim); }
.account {
  margin-left: auto; margin-right: 14px; display: flex; gap: 12px; align-items: center;
  color: var(--pearl-dim); font-size: 14px; text-decoration: none;
}
a.account:hover, .account button:hover { color: var(--pearl); }
.account span { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account button { all: unset; cursor: pointer; color: var(--pearl-dim); }
.account button:focus-visible { outline: 2px solid var(--uv-hi); outline-offset: 3px; }
@media (max-width: 560px) { .account span { display: none; } }

/* ---------- hero: sits in the wall as its first tile ---------- */
.hero {
  container-type: inline-size;
  break-inside: avoid;
  /* px, not cqi: container units on the container itself resolve to the viewport */
  padding: 10px 12px 56px calc(var(--pad) - 8px);
}
.hero h1 {
  margin: 0;
  font-weight: 600;
  font-size: 25cqi;
  line-height: .88;
  letter-spacing: -.06em;
  font-variation-settings: "opsz" 96;
}
.hero p {
  margin: 8cqi 0 0;
  max-width: 30ch;
  font-size: clamp(14px, 4.6cqi, 18px);
  color: var(--pearl-dim);
}
.hero[hidden] { display: none; }

/* ---------- landing and home ---------- */
body.plain { padding-bottom: 64px; }
.lead { padding: clamp(28px, 7vh, 90px) var(--pad) clamp(40px, 8vh, 96px); }
.lead h1 {
  margin: 0; max-width: 13ch;
  font-weight: 600; font-size: clamp(46px, 10.5vw, 168px);
  line-height: .88; letter-spacing: -.06em;
  font-variation-settings: "opsz" 96;
}
.lead p { margin: clamp(20px, 3vw, 36px) 0 0; max-width: 46ch; font-size: clamp(16px, 1.5vw, 20px); color: var(--pearl-dim); }
.lead .btn { display: inline-block; width: auto; margin-top: 28px; padding: 15px 30px; font-size: 17px; }
.lead.small { padding-bottom: clamp(24px, 4vh, 44px); }
.lead.small h1 { max-width: none; font-size: clamp(38px, 6vw, 88px); }

/* The tools, as a list you can read like an index: the live one is tall and
   full of pictures, the ones still to come are slim and dark. */
.services { display: grid; gap: 8px; padding: 0 8px; }
.svc {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 28px;
  padding: clamp(20px, 2.6vw, 36px) calc(var(--pad) - 8px);
  border-radius: var(--r-lg); overflow: hidden;
  background: var(--lit); box-shadow: var(--glow);
  color: var(--pearl); text-decoration: none;
  transition: box-shadow .25s;
}
a.svc:hover { box-shadow: var(--uv-glow-soft); }
.svc-name { margin: 0; font-weight: 600; font-size: clamp(34px, 6.4vw, 96px); line-height: .9; letter-spacing: -.055em; }
.svc p { margin: 14px 0 0; max-width: 36ch; color: var(--pearl-dim); }
.strip { display: flex; gap: 6px; margin: calc(clamp(20px, 2.6vw, 36px) * -1 + 8px) 0; }
.strip img { height: clamp(150px, 19vw, 280px); aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-sm); }
.strip.wide img { aspect-ratio: 16 / 9; height: clamp(110px, 12.5vw, 200px); }
.svc.soon { align-items: center; background: none; }
.svc.soon .svc-name { font-size: clamp(26px, 3.6vw, 52px); color: var(--pearl-faint); }
.svc.soon p { margin-top: 8px; color: var(--pearl-faint); }
.tag { padding: 6px 14px; border-radius: 999px; background: var(--lit); box-shadow: var(--glow); font-size: 13px; color: var(--pearl-dim); white-space: nowrap; }
.made { padding-top: clamp(48px, 8vh, 96px); }
.empty { margin: 0; padding: 0 var(--pad); color: var(--pearl-dim); }
.empty a { color: var(--uv-hi); }
@media (max-width: 760px) {
  .svc { grid-template-columns: 1fr; align-items: start; }
  .strip { margin: 0 calc(var(--pad) * -1) 0 0; overflow: hidden; }
  .strip img { height: 150px; }
  .strip.wide img { height: 110px; }
  .svc.soon .tag { justify-self: start; }
}

/* ---------- Neo UI ---------- */
.stage { padding: 0 8px; }
.frame {
  position: relative; overflow: hidden;
  aspect-ratio: 16 / 9; width: min(100%, calc((100vh - 250px) * 16 / 9)); margin: 0 auto;
  border-radius: var(--r-lg); background: var(--lit); box-shadow: var(--glow);
}
/* The page is laid out at a real screen size and scaled to fit; ui.js sets the size and --s. */
.frame iframe { display: block; border: 0; background: #fff; transform-origin: 0 0; transform: scale(var(--s, 1)); }
.frame.pending::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 160px rgba(109, 75, 255, .5), inset 0 0 40px rgba(179, 162, 255, .28);
  animation: breathe 2.4s ease-in-out infinite;
}
.stage-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding: 16px calc(var(--pad) - 8px) 0;
}
.stage-foot p { margin: 0; max-width: 60ch; color: var(--pearl-dim); }
.stage-foot .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stage-foot .btn { width: auto; text-decoration: none; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 8px; padding: 0 8px; }
.shelf .tile { aspect-ratio: 16 / 9; margin: 0; cursor: pointer; }
@media (max-width: 700px) { .frame { aspect-ratio: 9 / 16; width: 100%; } }

/* ---------- walls ---------- */
section h2 {
  margin: 0; padding: 0 var(--pad) 16px;
  font-size: 14px; font-weight: 400; color: var(--pearl-dim);
}
#mine + #showcase h2 { padding-top: 56px; }
.wall {
  columns: 2; column-gap: 6px;
  padding: 0 6px;
}
@media (min-width: 700px)  { .wall { columns: 3; column-gap: 8px; padding: 0 8px; } }
@media (min-width: 1100px) { .wall { columns: 4; } }
@media (min-width: 1700px) { .wall { columns: 5; } }

.tile {
  display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0;
  position: relative; overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--lit);
  break-inside: avoid;
}
@media (min-width: 700px) { .tile { margin-bottom: 8px; } }
.tile img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .5s;
}
.tile img.in { opacity: 1; }
.tile figcaption, .tile .cap {
  position: absolute; inset: auto 0 0 0;
  padding: 28px 12px 10px;
  font-size: 13px; text-align: left; color: var(--pearl);
  background: linear-gradient(transparent, rgba(0, 0, 0, .72));
  opacity: 0; transition: opacity .2s;
}
.tile:hover .cap, .tile:focus-visible .cap { opacity: 1; }

/* A picture that is still being made: lit from inside, slowly breathing. */
.tile.pending { box-shadow: var(--glow); }
.tile.pending::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 90px rgba(109, 75, 255, .5), inset 0 0 22px rgba(179, 162, 255, .28);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

/* ---------- composer ---------- */
.composer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 40px 12px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .88) 55%);
  pointer-events: none;
}
.composer > * { pointer-events: auto; }
.bar {
  display: flex; align-items: flex-end; gap: 8px;
  width: min(760px, 100%); margin: 0 auto;
  padding: 8px 8px 8px 22px;
  border-radius: var(--r-lg);
  background: rgba(22, 21, 20, .82);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: var(--glow);
  transition: box-shadow .25s;
}
.bar:focus-within { box-shadow: var(--uv-glow-soft); }
.bar textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: none; outline: 0;
  padding: 10px 0; max-height: 132px;
  font-size: 17px; line-height: 1.4;
}
.bar textarea::placeholder { color: var(--pearl-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.count { display: flex; border: 0; margin: 0 0 3px; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, .35); }
.count input { position: absolute; opacity: 0; pointer-events: none; }
.count span {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  font-size: 14px; color: var(--pearl-dim); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.count input:checked + span { background: var(--uv-fill); box-shadow: var(--uv-glow); color: #fff; }
.count input:focus-visible + span { outline: 2px solid var(--uv-hi); outline-offset: 2px; }

.styles {
  display: flex; gap: 4px; width: min(760px, 100%); margin: 0 auto 8px; padding: 0 4px; border: 0;
  overflow-x: auto; scrollbar-width: none;
}
.styles input { position: absolute; opacity: 0; pointer-events: none; }
.styles span {
  display: block; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(22, 21, 20, .82); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  box-shadow: var(--glow); font-size: 13px; color: var(--pearl-dim); cursor: pointer;
}
.styles input:checked + span { background: var(--uv-fill); box-shadow: var(--uv-glow); color: #fff; }
.styles input:focus-visible + span { outline: 2px solid var(--uv-hi); outline-offset: 2px; }

.go {
  border: 0; border-radius: 999px; padding: 0 22px; height: 44px;
  background: var(--uv-fill); box-shadow: var(--uv-glow); color: #fff; font-weight: 600; font-size: 15px;
  transition: opacity .2s, filter .2s;
}
.go:hover { filter: brightness(1.12); }
.go[disabled] { opacity: .55; cursor: default; filter: none; }

.notice {
  width: min(760px, 100%); margin: 0 auto 10px; padding: 10px 18px;
  border-radius: var(--r-md);
  background: rgba(22, 21, 20, .92); box-shadow: var(--glow);
  font-size: 14px;
}

@media (max-width: 560px) {
  .bar { flex-wrap: wrap; padding: 8px 8px 8px 16px; border-radius: 22px; }
  .bar textarea { flex-basis: 100%; }
  .count { margin-right: auto; }
}

/* ---------- dialogs ---------- */
dialog {
  border: 0; padding: 0; color: var(--pearl);
  background: #0b0a0a; box-shadow: var(--glow);
  border-radius: var(--r-lg);
  max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px);
}
dialog::backdrop { background: rgba(0, 0, 0, .8); backdrop-filter: blur(10px); }
dialog[open] { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .5); font-size: 20px; line-height: 1;
}

.viewer[open] { display: grid; grid-template-columns: minmax(0, auto) 300px; overflow: hidden; }
.viewer img { display: block; max-width: 100%; max-height: calc(100dvh - 24px); object-fit: contain; background: #000; }
.viewer-side { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 56px 24px 24px; }
.viewer-prompt { margin: 0; font-size: 20px; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.actions { display: grid; gap: 8px; }
.edit { display: grid; gap: 8px; margin-top: auto; }
.edit label { font-size: 14px; color: var(--pearl-dim); }
.edit input {
  font: inherit; font-size: 15px; color: var(--pearl); background: var(--lit);
  border: 0; border-radius: 12px; padding: 12px 14px; box-shadow: var(--glow);
}
.edit input:focus-visible { outline: 2px solid var(--uv-hi); outline-offset: 2px; }
.edit input::placeholder { color: var(--pearl-faint); }
@media (max-width: 820px) {
  .viewer[open] { grid-template-columns: 1fr; overflow: auto; }
  .viewer img { max-height: 62dvh; width: 100%; }
  .viewer-side { padding: 20px; }
}

.btn {
  display: block; width: 100%; text-align: center; text-decoration: none;
  border: 0; border-radius: 999px; padding: 12px 18px;
  background: var(--lit); box-shadow: var(--glow); color: var(--pearl); font-size: 15px;
}
.btn:hover { box-shadow: var(--glow-strong); }
.btn.solid { background: var(--uv-fill); color: #fff; font-weight: 600; box-shadow: var(--uv-glow); }
.btn.solid:hover { box-shadow: var(--uv-glow); filter: brightness(1.12); }
.btn.quiet { background: none; box-shadow: none; color: var(--pearl-dim); }
.btn.quiet:hover { color: var(--pearl); }

.sheet { width: 420px; padding: 34px 28px 28px; }
.sheet h2 { margin: 0; padding: 0; font-size: 30px; font-weight: 600; letter-spacing: -.03em; color: var(--pearl); }
.sheet-lede { margin: 6px 0 22px; color: var(--pearl-dim); }
.packs { display: grid; gap: 8px; }
.pack {
  display: flex; justify-content: space-between; align-items: baseline;
  border: 0; border-radius: var(--r-md); padding: 18px 20px;
  background: var(--lit); box-shadow: var(--glow);
  font-size: 17px; text-align: left;
  transition: box-shadow .2s;
}
.pack:hover { box-shadow: var(--uv-glow-soft); }
.pack:hover span { color: var(--uv-hi); }
.pack strong { font-weight: 500; }
.pack span { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.pack[disabled] { opacity: .5; cursor: progress; }
.sheet-error { margin: 14px 0 0; font-size: 14px; }
.restore { margin-top: 26px; padding-top: 20px; box-shadow: inset 0 1px 0 rgba(236, 232, 225, .1); }
.restore p { margin: 0 0 12px; font-size: 14px; color: var(--pearl-dim); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tile.pending::after { opacity: .6; }
}
