:root {
  --bg: #0f1020;
  --bg-soft: #181a2f;
  --card: #1f2138;
  --ink: #f4f3ff;
  --ink-soft: #b9b8d6;
  --accent: #ff5d8f;
  --accent-2: #6c5ce7;
  --accent-3: #00d2c6;
  --ring: rgba(108, 92, 231, 0.5);
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(108, 92, 231, 0.35), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 93, 143, 0.28), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header / footer ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem clamp(1rem, 5vw, 4rem);
}
.brand {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand-mark { color: var(--accent-3); }
.brand-accent { color: var(--accent); }
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  margin-left: 1.4rem;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.site-nav a:hover { color: var(--ink); }

.site-main {
  flex: 1;
  width: min(1040px, 92vw);
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem) 0 4rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.2rem clamp(1rem, 5vw, 4rem);
  color: var(--ink-soft);
  font-size: 0.82rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.site-footer .modes b { color: var(--accent-3); text-transform: uppercase; font-size: 0.72rem; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin-bottom: 2.2rem; }
.hero-title {
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 0.9rem;
  text-wrap: balance;
}
.hero-sub {
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.15rem);
  max-width: 38ch;
  margin: 0 auto;
}

/* ---------- Generator form ---------- */
.generator {
  position: relative;  /* anchors the diagonal quota ribbon in the corner */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* Daily-allowance ribbon: a diagonal band across the top-right corner of the form. The
   wrapper is a fixed corner box with overflow:hidden, so the rotated band is clipped to a
   clean across-the-corner stripe. */
.quota-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  width: 168px;
  height: 168px;
  overflow: hidden;
  border-top-right-radius: var(--radius);
  pointer-events: none;
  z-index: 3;
}
.quota-ribbon-band {
  position: absolute;
  left: -30px;
  top: 44px;
  width: 280px;
  transform: rotate(45deg);
  text-align: center;
  padding: 0.42rem 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}
.quota-ribbon.is-low .quota-ribbon-band {
  background: linear-gradient(135deg, var(--accent), #ff8a5d);
}
.quota-ribbon.is-exhausted .quota-ribbon-band {
  /* Out of generations — a striking deep red so it reads as a hard stop. */
  background: linear-gradient(135deg, #ff2d4f, #8a0011);
}
.inputs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field-label { font-size: 0.8rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.field input {
  background: var(--bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--ink);
  font-size: 1.05rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input::placeholder { color: #6f6e92; }
/* The second field sits under the corner ribbon — keep its text clear of the band so a
   long value can't slide beneath it. (On mobile the fields stack and the FIRST field is
   the one under the ribbon; handled in the breakpoint below.) */
.field--second input { padding-right: 2.9rem; }
.field input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px var(--ring);
}
.field-join {
  font-family: "Fraunces", serif;
  font-size: 1.6rem;
  color: var(--accent);
  padding-bottom: 0.7rem;
}
.actions { display: flex; gap: 0.8rem; margin-top: 1.3rem; flex-wrap: wrap; }
.btn-ghost .die { vertical-align: -3px; margin-right: 0.2rem; color: var(--accent-3); }

.examples {
  margin: 1.3rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.examples-lead { margin-right: 0.1rem; }
.example-chip {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  max-width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.example-chip:hover { background: rgba(108, 92, 231, 0.25); border-color: var(--accent-2); }
.example-chip:active { transform: translateY(1px); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s, opacity 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 10px 24px rgba(255, 93, 143, 0.32);
}
.btn-primary:hover { box-shadow: 0 14px 30px rgba(255, 93, 143, 0.45); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-pick { width: 100%; background: #14c4b8; color: #04201e; font-weight: 700; border: 1px solid rgba(0, 210, 198, 0.85); }
.btn-pick:hover { background: var(--accent-3); color: #04201e; box-shadow: 0 8px 20px rgba(0, 210, 198, 0.3); }

/* ---------- Spinner ---------- */
.spinner { display: none; align-items: center; gap: 0.5rem; margin-top: 1.2rem; color: var(--ink-soft); }
.spinner.htmx-request { display: flex; }
.spinner p { margin: 0; }
.spinner .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite ease-in-out;
}
.spinner .dot:nth-child(2) { animation-delay: 0.15s; background: var(--accent-2); }
.spinner .dot:nth-child(3) { animation-delay: 0.3s; background: var(--accent-3); }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.5); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- Results ---------- */
.results:empty { display: none; }
.results { margin-top: 2.4rem; animation: fade-in 0.4s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.brief-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
}
.brief-title { font-family: "Fraunces", serif; font-size: 1.6rem; margin: 0 0 0.3rem; }
.brief-summary { color: var(--ink-soft); margin: 0 0 1rem; }
.brief-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.palette { display: flex; gap: 0.4rem; }
.swatch { width: 26px; height: 26px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.2); }
.brief-mood { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }

.grid-heading { font-family: "Fraunces", serif; font-size: 1.3rem; margin: 2.6rem 0 1.1rem; }
.design-grid {
  display: grid;
  /* auto-FIT (not fill) so 3 cards stretch to fill the row instead of leaving a
     phantom empty 4th column; larger min makes each tee bigger. */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
}
.design-card {
  margin: 0;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.2s;
}
.design-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.design-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.design-card form { padding: 0.8rem; }

/* Price block — mirrors the enlarged view's bar (label / $value / note). */
.card-price {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 0.6rem;
  padding: 0.8rem 0.8rem 0;
}
.card-price-label {
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft);
}
.card-price-value {
  grid-row: 1 / span 2; align-self: center;
  font-family: "Fraunces", serif; font-weight: 800; font-size: 1.5rem; color: var(--ink);
}
.card-price-note { font-size: 0.74rem; color: var(--ink-soft); }

/* Card actions: Add to cart (wide primary) + Share (compact secondary) share one
   row. Size + quantity are chosen in the cart drawer, not on the card. */
.card-actions { display: flex; flex-direction: row; align-items: stretch; gap: 0.6rem; padding: 0.8rem; }
.card-actions .card-action { padding: 0; margin: 0; display: flex; }
.card-actions .card-action .btn { width: 100%; }
.card-action-pick { flex: 1 1 auto; min-width: 0; }   /* Add to cart takes the width */
.card-action-share { flex: 0 0 auto; }                /* Share stays compact */
.btn-share {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
  padding: 0.85rem 1.1rem;
}
.btn-share:hover { background: rgba(255, 255, 255, 0.12); }

/* Daily usage counter + limit card */
.grid-headrow { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }

.limit-card {
  text-align: center; padding: 2.2rem 1.4rem;
  border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

/* ---------- Day history (flick back through today's batches, in the gallery widget) ---------- */
/* Eyebrow on the on-load gallery so revisited designs don't read as a fresh generation. */
.gallery-eyebrow {
  margin: 0 0 0.8rem;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
}
.history-pager {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin: 2rem auto 1.4rem; flex-wrap: wrap;  /* clear space above so it doesn't crowd the cards */
}
.history-nav[disabled] { opacity: 0.35; pointer-events: none; }
/* While a batch is still generating, the pending design slots and the pager share the
   #results container. A pager click swaps #results out and aborts the in-flight /design
   requests, so the not-yet-finished designs are lost. Disable the pager for that window;
   :has() drops the guard automatically once the last slot resolves (no .design-slot left). */
#results:has(.design-slot) .history-nav { opacity: 0.35; pointer-events: none; cursor: progress; }
.history-counter {
  font-family: "Fraunces", serif; font-weight: 600; font-size: 1.05rem;
  color: var(--ink); white-space: nowrap;
}
.history-empty {
  text-align: center; padding: 3rem 1.4rem;
  border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}
.history-empty-msg { margin: 0 0 1.1rem; color: var(--ink-soft); font-size: 1.05rem; }
.limit-title { margin: 0 0 0.5rem; }
.limit-msg { margin: 0; color: var(--ink-soft); }

/* Garment-preview overlay (raw design -> mockup) */
.design-media { position: relative; }
/* While the tee mockup is loading we show a spinner in the card (no raw-design flash). */
.design-media-loading {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
}
.mockup-pending,
.mockup-tag {
  position: absolute;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  backdrop-filter: blur(4px);
}
.mockup-tag { top: 0.55rem; left: 0.55rem; }
.mockup-pending { bottom: 0.55rem; left: 50%; transform: translateX(-50%); opacity: 0.9; }

/* Streaming placeholder slot while a design generates */
.design-slot {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.slot-spinner { display: flex; gap: 0.4rem; }
.slot-spinner .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s infinite ease-in-out;
}
.slot-spinner .dot:nth-child(2) { animation-delay: 0.15s; background: var(--accent-2); }
.slot-spinner .dot:nth-child(3) { animation-delay: 0.3s; background: var(--accent-3); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 6, 18, 0.72);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; z-index: 50;
  animation: fade-in 0.2s ease;
}
.modal {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2rem;
  max-width: 460px; width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}
.modal-close {
  position: absolute; top: 0.8rem; right: 1rem;
  background: none; border: none; color: var(--ink-soft);
  font-size: 1.6rem; cursor: pointer; line-height: 1;
}
.modal-badge {
  display: inline-block;
  background: rgba(255, 93, 143, 0.15);
  color: var(--accent);
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.3rem 0.7rem; border-radius: 999px; margin-bottom: 0.9rem;
}
.modal-title { font-family: "Fraunces", serif; font-size: 1.5rem; margin: 0 0 0.8rem; }
.modal-body { color: var(--ink-soft); line-height: 1.5; margin: 0 0 1.4rem; }
.modal-design img { width: 160px; height: 160px; object-fit: cover; border-radius: 14px; margin: 0 auto 1.2rem; display: block; }
.modal-flow { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.4rem; }
.chip { font-size: 0.78rem; padding: 0.35rem 0.7rem; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--ink-soft); }
.chip.done { background: rgba(0, 210, 198, 0.18); color: var(--accent-3); }

/* ---------- Click-to-enlarge lightbox ---------- */
/* Cue that the tee preview is clickable. */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible {
  outline: 2px solid var(--accent-3);
  outline-offset: -2px;
}

.lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 6, 18, 0.88);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(0.75rem, 3vw, 2.5rem);
  z-index: 100;
  cursor: zoom-out;
  animation: fade-in 0.2s ease;
  /* Keep scroll/zoom gestures inside the overlay — never let them reach (and move) the
     page behind it. Paired with a body scroll-lock in base.html while the overlay is open. */
  overflow: auto;
  overscroll-behavior: contain;
}
/* Pinch-zoom targets the image itself, not the whole page. */
.lightbox-img { touch-action: pinch-zoom; }
.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: min(96vw, 1000px);
  max-height: 92vh;
  cursor: default;
}
.lightbox-img {
  /* Show the full-resolution file, whole and uncropped, as large as the
     viewport allows — crisp on the 1000px mockup / 768px design. The bar below
     claims room, so cap the image a little under the figure height. */
  max-width: 100%;
  max-height: calc(92vh - 4.5rem);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 14px 14px 0 0;
  box-shadow: var(--shadow);
  align-self: center;
  /* Scroll-to-zoom (base.html) applies a translate/scale transform from the centre. */
  transform-origin: center center;
  will-change: transform;
  cursor: zoom-in;
}
/* Price + Add to cart bar pinned under the enlarged image. */
.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: rgba(31, 33, 56, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: var(--shadow);
}
.lightbox-price { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.lightbox-price-label {
  font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-soft);
}
.lightbox-price-value {
  font-family: "Fraunces", serif; font-weight: 800; font-size: 1.5rem; color: var(--ink);
}
.lightbox-price-note {
  font-size: 0.74rem; color: var(--ink-soft); margin-top: 0.15rem;
}
.lightbox-cart {
  font: inherit; font-weight: 700;
  background: #14c4b8; color: #04201e;
  border: 1px solid rgba(0, 210, 198, 0.85);
  border-radius: 12px;
  padding: 0.7rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.2s, transform 0.12s ease;
}
.lightbox-cart:hover { background: var(--accent-3); box-shadow: 0 8px 20px rgba(0, 210, 198, 0.3); }
.lightbox-cart:active { transform: translateY(1px); }
/* Actions group (Size + Share + Add to cart) on the right of the bar. */
.lightbox-actions { display: flex; gap: 0.6rem; align-items: center; }
.lightbox-size { display: flex; flex-direction: column; gap: 0.15rem; text-align: left; }
.lightbox-size-label {
  font-size: 0.62rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft);
}
.lightbox-size select {
  font: inherit; font-size: 0.9rem;
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px;
  padding: 0.55rem 0.6rem; cursor: pointer;
}
.lightbox-size select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }
.lightbox-share {
  font: inherit; font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 0.7rem 1.2rem;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s, transform 0.12s ease;
}
.lightbox-share:hover { background: rgba(255, 255, 255, 0.16); }
.lightbox-share:active { transform: translateY(1px); }
.lightbox-close {
  position: fixed; top: 1rem; right: 1.2rem;
  width: 2.4rem; height: 2.4rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--ink);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

/* ---------- Share: modal copy row + reminder ---------- */
.copy-row { display: flex; gap: 0.5rem; margin: 0 0 1.2rem; }
.copy-input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 0.92rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}
.copy-input:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.copy-btn { white-space: nowrap; }
.copy-btn.copied { background: #14c4b8; color: #04201e; box-shadow: none; }

.reminder-form { text-align: left; margin: 0 0 1.2rem; }
.reminder-label { display: block; font-size: 0.82rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.reminder-row { display: flex; gap: 0.5rem; }
.reminder-row input {
  flex: 1; min-width: 0;
  font: inherit;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}
.reminder-row input:focus { outline: 2px solid var(--ring); outline-offset: 1px; }
.reminder-error { color: var(--accent); font-size: 0.82rem; margin: 0.4rem 0 0; }
.reminder-done {
  text-align: left; font-size: 0.92rem; color: var(--ink-soft); line-height: 1.5;
  background: rgba(0, 210, 198, 0.12);
  border: 1px solid rgba(0, 210, 198, 0.3);
  border-radius: 12px;
  padding: 0.8rem 1rem; margin: 0 0 1.2rem;
}
.reminder-check { color: var(--accent-3); font-weight: 700; margin-right: 0.3rem; }
.modal-dismiss { width: 100%; }

/* ---------- Shared-design landing page (/d/{token}) ---------- */
.shared-hero { text-align: center; margin: 1.5rem 0 2rem; }
.shared-eyebrow {
  display: inline-block; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent-3); margin-bottom: 0.6rem;
}
.shared-title {
  font-family: "Fraunces", serif; font-weight: 800; font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin: 0 0 0.6rem; letter-spacing: -0.02em;
}
.shared-sub { color: var(--ink-soft); max-width: 46ch; margin: 0 auto; line-height: 1.5; }
.shared-grid { max-width: 360px; margin: 0 auto; }
.shared-expiry { text-align: center; color: var(--ink-soft); font-size: 0.9rem; margin: 1.4rem 0 1rem; }
.shared-cta { text-align: center; margin: 1.8rem 0 2rem; }
.shared-missing { margin-top: 3rem; }
.shared-missing .shared-sub { margin-bottom: 0.5rem; }

/* ---------- Cart badge (nav) ---------- */
.nav-cart { display: inline-flex; align-items: center; gap: 0.35rem; }
.cart-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.35rem; box-sizing: border-box;
  background: var(--accent); color: #fff;
  font-size: 0.72rem; font-weight: 700; border-radius: 999px; line-height: 1;
}
.cart-badge-empty { display: none; }

/* ---------- Cart drawer ---------- */
.cart-drawer {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1.6rem;
  max-width: 480px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.cart-title { font-family: "Fraunces", serif; font-size: 1.4rem; margin: 0 0 1rem; }
.cart-empty { color: var(--ink-soft); margin: 0 0 1rem; }
.cart-error { color: var(--accent); font-size: 0.85rem; margin: 0 0 0.8rem; }
.cart-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.cart-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 0.8rem; align-items: start; }
.cart-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; background: var(--bg-soft); }
.cart-line-info { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.cart-line-name { font-weight: 600; font-size: 0.92rem; }
.cart-line-price { font-size: 0.76rem; color: var(--ink-soft); }
.cart-line-total { font-weight: 700; white-space: nowrap; }
.cart-line-controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; flex-wrap: wrap; }
.cart-line-controls form { display: inline-flex; margin: 0; padding: 0; }
.cart-qty-group { display: inline-flex; align-items: center; gap: 0.4rem; }
.cart-size {
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px;
  padding: 0.3rem 0.45rem; font: inherit; font-size: 0.82rem; cursor: pointer;
}
.cart-size:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }
.qty-btn {
  width: 1.7rem; height: 1.7rem; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 8px;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.qty-btn:hover { border-color: var(--accent-2); }
.qty-num { min-width: 1.4rem; text-align: center; font-weight: 600; }
.cart-remove { background: none; border: none; color: var(--ink-soft); font-size: 0.76rem; cursor: pointer; text-decoration: underline; padding: 0 0 0 0.3rem; }
.cart-remove:hover { color: var(--accent); }
.cart-totals { margin: 1.2rem 0 0.4rem; border-top: 1px solid rgba(255, 255, 255, 0.1); padding-top: 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; }
.cart-row { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 0.92rem; }
.cart-row-total { color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.cart-checkout { width: 100%; margin-top: 1rem; }
.cart-note { text-align: center; font-size: 0.74rem; color: var(--ink-soft); margin: 0.7rem 0 0; }

/* ---------- Checkout result pages ---------- */
.checkout-result { display: flex; justify-content: center; padding: 3rem 1rem; }
.checkout-card {
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px; padding: 2.4rem; max-width: 520px; width: 100%;
  text-align: center; box-shadow: var(--shadow);
}
.checkout-badge {
  display: inline-block; background: rgba(0, 210, 198, 0.18); color: var(--accent-3);
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 0.3rem 0.7rem; border-radius: 999px; margin-bottom: 1rem;
}
.checkout-badge-muted { background: rgba(255, 255, 255, 0.08); color: var(--ink-soft); }
.checkout-title { font-family: "Fraunces", serif; font-size: 1.7rem; margin: 0 0 0.9rem; }
.checkout-body { color: var(--ink-soft); line-height: 1.55; margin: 0 0 1.2rem; }
.checkout-fulfilment { font-size: 0.85rem; color: var(--accent-3); margin: 0 0 1.4rem; }
.checkout-actions { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }

/* ---------- Prep-for-print popup ---------- */
.prep-modal { max-width: 540px; }
.prep-figure { margin: 0 0 0.85rem; }
.prep-img {
  width: 100%; max-height: 52vh; object-fit: contain;
  border-radius: 12px; background: #0e0e16; cursor: zoom-in;
}
.prep-spec { font-size: 0.82rem; color: var(--ink-soft); margin: 0 0 1.2rem; }
.prep-spec b { color: var(--ink); }
.prep-form { display: flex; align-items: flex-end; gap: 0.6rem; justify-content: center; }
.prep-size { display: flex; flex-direction: column; gap: 0.2rem; text-align: left; flex: 0 0 auto; }
.prep-size-label { font-size: 0.68rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.prep-size select {
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px;
  padding: 0.6rem 0.6rem; font: inherit; cursor: pointer;
}
.prep-size select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--ring); }
.prep-form .prep-add { flex: 1 1 auto; width: auto; }

/* Loading overlay while the upscale runs (htmx toggles .htmx-request). */
.prep-loading {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6, 6, 18, 0.72); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.prep-loading.htmx-request { display: flex; }
.prep-loading-card {
  background: var(--card); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px; padding: 1.8rem 2.2rem; text-align: center; box-shadow: var(--shadow);
}
.prep-loading-card p { color: var(--ink-soft); margin: 0.7rem 0 0; }

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .inputs { grid-template-columns: 1fr; }
  .field-join { display: none; }
  .actions .btn { flex: 1; }
  /* Stacked layout: the FIRST field is now the one under the corner ribbon. Shift the
     text-clearance there and let the second field use full width again. Shrink the ribbon
     so it doesn't dominate the narrower card. */
  .field--second input { padding-right: 1rem; }
  .inputs .field:first-child input { padding-right: 2.9rem; }
  .quota-ribbon { width: 150px; height: 150px; }
  .quota-ribbon-band { top: 36px; left: -40px; width: 250px; font-size: 0.7rem; }
  /* Let the price + actions stack rather than collide on narrow screens. */
  .lightbox-bar { flex-wrap: wrap; }
  .lightbox-actions { flex: 1 0 100%; }
  .lightbox-actions .lightbox-cart,
  .lightbox-actions .lightbox-share { flex: 1; text-align: center; }
  .lightbox-size select { width: 100%; }
  /* Keep Older/Newer on ONE row: drop the counter to its own line above, then let the
     two nav buttons share the row below (instead of wrapping to two rows). */
  .history-pager { gap: 0.6rem; }
  .history-counter { flex: 1 0 100%; order: -1; text-align: center; white-space: normal; font-size: 0.95rem; }
  .history-nav { flex: 1 1 0; padding: 0.7rem 0.6rem; white-space: nowrap; }
}
