:root {
  --cream: #faf6ee;
  --paper: #fffdf8;
  --ink: #252836;
  --ink-soft: #5f6272;
  --border: #eadfce;
  --red: #d95360;
  --red-dark: #b83d4a;
  --sage: #2f7d4e;
  --sage-bg: #e7f6ed;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* Hero */
.hero {
  background: linear-gradient(180deg, #79c1f6 0%, #b4defc 56%, #ebf6ff 92%, #b5e0b0 92%, #8cc688 100%);
  padding: 18px 20px 58px;
  position: relative;
  overflow: hidden;
}

.top-nav {
  max-width: 1080px;
  margin: 0 auto 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  background: rgba(255, 253, 248, 0.92);
  padding: 7px 15px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(37, 40, 54, 0.08);
}
.brand-icon { font-size: 1.15rem; }
.brand-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-links a {
  text-decoration: none;
  color: #1f334a;
  font-weight: 700;
  font-size: 0.92rem;
}
.nav-links a:hover { color: var(--red-dark); }
.nav-pill-btn {
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 253, 248, 0.85);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.nav-pill-btn:hover { background: #fff; }

.hero-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 36px;
  align-items: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #214466;
  background: rgba(255, 255, 255, 0.65);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero-copy h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2rem, 4.2vw, 2.95rem);
  line-height: 1.1;
  margin: 0 0 12px;
  color: #1b2433;
}

.subtitle {
  font-size: 1.05rem;
  line-height: 1.55;
  color: #2d3e52;
  font-weight: 600;
  margin: 0 0 22px;
  max-width: 540px;
}

/* Hero Action Card */
.hero-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 16px 18px 18px;
  box-shadow: 0 20px 44px rgba(31, 40, 56, 0.12);
}

.card-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #f3ede2;
  padding: 4px;
  border-radius: 14px;
  margin-bottom: 14px;
}

.card-tab {
  border: none;
  background: transparent;
  padding: 9px 10px;
  border-radius: 10px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.card-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(37, 40, 54, 0.08);
}

.start-fields {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 10px;
}

.input-group {
  display: grid;
  gap: 5px;
}
.input-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.input-label small { font-weight: 600; opacity: 0.85; }

.input-group input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1.5px solid #e1d5c2;
  background: #fff;
  font-family: 'Quicksand', sans-serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
}
.input-group input:focus {
  outline: none;
  border-color: var(--red);
}

.slug-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1.5px solid #e1d5c2;
  border-radius: 12px;
  padding-left: 11px;
}
.slug-wrap:focus-within { border-color: var(--red); }
.slug-prefix {
  font-family: 'Fredoka', sans-serif;
  color: var(--ink-soft);
  font-size: 0.96rem;
  user-select: none;
}
.slug-wrap input {
  border: none;
  padding-left: 3px;
  font-family: 'Fredoka', sans-serif;
}

.slug-feedback-row {
  min-height: 22px;
  margin: 8px 2px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.slug-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.slug-status.ok { color: var(--sage); }
.slug-status.bad { color: var(--red-dark); }
.inline-switch-link {
  color: var(--red-dark);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  padding: 0;
  font-weight: 700;
}

/* Right Column Live Preview */
.hero-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.preview-cloud {
  position: relative;
  width: 268px;
  min-height: 92px;
  display: grid;
  place-items: center;
  padding: 18px 28px 14px;
  text-align: center;
  filter: drop-shadow(0 8px 18px rgba(45, 75, 110, 0.12));
  animation: gentleFloat 5s ease-in-out infinite;
}
.cloud-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.preview-cloud-text {
  position: relative;
  z-index: 2;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  line-height: 1.3;
  color: #2c384b;
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.preview-mailbox-wrap {
  width: 260px;
  margin-top: -4px;
}
.preview-mailbox-svg {
  width: 100%;
  height: auto;
  display: block;
}
.preview-flag {
  transform-origin: 237.5px 102px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hero-preview.is-ready .preview-flag {
  transform: rotate(-10deg);
}

.preview-url-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 253, 248, 0.95);
  border: 1px solid var(--border);
  padding: 7px 16px;
  border-radius: 999px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 40, 54, 0.1);
}
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4caf73;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 14px;
  padding: 11px 18px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.96rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f4eee4; color: var(--ink); }
.btn-lg { padding: 13px 20px; font-size: 1rem; }
.btn-full { width: 100%; }

/* Three Spaces Section */
.section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 54px 20px 56px;
}
.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 30px;
}
.section-head h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 8px;
}
.section-head p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-weight: 600;
}

.spaces-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.space-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 20px;
  box-shadow: 0 10px 26px rgba(37, 40, 54, 0.04);
}
.space-card.featured {
  border-color: #e6bcc0;
  box-shadow: 0 14px 32px rgba(217, 83, 96, 0.08);
}
.space-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red-dark);
  background: #fdeef0;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.space-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-weight: 700;
}
.space-card h3 {
  font-family: 'Fredoka', sans-serif;
  margin: 0 0 8px;
  font-size: 1.18rem;
}
.space-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 0.93rem;
}

/* Promise Band */
.promise-band {
  background: #f3ece0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 32px 20px;
}
.promise-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.promise-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.promise-icon { font-size: 1.55rem; line-height: 1; }
.promise-item strong {
  font-family: 'Fredoka', sans-serif;
  display: block;
  margin-bottom: 4px;
}
.promise-item p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 22px 16px 30px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
}
.site-footer .dot { margin: 0 8px; }
.site-footer a { color: var(--ink-soft); text-decoration: none; font-weight: 700; }
.site-footer a:hover { color: var(--red-dark); }

/* Setup Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 30, 42, 0.48);
  backdrop-filter: blur(2px);
}
.modal-sheet {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: 0 24px 60px rgba(20, 22, 32, 0.24);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h3 {
  font-family: 'Fredoka', sans-serif;
  margin: 0;
  font-size: 1.35rem;
}
.modal-sub {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.icon-btn {
  border: none;
  background: #f2ece2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.95rem;
}

.setup-form { display: grid; gap: 14px; }
.pw-card {
  background: #faf5ec;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}
.pw-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
}
.pw-card-btns { display: flex; gap: 6px; }
.btn-mini {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-family: 'Quicksand', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 8px;
  cursor: pointer;
}
.btn-mini:hover { background: #f4eee4; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.error-msg {
  color: var(--red-dark);
  font-weight: 700;
  font-size: 0.88rem;
  margin: 0;
}

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: #252836;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 90;
}

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 26px; }
  .hero-preview { order: -1; }
  .preview-mailbox-wrap { width: 210px; }
  .spaces-grid, .promise-inner { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .start-fields { grid-template-columns: 1fr; }
  .nav-links a { display: none; }
}

/* Interactive Mailbox Color Swatches on Landing Preview */
.preview-swatches {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 253, 248, 0.88);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-top: 4px;
}
.pv-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(37, 40, 54, 0.18);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  padding: 0;
}
.pv-swatch:hover { transform: scale(1.15); }
.pv-swatch.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2.5px #252836;
}

/* Stationery / Airmail Accent on Three Spaces Cards */
.space-card {
  position: relative;
  overflow: hidden;
}
.space-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: repeating-linear-gradient(
    -45deg,
    #d95360 0 10px,
    #fffdf8 10px 18px,
    #5b8fc7 18px 28px,
    #fffdf8 28px 36px
  );
  opacity: 0.45;
}
.space-card.featured::before {
  opacity: 0.9;
}

/* Drifting Prompt Clouds Marquee in Hero Preview */
body { overflow-x: hidden; }

.visit-btn-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
}

.preview-sky-marquee {
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  padding: 6px 0 8px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
}
.preview-sky-track {
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  animation: driftClouds 28s linear infinite;
}
.preview-sky-track:hover {
  animation-play-state: paused;
}
.preview-sky-track .preview-cloud {
  flex: 0 0 auto;
  width: 236px;
  min-height: 82px;
  padding: 15px 24px 12px;
  animation: none;
}
.preview-sky-track .preview-cloud:nth-child(even) {
  transform: translateY(6px);
}
@keyframes driftClouds {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Setup Modal Child Rows with Tactile Swatches */
.signup-child-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #eadfce;
  border-radius: 12px;
  padding: 8px 10px;
}
.signup-child-row input {
  flex: 1 1 150px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1.5px solid #e1d5c2;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
}
.signup-swatches {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.signup-swatch-btn {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(37, 40, 54, 0.2);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.signup-swatch-btn:hover { transform: scale(1.15); }
.signup-swatch-btn.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2.5px #252836;
}

/* Mobile Polish (prevents iOS auto-zoom & keeps touch targets generous) */
@media (max-width: 640px) {
  .input-group input,
  .signup-child-row input,
  .slug-wrap input {
    font-size: 16px;
  }
  .visit-btn-row {
    grid-template-columns: 1fr;
  }
  .modal-sheet {
    padding: 18px 16px;
    border-radius: 20px;
  }
  .modal-foot {
    flex-direction: column-reverse;
  }
  .modal-foot .btn {
    width: 100%;
  }
  .preview-sky-marquee {
    max-width: 94vw;
  }
  .preview-sky-track .preview-cloud {
    width: 214px;
    min-height: 76px;
    padding: 13px 20px 10px;
  }
}
