@view-transition { navigation: auto; }

:root {
  --tan: #F8EACA;
  --tan-deep: #F0DFB8;
  --ink: #14110C;
  --muted: #62573F;
  --rule: #14110C33;
  --error: #8F2412;
  --gutter: clamp(16px, 3vw, 48px);
  --font: "Coming Soon", "Segoe Print", "Bradley Hand", cursive;
  --maroon: #8B565A;
}

/* Arriving from the intro: the page starts under the black the intro ended
   on. "iris" opens a growing circle out of the centre; otherwise it fades. */
html.reveal body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
html.reveal.iris body::after {
  transition: none;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, transparent var(--iris, 0px), #000 calc(var(--iris, 0px) + 2px));
  mask-image: radial-gradient(circle at 50% 50%, transparent var(--iris, 0px), #000 calc(var(--iris, 0px) + 2px));
}
html.reveal.revealed:not(.iris) body::after { opacity: 0; }

* { box-sizing: border-box; margin: 0; }
html { background: var(--tan); }
body {
  min-height: 100vh;
  min-height: 100svh; /* phones: the visible height with browser bars shown */
  display: flex;
  flex-direction: column;
  background: var(--tan);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  font-synthesis: none;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; touch-action: manipulation; }
/* No double-tap zoom delay on controls; no grey flash on tap. */
a, button { -webkit-tap-highlight-color: transparent; }
/* Open panels keep the page behind them still. */
html:has(dialog[open]) { overflow: hidden; }
/* Desktop: no jump when the scrollbar goes away under an open panel. */
html { scrollbar-gutter: stable; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: var(--error); font-size: 15px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.demo-note {
  padding: 8px var(--gutter);
  background: var(--ink);
  color: var(--tan);
  font-size: 14px;
  text-align: center;
}

.link-btn {
  min-height: 44px;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 15px;
  text-underline-offset: 5px;
}
@media (hover: hover) { .link-btn:hover { text-decoration: underline; } }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 84px;
  padding: 0 var(--gutter);
  background: var(--tan);
  border-bottom: 1px solid var(--rule);
}
.top-mark { display: grid; place-items: center; width: 52px; height: 52px; }
.top-mark img {
  width: 100%;
  mix-blend-mode: multiply;
  transition: transform 1.2s cubic-bezier(.2, .7, .2, 1);
  /* Ambient: a very slow turn and a faint breath. */
  animation: mark-turn 36s linear infinite, mark-breathe 5s ease-in-out infinite alternate;
}
@media (hover: hover) { .top-mark:hover img { transform: rotate(180deg); } }
@keyframes mark-turn { to { rotate: 360deg; } }
@keyframes mark-breathe { from { scale: 0.96; } to { scale: 1.05; } }

.top-word { --wm-h: 40px; position: relative; display: flex; align-items: center; min-height: 44px; }
.top-word img {
  height: var(--wm-h);
  width: auto;
  filter: url(#ink);
}
/* Letters drift independently (fractions of a pixel); the image underneath
   keeps the layout and the accessible name. */
.word-letters { position: absolute; left: 0; right: 0; top: 50%; height: var(--wm-h); translate: 0 -50%; pointer-events: none; }
.word-letters span {
  --w: calc(var(--x1) - var(--x0));
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--x0) / 730 * 100%);
  width: calc(var(--w) / 730 * 100%);
  background: url("../assets/wordmark.png") no-repeat;
  background-size: calc(730 / var(--w) * 100%) 100%;
  background-position: calc(var(--x0) / (730 - var(--w)) * 100%) 0;
  filter: url(#ink);
  animation: letter-drift var(--d) ease-in-out var(--o) infinite;
  will-change: translate, rotate;
}
.top-word:has(.word-letters) img { visibility: hidden; }
@keyframes letter-drift {
  0%   { translate: 0 0;           rotate: 0deg; }
  25%  { translate: 1.2px -3.6px;  rotate: 2.4deg; }
  50%  { translate: -0.9px -1.2px; rotate: -1.5deg; }
  75%  { translate: -1.3px 2.5px;  rotate: 1.7deg; }
  100% { translate: 0 0;           rotate: 0deg; }
}
#open-bag { justify-self: end; white-space: nowrap; }
#bag-count { display: inline-block; }
/* Add to Bag courier layer (top layer, above the product panel) */
.courier-canvas {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: transparent; overflow: visible; pointer-events: none;
}

/* Listing */
.shop { flex: 1; width: 100%; max-width: 1680px; margin: 0 auto; padding: 56px var(--gutter) 96px; }
.shop-head {
  display: flex;
  align-items: baseline;
  gap: 40px;
  margin-bottom: 40px;
}
.shop-head h1 { font-size: 40px; line-height: 1; font-weight: 400; letter-spacing: .18em; text-transform: uppercase; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.tabs button {
  min-height: 44px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 15px;
  color: var(--muted);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 56px clamp(20px, 2.4vw, 40px);
}
@media (max-width: 900px)  { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card.row-start { grid-column-start: 1; }

.card { display: block; width: 100%; text-align: left; }
.card-img {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
.card-img img,
.card-img video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .45s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
}
.card-img .alt { opacity: 0; }
@media (hover: hover) {
  .card:hover .card-img .alt { opacity: 1; }
  .card:hover .card-img img,
  .card:hover .card-img video { transform: scale(1.025); }
}
.card-line { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 14px; text-align: center; }
.card-name { font-size: 18px; }
.card.sold-out .card-img img { opacity: .55; }
.tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--tan);
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.skeleton { aspect-ratio: 4 / 5; }

.message { padding: 96px 0; text-align: center; }
.message .btn { width: auto; margin-top: 20px; padding: 0 28px; }

.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--rule);
}
.foot img { width: 36px; mix-blend-mode: multiply; }
/* The concert: the crowd and stage stand on the footer's divider line,
   which becomes the street. The canvas sits just above that line. */
.foot { --party-h: clamp(56px, 5.5vw, 84px); position: relative; margin-top: max(0px, calc(var(--party-h) - 60px)); }
.foot .party {
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: var(--party-h);
  color: var(--ink);
  pointer-events: none;
}
@media (max-width: 640px) {
  .foot { margin-top: calc(var(--party-h) - 34px); }
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  min-height: 54px;
  background: var(--ink);
  color: var(--tan);
  text-transform: uppercase;
  letter-spacing: .14em;
  transition: opacity .2s;
}
@media (hover: hover) { .btn:hover { opacity: .85; } }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Dialogs */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--tan); }
dialog::backdrop { background: #14110C66; }

/* Product window: a card floating in the middle of the screen over the
   blurred shop. The <dialog> itself is a transparent full-screen layer (the
   browser keeps it fixed to the screen, above everything, whatever the
   scroll position); .p-card is the visible window inside it. */
.product {
  --gap: clamp(14px, 6vw, 40px);                 /* sides: the card is about 88% of a phone screen */
  --gap-y: clamp(24px, 7vh, 64px);
  --gap-y: clamp(24px, 7dvh, 64px);              /* top and bottom: the shop shows above and below */
  position: fixed;
  inset: 0 auto auto 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100svh;
  height: 100dvh;        /* the visible area, with the browser bars shown or hidden */
  max-height: none;
  margin: 0;
  /* Room around the card, and clear of the notch and home bar. */
  padding:
    max(var(--gap-y), calc(env(safe-area-inset-top) + 8px))
    max(var(--gap), env(safe-area-inset-right))
    max(var(--gap-y), calc(env(safe-area-inset-bottom) + 8px))
    max(var(--gap), env(safe-area-inset-left));
  background: transparent;
  overflow: hidden;
  overscroll-behavior: contain;
}
.product[open] { display: grid; place-items: center; }
.product::backdrop {
  background: rgba(20, 17, 12, 0.22);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.p-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 460px);
  max-height: 100%;
  background: var(--tan);
  border: 1px solid var(--ink);
  box-shadow: 0 18px 50px rgba(20, 17, 12, 0.22);
  overflow: hidden;
}
/* Opening: a short fade and the slightest scale. Only the card animates, so
   the animation layers pinned to the screen never move. */
.product[open] .p-card { animation: card-in .22s cubic-bezier(.2, .7, .2, 1); }
.product[open]::backdrop { animation: fade-in .22s ease-out; }
@keyframes card-in { from { opacity: 0; transform: scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }

.p-head {
  flex: none;
  display: flex;
  justify-content: flex-end;
  padding: 4px 8px 0;
}
.close { padding: 0 12px; }
/* Only the middle scrolls when the window is taller than the screen; Close
   and Add to Bag stay put. */
.p-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.p-media { min-width: 0; padding: 0 16px; }
/* A square frame; the whole photo always shows (never cropped or stretched). */
.p-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-height: 42vh;
  max-height: 42dvh;
  margin: 0 auto;
}
.p-frame > img { width: 100%; height: 100%; object-fit: contain; }
.p-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--rule);
}
.p-foot .error { text-align: center; }
/* The printed ring on 002 / 005, turning a touch faster than the header circle. */
.print-spin {
  position: absolute;
  border-radius: 50%;
  background-repeat: no-repeat;
  pointer-events: none;
  /* Solid over the ring, fading into the fabric beyond it (no visible edge). */
  -webkit-mask-image: radial-gradient(circle closest-side, #000 72%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 72%, transparent 100%);
  animation: print-turn var(--spin, 29s) linear infinite;
  will-change: transform;
}
.print-spin[hidden] { display: none; }
/* The moving back print on 003 / 004 / 006 (drawn exactly over the photo). */
.back-dance { position: absolute; pointer-events: none; }
.back-dance[hidden] { display: none; }
@keyframes print-turn { to { transform: rotate(360deg); } }
.thumbs { display: flex; justify-content: safe center; gap: 8px; padding: 8px 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.thumbs:empty { display: none; }
.thumbs button { flex: 0 0 52px; height: 68px; opacity: .6; }
.thumbs button[aria-current="true"] { opacity: 1; }
@media (hover: hover) { .thumbs button:hover { opacity: 1; } }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.p-info { position: relative; min-width: 0; padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 20px; }
.chase-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; z-index: 3; pointer-events: none; }
.p-info h2 { font-size: clamp(24px, 6.4vw, 30px); line-height: 1.15; font-weight: 400; }
.price { font-size: 20px; }
.options { border: 0; padding: 0; }
.options[hidden] { display: none; }
.options legend { padding: 0; margin-bottom: 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .1em; }
.options legend .muted { text-transform: none; letter-spacing: 0; margin-left: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  min-width: 52px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ink);
}
@media (hover: hover) { .choice:hover:not(:disabled) { background: var(--tan-deep); } }
.choice[aria-pressed="true"] { background: var(--ink); color: var(--tan); }
.choice:disabled { opacity: .35; text-decoration: line-through; cursor: not-allowed; }
.choice.size {
  position: relative;
  /* Fluid: five sizes always fit on one row, never smaller than a 44px tap. */
  width: 63px;
  width: clamp(44px, calc((100% - 32px) / 5), 63px);
  height: auto;
  aspect-ratio: 1;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 17px;
}
.choice.size::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../assets/logo-mark-256.png") center / contain no-repeat;
  /* Every size ring turns all the time, each a little out of step. */
  /* Every size ring turns all the time, all in step (the buttons are made
     together and never rebuilt, so their spins start at the same moment). */
  animation: ring-spin 12s linear infinite;
}
@media (hover: hover) {
  .choice.size[aria-pressed="false"]:hover:not(:disabled) { background: none; }
}
.choice.size[aria-pressed="true"] {
  background: radial-gradient(circle closest-side, var(--ink) 62%, transparent 64%);
  color: var(--tan);
}
@keyframes ring-spin { to { transform: rotate(360deg); } }
.swatch { width: 44px; min-width: 44px; padding: 0; border: 1px solid var(--rule); box-shadow: inset 0 0 0 3px var(--tan); }
.swatch[aria-pressed="true"] { border: 2px solid var(--ink); }
.desc { color: var(--muted); white-space: pre-line; }

.bag {
  width: min(480px, 100vw);
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
}
.bag[open] { display: flex; flex-direction: column; animation: slide .28s ease-out; }
.bag-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
}
.bag-head h2 { font-size: 20px; font-weight: 400; text-transform: uppercase; letter-spacing: .08em; }
.bag-items { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 0 24px; }
.bag-empty { padding: 64px 0; text-align: center; color: var(--muted); }
.line { display: grid; grid-template-columns: 88px 1fr auto; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.line img { width: 88px; aspect-ratio: 4 / 5; object-fit: cover; }
.line-name { font-size: 18px; line-height: 1.25; }
.qty { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; border: 1px solid var(--rule); }
.qty button { width: 44px; height: 44px; font-size: 18px; }
@media (hover: hover) { .qty button:hover { background: var(--tan-deep); } }
.bag-items[aria-busy="true"] .qty, .bag-items[aria-busy="true"] .remove { opacity: .5; pointer-events: none; }
.qty span { min-width: 24px; text-align: center; }
.remove { min-height: 44px; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; color: var(--muted); }
.line-right { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; }
.bag-foot { padding: 20px 24px 24px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 10px; }
.total { display: flex; justify-content: space-between; font-size: 20px; }

@keyframes slide { from { transform: translateX(40px); opacity: .4; } }

@media (max-width: 760px) {
  .choice.size { width: clamp(44px, calc((100% - 32px) / 5), 56px); font-size: 15px; }
  .bag { max-width: 100vw; height: 100dvh; max-height: 100dvh; }
  .shop { padding: 32px var(--gutter) 64px; }
  .shop-head { flex-wrap: wrap; gap: 8px 24px; margin-bottom: 24px; }
  .shop-head h1 { font-size: clamp(28px, 8.5vw, 40px); }
  .grid { gap: 40px 16px; }
  .card-line { margin-top: 12px; }
  .card-name { font-size: clamp(16px, 4.4vw, 18px); }
  .top { height: 68px; }
  .top-mark { width: 44px; height: 44px; padding: 2px; }
  /* The wordmark scales with the screen so it never crowds the bag. */
  .top { column-gap: 8px; }
  .top-word { --wm-h: clamp(16px, 6.4vw, 26px); }
  .foot { padding: 24px var(--gutter); }
}

/* Wider screens (tablets, desktop, phones held sideways): photo on the left,
   details on the right, still a window over the shop. */
@media (min-width: 761px) {
  .p-card { width: min(100%, 920px); }
  .p-scroll { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .p-media { position: sticky; top: 0; padding: 0 0 0 20px; }
  .p-frame { max-height: none; }
  .p-info { padding: 8px 28px 24px; }
  /* Add to Bag sits under the details column. */
  .p-foot { padding-left: calc(50% + 28px); padding-right: 28px; border-top: 0; }
}
/* Short screens (phones sideways): a smaller photo so the details show too. */
@media (min-width: 761px) and (max-height: 520px) {
  .p-card { height: 100%; }
  .p-scroll { grid-template-columns: minmax(0, .8fr) 1fr; }
  .p-head { position: absolute; top: 0; right: 0; z-index: 2; }
  .p-info { padding-top: 40px; }
  .p-foot { padding: 8px 28px 10px calc(44% + 28px); }
}

/* Small phones (iPhone SE / mini width and below). */
@media (max-width: 420px) {
  .bag-head, .bag-foot { padding-left: 20px; padding-right: 20px; }
  .bag-items { padding: 0 20px; }
  .line { grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; }
  .line img { width: 72px; }
  .line-name { font-size: 17px; }
}
@media (max-width: 360px) {
  #open-bag { font-size: 14px; letter-spacing: .08em; }
}

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