/* Hidden until js/main.js has filled in the interface text, to avoid a flash of empty labels. */
.is-booting body {
  visibility: hidden;
}

:root {
  --navy: #071f4c;
  --navy-2: #0d2f66;
  --navy-3: #183d74;
  --gold: #b08a23;
  --gold-bright: #d5b552;
  --ink: #14213d;
  --muted: #667078;
  --line: #d7d0c5;
  --surface: #fbfaf7;
  --surface-warm: #f3eee6;
  --page: #e9e3da;
  --success: #3e7e62;
  --danger: #a43b44;
  --shadow: 0 18px 46px rgba(7, 31, 76, 0.1);
  --font-card: "New Peninim MT", "Nadeem", "Geeza Pro", "SF Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  --radius-large: 14px;
  --radius-medium: 10px;
  --radius-small: 7px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
  scroll-behavior: smooth;
  scrollbar-color: #a9a197 var(--page);
  scrollbar-width: thin;
}

html[lang="ar"] body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Geeza Pro", Tahoma, Arial, sans-serif;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

::selection {
  color: #fff;
  background: var(--navy);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(176, 138, 35, 0.45);
  outline-offset: 3px;
}

.app-shell {
  min-height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(20px, 5vw, 76px);
  color: #fff;
  background: var(--navy);
  border-bottom: 1px solid rgba(213, 181, 82, 0.32);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 30px;
  place-items: center;
  color: var(--gold-bright);
  background: transparent;
  border: 1px solid rgba(213, 181, 82, 0.75);
  border-radius: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  letter-spacing: 0.18em;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.topbar-actions,
.language-switch,
.privacy-pill {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 16px;
}

.privacy-pill {
  gap: 7px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.privacy-pill svg,
.privacy-note svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.language-switch {
  gap: 15px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.language-button {
  position: relative;
  min-height: 31px;
  padding: 4px 0 7px;
  color: rgba(255, 255, 255, 0.65);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  transition: color 180ms ease;
}

.language-button:hover {
  color: #fff;
}

.language-button.is-active {
  color: #fff;
  font-weight: 700;
}

.language-button.is-active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  content: "";
  background: var(--gold-bright);
}

.language-button:active {
  transform: translateY(1px);
}

.page-content {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(34px, 5vw, 68px) 0 72px;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: clamp(26px, 3.8vw, 48px);
}

.intro-copy {
  max-width: 760px;
}

.intro h1 {
  max-width: 700px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 560;
  letter-spacing: -0.028em;
  line-height: 1.16;
}

.intro-lead {
  max-width: 61ch;
  margin: 16px 0 0;
  color: #59636b;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.75;
}

.intro-detail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

.detail-line {
  display: block;
  width: 72px;
  height: 1px;
  background: var(--gold);
}

.detail-line-short {
  width: 26px;
  opacity: 0.55;
}

.detail-dot {
  width: 7px;
  height: 7px;
  background: var(--gold);
  border-radius: 50%;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.84fr) minmax(420px, 1.16fr);
  align-items: start;
  gap: clamp(24px, 3.6vw, 54px);
}

.panel-surface,
.preview-panel {
  border-radius: var(--radius-large);
}

.panel-surface {
  padding: clamp(25px, 3vw, 38px);
  background: var(--surface);
  border: 1px solid rgba(7, 31, 76, 0.1);
  box-shadow: var(--shadow);
}

.section-heading,
.preview-heading,
.field-label-row,
.field-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-heading {
  margin-bottom: 25px;
}

.section-heading h2,
.preview-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.required-note {
  color: var(--muted);
  font-size: 12px;
}

.required-note span:first-child {
  color: var(--gold);
  font-weight: 800;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field-group {
  min-width: 0;
}

.field-group > label,
.field-label,
.style-fieldset legend {
  display: block;
  margin-bottom: 7px;
  color: #45515e;
  font-size: 13px;
  font-weight: 650;
}

.field-group input[type="text"],
.field-group textarea {
  width: 100%;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  outline: 0;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.field-group input[type="text"] {
  min-height: 46px;
  padding: 11px 14px;
}

.field-group textarea {
  min-height: 106px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.75;
}

.field-group input[type="text"]::placeholder,
.field-group textarea::placeholder {
  color: #9ba2ac;
}

.field-group input[type="text"]:hover,
.field-group textarea:hover {
  border-color: #b8b4ac;
}

.field-group input[type="text"]:focus,
.field-group textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 138, 35, 0.12);
}

.field-group [aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(164, 59, 68, 0.1);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.input-with-action {
  position: relative;
}

.input-with-action input[type="text"] {
  padding-inline-end: 48px;
}

.input-action {
  position: absolute;
  top: 50%;
  inset-inline-end: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--navy);
  background: transparent;
  border: 0;
  border-radius: 7px;
  transform: translateY(-50%);
  transition: color 180ms ease, background 180ms ease;
}

.input-action:hover {
  color: var(--gold);
  background: rgba(176, 138, 35, 0.1);
}

.input-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.visually-hidden-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-hint,
.field-error,
.field-meta {
  margin: 6px 0 0;
  font-size: 11px;
}

.field-hint {
  color: var(--muted);
}

.field-error {
  min-height: 16px;
  color: var(--danger);
}

.field-meta {
  align-items: start;
}

.character-count {
  color: #8d939c;
  font-size: 10px;
  direction: ltr;
  white-space: nowrap;
}

.fixed-field {
  padding: 15px 16px 16px;
  background: var(--surface-warm);
  border: 1px solid #e6ddcf;
  border-radius: 8px;
}

.field-label-row {
  margin-bottom: 8px;
}

.field-label-row .field-label {
  margin: 0;
}

.fixed-badge {
  padding: 3px 8px;
  color: var(--gold);
  background: rgba(176, 138, 35, 0.1);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 750;
}

.fixed-value {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 15px;
  font-weight: 650;
}

.fixed-value svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

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

.style-fieldset legend {
  padding: 0;
}

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

.style-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.style-option:hover {
  border-color: #b8b4ac;
}

.style-option:has(input:checked) {
  background: #f7f0e3;
  border-color: var(--gold);
}

.style-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.style-option-content {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.style-option-title {
  color: var(--navy);
  font-size: 13px;
  font-weight: 650;
}

.style-option-description {
  color: var(--muted);
  font-size: 11px;
}

.radio-mark {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-inline-start: auto;
  border: 1px solid #b8b4ac;
  border-radius: 50%;
}

.style-option:has(input:checked) .radio-mark {
  position: relative;
  border-color: var(--gold);
}

.style-option:has(input:checked) .radio-mark::after,
.font-option:has(input:checked) .radio-mark::after {
  position: absolute;
  inset: 3px;
  content: "";
  background: var(--gold);
  border-radius: inherit;
}

.style-option:has(input:focus-visible),
.font-option:has(input:focus-visible),
.design-option:has(input:focus-visible) {
  outline: 3px solid rgba(176, 138, 35, 0.45);
  outline-offset: 2px;
}

/* Design picker: a picture of each whole card. */
.design-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.design-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 10px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.design-option:hover {
  border-color: #b8b4ac;
}

.design-option:has(input:checked) {
  background: #f7f0e3;
  border-color: var(--gold);
}

.design-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.design-thumb {
  grid-column: 1 / -1;
  display: block;
  width: min(100%, 112px);
  aspect-ratio: 9 / 16;
  justify-self: center;
  object-fit: cover;
  background: #e9e4da;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(7, 31, 76, 0.18);
}

.design-name {
  min-width: 0;
  color: var(--navy);
  font-size: 13px;
  font-weight: 650;
}

.design-option .radio-mark {
  margin-inline-start: 0;
}

.design-option:has(input:checked) .radio-mark {
  position: relative;
  border-color: var(--gold);
}

.design-option:has(input:checked) .radio-mark::after {
  position: absolute;
  inset: 3px;
  content: "";
  background: var(--gold);
  border-radius: inherit;
}

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

/* Each font list folds away behind its current choice; fonts inside a closed
   list are not downloaded until it is opened. */
.font-picker {
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: border-color 180ms ease;
}

.font-picker:hover,
.font-picker[open] {
  border-color: #b8b4ac;
}

.font-picker-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
}

.font-picker-summary::-webkit-details-marker {
  display: none;
}

.font-picker-summary:focus-visible {
  outline: 3px solid rgba(176, 138, 35, 0.45);
  outline-offset: 2px;
}

.font-picker-text {
  display: grid;
  flex: 1 1 auto;
  gap: 1px;
  min-width: 0;
}

.font-picker-label {
  color: #45515e;
  font-size: 13px;
  font-weight: 650;
}

.font-picker-current {
  overflow: hidden;
  color: var(--navy);
  font-family: var(--option-font);
  font-size: 18px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-picker-chevron {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--navy);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform 180ms ease;
}

.font-picker[open] .font-picker-chevron {
  transform: rotate(180deg);
}

.style-fieldset.font-picker-body {
  padding: 0 14px 14px;
  border-top: 1px solid #ece5d9;
}

.font-hint {
  margin: 10px 0 0;
}

.font-groups {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.font-group-title {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.font-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.font-option {
  position: relative;
  container-type: inline-size;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 20px 8px 10px;
  text-align: center;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease;
}

.font-option:hover {
  border-color: #b8b4ac;
}

.font-option:has(input:checked) {
  background: #f7f0e3;
  border-color: var(--gold);
}

.font-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.font-option-sample {
  max-width: 100%;
  color: var(--navy);
  font-family: var(--option-font);
  /* Scales with the tile so wide families (Alexandria, Lalezar) stay inside it. */
  font-size: clamp(12px, 14cqi, 20px);
  line-height: 1.45;
  white-space: nowrap;
}

.font-option-name {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
  direction: ltr;
  unicode-bidi: isolate;
}

.font-option .radio-mark {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  width: 12px;
  height: 12px;
  margin: 0;
}

.font-option:has(input:checked) .radio-mark {
  border-color: var(--gold);
}

.font-option:has(input:checked) .radio-mark::after {
  inset: 2px;
}

.photo-picker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.photo-thumb {
  flex: 0 0 auto;
  width: 54px;
  height: 64px;
  object-fit: cover;
  object-position: center 40%;
  background: #422719;
  border-radius: 4px;
}

.photo-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 2px;
  min-width: 0;
}

.photo-name {
  margin: 0;
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-copy .field-hint {
  margin: 0;
}

.photo-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 4px;
  justify-items: center;
}

.photo-actions .secondary-button {
  min-height: 38px;
  padding: 7px 13px;
  font-size: 12px;
}

.text-button {
  padding: 2px 4px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover {
  color: var(--gold);
}

.editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 9px;
  margin-top: 3px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 47px;
  padding: 10px 16px;
  border-radius: var(--radius-small);
  font-size: 13px;
  font-weight: 650;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.primary-button {
  color: #fff;
  background: var(--navy);
  border: 1px solid var(--navy);
  box-shadow: 0 8px 18px rgba(7, 31, 76, 0.14);
}

.primary-button:hover {
  background: var(--navy-2);
  box-shadow: 0 12px 22px rgba(7, 31, 76, 0.2);
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.primary-button:disabled {
  box-shadow: none;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.secondary-button {
  color: var(--navy);
  background: transparent;
  border: 1px solid var(--line);
}

.secondary-button:hover {
  color: var(--gold);
  background: #fffaf0;
  border-color: var(--gold);
}

.preview-button {
  border-color: rgba(176, 138, 35, 0.58);
}

.primary-button svg,
.secondary-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.privacy-note {
  display: flex;
  align-items: start;
  gap: 9px;
  padding-top: 4px;
  color: #697382;
}

.privacy-note svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--success);
}

.privacy-note p {
  max-width: 56ch;
  margin: 0;
  font-size: 11px;
  line-height: 1.65;
}

.preview-panel {
  position: sticky;
  top: 22px;
  min-height: 700px;
  padding: clamp(20px, 3vw, 34px);
  color: #fff;
  background: #0a2147;
  box-shadow: 0 22px 58px rgba(7, 31, 76, 0.2);
  overflow: hidden;
}

.preview-panel::before,
.preview-panel::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.preview-panel::before {
  top: 28px;
  bottom: 28px;
  inset-inline-start: 18px;
  width: 1px;
  background: rgba(213, 181, 82, 0.34);
}

.preview-panel::after {
  top: 28px;
  right: 18px;
  width: 36px;
  height: 1px;
  background: rgba(213, 181, 82, 0.34);
}

.preview-heading {
  position: relative;
  z-index: 1;
  margin-bottom: 20px;
}

.preview-heading h2 {
  color: #fff;
}

.preview-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #8dcc9f;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(141, 204, 159, 0.13);
}

.preview-stage {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 590px;
  place-items: center;
  padding: 8px 0 20px;
}

.invitation-card {
  position: relative;
  width: min(100%, 498px);
  aspect-ratio: 9 / 16;
  container-type: inline-size;
  direction: rtl;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  font-family: var(--font-card);
  font-kerning: normal;
  font-synthesis: none;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 4px;
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.32);
  isolation: isolate;
  transform: translateZ(0);
}

/*
 * A drawn design: the canvas keeps its own 9:16 proportions inside the card frame.
 * Size containment would discard them, so the canvas is not a query container.
 */
.invitation-canvas {
  display: block;
  height: auto;
  aspect-ratio: auto;
  container-type: normal;
  background: #071f4c;
}

.invitation-canvas[hidden] {
  display: none;
}

.invitation-card.is-updating {
  animation: card-update 320ms ease-out;
}

@keyframes card-update {
  0% { box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(213, 181, 82, 0); }
  45% { box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(213, 181, 82, 0.13); }
  100% { box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(213, 181, 82, 0); }
}

.card-hero {
  position: absolute;
  inset: 0 0 auto;
  height: 47%;
  overflow: hidden;
  background: #422719;
}

.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
}

.hero-tint {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.01), rgba(18, 15, 12, 0.03) 72%, rgba(12, 10, 8, 0.16));
}

.card-body {
  position: absolute;
  inset: 47% 0 0;
  display: block;
  overflow: hidden;
  padding: 0;
  background: #fff;
  border-radius: 0;
}

.logo-plaque {
  position: absolute;
  z-index: 2;
  left: 50%;
  display: grid;
  width: 28%;
  height: auto;
  aspect-ratio: 582 / 276;
  bottom: 5%;
  place-items: center;
  background: transparent;
  transform: translateX(-50%);
}

.logo-plaque img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.card-kicker {
  position: absolute;
  top: 8.5%;
  inset-inline: 0;
  margin: 0;
  color: #171717;
  font-family: var(--font-card);
  font-size: 3.15cqw;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
}

.card-title {
  position: absolute;
  top: var(--title-top, 31%);
  left: 5%;
  width: 90%;
  max-width: none;
  min-height: 0;
  margin: 0;
  color: #171717;
  font-family: var(--font-card);
  /* Size, position and line breaks come from script.js (computeCardLayout),
     the same measurements the PNG export uses. */
  font-size: var(--title-size, 3.45cqw);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.28;
  text-align: center;
  white-space: pre;
}

.card-description {
  position: absolute;
  top: var(--description-top, 38.7%);
  left: 5%;
  width: 90%;
  max-width: none;
  min-height: 0;
  margin: 0;
  color: #171717;
  font-family: var(--font-card);
  font-size: var(--description-size, 2.85cqw);
  line-height: 1.55;
  text-align: center;
  white-space: pre;
}

/* Each invitee line is positioned by script.js (computeCardLayout) from the
   measured name, so deep strokes are never clipped and match the PNG. */
.invitee-block {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.invitee-prelude,
.invitee-name,
.invitee-followup {
  position: absolute;
  inset-inline: 0;
  margin: 0;
  text-align: center;
  white-space: nowrap;
}

.invitee-prelude,
.invitee-followup {
  color: #171717;
  font-size: 2.222cqw; /* 24px of the 1080px export */
  font-weight: 400;
  line-height: 1.5;
}

.invitee-prelude {
  display: none;
  top: var(--prelude-top, 13%);
}

.invitee-block.is-greeting .invitee-prelude {
  display: block;
}

.invitee-name {
  top: var(--name-top, 17%);
  color: #171717;
  font-family: var(--font-name, var(--font-card));
  font-size: var(--name-size, 6.25cqw);
  font-weight: 400;
  letter-spacing: -0.018em;
  line-height: 1.2;
}

.invitee-followup {
  display: none;
  top: var(--followup-top, 26%);
  color: #3d3d3d;
  font-weight: 500;
}

.invitee-block.is-greeting .invitee-followup {
  display: block;
}

.event-details {
  position: absolute;
  top: var(--details-top, 48.9%);
  left: 8.6%;
  right: 8.6%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: start;
  gap: 1.5%;
  margin: 0;
  padding-top: 4.2%;
  border-top: 1px solid #d5d5d5;
}

.event-detail {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  text-align: center;
}

.event-detail + .event-detail {
  border-inline-start: 1px solid #c9c9c9;
}

.event-detail-label {
  color: #333;
  font-size: 1.75cqw;
  font-weight: 400;
}

.event-detail-value {
  color: #171717;
  /* Fitted per value by the shared layout, like the PNG. */
  font-size: var(--value-size, 2.35cqw);
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
}

.is-placeholder {
  color: #9fa4a9 !important;
  font-weight: 500 !important;
}

.preview-footnote {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  text-align: center;
}

.preview-dialog {
  width: min(720px, calc(100% - 32px));
  max-width: 720px;
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(7, 31, 76, 0.12);
  border-radius: 14px;
  box-shadow: 0 30px 90px rgba(3, 14, 36, 0.3);
  overflow: hidden;
}

.preview-dialog::backdrop {
  background: rgba(4, 15, 34, 0.76);
  backdrop-filter: blur(6px);
}

.preview-dialog[open] {
  animation: dialog-in 210ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-shell {
  display: grid;
  gap: 0;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.dialog-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 26px 0;
}

.dialog-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
  letter-spacing: -0.025em;
}

.dialog-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--navy);
  background: var(--surface-warm);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: color 180ms ease, background 180ms ease, border-color 180ms ease;
}

.dialog-close:hover {
  color: var(--gold);
  background: #fffaf0;
  border-color: var(--gold);
}

.dialog-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

.dialog-hint {
  margin: 8px 26px 0;
  color: var(--muted);
  font-size: 12px;
}

.dialog-preview-stage {
  display: grid;
  max-height: min(68vh, 720px);
  margin-top: 20px;
  padding: 22px;
  place-items: center;
  background: #0a2147;
  overflow: auto;
}

.dialog-preview-stage .invitation-card {
  width: min(100%, 456px);
  flex: 0 0 auto;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 18px 26px 24px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(390px, calc(100vw - 32px));
  padding: 12px 15px;
  color: #fff;
  background: #183d31;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(7, 31, 76, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #a9e1b9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.toast span {
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 1040px) {
  .studio-grid {
    grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
    gap: 22px;
  }

  .panel-surface,
  .preview-panel {
    border-radius: 12px;
  }

  .panel-surface {
    padding: 26px;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 8px;
  }

  .privacy-pill {
    display: none;
  }

  .intro {
    display: block;
  }

  .intro-detail {
    margin-top: 24px;
  }

  .studio-grid {
    display: flex;
    flex-direction: column;
  }

  .editor-panel,
  .preview-panel {
    width: 100%;
  }

  .preview-panel {
    position: static;
    min-height: 0;
  }

  .preview-stage {
    min-height: 0;
  }

  .invitation-card {
    width: min(100%, 520px);
  }
}

@media (max-width: 540px) {
  .topbar {
    min-height: 68px;
    padding: 13px 16px;
  }

  .brand-name {
    font-size: 13px;
  }

  .brand-subtitle {
    font-size: 10px;
  }

  .brand-mark {
    width: 32px;
    height: 28px;
    font-size: 18px;
  }

  .language-button {
    min-height: 28px;
    padding-inline: 0;
    font-size: 10px;
  }

  .language-switch {
    gap: 11px;
  }

  .page-content {
    width: min(100% - 24px, 1400px);
    padding-top: 30px;
    padding-bottom: 44px;
  }

  .intro {
    margin-bottom: 26px;
  }

  .intro h1 {
    font-size: 34px;
  }

  .intro-lead {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.7;
  }

  .panel-surface,
  .preview-panel {
    padding: 21px 16px;
    border-radius: 11px;
  }

  .section-heading h2,
  .preview-heading h2 {
    font-size: 22px;
  }

  .field-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .style-options {
    grid-template-columns: 1fr;
  }

  .font-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }


  .photo-picker {
    flex-wrap: wrap;
  }

  .photo-actions {
    grid-template-columns: auto auto;
    align-items: center;
    width: 100%;
    justify-content: start;
  }

  .editor-actions {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    min-height: 44px;
  }

  .preview-heading {
    margin-bottom: 15px;
  }

  .invitation-card {
    width: 100%;
    border-width: 2px;
  }

  .preview-footnote {
    margin-top: 2px;
    font-size: 10px;
  }

  .dialog-heading {
    padding-inline: 18px;
  }

  .dialog-hint {
    margin-inline: 18px;
  }

  .dialog-preview-stage {
    max-height: 62vh;
    padding: 16px;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
    padding: 14px 18px 18px;
  }

  .toast {
    right: 16px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
