:root {
  --paper: #fcf9ed;
  --paper-strong: #fffdf7;
  --ink: #212020;
  --muted: #75736c;
  --line: rgba(33, 32, 32, 0.12);
  --green: #536954;
  --green-dark: #314332;
  --blue: #2f67d8;
  --amber: #b97b24;
  --red: #b4453e;
  --shadow: 0 24px 70px rgba(33, 32, 32, 0.11);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Aptos, "Segoe UI", system-ui, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
label,
.drop-zone,
summary {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 46px;
}

.hero {
  padding: 6px 0 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
}

.eyebrow,
.status-label {
  margin: 0;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 270px);
  gap: 20px;
  align-items: center;
}

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

h1 {
  max-width: 650px;
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: clamp(44px, 6.6vw, 78px);
  font-weight: 500;
  line-height: 0.94;
  letter-spacing: 0;
}

.lede {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.38;
}

.quick-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.quick-steps li {
  border: 1px solid rgba(83, 105, 84, 0.28);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 850;
}

.file-system {
  position: relative;
  min-height: 190px;
  perspective: 900px;
}

.file-card {
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  width: 124px;
  height: 154px;
  border: 1px solid rgba(33, 32, 32, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(83, 105, 84, 0.16) 0 4px, transparent 4px),
    linear-gradient(180deg, var(--paper-strong), #f5eedf);
  box-shadow: 0 24px 48px rgba(33, 32, 32, 0.13);
  transform-style: preserve-3d;
}

.file-card::before {
  position: absolute;
  right: -1px;
  top: -1px;
  width: 30px;
  height: 30px;
  border-left: 1px solid rgba(33, 32, 32, 0.16);
  border-bottom: 1px solid rgba(33, 32, 32, 0.16);
  border-radius: 0 8px 0 8px;
  background: #eee3d0;
  content: "";
}

.file-card::after {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 34px;
  height: 34px;
  border-top: 1px solid rgba(83, 105, 84, 0.35);
  border-bottom: 1px solid rgba(83, 105, 84, 0.35);
  content: "";
}

.file-card-one {
  transform: translate(-72%, -44%) rotateY(-28deg) rotateX(10deg) translateZ(-48px);
}

.file-card-two {
  transform: translate(-46%, -52%) rotateY(-15deg) rotateX(8deg) translateZ(12px);
}

.file-card-three {
  border-color: rgba(83, 105, 84, 0.42);
  background:
    linear-gradient(90deg, var(--green) 0 4px, transparent 4px),
    linear-gradient(180deg, var(--paper-strong), #f8f1df);
  transform: translate(-22%, -60%) rotateY(-6deg) rotateX(7deg) translateZ(70px);
}

.file-node {
  position: absolute;
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(83, 105, 84, 0.12);
}

.node-one {
  left: 18%;
  top: 28%;
}

.node-two {
  right: 12%;
  top: 42%;
}

.node-three {
  left: 38%;
  bottom: 12%;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.tool-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: var(--shadow);
}

.tool-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4ecdc;
}

.mode-button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 850;
}

.mode-button.is-active {
  background: var(--green);
  color: var(--paper);
  box-shadow: 0 8px 18px rgba(83, 105, 84, 0.18);
}

.field-block,
.controls-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

input[type="range"] {
  min-height: 34px;
  padding: 0;
  accent-color: var(--green);
  background: transparent;
  box-shadow: none;
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 13px;
  line-height: 1.45;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(83, 105, 84, 0.15);
}

.source-line {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.source-line a {
  flex: 0 0 auto;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.drop-zone {
  display: grid;
  min-height: 156px;
  place-items: center;
  border: 1.5px dashed rgba(83, 105, 84, 0.42);
  border-radius: 8px;
  padding: 22px;
  background: #f6efdf;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease);
}

.drop-zone:hover,
.drop-zone.is-dragging {
  transform: translateY(-2px);
  border-color: var(--blue);
  background: #eef3ff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone strong {
  display: block;
  margin-top: 12px;
  font-size: 19px;
}

.drop-zone small {
  display: block;
  max-width: 100%;
  margin-top: 7px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.drop-icon {
  position: relative;
  width: 50px;
  height: 58px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: var(--paper-strong);
}

.drop-icon::before,
.drop-icon::after {
  position: absolute;
  content: "";
}

.drop-icon::before {
  right: -2px;
  top: -2px;
  width: 16px;
  height: 16px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  background: #f6efdf;
}

.drop-icon::after {
  left: 14px;
  bottom: 14px;
  width: 18px;
  height: 18px;
  border-right: 2px solid var(--blue);
  border-bottom: 2px solid var(--blue);
  transform: rotate(45deg);
}

.advanced {
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.advanced summary {
  cursor: pointer;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 850;
}

.advanced textarea {
  margin-top: 14px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.unit-field {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 6px;
}

.primary-action,
.secondary-action,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  background: var(--green);
  color: var(--paper);
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
  transition: transform 140ms var(--ease), background 140ms var(--ease), opacity 140ms var(--ease);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-action {
  min-width: 104px;
  background: var(--ink);
}

.secondary-action:hover {
  background: var(--green-dark);
}

.download-button.is-disabled {
  background: #a9ada3;
  color: rgba(255, 253, 247, 0.9);
  cursor: not-allowed;
  pointer-events: none;
}

.primary-action:not(:disabled):hover,
.download-button:not(.is-disabled):hover {
  transform: translateY(-1px);
  background: var(--green-dark);
}

.result-panel {
  min-height: 540px;
  padding: 22px;
}

.result-empty {
  display: grid;
  min-height: 496px;
  place-items: center;
  text-align: center;
}

.empty-dot {
  width: 18px;
  height: 18px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 12px rgba(185, 123, 36, 0.13);
  animation: pulse 1.8s var(--ease) infinite;
}

.result-empty h2,
.result-empty p {
  margin-bottom: 6px;
}

.result-empty p,
.note {
  color: var(--muted);
}

.result-ready {
  animation: liftIn 420ms var(--ease) both;
}

.status-row {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.status-label {
  display: inline-flex;
  margin-bottom: 7px;
  color: var(--green);
}

.status-label.is-fail {
  color: var(--red);
}

h2 {
  margin-bottom: 4px;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: 0;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.preview-grid.is-pdf {
  display: none;
}

figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f5efdf;
}

figcaption {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

figure img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #e8deca 25%, transparent 25%),
    linear-gradient(-45deg, #e8deca 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e8deca 75%),
    linear-gradient(-45deg, transparent 75%, #e8deca 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.metrics div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper-strong);
}

dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 850;
}

.checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0 0 14px;
  list-style: none;
}

.checklist li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--paper-strong);
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.checklist li::before {
  display: grid;
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: var(--green);
  color: var(--paper);
  content: "OK";
  font-size: 9px;
  font-weight: 900;
}

.checklist li.fail::before {
  background: var(--red);
  content: "NO";
}

.checklist li.warn::before {
  background: var(--amber);
  content: "!";
}

.rejection-panel {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.rejection-panel label {
  margin-bottom: 8px;
}

.rejection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.rejection-actions {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 10px 0 0;
  list-style: none;
}

.rejection-actions li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper-strong);
  font-weight: 750;
  line-height: 1.35;
}

.rejection-actions li.warn {
  border-color: rgba(185, 123, 36, 0.32);
  background: rgba(185, 123, 36, 0.08);
}

.note {
  margin: 0;
  line-height: 1.45;
}

body[data-mode="pdf"] .photo-only {
  display: none;
}

body:not([data-mode="pdf"]) .pdf-only {
  display: none;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin: 28px 0 0;
  color: var(--muted);
  font: 700 12px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--ink);
}

@keyframes liftIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.76);
  }
}

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

@media (max-width: 920px) {
  .hero-grid,
  .workspace,
  .preview-grid,
  .metrics,
  .checklist {
    grid-template-columns: 1fr;
  }

  .file-system {
    min-height: 150px;
  }

  .result-panel {
    min-height: auto;
  }

  .result-empty {
    min-height: 260px;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 22px, 1120px);
    padding-top: 20px;
  }

  h1 {
    font-size: 44px;
  }

  .hero-grid {
    gap: 12px;
  }

  .file-system {
    display: none;
  }

  .file-card {
    width: 128px;
    height: 160px;
  }

  .workspace {
    gap: 12px;
  }

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

  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }

  .rejection-row {
    grid-template-columns: 1fr;
  }

  .secondary-action {
    width: 100%;
  }
}
