/* ===== Postcard Designer chrome ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: #0b141d;           /* slightly deeper than --asa-navy for editor stage */
  color: var(--asa-off-white);
  font-family: var(--ff-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#root { height: 100%; }

/* ===== Layout grid ===== */
.app {
  display: grid;
  grid-template-columns: 340px 1fr;
  grid-template-rows: 56px 1fr;
  height: 100vh;
}
.topbar  { grid-column: 1 / 3; grid-row: 1; }
.sidebar { grid-column: 1; grid-row: 2; }
.stage   { grid-column: 2; grid-row: 2; }

/* ===== Top bar ===== */
.topbar {
  display: flex; align-items: center;
  background: var(--asa-navy);
  border-bottom: 1px solid rgba(243,237,228,0.10);
  padding: 0 18px 0 22px;
  gap: 24px;
}
.topbar__brand {
  display: flex; align-items: baseline; gap: 14px;
  flex: 0 0 auto;
}
.topbar__brand .mark {
  font-family: var(--ff-display); font-style: italic; font-weight: 500;
  font-size: 22px; color: var(--asa-cream);
  line-height: 1;
}
.topbar__brand .name {
  font-family: var(--ff-sans); font-size: 11px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  color: var(--asa-off-white);
}
.topbar__brand .name span { opacity: .55; margin: 0 8px; }

.topbar__center { flex: 1; display: flex; justify-content: center; }
.topbar__right  { display: flex; align-items: center; gap: 10px; }

/* segmented control */
.seg {
  display: inline-flex;
  border: 1px solid rgba(243,237,228,0.18);
  border-radius: 2px;
  overflow: hidden;
}
.seg button {
  appearance: none;
  background: transparent; color: var(--asa-off-white);
  border: 0; border-right: 1px solid rgba(243,237,228,0.12);
  padding: 8px 16px;
  font-family: var(--ff-sans);
  font-size: 11px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: rgba(243,237,228,0.05); }
.seg button[aria-pressed="true"] {
  background: var(--asa-cream); color: var(--asa-navy);
}

.iconbtn {
  appearance: none; background: transparent; border: 1px solid rgba(243,237,228,0.18);
  color: var(--asa-off-white);
  font-family: var(--ff-sans); font-size: 11px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 160ms ease, border-color 160ms ease;
}
.iconbtn:hover { background: rgba(243,237,228,0.06); border-color: rgba(243,237,228,0.36); }
.iconbtn--primary {
  background: var(--asa-cream); color: var(--asa-navy);
  border-color: var(--asa-cream);
}
.iconbtn--primary:hover { background: #f7e0c5; border-color: #f7e0c5; }

/* ===== Sidebar / inspector ===== */
.sidebar {
  background: #08111a;
  border-right: 1px solid rgba(243,237,228,0.08);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(243,237,228,0.10); border-radius: 8px; }

.section {
  border-bottom: 1px solid rgba(243,237,228,0.08);
  padding: 18px 22px 22px;
}
.section__head {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--ff-sans);
  font-size: 10px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  color: rgba(243,237,228,0.55);
  margin: 0 0 14px;
}
.section__head .num {
  display: inline-block; min-width: 18px;
  font-family: var(--ff-display); font-style: italic;
  font-size: 14px; color: var(--asa-cream); letter-spacing: 0;
  text-transform: none;
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: 9px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  color: rgba(243,237,228,0.50);
  margin: 0 0 5px;
}
.input,
.textarea,
.select {
  width: 100%;
  appearance: none;
  background: rgba(243,237,228,0.04);
  color: var(--asa-off-white);
  border: 1px solid rgba(243,237,228,0.10);
  border-radius: 2px;
  padding: 8px 10px;
  font-family: var(--ff-sans);
  font-size: 12px;
  line-height: 1.4;
  transition: border-color 160ms ease, background 160ms ease;
}
.textarea { resize: vertical; min-height: 64px; font-family: var(--ff-text); font-size: 12.5px; }
.input:focus, .textarea:focus, .select:focus {
  outline: 0;
  border-color: var(--asa-cream);
  background: rgba(243,237,228,0.07);
}
.input::placeholder, .textarea::placeholder { color: rgba(243,237,228,0.32); }

/* helper text under fields */
.hint {
  font-family: var(--ff-text);
  font-style: italic;
  font-size: 10px;
  line-height: 1.45;
  color: rgba(243,237,228,0.45);
  margin: 5px 0 0;
  letter-spacing: 0;
  text-transform: none;
}
.hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-style: normal;
  font-size: 9.5px;
  background: rgba(243,237,228,0.08);
  color: var(--asa-cream);
  padding: 1px 4px;
  border-radius: 2px;
  margin: 0 1px;
}

/* segmented (full-width, in sidebar) */
.seg--block {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  width: 100%;
}
.seg--block button { padding: 9px 4px; font-size: 10px; letter-spacing: var(--tr-3); }

/* checkbox grid */
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.check {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0; text-transform: none;
  color: rgba(243,237,228,0.78);
  cursor: pointer; user-select: none;
}
.check input { accent-color: var(--asa-cream); }
.check span { line-height: 1.2; }

.toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: rgba(243,237,228,0.04);
  border: 1px solid rgba(243,237,228,0.10);
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
}
.toggle__label {
  font-size: 10px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  color: var(--asa-off-white);
}
.switch {
  position: relative;
  width: 28px; height: 16px;
  background: rgba(243,237,228,0.18);
  border-radius: 999px; transition: background 200ms ease;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 999px;
  background: var(--asa-off-white);
  transition: transform 200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.toggle[data-on="true"] .switch { background: var(--asa-cream); }
.toggle[data-on="true"] .switch::after { transform: translateX(12px); }

/* design variation cards */
.varcards { display: grid; gap: 10px; }
.varcard {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  padding: 8px;
  background: rgba(243,237,228,0.03);
  border: 1px solid rgba(243,237,228,0.08);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}
.varcard:hover { border-color: rgba(243,237,228,0.22); }
.varcard[data-on="true"] {
  border-color: var(--asa-cream);
  background: rgba(237,210,182,0.06);
}
.varcard__thumb {
  height: 36px; width: 64px;
  background: var(--asa-stone-300);
  position: relative;
  overflow: hidden;
}
.varcard__name {
  font-size: 10px; font-weight: 500;
  letter-spacing: var(--tr-4); text-transform: uppercase;
  color: var(--asa-off-white);
  align-self: center;
}
.varcard__sub {
  font-size: 10px; color: rgba(243,237,228,0.45);
  margin-top: 2px;
  letter-spacing: 0; text-transform: none;
  font-family: var(--ff-text); font-style: italic;
}

/* ===== Stage ===== */
.stage {
  position: relative;
  background: #0b141d;
  background-image:
    linear-gradient(rgba(243,237,228,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243,237,228,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.stage__inner {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  padding: 30px;
}

.stage__hud {
  position: absolute; left: 24px; bottom: 18px;
  display: flex; gap: 22px; align-items: center;
  font-size: 10px; letter-spacing: var(--tr-4); text-transform: uppercase;
  color: rgba(243,237,228,0.45);
  pointer-events: none;
}
.stage__hud b { color: rgba(243,237,228,0.75); font-weight: 500; }

.stage__zoom {
  position: absolute; right: 24px; bottom: 18px;
  display: flex; gap: 4px; align-items: center;
  font-size: 10px; letter-spacing: var(--tr-4); text-transform: uppercase;
  color: rgba(243,237,228,0.45);
}
.stage__zoom button {
  appearance: none; background: transparent; border: 1px solid rgba(243,237,228,0.16);
  color: var(--asa-off-white); width: 24px; height: 22px;
  font-size: 14px; cursor: pointer;
}
.stage__zoom button:hover { background: rgba(243,237,228,0.06); }
.stage__zoom .pct { min-width: 44px; text-align: center; color: rgba(243,237,228,0.75); }

/* ===== Print-only pages (hidden on screen, shown for window.print()) ===== */
.print-pages { display: none; }

@media print {
  @page { size: 11.25in 6.25in; margin: 0; }

  /* Force backgrounds + colors to render even when the user has
     "Background graphics" unchecked in the print dialog.
     Applies to every print-side element so the navy spine bar,
     pattern strips, and accent colors all reproduce faithfully. */
  html, body, .print-pages, .print-pages *,
  .print-page, .print-page *,
  .print-card, .print-card * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* hide the editor chrome */
  html, body { background: #fff !important; }
  .topbar, .sidebar, .stage__hud, .stage__zoom, .toast,
  .stage__inner, .modal { display: none !important; }
  .app { display: block !important; height: auto !important; }
  .stage { display: block !important; background: #fff !important; height: auto !important; padding: 0 !important; overflow: visible !important; }

  .print-pages {
    display: block !important;
    background: #fff;
  }
  .print-page {
    width: 11.25in;
    height: 6.25in;
    page-break-after: always;
    break-after: page;
    overflow: hidden;
    position: relative;
    background: #fff;
  }
  .print-page:last-child { page-break-after: auto; break-after: auto; }
  .print-card {
    /* .pc is laid out at 810×450 CSS px (72dpi grid).
       11.25in × 6.25in = 1080 × 600 CSS px @ 96dpi.
       Scale 810→1080 = 1.3333 to fill the page exactly. */
    position: absolute; left: 0; top: 0;
    width: 810px; height: 450px;
    transform: scale(1.33333333);
    transform-origin: top left;
  }
  .print-card .pc { box-shadow: none !important; }
}

/* ===== Postcard frame ===== */
.pc-frame {
  position: relative;
  transform-origin: center center;
  transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.pc-shadow { box-shadow: 0 22px 60px -20px rgba(0,0,0,0.55), 0 6px 18px rgba(0,0,0,0.30); }

.pc {
  position: relative;
  background: var(--asa-off-white);
  color: var(--asa-navy);
  overflow: hidden;
  /* dimensions set inline via style */
}

/* image-slot inside postcard — prevent letterboxing background */
.pc image-slot {
  --slot-bg: var(--asa-stone-300);
  background: var(--asa-stone-300);
}

/* Print marks overlay — sits on top of postcard, same dims */
.printmarks {
  position: absolute; inset: 0;
  pointer-events: none;
  font-family: var(--ff-sans);
  font-size: 9px; letter-spacing: var(--tr-4); text-transform: uppercase;
  color: rgba(255,77,77,0.95);
}
.printmarks .bleed-edge,
.printmarks .trim-edge,
.printmarks .safe-edge {
  position: absolute;
  border: 1px dashed currentColor;
}
.printmarks .bleed-edge { inset: 0; color: rgba(180,90,90,0.85); }
.printmarks .trim-edge  { color: rgba(255,77,77,0.95); }
.printmarks .safe-edge  { color: rgba(56,180,120,0.95); border-style: dotted; }
.printmarks .legend {
  position: absolute;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 8px;
  background: rgba(11,20,29,0.9);
  padding: 3px 6px;
  white-space: nowrap;
}
.printmarks .legend--bleed { top: 4px; left: 4px; color: rgba(180,90,90,1); }
.printmarks .legend--trim  { top: 4px; left: 90px; color: rgba(255,77,77,1); }
.printmarks .legend--safe  { top: 4px; left: 168px; color: rgba(56,180,120,1); }
.printmarks .corner {
  position: absolute; width: 18px; height: 18px;
  border: 1px solid currentColor; border-radius: 0;
}

/* Side flip wrapper — keep both sides mounted to preserve image-slot state */
.flipper {
  position: relative;
  perspective: 2400px;
}
.flipper__inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.flipper[data-side="back"] .flipper__inner {
  transform: rotateY(180deg);
}
.flipper__face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flipper__face--back { transform: rotateY(180deg); }

/* ===== Modal ===== */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(11,20,29,0.86);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal {
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100vh - 80px);
  background: var(--asa-off-white);
  color: var(--asa-navy);
  display: grid; grid-template-rows: auto 1fr auto;
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
}
.modal__head {
  padding: 22px 28px 16px;
  border-bottom: 1px solid rgba(21,33,47,0.12);
}
.modal__eyebrow {
  font-size: 10px; letter-spacing: var(--tr-4); text-transform: uppercase;
  color: var(--asa-stone-500); margin: 0 0 6px;
}
.modal__title {
  font-family: var(--ff-display); font-style: italic;
  font-size: 30px; line-height: 1.05; margin: 0;
  color: var(--asa-navy);
}
.modal__body { padding: 22px 28px; overflow-y: auto; }
.spec-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px;
  font-size: 12px; line-height: 1.5;
}
.spec-grid dt {
  font-size: 9px; letter-spacing: var(--tr-4); text-transform: uppercase;
  color: var(--asa-stone-500); margin: 0 0 1px;
}
.spec-grid dd { margin: 0 0 8px; font-family: var(--ff-text); font-size: 13px; color: var(--asa-stone-700); }
.spec-grid dd b { font-family: var(--ff-sans); font-weight: 500; color: var(--asa-navy); }

.payload {
  margin-top: 14px;
  background: var(--asa-navy); color: var(--asa-cream);
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}
.modal__foot {
  padding: 16px 28px;
  border-top: 1px solid rgba(21,33,47,0.12);
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  background: var(--asa-stone-100);
}
.modal__foot .pre {
  font-size: 10px; letter-spacing: var(--tr-3); text-transform: uppercase;
  color: var(--asa-stone-500);
}
.modal__foot .actions { display: flex; gap: 8px; }

.btn-ghost-light {
  background: transparent; color: var(--asa-navy);
  border: 1px solid rgba(21,33,47,0.20);
  padding: 10px 16px;
  font-size: 11px; letter-spacing: var(--tr-4); text-transform: uppercase; font-weight: 500;
  cursor: pointer;
}
.btn-ghost-light:hover { background: rgba(21,33,47,0.06); }
.btn-primary-light {
  background: var(--asa-navy); color: var(--asa-white);
  border: 1px solid var(--asa-navy);
  padding: 10px 18px;
  font-size: 11px; letter-spacing: var(--tr-4); text-transform: uppercase; font-weight: 500;
  cursor: pointer;
}
.btn-primary-light:hover { background: #0a141d; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--asa-cream); color: var(--asa-navy);
  padding: 12px 22px;
  font-size: 11px; letter-spacing: var(--tr-4); text-transform: uppercase; font-weight: 500;
  z-index: 60;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  animation: toast-in 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* utility */
.hidden { display: none !important; }
.row    { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }

/* ── Wedding-invite ampersand ────────────────────────────────────────
   Any couple's name on the creative ("John & Jane") gets a stylized
   Ivar Display italic ampersand, sized larger and tightly hugged by
   the names so it reads like a wedding invite tie. */
.amp {
  font-family: "Ivar Display", "Ivar Text", Georgia, serif !important;
  font-style: italic !important;
  font-weight: 400 !important;
  font-size: 1.55em;
  line-height: 0.7;
  vertical-align: -0.16em;
  margin: 0 0.04em;       /* hug the names — tighter than a normal space */
  letter-spacing: 0;
}
