:root {
  --canvas: #f2efe7;
  --paper: #fffef9;
  --ink: #171713;
  --muted: #656159;
  --line: #d5d0c4;
  --soft-line: #e7e2d8;
  --accent: #9b2f1f;
  --accent-dark: #7e2115;
  --focus: #1265a8;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Iowan Old Style, Palatino Linotype, Book Antiqua, Palatino, Georgia, serif;
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.live-region { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.site-shell { min-height: 100vh; padding: 0 42px; display: flex; flex-direction: column; }
.site-header {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.05em;
  text-decoration: none;
}
.wordmark span { color: var(--accent); }
.header-meta { display: flex; align-items: center; gap: 28px; }
.privacy-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #4d4a43;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.privacy-status i, .local-caption i { width: 7px; height: 7px; border-radius: 50%; background: #477b4a; box-shadow: 0 0 0 3px #dce6d9; }
.text-button { border: 0; border-bottom: 1px solid currentColor; background: none; padding: 4px 0; cursor: pointer; font-size: 13px; }

main { flex: 1; }
.hero {
  min-height: calc(100vh - 148px);
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(390px, 0.8fr);
  grid-template-rows: 1fr auto;
  column-gap: clamp(70px, 9vw, 150px);
  align-items: center;
  padding: 64px 36px 28px;
}
.hero-copy { max-width: 690px; padding-bottom: 20px; }
.eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 26px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.eyebrow b { color: var(--muted); font-weight: 400; }
.eyebrow span { display: inline-block; }
.hero h1, .workspace-intro h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(54px, 6.2vw, 92px);
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: -0.055em;
}
.hero h1 em { color: var(--accent); font-weight: 400; }
.hero-lead { max-width: 590px; margin: 30px 0 0; color: #4f4b43; font-family: var(--serif); font-size: 20px; line-height: 1.55; }
.feature-row { display: flex; gap: 0; padding: 0; margin: 46px 0 0; list-style: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feature-row li { min-width: 0; flex: 1; display: grid; gap: 3px; padding: 16px 19px 16px 0; }
.feature-row li + li { padding-left: 19px; border-left: 1px solid var(--line); }
.feature-row strong { font-family: var(--serif); font-size: 19px; }
.feature-row span { color: var(--muted); font-size: 10px; letter-spacing: 0.045em; text-transform: uppercase; }

.upload-stage { position: relative; width: min(100%, 490px); justify-self: end; }
.paper-shadow { position: absolute; inset: 0; border: 1px solid #cbc5b9; background: #e9e5dc; }
.paper-shadow-one { transform: rotate(4deg) translate(10px, -3px); }
.paper-shadow-two { transform: rotate(-2.5deg) translate(-7px, 5px); background: #f9f6ee; }
.upload-card { position: relative; z-index: 2; padding: 26px; background: var(--paper); border: 1px solid #c9c3b6; box-shadow: 0 20px 50px rgba(51, 42, 29, 0.13); }
.upload-card-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 19px; border-bottom: 1px solid var(--soft-line); color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.format-pill { padding: 5px 7px; color: var(--accent); border: 1px solid #d4a9a1; background: #fbefeb; }
.drop-zone { width: 100%; min-height: 335px; margin-top: 18px; padding: 36px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed #aaa397; background: #fbfaf5; cursor: pointer; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--accent); background: #fbf1ed; transform: translateY(-2px); }
.file-mark { width: 46px; height: 58px; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 13px 9px; margin-bottom: 28px; border: 1.5px solid var(--accent); border-radius: 1px; transform: rotate(-3deg); box-shadow: 7px 6px 0 #ead9d2; }
.file-mark i { display: block; height: 1px; background: var(--accent); }
.file-mark i:nth-child(2) { width: 75%; }
.drop-title { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.drop-or { margin: 8px 0; color: #827d73; font-family: var(--serif); font-size: 13px; font-style: italic; }
.choose-file { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: 3px; }
.choose-file b { margin-left: 5px; }
.file-help { margin: 17px 0 0; color: #777269; text-align: center; font-size: 10px; letter-spacing: 0.045em; text-transform: uppercase; }
.error-message { position: relative; z-index: 3; margin: 14px 0 0; padding: 11px 13px; background: #fff1ed; border-left: 3px solid var(--accent); color: #6e1c12; font-size: 13px; line-height: 1.45; }
.privacy-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; align-self: end; margin-top: 30px; color: var(--muted); }
.privacy-note p { margin: 0; font-size: 11px; letter-spacing: 0.015em; }
.privacy-note strong { color: var(--ink); }
.lock-mark { width: 17px; height: 14px; position: relative; border: 1.5px solid var(--ink); border-radius: 2px; }
.lock-mark::before { content: ""; position: absolute; width: 8px; height: 8px; left: 3px; top: -8px; border: 1.5px solid var(--ink); border-bottom: 0; border-radius: 6px 6px 0 0; }

.workspace { max-width: 1420px; margin: 0 auto; padding: 58px 24px 72px; }
.workspace-intro { max-width: 860px; margin-bottom: 52px; }
.workspace-intro h1 { font-size: clamp(50px, 5.4vw, 78px); }
.workspace-intro > p:last-child { max-width: 630px; color: var(--muted); font-family: var(--serif); font-size: 18px; line-height: 1.5; }
.editor-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: clamp(34px, 5vw, 78px); align-items: start; }
.control-panel { position: sticky; top: 24px; padding: 25px; background: #fbfaf5; border: 1px solid var(--line); }
.file-summary { display: grid; grid-template-columns: 42px 1fr 28px; gap: 12px; align-items: center; padding-bottom: 21px; border-bottom: 1px solid var(--soft-line); }
.mini-file { width: 40px; height: 48px; display: grid; place-items: end center; padding-bottom: 8px; border: 1px solid #b8b1a6; color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: 0.07em; }
.file-summary > span:nth-child(2) { min-width: 0; display: grid; gap: 4px; }
.file-summary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.file-summary small { color: var(--muted); font-size: 10px; }
.file-summary button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.field-group { margin-top: 25px; }
.field-group label, .mode-group legend { display: block; padding: 0; margin: 0 0 9px; color: #4f4b44; font-size: 10px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.field-group input { width: 100%; padding: 12px 11px; border: 1px solid #bdb7ab; border-radius: 0; background: var(--paper); color: var(--ink); }
.field-group input:focus { border-color: var(--focus); }
.mode-group { margin: 26px 0 0; padding: 0; border: 0; }
.mode-group label { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; min-height: 62px; padding: 12px; border: 1px solid var(--line); cursor: pointer; }
.mode-group label + label { margin-top: 8px; }
.mode-group label.selected { border-color: var(--accent); background: #fbefeb; box-shadow: inset 3px 0 0 var(--accent); }
.mode-group input { position: absolute; opacity: 0; pointer-events: none; }
.mode-group span { display: grid; gap: 3px; }
.mode-group strong { font-size: 12px; }
.mode-group small { color: var(--muted); font-size: 10px; }
.mode-group i { font-family: var(--serif); font-size: 16px; font-style: normal; }
.mode-group .large-aa { font-size: 20px; }
.document-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 28px 0 0; border-top: 1px solid var(--soft-line); border-bottom: 1px solid var(--soft-line); }
.document-stats div { display: grid; gap: 5px; padding: 13px 4px; text-align: center; }
.document-stats div + div { border-left: 1px solid var(--soft-line); }
.document-stats dt { color: var(--muted); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.document-stats dd { margin: 0; font-family: var(--serif); font-size: 15px; }
.panel-error { position: static; }
.download-button { width: 100%; min-height: 53px; display: flex; align-items: center; justify-content: space-between; margin-top: 22px; padding: 0 18px; border: 1px solid var(--accent-dark); background: var(--accent); color: #fff; cursor: pointer; font-size: 12px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.download-button b { font-size: 19px; }
.download-button:hover { background: var(--accent-dark); }
.download-button:disabled { opacity: 0.55; cursor: not-allowed; }
.local-caption { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 12px 0 0; color: var(--muted); font-size: 9px; }
.local-caption i { width: 6px; height: 6px; }

.preview-area { min-width: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.preview-toolbar h2, .preview-toolbar span { margin: 0; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.paper-frame { max-height: 980px; overflow: auto; padding: clamp(22px, 4vw, 56px); background: #d9d5cc; border: 1px solid #c7c1b5; box-shadow: inset 0 0 40px rgba(50, 44, 35, 0.08); }
.paper-preview { width: min(100%, 760px); min-height: 1000px; margin: 0 auto; padding: clamp(60px, 8vw, 100px) clamp(48px, 8vw, 96px) 42px; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 12px 35px rgba(41, 35, 25, 0.14); }
.paper-preview header { padding-bottom: 26px; border-bottom: 1px solid #cfc8bb; }
.paper-preview header > p { margin: 0 0 25px; color: var(--accent); font-family: var(--sans); font-size: 8px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; }
.paper-preview header h2 { max-width: 20ch; margin: 0; font-family: var(--serif); font-size: clamp(29px, 4vw, 42px); line-height: 1.05; font-weight: 700; letter-spacing: -0.035em; }
.paper-preview header div { display: flex; justify-content: space-between; margin-top: 26px; color: var(--muted); font-family: var(--sans); font-size: 8px; letter-spacing: 0.08em; text-transform: uppercase; }
.preview-copy { flex: 1; padding-top: 34px; font-family: var(--serif); font-size: 17px; line-height: 1.62; }
.preview-copy p { max-width: 65ch; margin: 0 0 1.25em; }
.preview-copy h3 { max-width: 50ch; margin: 2em 0 0.7em; font-size: 1.08em; line-height: 1.3; letter-spacing: 0.02em; }
.paper-preview.large-type .preview-copy { font-size: 19px; line-height: 1.62; }
.paper-preview footer { display: flex; justify-content: space-between; padding-top: 16px; margin-top: 35px; border-top: 1px solid #cfc8bb; color: var(--muted); font-family: var(--sans); font-size: 8px; letter-spacing: 0.14em; }
.paper-preview footer span:first-child { color: var(--accent); font-weight: 800; }

.site-footer { min-height: 60px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; letter-spacing: 0.04em; }

@media (max-width: 980px) {
  .site-shell { padding: 0 24px; }
  .hero { grid-template-columns: 1fr; gap: 54px; padding: 58px 12px 30px; }
  .upload-stage { justify-self: center; width: min(100%, 560px); }
  .privacy-note { grid-column: auto; }
  .editor-grid { grid-template-columns: 1fr; }
  .control-panel { position: static; }
  .paper-frame { max-height: 850px; }
}

@media (max-width: 600px) {
  .site-shell { padding: 0 16px; }
  .site-header { min-height: 70px; }
  .privacy-status { font-size: 9px; }
  .header-meta { gap: 14px; }
  .text-button { font-size: 11px; }
  .hero { min-height: auto; padding: 45px 4px 28px; }
  .hero h1 { font-size: clamp(44px, 14vw, 64px); }
  .hero-lead { font-size: 18px; }
  .feature-row { flex-direction: column; }
  .feature-row li + li { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .upload-card { padding: 18px; }
  .drop-zone { min-height: 290px; }
  .privacy-note { align-items: flex-start; }
  .workspace { padding: 42px 2px 56px; }
  .workspace-intro h1 { font-size: 47px; }
  .control-panel { padding: 20px 16px; }
  .paper-frame { padding: 12px; }
  .paper-preview { min-height: 850px; padding: 52px 32px 32px; }
  .preview-copy { font-size: 16px; }
  .paper-preview.large-type .preview-copy { font-size: 18px; }
  .site-footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (forced-colors: active) {
  .drop-zone, .upload-card, .control-panel, .mode-group label { border: 1px solid CanvasText; }
  .privacy-status i, .local-caption i { background: CanvasText; box-shadow: none; }
}
