:root {
  color-scheme: light;
  --desk: #f2eee5;
  --desk-deep: #e8e1d4;
  --surface: #fffdfa;
  --surface-muted: #f7f3ec;
  --paper: #ffffff;
  --ink: #1f2524;
  --ink-soft: #53605e;
  --line: #d5cec1;
  --line-strong: #aaa397;
  --accent: #cf552f;
  --accent-dark: #a63d20;
  --accent-soft: #f6ddd2;
  --navy: #253b46;
  --success: #1d6e4b;
  --success-soft: #e1f0e8;
  --error: #9d352c;
  --error-soft: #fae6e2;
  --focus: #166789;
  --shadow: 0 18px 55px rgb(55 48 37 / 9%);
  --radius: 18px;
  --font-body: "PT Sans", "Segoe UI", Tahoma, sans-serif;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    linear-gradient(rgb(255 255 255 / 18%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 18%) 1px, transparent 1px),
    var(--desk);
  background-size: 24px 24px;
}

button,
input,
textarea {
  font: inherit;
}

button,
label,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 10px clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 253 250 / 86%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  border-radius: 7px 7px 7px 2px;
  background: var(--navy);
  font-family: var(--font-display);
  font-size: 13px;
}

.local-badge {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.shell {
  width: min(100% - 40px, 1440px);
  margin: 0 auto;
  padding: 56px 0 72px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 330px);
  gap: clamp(30px, 7vw, 110px);
  align-items: end;
  margin-bottom: 42px;
  padding: 0 clamp(0px, 2vw, 30px);
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: clamp(38px, 5.5vw, 72px);
  font-weight: 500;
  line-height: 0.99;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.55;
}

.privacy-note {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  background: rgb(255 253 250 / 62%);
}

.privacy-note strong,
.privacy-note span {
  display: block;
}

.privacy-note strong {
  margin: 1px 0 5px;
  font-size: 14px;
}

.privacy-note div > span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.privacy-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--success);
  font-size: 22px;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(410px, 0.97fr);
  gap: 24px;
  align-items: start;
}

.editor {
  display: grid;
  gap: 18px;
}

.panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-panel {
  padding: clamp(20px, 3vw, 32px);
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.section-heading h2,
.preview-toolbar h2 {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
}

.section-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.45;
}

.step-number {
  display: inline-block;
  min-width: 31px;
  padding-top: 5px;
  color: var(--accent-dark);
  border-top: 2px solid var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.dropzone {
  position: relative;
  display: grid;
  min-height: 215px;
  padding: 30px;
  place-items: center;
  align-content: center;
  color: var(--ink-soft);
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  background:
    linear-gradient(135deg, transparent 0 48%, rgb(37 59 70 / 2%) 48% 52%, transparent 52%),
    var(--surface-muted);
  cursor: pointer;
  text-align: center;
  transition: 180ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  color: var(--ink);
  border-color: var(--accent);
  background-color: var(--accent-soft);
  transform: translateY(-2px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.dropzone strong {
  margin: 16px 0 4px;
  color: var(--ink);
  font-size: 17px;
}

.dropzone > span:not(.drop-illustration, .file-limits) {
  font-size: 14px;
}

.file-limits {
  margin-top: 15px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.demo-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 13px;
  color: var(--ink-soft);
  font-size: 12px;
}

.text-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--navy);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  font-weight: 900;
  cursor: pointer;
}

.text-button:hover:not(:disabled) {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.text-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.drop-illustration {
  position: relative;
  width: 72px;
  height: 48px;
}

.drop-illustration span {
  position: absolute;
  width: 43px;
  height: 31px;
  border: 2px solid var(--navy);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: 3px 4px 0 rgb(37 59 70 / 10%);
}

.drop-illustration span::after {
  position: absolute;
  right: 5px;
  bottom: 5px;
  left: 5px;
  height: 9px;
  background: linear-gradient(140deg, transparent 28%, var(--accent) 30% 58%, var(--navy) 60%);
  content: "";
  clip-path: polygon(0 100%, 30% 20%, 52% 70%, 72% 0, 100% 100%);
}

.drop-illustration span:nth-child(1) {
  top: 0;
  left: 0;
  transform: rotate(-7deg);
}

.drop-illustration span:nth-child(2) {
  top: 5px;
  right: 0;
  transform: rotate(7deg);
}

.drop-illustration span:nth-child(3) {
  bottom: 0;
  left: 15px;
}

.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
}

.alert-error {
  color: var(--error);
  border: 1px solid color-mix(in srgb, var(--error) 24%, white);
  background: var(--error-soft);
}

.empty-list {
  display: grid;
  min-height: 112px;
  place-items: center;
  align-content: center;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.empty-list span {
  color: var(--line-strong);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.2em;
}

.empty-list p {
  margin: 8px 0 0;
  font-size: 13px;
}

.photo-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 15px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.photo-card[draggable="true"] {
  cursor: grab;
}

.photo-card.is-dragging,
.photo-card.drag-target {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgb(207 85 47 / 14%);
}

.photo-card.is-dragging {
  opacity: 0.58;
}

.photo-thumb {
  position: relative;
  min-height: 105px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--navy);
}

.photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 105px;
  object-fit: cover;
}

.photo-index {
  position: absolute;
  top: 7px;
  left: 7px;
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: white;
  border-radius: 4px;
  background: var(--navy);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.photo-fields {
  display: grid;
  min-width: 0;
  gap: 9px;
}

.photo-card-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.filename {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.icon-button {
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.icon-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-button.remove:hover {
  color: white;
  border-color: var(--error);
  background: var(--error);
}

.caption-label {
  position: relative;
  display: grid;
  gap: 5px;
}

.caption-label > span:first-child {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.caption-label textarea {
  width: 100%;
  min-height: 59px;
  padding: 9px 52px 9px 10px;
  resize: vertical;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  line-height: 1.35;
}

.caption-label textarea:focus {
  border-color: var(--focus);
}

.char-count {
  position: absolute;
  right: 9px;
  bottom: 9px;
  color: var(--line-strong);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 17px;
  align-items: end;
}

.field,
.density-field {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.field > span,
.density-field legend {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.density-field {
  padding: 0;
  border: 0;
}

.density-field legend {
  margin-bottom: 8px;
  padding: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-muted);
}

.segmented-control label {
  cursor: pointer;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.segmented-control input:checked + span {
  color: white;
  background: var(--navy);
  box-shadow: 0 3px 8px rgb(37 59 70 / 18%);
}

.segmented-control input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.export-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.completion-summary strong,
.completion-summary span {
  display: block;
}

.completion-summary strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.completion-summary span {
  color: var(--ink-soft);
  font-size: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
  transition: 160ms ease;
}

.primary-button {
  display: inline-flex;
  min-width: 196px;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px 0 19px;
  color: white;
  border: 1px solid var(--accent);
  background: var(--accent);
  box-shadow: 0 7px 0 var(--accent-dark);
}

.primary-button:hover:not(:disabled) {
  background: #d75e36;
  transform: translateY(-2px);
  box-shadow: 0 9px 0 var(--accent-dark);
}

.primary-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--accent-dark);
}

.primary-button:disabled {
  color: #8e8b84;
  border-color: #d7d2c8;
  background: #e5e1d9;
  box-shadow: 0 5px 0 #c9c3b8;
  cursor: not-allowed;
}

.button-arrow {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 5px;
  background: rgb(255 255 255 / 18%);
  font-size: 18px;
}

.export-note {
  margin: 15px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.success-panel {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--success) 24%, white);
  border-radius: 10px;
  background: var(--success-soft);
}

.success-copy {
  display: flex;
  gap: 11px;
  align-items: center;
}

.success-copy strong,
.success-copy span {
  display: block;
}

.success-copy div > span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.success-mark {
  display: grid;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--success);
  font-weight: 900;
}

.secondary-button {
  min-height: 40px;
  padding: 0 13px;
  color: var(--success);
  border: 1px solid var(--success);
  background: transparent;
  font-size: 12px;
}

.secondary-button:hover:not(:disabled) {
  color: white;
  background: var(--success);
}

.secondary-button:disabled {
  color: var(--ink-soft);
  border-color: var(--line);
  cursor: default;
}

.preview-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
  background: var(--desk-deep);
}

.preview-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 23px 25px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
}

.preview-toolbar .eyebrow {
  margin-bottom: 6px;
}

.preview-toolbar h2 {
  margin: 0;
}

#page-count {
  padding-bottom: 2px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
}

.document-preview {
  display: grid;
  max-height: 790px;
  min-height: 610px;
  gap: 20px;
  padding: clamp(18px, 3vw, 34px);
  overflow: auto;
  align-content: start;
}

.preview-empty {
  display: grid;
  place-items: center;
  align-self: center;
  color: var(--ink-soft);
  text-align: center;
}

.preview-empty strong {
  margin: 22px 0 5px;
  color: var(--ink);
  font-family: var(--font-display);
}

.preview-empty > span {
  max-width: 240px;
  font-size: 12px;
  line-height: 1.5;
}

.empty-page {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  width: 150px;
  height: 210px;
  padding: 30px 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 12px 24px rgb(55 48 37 / 12%);
}

.empty-page span {
  border: 1px dashed var(--line);
  background: var(--surface-muted);
}

.document-page {
  position: relative;
  display: flex;
  width: min(100%, 470px);
  aspect-ratio: 210 / 297;
  flex-direction: column;
  justify-self: center;
  padding: 6.5% 7%;
  overflow: hidden;
  color: #141716;
  border: 1px solid #ddd9d1;
  background: var(--paper);
  box-shadow: 0 14px 32px rgb(55 48 37 / 15%);
}

.document-page::after {
  position: absolute;
  right: 6%;
  bottom: 2.6%;
  color: #8a8a87;
  content: attr(data-page);
  font-family: var(--font-display);
  font-size: 8px;
}

.document-page h3 {
  flex: 0 0 auto;
  margin: 0 0 4.5%;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: clamp(10px, 1.25vw, 16px);
  font-weight: 700;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-grid {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  border-top: 1px solid #333;
  border-left: 1px solid #333;
}

.document-photo,
.document-slot-empty {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 3.5%;
  border-right: 1px solid #333;
  border-bottom: 1px solid #333;
}

.document-photo img {
  display: block;
  width: 100%;
  min-height: 0;
  flex: 1;
  object-fit: contain;
  background: #f4f4f2;
}

.document-photo p {
  flex: 0 0 auto;
  min-height: 1.8em;
  margin: 3.5% 1% 0;
  overflow: hidden;
  font-family: "Times New Roman", serif;
  font-size: clamp(5px, 0.75vw, 9px);
  line-height: 1.15;
  text-align: center;
}

.document-photo p.is-placeholder {
  color: #9c9b96;
}

.document-slot-empty {
  background: #fafafa;
}

.preview-disclaimer {
  margin: 0;
  padding: 13px 24px 15px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-strong);
  background: rgb(255 253 250 / 55%);
  font-size: 10px;
  line-height: 1.4;
}

footer {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 64px);
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 11px;
}

footer a {
  color: var(--navy);
  font-weight: 800;
  text-underline-offset: 3px;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(370px, 0.88fr);
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .document-preview {
    min-height: 560px;
  }
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 28px, 680px);
    padding-top: 38px;
  }

  .intro,
  .workspace {
    grid-template-columns: 1fr;
  }

  .intro {
    gap: 24px;
  }

  h1 {
    font-size: clamp(39px, 11vw, 60px);
  }

  .preview-panel {
    position: static;
  }

  .document-preview {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    min-height: 58px;
    padding: 9px 14px;
  }

  .brand-mark {
    width: 31px;
    height: 31px;
  }

  .local-badge {
    max-width: 145px;
    font-size: 10px;
    line-height: 1.25;
  }

  .shell {
    width: min(100% - 20px, 520px);
    padding: 29px 0 50px;
  }

  .intro {
    margin-bottom: 27px;
    padding: 0 3px;
  }

  h1 {
    margin-bottom: 14px;
    font-size: clamp(37px, 12.5vw, 52px);
  }

  .lead {
    font-size: 16px;
  }

  .privacy-note {
    padding: 15px;
  }

  .section-panel {
    padding: 19px 15px;
  }

  .section-heading {
    gap: 12px;
    margin-bottom: 19px;
  }

  .section-heading h2 {
    font-size: 20px;
  }

  .dropzone {
    min-height: 190px;
    padding: 24px 15px;
  }

  .demo-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .text-button {
    width: 100%;
  }

  .photo-card {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 10px;
    padding: 9px;
  }

  .photo-thumb,
  .photo-thumb img {
    min-height: 116px;
  }

  .photo-card-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-actions {
    width: 100%;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .caption-label textarea {
    min-height: 66px;
  }

  .export-row,
  .success-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .secondary-button {
    width: 100%;
  }

  .preview-toolbar {
    padding: 19px 17px 15px;
  }

  .document-preview {
    min-height: 470px;
    padding: 18px 12px;
  }

  .document-page {
    width: min(100%, 420px);
  }

  .preview-disclaimer {
    padding-inline: 16px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@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;
  }
}
