@font-face {
  font-family: "Fredoka";
  src: url("assets/Fredoka.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #20223b;
  --cream: #fffaf2;
  --paper: #ffffff;
  --yellow: #ffd45c;
  --coral: #ff6b5f;
  --coral-text: #b8362f;
  --mint: #9fe0c3;
  --lilac: #c8b7ff;
  --soft: #5f6175;
  --line: rgba(32, 34, 59, 0.2);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 1rem/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }

button, input, select, textarea, a { touch-action: manipulation; }

a { color: #7f241f; }

:focus-visible {
  outline: 4px solid #1f63c4;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif;
  font-size: 1.15rem;
  text-decoration: none;
}

.brand strong { color: var(--coral-text); }

.prototype-badge {
  padding: 7px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--yellow);
  font-weight: 800;
  font-size: 0.82rem;
}

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 80px; }

.hero { padding: 68px 0 46px; max-width: 820px; }

.eyebrow, .step {
  margin: 0 0 8px;
  color: var(--coral-text);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1, h2, h3 { font-family: "Fredoka", ui-rounded, system-ui, sans-serif; letter-spacing: -0.03em; }

h1 { margin: 0; font-size: clamp(2.7rem, 8vw, 5.8rem); line-height: 0.95; }

.hero-copy { max-width: 680px; margin: 24px 0; color: var(--soft); font-size: clamp(1.08rem, 2vw, 1.3rem); }

.prototype-notice {
  max-width: 720px;
  padding: 16px 18px;
  border: 2px dashed var(--ink);
  border-radius: 16px;
  background: var(--paper);
}

.prototype-notice strong { display: block; }

.workspace { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr); gap: 28px; align-items: start; }

.builder-card, .preview-panel {
  min-width: 0;
  border: 3px solid var(--ink);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--ink);
}

.builder-card { padding: clamp(22px, 4vw, 38px); }

.preview-panel { position: sticky; top: 18px; padding: 22px; background: #f2efe9; }

.section-heading h2, .preview-heading h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.05; }

.section-heading > p:last-child, .preview-heading > p:last-child { color: var(--soft); }

.section-divider { margin-top: 38px; padding-top: 34px; border-top: 2px dashed var(--line); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

.occasion-grid, .style-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.occasion-grid label, .style-choice {
  position: relative;
  min-height: 58px;
  display: flex;
  align-items: stretch;
  cursor: pointer;
}

.occasion-grid input, .style-choice input { position: absolute; opacity: 0; }

.occasion-grid span, .style-choice > span {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--cream);
  font-weight: 800;
}

.occasion-grid input:checked + span, .style-choice input:checked + span { background: var(--yellow); box-shadow: 4px 4px 0 var(--ink); }

.occasion-grid input:focus-visible + span, .style-choice input:focus-visible + span { outline: 4px solid #1f63c4; outline-offset: 3px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.field { display: flex; flex-direction: column; gap: 7px; }

.field-wide { grid-column: 1 / -1; }

.field label { font-weight: 850; }

.field label span, .field-help { color: var(--soft); font-weight: 500; }

.field-classification {
  width: fit-content;
  margin: 0;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: #f0e8ff;
  color: var(--ink);
  font-size: 0.84rem;
}

.field-classification strong { display: inline; }

.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.field input[aria-invalid="true"] { border-color: #8a211c; box-shadow: 0 0 0 2px #fff0ee; }

.field textarea { min-height: 112px; resize: vertical; }

.field-help { margin: 0; font-size: 0.84rem; }

.field-error { margin: 0; color: #8a211c; font-size: 0.9rem; font-weight: 750; }

.registry-builder { display: grid; gap: 14px; }

.registry-entry { display: flex; gap: 10px; align-items: stretch; }

.registry-entry input { min-width: 0; }

.secondary-button, .remove-registry {
  min-height: 48px;
  padding: 10px 15px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 850;
  cursor: pointer;
}

.secondary-button { flex: 0 0 auto; }

.registry-list, .registry-link-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.registry-list { display: grid; gap: 9px; }

.registry-list li {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--cream);
}

.registry-list li > span { min-width: 0; display: flex; flex-direction: column; }

.registry-list li > span > span, .registry-link-copy > span {
  overflow-wrap: anywhere;
  color: var(--soft);
  font-size: 0.82rem;
}

.remove-registry { background: var(--paper); }

.style-choice > span { min-height: 96px; flex-direction: column; align-items: flex-start; justify-content: center; }

.style-choice small { display: block; color: var(--soft); font-weight: 600; }

.style-choice.sunbeam > span { background: linear-gradient(135deg, #fffaf2 58%, #ffd45c 58%); }
.style-choice.garden > span { background: linear-gradient(135deg, #fffaf2 58%, #9fe0c3 58%); }
.style-choice.midnight > span { background: linear-gradient(135deg, #20223b 58%, #c8b7ff 58%); color: #fffaf2; }
.style-choice.midnight small { color: #fffaf2; }
.style-choice.paper > span { background: linear-gradient(135deg, #fff 58%, #ff8b82 58%); }
.style-choice.pastel-space { grid-column: 1 / -1; }
.style-choice.pastel-space > span {
  background:
    radial-gradient(circle at 83% 24%, #ffd45c 0 7px, transparent 8px),
    radial-gradient(circle at 88% 72%, #c8b7ff 0 12px, transparent 13px),
    linear-gradient(135deg, #fff8f3 55%, #f4c8d3 55%);
}

.error-summary { margin-top: 22px; padding: 16px; border: 3px solid #8a211c; border-radius: 12px; background: #fff0ee; }
.error-summary ul { margin: 8px 0 0; }

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 24px;
  padding: 12px 18px;
  border: 3px solid var(--ink);
  border-radius: 13px;
  background: var(--coral);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
}

.primary-button:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.primary-button:disabled:hover {
  box-shadow: 4px 4px 0 var(--ink);
  transform: none;
}

.runtime-status {
  margin: 24px 0 0;
  padding: 14px 16px;
  border: 2px solid #8a211c;
  border-radius: 12px;
  background: #fff0ee;
  color: #641713;
  font-weight: 750;
}

.external-warning {
  margin-top: 24px;
  padding: 15px 16px;
  border: 2px dashed var(--ink);
  border-radius: 14px;
  background: #fff7d8;
  font-size: 0.92rem;
}

.external-warning strong { display: block; }

.hosted-create {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  padding: 20px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #f0e8ff;
}

.hosted-create h3, .hosted-create p { margin: 0; }

.turnstile-widget { width: 100%; min-width: 0; min-height: 68px; }

.hosted-button { margin-top: 0; }

.creation-status {
  padding: 11px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  font-size: 0.9rem;
}

.creation-status[data-error="true"] {
  border-color: #8a211c;
  background: #fff0ee;
  color: #641713;
  font-weight: 750;
}

.preview-heading { padding: 4px 4px 18px; }

.handoff-preview {
  padding: 18px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
}

.handoff-preview h3 { margin: 0 0 12px; font-size: 1.15rem; }

.handoff-grid { display: grid; gap: 9px; }

.handoff-grid article {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-left: 8px solid var(--mint);
  border-radius: 8px;
  background: var(--cream);
}

.handoff-grid article:nth-child(2) { border-left-color: var(--lilac); }
.handoff-grid article.manage-handoff { border-left-color: var(--coral); }

.handoff-grid code { overflow-wrap: anywhere; color: #303249; font-size: 0.78rem; }
.handoff-grid span { color: var(--soft); font-size: 0.78rem; }

.copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 6px;
}

.copy-row input {
  min-width: 0;
  min-height: 48px;
  padding: 10px 11px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 0.8rem/1.35 system-ui, sans-serif;
}

.copy-row .secondary-button { white-space: nowrap; }

.manage-warning {
  margin: 14px 0 0;
  padding: 13px;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: #fff7d8;
  font-size: 0.88rem;
}

.event-preview {
  --theme-bg: #fffaf2;
  --theme-accent: #ffd45c;
  position: relative;
  overflow: hidden;
  margin-top: 18px;
  padding: 22px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: var(--theme-bg);
  color: var(--ink);
}

.preview-label { display: flex; justify-content: space-between; gap: 12px; font-size: 0.72rem; font-weight: 850; letter-spacing: 0.03em; text-transform: uppercase; }

.preview-decoration { width: 88px; height: 12px; margin: 20px 0; border-radius: 999px; background: var(--theme-accent); box-shadow: 96px 0 0 var(--mint), 192px 0 0 var(--lilac); }

.preview-kicker { margin: 0; color: var(--coral-text); font-weight: 850; }

.event-preview h3 { margin: 4px 0 18px; font-size: clamp(1.8rem, 5vw, 3rem); line-height: 1; }

.event-preview dl { margin: 0; display: grid; gap: 10px; }
.event-preview dl div { padding: 10px 0; border-top: 1px dashed var(--line); }
.event-preview dt { font-size: 0.74rem; color: var(--soft); font-weight: 850; text-transform: uppercase; }
.event-preview dd { margin: 3px 0 0; font-weight: 750; }

.guest-note { padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.72); }
.link-limit { margin-bottom: 0; color: var(--soft); font-size: 0.84rem; }

.preview-registries { margin-top: 18px; }
.preview-registries h4 { margin: 0 0 9px; font-family: "Fredoka", ui-rounded, system-ui, sans-serif; font-size: 1rem; }

.registry-link-list { display: grid; gap: 9px; }

.registry-link-list a {
  min-height: 176px;
  display: grid;
  grid-template-columns: minmax(132px, 176px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 2px solid currentColor;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.registry-qr {
  width: 100%;
  height: auto;
  display: block;
  border: 8px solid #fff;
  background: #fff;
  image-rendering: pixelated;
}

.registry-link-copy { min-width: 0; display: flex; flex-direction: column; }

.empty-registries { margin: 0; color: var(--soft); font-size: 0.88rem; }

.keepsake-card {
  margin-top: 18px;
  padding: 18px;
  border: 2px dashed var(--ink);
  border-radius: 16px;
  background: var(--paper);
}

.keepsake-card h3, .keepsake-card p { margin-top: 0; }
.keepsake-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.keepsake-actions .secondary-button { width: 100%; }

.theme-garden { --theme-bg: #eaf8f1; --theme-accent: #9fe0c3; }
.theme-midnight { --theme-bg: #20223b; --theme-accent: #ffd45c; color: #fffaf2; --line: rgba(255, 250, 242, 0.25); --soft: #dad7e5; }
.theme-midnight .preview-kicker { color: #ffd45c; }
.theme-midnight .guest-note { background: rgba(255, 255, 255, 0.1); }
.theme-midnight .registry-link-list a { background: rgba(255, 255, 255, 0.1); color: #fffaf2; }
.theme-midnight .registry-link-list a span { color: #dad7e5; }
.theme-paper { --theme-bg: #ffffff; --theme-accent: #ff8b82; box-shadow: inset 9px 0 0 #c8b7ff; }
.theme-pastel-space {
  --theme-bg: #fff8f3;
  --theme-accent: #f2bdcb;
  background-color: var(--theme-bg);
  background-image:
    linear-gradient(rgba(255, 248, 243, 0.78), rgba(255, 248, 243, 0.7)),
    url("assets/pastel-space-invitation.webp");
  background-position: center top;
  background-size: cover;
}

.theme-pastel-space .preview-decoration {
  position: relative;
  width: 112px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 24% 35%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 48% 72%, #ffd45c 0 3px, transparent 4px),
    radial-gradient(circle at 74% 26%, #c8b7ff 0 8px, transparent 9px),
    linear-gradient(153deg, transparent 42%, rgba(184, 54, 47, 0.32) 43% 45%, transparent 46%);
  box-shadow: none;
}

.theme-pastel-space .preview-decoration::before {
  position: absolute;
  top: 13px;
  left: 4px;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  background: #ffd45c;
  box-shadow: 10px -4px 0 var(--theme-bg);
  content: "";
}

.theme-pastel-space .preview-decoration::after {
  position: absolute;
  right: 11px;
  bottom: 7px;
  width: 16px;
  height: 31px;
  border: 2px solid var(--ink);
  border-radius: 55% 55% 35% 35%;
  background: linear-gradient(#fff 0 42%, #ff6b5f 43% 72%, #ffd45c 73%);
  content: "";
  transform: rotate(38deg);
}

.retention-card { margin-top: 18px; padding: 18px; border: 2px dashed var(--ink); border-radius: 16px; background: var(--paper); }
.retention-card h3 { margin: 0; font-size: 1.1rem; }
.retention-card p { margin-bottom: 0; color: var(--soft); }

footer { padding: 24px 16px 42px; text-align: center; color: var(--soft); }

@media (max-width: 940px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}

@media (max-width: 620px) {
  .site-header, main { width: min(100% - 20px, 1180px); }
  .site-header { align-items: flex-start; flex-wrap: wrap; padding-top: 14px; }
  .brand span { max-width: 150px; }
  .prototype-badge { max-width: 100%; white-space: normal; text-align: center; }
  .hero { padding-top: 44px; }
  .builder-card, .preview-panel { border-radius: 18px; box-shadow: 5px 5px 0 var(--ink); }
  .occasion-grid, .style-grid, .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .style-choice.pastel-space { grid-column: auto; }
  .preview-label { flex-direction: column; gap: 3px; }
  .registry-entry { flex-direction: column; }
  .secondary-button { width: 100%; }
  .keepsake-actions { grid-template-columns: 1fr; }
  .copy-row { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .site-header, main { width: calc(100% - 8px); }
  .builder-card, .preview-panel { box-shadow: 2px 2px 0 var(--ink); }
  .builder-card { padding-inline: 16px; }
  .hosted-create { margin-inline: -16px; padding-inline: 0; }
  .hosted-create > :not(.turnstile-widget) { margin-inline: 16px; }
  .hosted-create .hosted-button { width: auto; }
  .registry-link-list a { grid-template-columns: 1fr; }
  .registry-qr { width: min(176px, 100%); justify-self: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
  .primary-button:hover { transform: none; }
}
