/* Vivaha Biodata — app UI. Biodata sheet designs live in css/templates.css (Tailwind build). */

:root {
  --bg: #f3ece3;
  --paper: #fffdf9;
  --ink: #2b221c;
  --muted: #6b5c50;
  --line: #e6d9cb;
  --maroon: #8a1f24;
  --maroon-deep: #5e1418;
  --gold: #c4a04a;
  --focus: #8a1f24;
  --shadow: 0 10px 30px rgba(70, 40, 20, 0.08);
  --radius: 16px;
  --ui: "Poppins", "Noto Sans Devanagari", "Noto Sans Telugu", sans-serif;
  --display: "Cormorant Garamond", "Noto Serif Devanagari", "Noto Serif Telugu", serif;
  --sheet-w: 210mm;
  --sheet-h: 297mm;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fbeedc 0%, transparent 55%),
    var(--bg);
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

/* —— Header / hero —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 236, 227, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 60px;
  padding: 6px 0;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  color: inherit;
}
.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  color: var(--maroon-deep);
}
.brand-tag { display: none; font-size: 0.75rem; color: var(--muted); }

.lang-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-btn, .tpl-btn, .pane-btn, .btn {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
}
.lang-btn[aria-pressed="true"],
.tpl-btn[aria-pressed="true"],
.pane-btn[aria-pressed="true"] {
  background: var(--maroon);
  border-color: var(--maroon);
  color: #fff;
}

.hero {
  padding: 28px 0 12px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--maroon-deep);
}
.hero p.lead {
  margin: 0 0 18px;
  color: var(--muted);
  max-width: 62ch;
  font-size: 1.02rem;
}
.privacy-note {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 70ch;
}

.btn-primary {
  background: var(--maroon);
  color: #fff;
  border: 1px solid var(--maroon-deep);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
}
.btn-primary:hover { background: var(--maroon-deep); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  text-decoration: underline;
}

/* —— Studio —— */
.studio { padding: 8px 0 56px; }
.pane-switch {
  display: flex;
  gap: 6px;
  margin: 8px 0 14px;
}
.studio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.form-col { min-width: 0; }
.preview-col { min-width: 0; }

.form-section + .form-section { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.form-section h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--maroon-deep);
}

.grid-2, .grid-3 {
  display: grid;
  gap: 10px;
}
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
}
.field input::placeholder,
.field textarea::placeholder { color: #b3a394; opacity: 1; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--maroon);
  outline-offset: 1px;
  border-color: var(--maroon);
}
.hint { margin: 6px 0 0; font-size: 0.78rem; color: var(--muted); }

.photo-picker {
  display: flex;
  align-items: center;
  gap: 12px;
}
.photo-picker img {
  width: 72px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eee;
}
.file-btn { position: relative; overflow: hidden; display: inline-flex; }
.file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.extra-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 8px;
}
.extra-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  background: #fff;
}
.icon-btn {
  width: 42px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.toolbar .btn-primary, .toolbar .btn { font-size: 0.85rem; padding: 9px 14px; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.tpl-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; align-self: center; }


/* Template picker with visual thumbnails */
.tpl-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.tpl-thumb {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 12px;
  padding: 8px 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-align: center;
  min-width: 0;
}
.tpl-thumb[aria-pressed="true"] {
  border-color: var(--maroon);
  box-shadow: 0 0 0 2px rgba(138, 31, 36, 0.2);
}
.tpl-thumb .thumb-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.tpl-thumb .thumb-desc {
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.25;
}
.thumb-art {
  width: 84px;
  height: 119px;
  border-radius: 4px;
  overflow: hidden;
  flex: none;
  box-shadow: 0 2px 8px rgba(60, 30, 10, 0.18);
  background: #eee;
}
.thumb-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

#export-status { font-size: 0.85rem; color: var(--muted); margin: 0 0 8px; }
#toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--maroon-deep);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 40;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}

/* Preview: true A4 pages, scaled to the column */
#preview-viewport {
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: #e8ddd0;
  border-radius: 12px;
  border: 1px solid var(--line);
}
#sheet-host {
  width: var(--sheet-w);
  transform-origin: top center;
}
#sheet-host .sheet + .sheet { margin-top: 8mm; }


.modal[hidden], [hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(40, 22, 16, 0.45); }
.modal-card {
  position: relative; background: var(--paper); border-radius: 18px; padding: 22px 20px;
  max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal-card h2 { margin: 0 0 8px; font-family: var(--display); color: var(--maroon-deep); }
.modal-card p { margin: 0 0 16px; color: var(--muted); }
.pay-soon {
  display: inline-block; background: #f3e6c8; color: #6a4b12; border-radius: 999px;
  padding: 4px 10px; font-size: 0.75rem; font-weight: 700; margin-bottom: 10px;
}

footer.site-foot {
  border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 0.82rem;
}

@media (max-width: 959px) {
  .studio[data-pane="edit"] .preview-col { display: none; }
  .studio[data-pane="preview"] .form-col { display: none; }
  .tpl-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .brand-tag { display: block; }
  .hero { padding-top: 40px; }
}
@media (min-width: 960px) {
  .pane-switch { display: none; }
  .studio-grid {
    grid-template-columns: minmax(300px, 400px) minmax(0, 1fr);
    align-items: start; gap: 24px;
  }
  .preview-col { position: sticky; top: 76px; }
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}
@media print {
  body { background: #fff; }
  .topbar, .hero, .form-col, .toolbar, .tpl-picker, .pane-switch, footer, #toast, .modal, .privacy-note { display: none !important; }
  .studio, .studio-grid, .preview-col, .wrap, #preview-viewport, #sheet-host {
    display: block !important; width: auto; height: auto; background: none; border: none;
    box-shadow: none; padding: 0; margin: 0; position: static; transform: none !important;
  }
  #preview-viewport { overflow: visible; }
  .sheet { transform: none !important; box-shadow: none; page-break-after: always; }
  @page { size: A4; margin: 0; }
}
