@view-transition { navigation: auto; }

:root {
  --fg: #111; --mute: #8b8b8b; --line: #ececec; --soft: #f3f3f3;
  --red: #e0352b; --green: #2a8a3a;
  --pad: 16px; --row: 150px; --maxh: min(62svh, 1000px);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: #fff; }
body {
  color: var(--fg); background: #fff;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 4px; }
.ph { color: var(--mute); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- home ---------- */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 24px var(--pad) 0; }
.name { font-size: 36px; font-weight: 800; line-height: .92; letter-spacing: -.025em; text-transform: uppercase; }
.top > a { font-size: 15px; font-weight: 600; padding: 4px 0 8px 12px; }
.tag { padding: 12px var(--pad) 0; font-size: 14px; color: var(--mute); }
.chips { display: flex; gap: 8px; padding: 18px var(--pad) 0; }
.chips button { height: 34px; padding: 0 15px; border-radius: 999px; background: #f1f1f1; font-size: 14px; font-weight: 500; transition: background-color .2s, color .2s; }
.chips button[aria-pressed="true"] { background: var(--fg); color: #fff; }

/* Justified rows with no script: each piece grows in proportion to its shape, so a row shares one height.
   The grow factor is scaled up, since a line whose factors add up to less than 1 doesn't fill. */
.mosaic { display: flex; flex-wrap: wrap; gap: 3px; list-style: none; margin-top: 16px; }
.mosaic li { flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row)); position: relative; }
.mosaic li.end { flex: 100000 1 0; }
.mosaic a { display: block; height: 100%; }
.mosaic img { width: 100%; height: 100%; aspect-ratio: var(--r); object-fit: cover; background: var(--soft); transition: opacity .15s; }
.mosaic a:active img { opacity: .82; }
.badge {
  position: absolute; left: 8px; top: 8px; display: flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px 0 8px; border-radius: 999px; background: rgba(255,255,255,.94);
  font-size: 12px; font-weight: 600; pointer-events: none;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); flex: none; }

/* ---------- piece ---------- */
.bar { display: flex; justify-content: space-between; align-items: center; height: 50px; padding: 0 var(--pad); font-size: 15px; }
.back { display: flex; align-items: center; gap: 2px; margin-left: -6px; padding: 12px 6px; font-weight: 600; }
.back svg { width: 18px; height: 18px; }
.bar .count { color: var(--mute); font-variant-numeric: tabular-nums; }
.stage { position: relative; background: var(--soft); padding: 26px 26px 20px; touch-action: pan-y; user-select: none; -webkit-user-select: none; overflow: hidden; }
.frame {
  display: block; position: relative; margin: 0 auto; width: min(100%, calc(var(--maxh) * var(--r))); aspect-ratio: var(--r);
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.12); background: #ddd; cursor: zoom-in;
  will-change: transform;
}
.frame img { width: 100%; height: 100%; object-fit: cover; -webkit-touch-callout: none; }
.dots { display: flex; justify-content: center; gap: 6px; padding-top: 16px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #cfcfcf; transition: background-color .2s; }
.dots i.on { background: var(--fg); }
.step {
  position: absolute; top: 50%; width: 40px; height: 40px; margin-top: -30px; border-radius: 50%;
  background: rgba(255,255,255,.92); box-shadow: 0 1px 6px rgba(0,0,0,.14); display: none; place-items: center;
  opacity: 0; transition: opacity .2s;
}
.step svg { width: 18px; height: 18px; }
.step.prev { left: 14px; }
.step.next { right: 14px; }
@media (hover: hover) and (pointer: fine) {
  .step { display: grid; }
  .stage:hover .step, .step:focus-visible { opacity: 1; }
}
.info { padding: 20px var(--pad) 0; }
.info h1 { font-size: 24px; font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.specs { display: grid; grid-template-columns: 90px 1fr; gap: 10px 0; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; }
.specs dt { color: var(--mute); }
.ask { display: inline-block; margin-top: 18px; padding: 6px 0; font-size: 15px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.price { display: block; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.state { font-size: 13px; font-weight: 600; color: var(--green); }
.state.sold { color: var(--red); }
.state.ph { color: var(--mute); }
.buy {
  display: inline-flex; align-items: center; justify-content: center; height: 48px; min-width: 104px; padding: 0 28px;
  border-radius: 12px; background: var(--fg); color: #fff; font-size: 16px; font-weight: 600; transition: transform .12s;
}
.buy:active { transform: scale(.97); }
.buybar {
  position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.88); -webkit-backdrop-filter: saturate(1.8) blur(16px); backdrop-filter: saturate(1.8) blur(16px);
  border-top: 1px solid var(--line); view-transition-name: buybar;
}
.piece main { padding-bottom: 8px; }
.piece .foot { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }

/* ---------- contact ---------- */
.foot { margin-top: 44px; padding: 28px var(--pad) calc(36px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.foot h2 { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.ways { list-style: none; margin-top: 10px; }
.ways a, .ways span { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 600; }
.ways small { font-size: 14px; font-weight: 400; color: var(--mute); }
.copy { margin-top: 26px; font-size: 13px; color: var(--mute); }

/* ---------- sheets ---------- */
dialog { border: 0; padding: 0; color: inherit; background: none; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0,0,0,.36); }
.sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; background: #fff; border-radius: 16px 16px 0 0;
  padding: 10px var(--pad) calc(18px + env(safe-area-inset-bottom));
}
.sheet[open] { animation: rise .32s cubic-bezier(.2,.8,.2,1); }
.sheet[open]::backdrop { animation: fade .32s ease; }
.sheet .grab { width: 36px; height: 5px; border-radius: 3px; background: #d6d6d6; margin: 0 auto 14px; }
.sheet h2 { font-size: 17px; font-weight: 700; }
.sheet p { margin-top: 4px; font-size: 14px; color: var(--mute); }
.sheet .ways { margin-top: 8px; }
.sheet .close { width: 100%; height: 48px; margin-top: 14px; border-radius: 12px; background: #f1f1f1; font-weight: 600; }
.zoom { position: fixed; inset: 0; width: 100%; height: 100%; background: #000; cursor: zoom-out; }
.zoom::backdrop { background: #000; }
.zoom[open] { display: grid; place-items: center; animation: fade .2s ease; }
/* Sized by the piece's shape, so the sharper image swapping in later doesn't move. */
.zoom img { width: min(100vw, calc(100dvh * var(--r))); height: auto; aspect-ratio: var(--r); max-width: none; }
.zoom button { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; }
.zoom button svg { width: 18px; height: 18px; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.missing { padding: 40px var(--pad); }
.missing h1 { font-size: 36px; font-weight: 800; letter-spacing: -.025em; text-transform: uppercase; line-height: .95; }
.missing p { margin-top: 12px; color: var(--mute); }
.missing a { display: inline-block; margin-top: 22px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- wider screens ---------- */
@media (min-width: 700px) {
  :root { --pad: 28px; --row: 230px; }
  .name { font-size: 48px; }
  .top { padding-top: 36px; }
}
@media (min-width: 1100px) {
  :root { --pad: 40px; --row: 300px; --maxh: min(80svh, 1100px); }
  .piece .layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
  .piece .stage { min-height: calc(100svh - 50px); display: grid; align-content: center; padding: 40px; }
  .piece .side { position: sticky; top: 0; padding: 32px var(--pad) 0 36px; }
  .piece .info { padding: 0; }
  .piece .buybar { position: static; padding: 22px 0 0; margin-top: 22px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .piece .foot { padding-bottom: 40px; }
  .sheet { inset: 0; margin: auto; width: 420px; height: fit-content; border-radius: 16px; padding: 22px 24px; }
  .sheet .grab { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
