:root {
  --bg: #FFFFFF;
  --ink: #111827;
  --muted: #4B5563;
  --light: #F3F4F6;
  --line: #E5E7EB;
  --accent: #0F766E;
  --accent-soft: #CCFBF1;
  --radius: 16px;
  --pill: 999px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.muted { color: var(--muted); }

/* Header */
.biz {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.biz-logo, .biz-mono {
  width: 56px; height: 56px;
  border-radius: 14px;
  flex: none;
  object-fit: contain;
  background: var(--light);
}
.biz-mono {
  display: grid; place-items: center;
  font-weight: 700; font-size: 22px;
  color: var(--accent); background: var(--accent-soft);
}
.biz-name { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0; }
h1.address { font-size: clamp(24px, 5vw, 34px); line-height: 1.15; font-weight: 700; margin: 2px 0 0; letter-spacing: -0.01em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 28px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--pill);
  background: var(--light); color: var(--muted);
  font-size: 13px; font-weight: 500;
}
.chip strong { color: var(--ink); font-weight: 600; }

/* Sections */
section { margin-bottom: 36px; }
h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; margin: 0 0 14px;
}
.stage-pill {
  display: inline-block; padding: 4px 12px; border-radius: var(--pill);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--light); color: var(--ink);
}
.stage-pill.before { background: var(--ink); color: #fff; }
.stage-pill.after { background: var(--accent); color: #fff; }
.count { font-size: 14px; color: var(--muted); font-weight: 500; }

/* Before / after pairs */
.pairs { display: grid; gap: 18px; }
.pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  border-radius: var(--radius); overflow: hidden; background: var(--light);
}
.pair .tile { border-radius: 0; }
@media (min-width: 720px) {
  .pairs { grid-template-columns: repeat(2, 1fr); }
  .pairs:has(> .pair:only-child) { grid-template-columns: minmax(0, 640px); }
}

/* Photo grid */
.grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
}

.tile {
  position: relative; display: block; width: 100%;
  padding: 0; border: 0; cursor: zoom-in;
  aspect-ratio: 3 / 4; overflow: hidden;
  border-radius: 12px; background: var(--light);
  font: inherit; color: inherit;
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity .2s ease; opacity: 0;
}
.tile img.loaded { opacity: 1; }
.tile.broken::after {
  content: 'Still uploading'; position: absolute; inset: 0;
  display: grid; place-items: center; font-size: 13px; color: var(--muted);
}
.tile .tag {
  position: absolute; left: 8px; top: 8px;
  padding: 3px 10px; border-radius: var(--pill);
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(17, 24, 39, .82); color: #fff;
}
.tile .tag.after { background: rgba(15, 118, 110, .92); }
.tile .time {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 18px 10px 8px; text-align: left;
  font-size: 12px; font-weight: 500; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.6));
}
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Footer */
footer {
  margin-top: auto; padding-top: 24px;
  display: flex; justify-content: center;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--pill);
  background: var(--light); color: var(--ink);
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.brand:hover { background: var(--accent-soft); }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* States */
.state {
  margin: auto; text-align: center; max-width: 380px; padding: 48px 8px;
}
.state h1 { font-size: 26px; margin: 18px 0 8px; }
.state p { margin: 0 0 20px; line-height: 1.5; }
.state-icon {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px;
  background: var(--light); color: var(--muted);
}
.button {
  display: inline-block; padding: 12px 22px; border-radius: var(--pill);
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
  border: 0; font: inherit; cursor: pointer;
}
.spinner {
  width: 36px; height: 36px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--light); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .tile img { transition: none; } }

/* Viewer */
.viewer {
  width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
  margin: 0; padding: 0; border: 0; background: rgba(17, 24, 39, .96); color: #fff;
}
.viewer[open] { display: flex; align-items: center; justify-content: center; }
.viewer::backdrop { background: rgba(17, 24, 39, .96); }
.viewer figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 100%; }
.viewer img { max-width: 100vw; max-height: calc(100vh - 80px); object-fit: contain; display: block; }
.viewer figcaption { font-size: 14px; color: #D1D5DB; padding: 0 16px; text-align: center; }
.viewer button {
  position: absolute; border: 0; cursor: pointer; color: #fff;
  background: rgba(255,255,255,.12); border-radius: var(--pill);
  width: 44px; height: 44px; font-size: 26px; line-height: 1; font-family: inherit;
}
.viewer button:hover { background: rgba(255,255,255,.22); }
.viewer-close { top: 14px; right: 14px; }
.viewer-nav.prev { left: 12px; top: 50%; transform: translateY(-50%); }
.viewer-nav.next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 520px) { .viewer-nav { top: auto !important; bottom: 14px; transform: none !important; } }
