@font-face {
  font-family: "DM Sans";
  src: url("/assets/dm-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #191b1e;
  --paper: #f6f0e7;
  --white: #fffaf2;
  --linen: #ede4d7;
  --sage: #b9bca5;
  --sage-light: #e3e5d9;
  --rust: #842a1c;
  --rust-light: #f4e4dc;
  --line: #d1c5b6;
  --muted: #615a50;
  font: 16px / 1.5 "DM Sans", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body, h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 500; line-height: 1.1; letter-spacing: -.035em; }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }

.shell { width: min(100% - 64px, 1120px); margin-inline: auto; }
.skip-link, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip-link:focus {
  z-index: 2;
  width: auto;
  height: auto;
  clip-path: none;
  background: var(--white);
  color: var(--ink);
  padding: 12px;
}

.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
}
.masthead img { width: 112px; height: auto; }
.masthead span { color: var(--muted); font-size: .87rem; }

.welcome {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 36px;
  padding: clamp(25px, 5vw, 60px);
  background: var(--sage);
  border-radius: 4px 28px 8px 14px / 22px 10px 26px 8px;
}
.welcome h1 {
  font-size: clamp(2.6rem, 7.5vw, 5.25rem);
  letter-spacing: -.068em;
}
.welcome p {
  max-width: 470px;
  margin-top: 15px;
  font-size: clamp(.94rem, 1.8vw, 1.08rem);
}
.welcome-elf {
  display: block;
  width: clamp(68px, 17vw, 145px);
  height: auto;
  max-height: 150px;
  object-fit: contain;
  margin-inline: 8px clamp(0px, 3vw, 35px);
  transform: rotate(6deg);
}

.workspace { margin-block: 44px 76px; }
.workspace-head {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.workspace h2 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.055em; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 42px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: .89rem;
  font-weight: 600;
  text-align: left;
}
.button[aria-busy="true"] { opacity: .6; cursor: progress; }
.primary { background: var(--rust); border-color: var(--rust); color: var(--white); }
.primary:hover:not(:disabled) { background: #6d2015; border-color: #6d2015; }
.outline { background: transparent; color: var(--ink); }
.outline:hover:not(:disabled) { background: var(--linen); }
.arrow {
  flex: none;
  width: 15px;
  height: 15px;
  background: currentColor;
  mask: url("/assets/arrow.svg") center / contain no-repeat;
}

.views {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 23px;
  margin-top: 14px;
  border-bottom: 1px solid var(--line);
}
.views button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 11px 1px;
  background: transparent;
  color: var(--muted);
  font-size: .91rem;
}
.views button:hover, .views button[aria-pressed="true"] { color: var(--ink); }
.views button[aria-pressed="true"] { border-bottom-color: var(--ink); font-weight: 650; }
.views span:not(:empty) {
  min-width: 1.3rem;
  padding-inline: 3px;
  border-radius: 50%;
  background: var(--linen);
  text-align: center;
  font-size: .72rem;
  line-height: 1.3rem;
  font-variant-numeric: tabular-nums;
}

.empty {
  margin-top: 18px;
  padding: clamp(26px, 5vw, 56px) 16px;
  border: 1px dashed var(--line);
  text-align: center;
  color: var(--muted);
}
.empty h3 { margin-bottom: 7px; color: var(--ink); font-size: 1.55rem; }
.notice {
  margin-top: 15px;
  padding: 10px 13px;
  border-left: 2px solid var(--ink);
  background: var(--sage-light);
  font-size: .91rem;
}
.notice[data-kind="error"], .notice[data-kind="connection"], .render-error {
  background: var(--rust-light);
  color: var(--rust);
}

.job {
  margin-top: 22px;
  border: 1px solid var(--line);
  background: var(--white);
}
.job-head, .export-area {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 17px clamp(15px, 3vw, 24px);
}
.job-head { background: var(--linen); }
.job-name { font-size: 1.62rem; }
.job-progress, .elf-status, .export-help { color: var(--muted); font-size: .91rem; }
.job-progress:not(:empty), .export-help:not(:empty) { margin-top: 5px; }
.badge {
  padding: 4px 9px;
  border: 1px solid currentColor;
  color: var(--muted);
  font-size: .77rem;
  font-weight: 650;
}
.badge[data-tone="rust"] { background: var(--rust-light); color: var(--rust); }
.badge[data-tone="sage"] { background: var(--sage-light); color: #37432f; }

.elf {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(260px, 1fr);
  gap: clamp(18px, 3vw, 30px);
  padding: clamp(15px, 3vw, 24px);
  align-items: start;
}
.elf + .elf { border-top: 1px solid var(--line); }
.proof { min-width: 0; }
.preview {
  display: grid;
  align-content: center;
  background: var(--linen);
  min-height: 135px;
  color: var(--muted);
  text-align: center;
}
.preview img { width: 100%; display: block; }
.placeholder { padding: 12px; font-size: .9rem; }
figcaption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  color: var(--muted);
  padding: 6px 0 0;
  text-align: center;
  font-size: .82rem;
}
.details h4, .export-title { font-size: 1.25rem; }
.elf-status { margin-top: 8px; }
.render-error { padding: 8px 10px; margin-top: 10px; font-size: .88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions:has(button:not([hidden])) { margin-top: 15px; }

.adjust { border-block: 1px solid var(--line); margin-top: 15px; }
.adjust summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-block: 11px;
  font-size: .9rem;
  font-weight: 600;
}
.adjust summary::-webkit-details-marker { display: none; }
.adjust summary::after { content: "+"; font-size: 1.1rem; line-height: 1.1; }
.adjust[open] summary::after { content: "−"; }
.adjust form { padding-bottom: 13px; }
fieldset { margin: 0; border: 0; padding: 0; min-width: 0; }
.controls {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-block: 12px 16px;
}
.controls label, .check { font-size: .83rem; }
.controls label:not(.check) > * { display: block; width: 100%; margin-top: 3px; }
.check { display: flex; align-items: center; gap: 5px; }
input { accent-color: var(--rust); }
select, input[type="color"] { color: var(--ink); background: var(--paper); border: 1px solid var(--line); }
select { min-height: 34px; padding-inline: 7px; }
.export-area { border-top: 1px solid var(--line); background: var(--sage-light); }

dialog {
  width: min(100% - 32px, 470px);
  max-height: calc(100dvh - 32px);
  padding: clamp(18px, 4vw, 28px);
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
}
dialog::backdrop { background: #191b1e71; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.dialog-head h2 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
.close {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
}
#proof-form > p:first-of-type { margin: 12px 0 19px; color: var(--muted); }
#proof-form label { display: block; margin-bottom: 7px; font-weight: 600; }
#portrait { display: block; max-width: 100%; padding: 8px; border: 1px solid var(--line); background: var(--white); }
#portrait::file-selector-button {
  margin-right: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--linen);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.file-help { margin-top: 5px; color: var(--muted); font-size: .83rem; }
#proof-form .primary { margin-top: 18px; }

@media (max-width: 710px) {
  .shell { width: calc(100% - 36px); }
  .welcome { margin-top: 22px; }
  .workspace { margin-top: 30px; }
  .elf { grid-template-columns: 1fr; }
}
@media (max-width: 385px) {
  .welcome { gap: 8px; padding: 19px; }
  .welcome h1 { font-size: 2.15rem; }
  .welcome-elf { width: 49px; margin: 0; }
  .views { column-gap: 13px; }
}
