@font-face {
  font-family: Figtree;
  font-weight: 400 500;
  font-display: swap;
  src: url("./assets/fonts/figtree-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122;
}

@font-face {
  font-family: Figtree;
  font-weight: 400 500;
  font-display: swap;
  src: url("./assets/fonts/figtree-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: Inter;
  font-weight: 400 500;
  font-display: swap;
  src: url("./assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122;
}

@font-face {
  font-family: Inter;
  font-weight: 400 500;
  font-display: swap;
  src: url("./assets/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  font-synthesis: none;
  --canvas: #f2f2ed;
  --surface: #dbdbcf;
  --surface-pressed: #d4d5c4;
  --well: #e3e5d8;
  --ink: #1d1d1b;
  --muted: #5a5b48;
  --action: #45502b;
  --action-pressed: #38421f;
  --on-action: #f2f2ed;
  --on-action-pressed: #f2f2ed;
  --focus: #1d1d1b;
  --danger: #7e3327;
  --line: rgba(104, 110, 78, 0.18);
  --field-edge: #76785e;
  --scrim: rgba(29, 29, 27, 0.42);
  --ground: linear-gradient(160deg, rgba(176, 184, 182, 0.06), rgba(255, 255, 255, 0.14)),
    linear-gradient(to bottom, #f6f7f4 0%, #edefec 14%, #f0f1ec 30%, #f3f2eb 45%, #f3f2ea 62%, #eef0e4 78%, #ebeee1 90%, #f2f4ea 100%);
  --display-font: Figtree, system-ui, sans-serif;
  --body-font: Inter, system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #1a1b13;
    --surface: #484936;
    --surface-pressed: #6c6e53;
    --well: #2b2c20;
    --ink: #f2f2ed;
    --muted: #dbdbcf;
    --action: #c6c7b2;
    --action-pressed: #6c6e53;
    --on-action: #1a1b13;
    --focus: #fee951;
    --danger: #d89c90;
    --line: rgba(239, 238, 230, 0.14);
    --field-edge: #a9ab9d;
    --scrim: rgba(0, 0, 0, 0.66);
    --ground: linear-gradient(160deg, rgba(0, 0, 0, 0.30), rgba(255, 255, 255, 0.05)),
      linear-gradient(to bottom, #1b1f13 0%, #181c11 38%, #15190e 72%, #11150a 100%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--canvas);
  background-image: var(--ground);
  background-attachment: fixed;
  color: var(--ink);
  font: 400 0.9375rem/1.5 var(--body-font);
}

h1, h2, p { margin: 0; }
strong { font-weight: 500; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.shell {
  width: min(72rem, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.top {
  display: grid;
  grid-template:
    "title art" auto
    "intro art" auto
    "payment art" auto / minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 16px 32px;
  align-items: start;
  padding-block: 64px 40px;
}

h1, h2 {
  font-family: var(--display-font);
  font-weight: 500;
}

h1 {
  grid-area: title;
  max-width: 13ch;
  font-size: clamp(2.5rem, 5.6vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.intro {
  grid-area: intro;
  max-width: 44ch;
  color: var(--muted);
  font-size: 1rem;
}

.payment {
  grid-area: payment;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  width: fit-content;
  max-width: 36rem;
  padding: 12px;
  border-radius: 16px;
  background: var(--well);
}

.payment p {
  flex: 1 1 10rem;
  max-width: 34ch;
}

.venmo-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #0068c9;
  color: #fff;
  text-decoration: none;
}

.venmo-button:hover { background: #0059ae; }
.venmo-button img { display: block; width: 52px; height: auto; }

.meta a {
  color: var(--action);
  font-weight: 500;
  text-underline-offset: 0.2em;
}

.hero-art {
  grid-area: art;
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(100%, 23rem);
  height: 16rem;
}

.hero-art picture { position: absolute; display: block; }
.hero-art picture img { display: block; width: 100%; height: auto; }
.hero-portrait {
  position: absolute;
  inset: 0 auto 0 50%;
  width: min(72%, 13.5rem);
  height: 100%;
  transform: translateX(-50%);
  border: 8px solid var(--surface);
  border-radius: var(--radius);
  object-fit: cover;
  object-position: 50% 39%;
  background: var(--well);
}

.hero-sun { width: 3.5rem; top: 16px; left: 0; transform: rotate(-9deg); }
.hero-star { width: 2.75rem; top: 48px; right: 0; transform: rotate(12deg); }

.wrap { padding-block-end: max(64px, env(safe-area-inset-bottom)); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-block-end: 24px;
  padding-block-start: 24px;
  border-block-start: 1px solid var(--line);
}

.chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border-radius: 24px;
  background: var(--well);
}

.chip, .btn {
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  font: 500 0.875rem/1.35 var(--body-font);
  cursor: pointer;
}

.chip { color: var(--muted); background: transparent; }
.chip:hover, .btn.ghost:hover { color: var(--ink); background: var(--surface-pressed); }
.chip[aria-pressed="true"], .btn { color: var(--on-action); background: var(--action); }
.btn { min-height: 48px; }
.btn:not(.ghost):hover { color: var(--on-action-pressed); background: var(--action-pressed); }
.btn.ghost { color: var(--ink); background: var(--well); }
.btn.small { min-height: 44px; padding-inline: 12px; }
.btn:disabled { opacity: 0.62; cursor: default; }

.count, .status {
  color: var(--muted);
  font-size: 0.875rem;
}

.count { font-variant-numeric: tabular-nums; }
.status:not(:empty) { margin-block-start: 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
  gap: 16px;
}

.card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
}

.ph {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 16px;
  background: var(--well);
}

.product-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card.taken .product-photo { opacity: 0.65; }
.photo-placeholder img { display: block; width: 56px; height: auto; }

.ribbon {
  position: absolute;
  inset: 8px auto auto 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
}

.body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: -0.018em;
}

.meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.note { color: var(--muted); }
.act { display: flex; flex-direction: column; gap: 8px; margin-block-start: auto; padding-block-start: 8px; }
.who { font-weight: 500; }
.btn.ghost.claim-link-button {
  align-self: center;
  background: transparent;
  color: var(--action);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.claim-link-button:hover { text-decoration-thickness: 2px; }
#claimLinkStatus:empty { display: none; }
.admin-row { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-row [data-del] { color: var(--danger); }
.admin-row [data-del]:hover { background: var(--well); text-decoration: underline; }

.empty {
  grid-column: 1 / -1;
  padding: 32px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.adminbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-block-end: 16px;
  padding: 16px 24px;
  border-radius: var(--radius);
  background: var(--surface);
}

dialog {
  width: min(28rem, calc(100% - 2 * var(--gutter)));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

dialog::backdrop { background: var(--scrim); }
dialog form { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
dialog h2 { font-size: 1.625rem; }
label { display: flex; min-width: 0; flex-direction: column; gap: 8px; font-weight: 500; }

input, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--field-edge);
  border-radius: 12px;
  background: var(--well);
  color: var(--ink);
  font: 400 1rem/1.4 var(--body-font);
}

input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input::file-selector-button {
  margin-inline-end: 8px;
  padding: 4px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row > * { flex: 1 1 7rem; }

.toast {
  position: fixed;
  inset: auto auto max(16px, env(safe-area-inset-bottom)) 50%;
  max-width: calc(100% - 2 * var(--gutter));
  width: max-content;
  padding: 12px 16px;
  transform: translateX(-50%);
  border-radius: 16px;
  background: var(--ink);
  color: var(--canvas);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
}

.toast.on { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .venmo-button { transition: background-color 150ms ease, transform 150ms ease; }
  .btn:active, .chip:active, .venmo-button:active { transform: scale(0.97); }
  .toast { transition: opacity 150ms ease; }
  .card.flash { animation: claim-feedback 320ms cubic-bezier(0.22, 1, 0.36, 1); }
  @keyframes claim-feedback { 40% { background-color: var(--surface-pressed); } }
}

@media (max-width: 42rem) {
  .top {
    grid-template:
      "title art" auto
      "intro intro" auto
      "payment payment" auto / minmax(0, 1fr) minmax(5.25rem, 28%);
    gap: 12px 8px;
    align-items: center;
    padding-block: 32px 24px;
  }

  h1 { font-size: clamp(2.125rem, 8.6vw, 3rem); }
  .hero-art { width: 100%; height: clamp(5.25rem, 28vw, 7rem); }
  .hero-portrait { inset: 0; width: 100%; transform: none; border-width: 4px; border-radius: 16px; }
  .hero-star { width: 1.375rem; top: -4px; right: -4px; }
  .hero-art .hero-sun { display: none; }
  .bar { gap: 8px; margin-block-end: 16px; padding-block-start: 16px; }
  .chip { padding-inline: 12px; }
}
