/* Shared baseline for every design (served as /base.css, before /themes/<id>.css).
 *
 * Designs own the look and define the tokens: --bg --surface --raised --text
 * --muted --accent --accent-ink --divider --font-body. This file only holds
 * what must be true whichever design is live — accessibility helpers, the
 * honeypot, photo slots, and form text big enough that an iPhone doesn't zoom.
 *
 * Reset rules sit inside :where() so they have zero specificity: a design
 * never has to fight this file to get its own margins or display values.
 */

/* ── reset (deliberately small) ────────────────────────────────────────── */

:where(*, *::before, *::after) { box-sizing: border-box; }

:where(html) {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

:where(body) {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  line-height: 1.5;
  overflow-wrap: break-word;
}

:where(img, picture, video, canvas) {
  display: block;
  max-width: 100%;
  height: auto;
}

:where(svg) { max-width: 100%; }

:where(input, button, textarea, select) {
  font: inherit;
  color: inherit;
}

:where(button, [role="button"], label[for]) { cursor: pointer; }

/* iOS zooms the page into any field under 16px and doesn't zoom back. */
:where(input, select, textarea) { font-size: max(16px, 1em); }

/* <mark> is the "accent" option in the line editor; each design may restyle it. */
:where(mark) {
  background: transparent;
  color: var(--accent, currentColor);
}

/* Toggled from JS and by the edge (data-href with no value, data-show-if-query).
   Must beat any design's display rule, or a hidden link still shows. */
[hidden] { display: none !important; }

/* ── accessibility helpers ─────────────────────────────────────────────── */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 1000;
  padding: 12px 16px;
  border-radius: 6px;
  background: var(--accent, #1a1a1a);
  color: var(--accent-ink, #fff);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--accent, #1a73e8);
  outline-offset: 2px;
}

/* Sign-up honeypot (§6.1): off-screen rather than display:none, which some
   bots check for. Real people never see or reach it (tabindex=-1). */
.hp {
  position: absolute !important;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── photo slots (§4.10) ───────────────────────────────────────────────── */

/* Each design sizes the slot and draws its empty placeholder. Once a photo
   is uploaded the edge puts an <img> inside and adds .has-photo. */
.photo-slot {
  position: relative;
  overflow: hidden;
}

.photo-slot > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.photo-slot.has-photo { background: none; }

/* Only the owners see which photo goes where; the edge sets data-admin on
   <html> for a verified admin only, so a visitor never sees these labels. */
html[data-admin] .photo-slot:not(.has-photo)::after {
  content: attr(data-label);
  position: absolute;
  left: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px dashed var(--divider, rgba(127, 127, 127, 0.5));
  background: var(--surface, #fff);
  color: var(--muted, #555);
  font: 600 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* ── sign-up status (§6.1) ─────────────────────────────────────────────── */

[data-subscribe-status]:empty { display: none; }
[data-subscribe-status][data-state="error"] { color: var(--text, inherit); font-weight: 600; }

/* ── motion ────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
