:root {
  --brand: #7f1d1d;
  --brand-2: #b7791f;
  --ink: #1f1a17;
  --muted: #6b6259;
  --line: #e7ded3;
  --bg: #fbf8f4;
  --card: #ffffff;
  --focus: #2563eb;
  --error: #b42318;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
a { color: var(--brand); }
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1200px; }

.site-head { background: #fff; border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding-top: 10px; padding-bottom: 10px; }
.logo { font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--brand); }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.95rem; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--brand); }

main { padding: 18px 0 40px; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); line-height: 1.2; margin: 8px 0 6px; }
.lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 18px; max-width: 760px; }
.crumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.crumbs a { color: var(--muted); }

/* Maker */
.maker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr); gap: 20px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 1.1rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.card h2 small { font-weight: 400; color: var(--muted); }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.85rem; }
.fld { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.fld input, .fld select { display: block; width: 100%; margin-top: 4px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
input[type="text"], input[type="date"], select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #d6cbbd; border-radius: 8px; padding: 9px 10px; min-height: 42px; width: 100%;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .file-btn:focus-within {
  outline: 3px solid var(--focus); outline-offset: 1px;
}
.hint { font-size: 0.88rem; color: var(--muted); margin: 4px 0 10px; }
.error { color: var(--error); font-size: 0.9rem; margin: 6px 0; min-height: 0; }
.error:empty { display: none; }

.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 14px; }
.tpl { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 5px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font: inherit; }
.tpl[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(127, 29, 29, 0.15); }
.thumb { display: block; width: 100%; aspect-ratio: 1240 / 1754; border-radius: 4px; overflow: hidden; }
.thumb canvas { width: 100%; height: 100%; display: block; }
.tpl-name { font-size: 0.75rem; line-height: 1.2; color: var(--muted); text-align: center; }

.sec { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin: 0 0 12px; }
.sec-head { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.sec-title { font-weight: 700; color: var(--brand); }
.frow { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr) auto; gap: 6px; align-items: start; margin-bottom: 6px; }
.f-label { border-color: transparent !important; background: transparent !important; font-size: 0.92rem; font-weight: 600; color: #5a4636 !important; padding-left: 2px !important; }
.f-label:hover { border-color: #e2d6c8 !important; }
.f-label:focus { border-color: #d6cbbd !important; background: #fff !important; }
.frow.para { grid-template-columns: minmax(0, 1fr) auto; }
.tools { display: flex; gap: 2px; }
.tools button { width: 32px; height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 0; }
.tools button:hover { color: var(--brand); border-color: var(--brand); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 10px 16px; min-height: 44px; border-radius: 10px; border: 1px solid #cdbfae; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #681717; }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.link { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; font-size: 0.9rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.crop-box { display: flex; gap: 14px; margin-top: 12px; flex-wrap: wrap; user-select: none; -webkit-user-select: none; }
.crop-box[hidden] { display: none; }
#crop-canvas { width: 150px; height: auto; aspect-ratio: 286 / 364; border-radius: 6px; border: 1px solid var(--line); cursor: grab; touch-action: none; background: #eee; }
.crop-tools { flex: 1; min-width: 180px; }

.maker-preview .sticky { position: sticky; top: 12px; }
.preview-pages { background: #efe9e1; border-radius: var(--radius); padding: 12px; display: grid; gap: 12px; min-height: 200px; }
.page-canvas { width: 100%; height: auto; display: block; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); background: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; color: var(--muted); margin: 8px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; }
.privacy-note { font-size: 0.88rem; color: #2f5d3a; background: #eef7f0; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.jump { display: none; }

/* Content */
.prose { max-width: 760px; }
.prose h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; }
.prose h2 { font-size: 1.25rem; margin-top: 28px; }
.steps li { margin-bottom: 6px; }
details { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 2px; }
table.labels { border-collapse: collapse; width: 100%; max-width: 520px; background: #fff; font-size: 0.95rem; }
.labels th, .labels td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.labels tr.sub th { background: #f6efe6; color: var(--brand); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.gallery-card { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.gallery-canvas { aspect-ratio: 1240 / 1754; background: #f3eee8; }
.gallery-card figcaption { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sample { max-width: 360px; margin: 16px 0; }
/* Ads sit well away from buttons and carry a label, per AdSense placement guidance. */
.ad-slot { margin: 48px 0 32px; min-height: 100px; clear: both; }
.ad-slot::before { content: 'Advertisement'; display: block; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: #8a8f98; text-align: center; margin-bottom: 6px; }
.design-notes dt { font-weight: 700; margin-top: 12px; }
.design-notes dd { margin: 2px 0 0; color: var(--muted); }


.site-foot { border-top: 1px solid var(--line); background: #fff; padding: 18px 0; font-size: 0.88rem; color: var(--muted); }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.site-foot a { color: var(--muted); }
/* Link to the sister site. Plain and clearly labelled, so it never looks like an ad. */
.sister-card { border: 1px solid var(--line); border-left: 4px solid var(--sister-accent, #64748b); background: #fff; border-radius: 10px; padding: 12px 14px; margin: 24px 0; }
.sister-card p { margin: 4px 0; }
.sister-card .sister-tag { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; margin: 0; }
#print-area { display: none; }

@media (max-width: 900px) {
  main { padding-bottom: 80px; }
  .maker { grid-template-columns: 1fr; }
  .maker-preview .sticky { position: static; }
  .jump { display: block; position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; z-index: 5; background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); white-space: nowrap; }
  .preview-pages { max-width: 520px; margin: 0 auto; }
}
@media (max-width: 520px) {
  .tpl-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
  .tpl-name { font-size: 0.68rem; }
  .two { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 1fr auto; }
  .frow .f-label { grid-column: 1; }
  .frow .tools { grid-column: 2; grid-row: 1; }
  .frow .f-value { grid-column: 1 / -1; }
  .frow { margin-bottom: 10px; gap: 2px 6px; }
  .frow .f-label { min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
  .frow .tools button { height: 34px; }
  .frow.para .f-value { grid-column: 1 / -1; grid-row: 2; }
  .frow.para .tools { justify-content: flex-end; }
  .card { padding: 12px; }
}

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  #print-area img { display: block; width: 210mm; height: 297mm; page-break-after: always; break-after: page; }
  #print-area img:last-child { page-break-after: auto; break-after: auto; }
}
