@font-face {
  font-family: "Real Pro Display";
  src: local("Avenir Next Ultra Light"), local("Avenir Next UltraLight"), local("AvenirNext-UltraLight");
  font-weight: 200;
  font-display: swap;
}

:root {
  --graphite: #202c34;
  --petrol: #466a73;
  --mineral: #d3d8d7;
  --porcelain: #f6f4ef;
  --white: #fdfcf9;
  --ink-soft: #55636a;
  --line: #d8dbd5;
  --focus: #466a73;
  --error: #8a3931;
  --body-font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --display-font: "Real Pro Display", "Avenir Next", "Segoe UI Light", "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--porcelain); color: var(--graphite); font: 500 1rem/1.5 var(--body-font); }
button, input { font: inherit; }
a { color: inherit; }
button { color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible, .picker:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 4px; }

.container { width: min(1120px, calc(100% - 96px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark { text-decoration: none; white-space: nowrap; font: 200 2.2rem/1 var(--display-font); letter-spacing: .095em; }
.navigation { display: flex; align-items: center; gap: 29px; font-size: .85rem; }
.navigation a { position: relative; text-decoration: none; color: var(--ink-soft); white-space: nowrap; }
.navigation a:hover { color: var(--graphite); }
.navigation a[aria-current] { color: var(--graphite); font-weight: 700; }
.navigation a[aria-current]::after { content: ""; position: absolute; height: 1px; background: var(--petrol); inset: auto 0 -7px; }

.hero {
  min-height: 312px; display: grid; grid-template-columns: 1.2fr 1fr;
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 48px 0 42px; background: var(--white);
}
.hero-content { padding: 38px 45px 40px; align-self: center; }
.hero h1, .editor-intro h1 { font: 200 clamp(3rem, 6vw, 5.8rem)/.98 var(--display-font); letter-spacing: -.055em; }
.hero-content p { margin-top: 26px; color: var(--ink-soft); max-width: 35ch; font-size: 1rem; }
.hero-art {
  position: relative; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(ellipse at 79% 28%, #466a73 0, #35535b 39%, #202c34 91%); isolation: isolate;
}
.art-grid {
  position: absolute; inset: -70%; z-index: -1; transform: rotate(-26deg);
  background-image: linear-gradient(to right, #d3d8d733 1px, transparent 1px), linear-gradient(to bottom, #d3d8d733 1px, transparent 1px);
  background-size: 45px 45px; mask-image: radial-gradient(ellipse, black 15%, transparent 65%);
}
.art-paper {
  position: relative; padding: 27px 18px 19px; width: min(56%, 245px); aspect-ratio: 1.15;
  border-radius: 7px; background: var(--porcelain); transform: rotate(-12deg) skew(5deg, 0deg);
  box-shadow: 0 18px 38px #101e2590, 8px 11px 0 #8baba9, 12px 18px 0 #668b8d;
}
.art-paper::before { content: ""; position: absolute; inset: 12px auto auto 18px; width: 30%; height: 4px; border-radius: 20px; background: var(--petrol); }
.art-sheet {
  position: relative; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr);
  width: 100%; height: 100%; border-top: 1px solid #9eaaa7; border-left: 1px solid #9eaaa7;
}
.art-sheet i { border-right: 1px solid #9eaaa7; border-bottom: 1px solid #9eaaa7; }
.art-sheet i:nth-child(-n+2) { background: var(--mineral); }
.art-sheet i:nth-child(2n+3)::before { display: block; content: ""; background: #acb9b6; width: 35%; height: 2px; margin: 11px 7px; }
.art-building {
  position: absolute; right: -16%; bottom: 13%; width: 55%; aspect-ratio: 1.08;
  display: grid; place-items: center; background: #466a73; outline: 4px solid var(--porcelain); border: 1px solid #c8d6d3;
}
.art-building span { position: relative; width: 54%; height: 44%; margin-top: 13%; border: 1px solid #e2e8e3; }
.art-building span::before { content: ""; position: absolute; width: 66%; aspect-ratio: 1; left: 16%; top: 0; transform: translateY(-51%) rotate(45deg); border-top: 1px solid #e2e8e3; border-left: 1px solid #e2e8e3; }
.art-building span::after { content: ""; position: absolute; width: 19%; height: 55%; inset: auto auto 0 39%; border: 1px solid #e2e8e3; border-bottom: 0; }

.template-section h2, .history h2 { font-size: 1.4rem; letter-spacing: -.035em; font-weight: 600; }
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 13px; }
.template-card {
  min-height: 115px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 19px 22px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; background: var(--white);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.template-card:hover { background: #f1f3ee; border-color: var(--petrol); transform: translateY(-2px); }
.template-card h3 { font-size: 1.42rem; letter-spacing: -.035em; font-weight: 600; }
.template-card p, .history-heading p { color: var(--ink-soft); font-size: .9rem; }
.template-icon, .card-arrow, .history-icon, .drop-icon, .summary-icon {
  display: inline-grid; place-items: center; flex: none; color: var(--petrol); background: var(--mineral);
}
.template-icon { width: 52px; height: 54px; border-radius: 8px; }
.card-arrow { color: var(--graphite); background: transparent; font-size: 1.5rem; width: 34px; }

.history { margin: 43px 0 36px; scroll-margin: 26px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.history-count, .field-count {
  background: var(--mineral); color: var(--graphite); border-radius: 6px; padding: 4px 9px;
  flex: none; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.history-box { background: #eceee9; border: 1px solid var(--line); border-radius: 10px; }
.history-empty { min-height: 75px; display: flex; align-items: center; gap: 13px; padding: 16px 20px; color: var(--ink-soft); font-size: .9rem; }
.history-icon { width: 37px; height: 39px; border-radius: 6px; }
.history-icon .icon-sheet { transform: scale(.75); }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 13px; align-items: center; padding: 13px 17px; min-height: 65px; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-file { display: flex; flex-direction: column; min-width: 0; }
.history-file strong { font-weight: 600; font-size: .91rem; overflow-wrap: anywhere; }
.history-file > span { color: var(--ink-soft); font-size: .78rem; }
.download-link, .back-link { text-decoration: none; color: var(--petrol); font-weight: 700; font-size: .85rem; }
.download-link { display: flex; gap: 8px; align-items: center; padding: 7px 8px; }
.download-link:hover, .back-link:hover { text-decoration: underline; }

.editor-intro { margin: 34px 0 28px; }
.back-link { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 19px; }
.editor-intro h1 { font-size: clamp(2.6rem, 5.8vw, 4.9rem); letter-spacing: -.055em; }
.editor-intro p { color: var(--ink-soft); margin-top: 14px; font-size: .95rem; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(244px, 1fr); gap: 20px; align-items: start; }
.fields { display: grid; gap: 13px; min-width: 0; }
.field { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--white); }
.field-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 0 2px 12px; }
.field-heading h2, .summary h2 { font-size: 1.12rem; letter-spacing: -.025em; font-weight: 650; }
.field-heading p { color: var(--ink-soft); font-size: .84rem; margin-top: 2px; }
.drop-zone {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 76px;
  padding: 11px 12px; border-radius: 7px; border: 1px dashed #a7b6b4; background: #f6f7f2;
}
.drop-zone.is-over { background: #e4ece8; border-color: var(--petrol); outline: 2px solid var(--petrol); outline-offset: -2px; }
.drop-icon { width: 40px; height: 40px; border-radius: 7px; }
.drop-copy { display: flex; flex-direction: column; }
.drop-copy strong { font-size: .88rem; font-weight: 700; }
.drop-copy span { font-size: .75rem; color: var(--ink-soft); }
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 42px; gap: 10px;
  padding: 8px 13px; border: 1px solid transparent; border-radius: 6px; font-weight: 700;
  font-size: .83rem; text-align: center; text-decoration: none; cursor: pointer;
}
.button-secondary { background: var(--white); border-color: #bfcac6; color: var(--graphite); }
.button-secondary:hover { border-color: var(--petrol); background: #ebefea; }
.button-primary { background: var(--porcelain); color: var(--graphite); }
.button-primary:hover:not(:disabled) { background: #e0e9e6; }
.button-primary:disabled { opacity: .52; cursor: default; }
.picker:has(:disabled) { opacity: .66; cursor: default; }
.summary {
  position: sticky; top: 18px; background: var(--graphite); color: var(--porcelain);
  border-radius: 10px; padding: 19px; min-width: 0;
}
.summary-top { display: flex; gap: 11px; align-items: center; }
.summary-top p, .summary-note { font-size: .79rem; color: #d3d8d7; }
.summary-icon { height: 42px; width: 42px; border-radius: 6px; color: var(--porcelain); background: var(--petrol); }
.summary-details { margin: 19px 0 15px; border-top: 1px solid #5f6d73; padding-top: 11px; font-size: .82rem; }
.summary-details div { display: flex; justify-content: space-between; padding: 3px 0; gap: 6px; }
.summary-details dt { color: #dee3e1; }
.summary-details dd { margin: 0; font-variant-numeric: tabular-nums; }
.summary .button-primary { width: 100%; justify-content: space-between; margin-bottom: 11px; }
.summary .button-primary:focus-visible { outline-color: var(--white); }
.form-status { margin-top: 11px; padding-top: 10px; border-top: 1px solid #5f6d73; font-size: .83rem; color: var(--porcelain); }
.form-status.is-error { color: #ffcec6; }
.form-status a { display: inline-block; margin-top: 5px; font-weight: 700; }
.field-status { color: var(--error); font-size: .8rem; margin: 9px 0 0; }
.field-count.is-error { color: var(--error); background: #f4dfda; }
.muted { color: var(--ink-soft); }

.attachments { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.attachment {
  min-width: 0; display: grid; grid-template-columns: auto 48px minmax(0, 1fr) auto; align-items: center;
  gap: 9px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--white);
}
.attachment.is-dragging { opacity: .35; }
.attachment.insert-before { box-shadow: 0 -2px 0 var(--petrol); }
.attachment.insert-after { box-shadow: 0 2px 0 var(--petrol); }
.drag-handle {
  width: 13px; height: 26px; opacity: .35;
  background: radial-gradient(circle at center, #7a8b8c 1px, transparent 1.5px) 0 0 / 4px 5px;
}
.drag-handle.is-active { cursor: grab; user-select: none; touch-action: none; opacity: 1; }
.is-dragging .drag-handle { cursor: grabbing; }
.attachment-preview {
  overflow: hidden; position: relative; padding: 0; width: 48px; height: 40px; border: 0; border-radius: 4px;
  color: var(--petrol); background: #e6ebe7; cursor: zoom-in; display: grid; place-items: center;
}
.attachment-preview img { width: 100%; height: 100%; object-fit: contain; }
.attachment-format { font-weight: 700; font-size: .61rem; }
.attachment-preview img:not([hidden]) + .attachment-format { display: none; }
.attachment-text { min-width: 0; display: flex; flex-direction: column; font-size: .82rem; }
.attachment-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.attachment-text span { color: var(--ink-soft); font-size: .7rem; }
.attachment-actions { display: flex; gap: 3px; }
.icon-button {
  min-width: 33px; min-height: 33px; border-radius: 4px; border: 1px solid transparent; background: transparent;
  cursor: pointer; font-size: 1.08rem; line-height: 1;
}
.icon-button:hover:not(:disabled) { background: #edf0ec; border-color: var(--line); }
.icon-button:disabled { opacity: .25; cursor: default; }
.icon-button[data-action="remove"]:hover { color: var(--error); }

.preview-dialog {
  width: min(690px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: 10px; background: var(--white); color: var(--graphite); box-shadow: 0 20px 80px #202c3455;
}
.preview-dialog::backdrop { background: #202c34aa; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 12px 17px; }
.dialog-heading h2 { font-size: 1rem; overflow-wrap: anywhere; }
.dialog-content { display: grid; place-items: center; background: #edf0eb; padding: 13px; min-height: 100px; }
.dialog-content img { max-height: min(66dvh, 750px); max-width: 100%; object-fit: contain; }
.dialog-content p { color: var(--ink-soft); font-size: .88rem; }
.dialog-footer:has(a:not([hidden])) { padding: 10px 16px; }

.icon { position: relative; display: inline-block; flex: none; color: inherit; }
.icon-sheet { width: 17px; height: 21px; border: 1.5px solid currentColor; border-radius: 2px; }
.icon-sheet::before {
  content: ""; position: absolute; inset: 5px 3px 4px; border: 1px solid currentColor;
  background: linear-gradient(90deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%),
              linear-gradient(transparent 44%, currentColor 44%, currentColor 57%, transparent 57%);
}
.icon-download, .icon-upload { width: 15px; height: 14px; border-bottom: 1.5px solid currentColor; border-radius: 2px; }
.icon-download::before, .icon-upload::before { content: ""; position: absolute; width: 1.5px; height: 8px; background: currentColor; top: 0; left: calc(50% - .75px); }
.icon-download::after, .icon-upload::after {
  content: ""; position: absolute; width: 5px; height: 5px; top: 3px; left: calc(50% - 3.5px);
  border-bottom: 1.5px solid currentColor; border-right: 1.5px solid currentColor; transform: rotate(45deg);
}
.icon-upload::after { top: 0; transform: rotate(225deg); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 850px) {
  .container { width: min(100% - 48px, 760px); }
  .hero { min-height: 278px; margin-top: 31px; }
  .hero-content { padding: 28px; }
  .editor-grid { grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 12px; }
  .field, .summary { padding: 13px; }
}

@media (max-width: 650px) {
  .container { width: calc(100% - 30px); }
  .masthead-inner { min-height: 63px; gap: 12px; }
  .wordmark { font-size: 1.55rem; }
  .navigation { gap: 12px; font-size: .73rem; }
  .hero { grid-template-columns: 1fr; margin: 21px 0 27px; }
  .hero-content { padding: 25px 21px; }
  .hero h1 { font-size: clamp(3rem, 11vw, 4.1rem); }
  .hero-content p { font-size: .88rem; margin-top: 14px; }
  .hero-art { min-height: 145px; }
  .art-paper { width: 118px; padding: 15px 9px 10px; }
  .art-paper::before { inset: 7px auto auto 9px; height: 2px; }
  .art-sheet i:nth-child(2n+3)::before { margin: 6px 4px; height: 1px; }
  .template-grid, .editor-grid { grid-template-columns: 1fr; gap: 9px; }
  .template-card { min-height: 81px; padding: 12px; gap: 12px; }
  .template-icon { width: 43px; height: 43px; }
  .template-card h3 { font-size: 1.18rem; }
  .template-card p, .history-heading p { font-size: .81rem; }
  .editor-intro { margin: 22px 0 20px; }
  .editor-intro h1 { font-size: clamp(2.55rem, 9vw, 3.8rem); }
  .editor-intro p { font-size: .87rem; }
  .summary { position: static; }
  .history { margin: 27px 0 24px; }
  .history-row { padding: 10px 8px; gap: 7px; }
  .history-row .history-icon { width: 30px; height: 33px; }
  .download-link { padding: 7px 3px; font-size: .75rem; }
  .icon-button { min-width: 38px; min-height: 38px; }
}

@media (max-width: 360px) {
  .navigation { gap: 9px; font-size: .66rem; }
  .drop-zone { grid-template-columns: auto minmax(0, 1fr); }
  .drop-zone .picker { grid-column: 1 / -1; }
  .drag-handle { display: none; }
  .attachment { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .attachment-preview { width: 42px; }
}

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