@font-face {
  font-family: 'Biodata Noto';
  src: url('assets/fonts/noto-devanagari.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0900-097F, U+1CD0-1CF4, U+1CF7-1CF9, U+200C-200D, U+20A8, U+20B9, U+20F0, U+25CC, U+A830-A839, U+A8E0-A8FF, U+11B00-11B0A;
}
@font-face {
  font-family: 'Biodata Noto';
  src: url('assets/fonts/noto-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --plum: #380d1b;
  --wine: #701e37;
  --amber: #efcb7a;
  --ink: #42232c;
  --muted: #674b51;
  --paper: #fffaf1;
  --background: #f7efe4;
  --border: #dccab7;
  --sans: 'Biodata Noto', 'Nirmala UI', system-ui, sans-serif;
  --display: 'Baskerville', 'Palatino Linotype', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html[lang|='hi'] { --display: var(--sans); }
body { margin: 0; color: var(--ink); background: var(--background); font: 1rem/1.6 var(--sans); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #9a5b22; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; }
h2 { font-size: clamp(1.4rem, 2.2vw, 1.85rem); }
h3 { font-size: 1.38rem; }
html[lang|='hi'] :is(h1, h2, h3) { line-height: 1.35; }

.wrap { width: min(74rem, calc(100% - 3rem)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; z-index: 2; inset: .5rem auto auto .7rem; transform: translateY(-180%); background: var(--paper); color: var(--plum); padding: .6rem .9rem; }
.skip-link:focus { transform: none; }

.masthead { background: linear-gradient(110deg, #2d0915, #500f25); color: var(--paper); border-bottom: 2px solid #c1934d; }
.masthead-inner { min-height: 4.8rem; display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.masthead :focus-visible { outline-color: var(--amber); }
.brand { display: flex; gap: .65rem; align-items: center; }
.brand img { display: block; width: clamp(2.35rem, 5vw, 3.45rem); height: auto; }
.brand strong { display: block; white-space: nowrap; font: 650 clamp(1rem, 2.5vw, 1.5rem)/1.16 'Palatino Linotype', Georgia, serif; letter-spacing: .065em; }
.brand small { display: block; margin-top: .15rem; font-size: .85rem; line-height: 1.2; color: #efd8cc; }
.language-switch { display: flex; padding: .19rem; border: 1px solid #e8cb8d63; border-radius: 999px; }
.language-switch button { min-height: 2.5rem; color: var(--paper); background: transparent; border: 0; border-radius: 999px; padding: .25rem .73rem; font-size: .9rem; }
.language-switch button[aria-pressed='true'] { background: var(--amber); color: var(--plum); font-weight: 700; }

main { padding-bottom: 3.9rem; }
.page-heading { display: flex; gap: 1rem 2rem; align-items: end; justify-content: space-between; flex-wrap: wrap; padding-block: clamp(2.2rem, 5vw, 4rem) 1.3rem; }
.page-heading h1 { font-size: clamp(2.15rem, 4.8vw, 3.65rem); letter-spacing: -.043em; }
html[lang|='hi'] .page-heading h1 { letter-spacing: 0; }
.page-heading p { margin-top: .55rem; color: var(--muted); max-width: 37rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.privacy-note { background: #f0dfc8; border: 1px solid #ddc2a3; border-left: 3px solid #9a5b29; border-radius: .4rem; padding: .8rem 1rem; font-size: .93rem; }
.privacy-note strong { color: var(--plum); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; gap: clamp(1rem, 3.1vw, 2rem); margin-top: 1.5rem; }
#profileForm { min-width: 0; display: grid; gap: 1rem; scroll-margin-top: 1rem; }
.field-card, .output-panel { min-width: 0; background: var(--paper); border: 1px solid var(--border); border-radius: .65rem; }
.field-card { padding: clamp(1.1rem, 2.8vw, 1.8rem); }
.field-card h2::before { content: ''; display: inline-block; width: .7rem; height: .7rem; border: 1px solid #a57338; background: #e2bb78; transform: rotate(45deg); margin: 0 .65rem .15rem .12rem; }
.section-note { color: var(--muted); font-size: .91rem; margin-top: .44rem; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem 1rem; margin-top: 1.1rem; }
.field { display: grid; align-content: start; min-width: 0; gap: .33rem; }
.field.wide { grid-column: 1 / -1; }
.field label, .share-options legend { font-size: .93rem; font-weight: 650; }
.field :is(input:not([type='range'], [type='file']),select,textarea) { width: 100%; min-width: 0; min-height: 2.8rem; padding: .48rem .65rem; border: 1px solid #c8b29f; border-radius: .35rem; color: var(--ink); background: #fffcf7; }
.field textarea { resize: vertical; }
.field input[type='range'] { width: 100%; min-height: 2.7rem; accent-color: var(--wine); }
.field [aria-invalid='true'], .share-options[aria-invalid='true'] { border-color: #952744; outline: 1px solid #952744; }
#photoHint + .field { margin-top: 1rem; }
#photoInput { max-width: 100%; padding: .2rem; }
#photoInput::file-selector-button { font: inherit; color: var(--wine); background: #f8eddd; border: 1px solid #cbb18f; border-radius: .35rem; padding: .45rem .6rem; margin-right: .55rem; cursor: pointer; }
.photo-status:empty { display: none; }
.photo-status { margin-top: .5rem; color: var(--muted); font-size: .92rem; }
.crop-layout { display: grid; grid-template-columns: minmax(6.3rem, 9.75rem) 1fr; gap: 1rem; align-items: start; margin-top: 1rem; }
.crop-layout canvas { max-width: 100%; height: auto; display: block; border: 1px solid var(--border); border-radius: .35rem; }
.crop-controls { min-width: 0; display: grid; gap: .3rem; }
.crop-controls button { justify-self: start; }

.output-panel { position: sticky; top: 1rem; overflow: clip; box-shadow: 0 .5rem 1.5rem #47182a0e; }
.output-heading { display: flex; flex-wrap: wrap; gap: .7rem 1rem; justify-content: space-between; align-items: center; background: var(--plum); color: var(--paper); padding: 1.2rem clamp(1rem, 2.6vw, 1.5rem); border-bottom: 2px solid #c1934d; }
.output-heading .field { min-width: 7.4rem; }
.output-heading .field label { color: #f3debc; font-size: .84rem; }
.output-heading .field select { min-height: 2.7rem; }
.output-body { padding: clamp(1rem, 2.6vw, 1.5rem); }
.pdf-choice p, .reset-note { color: var(--muted); font-size: .91rem; }
.pdf-choice p { margin-top: .45rem; }
.share-choice { margin-top: 1.2rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.download-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .48rem; margin-top: .85rem; }
.share-options { margin: .8rem 0 0; border: 1px solid #dfcdb8; padding: .28rem .62rem .52rem; border-radius: .4rem; min-width: 0; }
.share-options legend { padding-inline: .27rem; }
#shareChoices { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .43rem; }
.share-option { display: flex; align-items: center; gap: .35rem; min-height: 2.75rem; font-size: .89rem; cursor: pointer; }
.share-option input { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; accent-color: var(--wine); margin: 0; }
.share-option input[aria-invalid='true'] { outline: 2px solid #952744; outline-offset: 2px; }
.personal-controls { display: grid; gap: .6rem; margin: .15rem 0 0; border: 1px solid #dfcdb8; border-radius: .4rem; padding: .7rem; }
.personal-controls .download-actions { margin-top: 0; }
.reset-note { margin-top: 1rem; }
.issues { padding: .7rem .8rem; background: #fae6e7; border: 1px solid #be8a94; border-radius: .35rem; color: #69142d; margin-bottom: .85rem; font-size: .91rem; }
.issues ul { margin: .3rem 0 0; padding-left: 1.3rem; }
#assetMessage { margin-bottom: .65rem; }

.button { min-height: 2.75rem; border-radius: .38rem; padding: .45rem .72rem; border: 1px solid transparent; font-weight: 650; font-size: .91rem; color: var(--wine); }
.button.primary { background: var(--wine); border-color: var(--wine); color: #fffaf4; }
.button.primary:hover:enabled { background: #501126; }
.button.secondary { background: #fffaf2; border-color: #c5a98e; }
.button.secondary:hover:enabled, .button.quiet:hover:enabled { background: #f1e2d2; }
.button.quiet { background: transparent; }

dialog { width: min(46rem, calc(100% - 1.5rem)); max-height: min(92vh, 65rem); overflow: auto; padding: 0; border: 1px solid #b4927b; border-radius: .55rem; color: var(--ink); background: var(--background); }
dialog::backdrop { background: #240a19b8; }
.dialog-top { position: sticky; top: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; background: var(--paper); border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
.draft-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem 1rem; margin-top: 1rem; padding: .85rem 1rem; border: 1px solid var(--border); border-radius: .6rem; background: var(--paper); }
.draft-panel h2 { font-size: 1.35rem; }
.draft-status { flex-basis: 100%; }
#draftDialog { width: min(34rem, calc(100% - 1.5rem)); }
.draft-form { display: grid; gap: .75rem; padding: 1rem; }
#draftFile { max-width: 100%; }
.private-format { margin-top: .65rem; }
.share-photo { border-top: 1px solid var(--border); padding-top: .55rem; }
.share-photo .section-note { margin-top: 0; }
.preview-text { margin: .8rem .7rem .12rem; border: 1px solid var(--border); border-radius: .4rem; background: var(--paper); padding: .55rem .75rem; }
.preview-text summary { cursor: pointer; color: var(--wine); font-weight: 650; }
.preview-text article { padding: .65rem 0 .25rem; overflow-wrap: anywhere; }
.preview-text :is(h4,dl) { margin-block: .75rem .4rem; }
.preview-text dt { font-weight: 650; }
.preview-text dd { margin: 0 0 .4rem; white-space: pre-wrap; }
.preview-review { background: var(--paper); border-top: 1px solid var(--border); padding: .65rem 1rem 1rem; }
.preview-review .share-option { margin-bottom: .45rem; }
.preview-pages { display: grid; padding: .7rem; gap: .7rem; }
.preview-pages canvas { display: block; width: 100%; height: auto; outline: 1px solid var(--border); }

@media (max-width: 56rem) {
  .workspace { grid-template-columns: minmax(0,1fr); }
  .output-panel { position: static; }
  .output-heading { justify-content: flex-start; gap: .65rem 1.6rem; }
}
@media (max-width: 34rem) {
  .wrap { width: calc(100% - 1.4rem); }
  .page-heading { align-items: start; }
  .fields { grid-template-columns: minmax(0,1fr); }
  .brand { gap: .35rem; }
  .language-switch button { padding-inline: .6rem; }
  .download-actions .button { flex: 1 1 auto; }
}
