:root {
  --bg: #f7f4ed;
  --surface: #fffdfa;
  --ink: #171a18;
  --muted: #666861;
  --line: #d9d2c7;
  --accent: #b94b16;
  --accent-ink: #ffffff;
  --warning: #b95118;
  --danger: #b53a2c;
  --success: #28735a;
  --radius: 8px;
  --shadow: 0 10px 28px rgb(51 42 33 / 0.045);
}

body {
  background: var(--bg);
}

svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

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

.site-header {
  min-height: 74px;
  padding-inline: clamp(18px, 3.2vw, 52px);
  background: rgb(247 244 237 / 0.94);
  backdrop-filter: blur(10px);
}

.brand {
  font-size: clamp(1.05rem, 2vw, 1.38rem);
  letter-spacing: -0.025em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-color: var(--ink);
  color: var(--ink);
  font-size: 0.7rem;
  letter-spacing: -0.04em;
}

.header-note {
  margin: 0;
  color: var(--ink);
}

.header-note svg {
  font-size: 1.05rem;
}

.page-shell {
  padding-top: clamp(34px, 4.8vw, 68px);
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 0.36fr);
  column-gap: 44px;
  margin-bottom: 32px;
}

h1 {
  max-width: 870px;
  font-size: clamp(2.35rem, 4.35vw, 4.15rem);
  line-height: 0.96;
  margin-bottom: 18px;
}

.lede {
  max-width: 820px;
  margin-bottom: 0;
}

.local-proof {
  align-self: end;
  margin: 0 0 4px;
  padding: 16px 0 2px 18px;
  border-left: 3px solid var(--success);
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.55;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px minmax(0, 1fr);
  align-items: stretch;
  gap: 16px;
}

.upload-card,
.summary-panel,
.visual-panel,
.checklist-panel,
.preflight-note,
.explanation,
.faq {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-card {
  min-width: 0;
  padding: 14px;
  border-radius: var(--radius);
  transition: border-color 160ms ease, transform 160ms ease;
}

.upload-card.has-file {
  border-color: color-mix(in srgb, var(--success) 44%, var(--line));
}

.upload-heading,
.upload-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-heading {
  justify-content: space-between;
  margin-bottom: 12px;
}

.upload-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.step-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  font-size: 0.78rem;
  font-weight: 800;
}

.clear-button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.clear-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drop-zone {
  min-height: 290px;
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  overflow: hidden;
  border: 1px dashed #aaa197;
  border-radius: 6px;
  background: #fbf9f4;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone:hover,
.drop-zone.is-dragging,
.drop-zone:focus-within {
  border-color: var(--accent);
  background: #fff7f0;
}

.drop-zone:focus-within {
  outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent);
  outline-offset: 2px;
}

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

.drop-zone strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.drop-icon {
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 2.1rem;
  margin-bottom: 2px;
}

.choose-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 6px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.83rem;
  font-weight: 750;
}

.file-limit {
  margin-top: 4px;
  font-size: 0.74rem;
}

.upload-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  background: #f7f3eb;
}

.upload-card.has-file .drop-zone::after {
  content: "Choose a different image";
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  padding: 8px 10px;
  border: 1px solid rgb(255 255 255 / 0.65);
  border-radius: 5px;
  background: rgb(23 26 24 / 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.file-meta {
  min-height: 18px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.compare-control {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 13px;
  text-align: center;
}

.compare-arrow {
  color: var(--muted);
  font-size: 2.4rem;
}

.compare-button {
  width: 100%;
  padding-inline: 12px;
}

.compare-control p {
  min-height: 38px;
  max-width: 150px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.error-message {
  margin: 18px 0 0;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-left: 4px solid var(--danger);
  background: #fff4f1;
  color: #7f261d;
  font-size: 0.88rem;
}

.preflight-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 0.62fr);
  gap: 40px;
  align-items: center;
  margin-top: 22px;
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--radius);
}

.preflight-note h2 {
  margin-bottom: 8px;
}

.preflight-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.preflight-note ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
  font-weight: 650;
}

.results {
  scroll-margin-top: 18px;
  margin-top: 26px;
}

.aspect-warning {
  margin: -2px 0 14px;
  padding: 11px 14px;
  border-left: 4px solid var(--warning);
  background: #fff4e9;
  color: #713512;
  font-size: 0.82rem;
  line-height: 1.5;
}

.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}

.results-heading h2 {
  margin-bottom: 4px;
}

.results-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.results-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.74fr) minmax(440px, 1.42fr) minmax(250px, 0.68fr);
  gap: 14px;
  align-items: start;
}

.summary-panel,
.visual-panel,
.checklist-panel {
  min-width: 0;
  border-radius: var(--radius);
  padding: 18px;
}

.panel-title,
.visual-toolbar,
.opacity-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  min-height: 32px;
  margin-bottom: 10px;
}

.panel-title h3,
.visual-toolbar h3 {
  margin: 0;
  font-size: 1rem;
}

.panel-title span,
.comparison-size-note {
  color: var(--muted);
  font-size: 0.72rem;
}

.metrics {
  margin: 0;
}

.metric-row {
  min-height: 52px;
  border-bottom: 1px solid var(--line);
}

.metric-row:last-child {
  border-bottom: 0;
}

.metric-row dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-row dd {
  margin: 0;
  max-width: 54%;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 780;
}

.metric-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

.metric-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-swatch--graphite {
  background: var(--ink);
}

.legend-swatch--orange {
  background: var(--accent);
}

.visual-toolbar {
  align-items: start;
  margin-bottom: 12px;
}

.view-tabs {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3eee6;
}

.view-tab {
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.view-tab.is-active {
  background: var(--accent);
  color: white;
}

.opacity-control {
  display: grid;
  grid-template-columns: auto auto minmax(110px, 1fr);
  justify-content: initial;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

.opacity-control output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.opacity-control input {
  min-width: 0;
  padding: 0;
  accent-color: var(--accent);
}

.canvas-stage,
.side-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ede8df;
}

.canvas-stage {
  aspect-ratio: 4 / 3;
}

.canvas-stage canvas,
.edited-reveal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.canvas-stage canvas {
  object-fit: contain;
}

.edited-reveal {
  overflow: hidden;
  border-right: 2px solid white;
}

.edited-reveal canvas {
  width: 100%;
  max-width: none;
}

.canvas-label {
  position: absolute;
  top: 10px;
  z-index: 3;
  padding: 6px 9px;
  border-radius: 4px;
  background: rgb(23 26 24 / 0.86);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 760;
}

.canvas-label--left {
  left: 10px;
}

.canvas-label--right {
  right: 10px;
}

.reveal-handle {
  position: absolute;
  top: 50%;
  z-index: 4;
  width: 32px;
  height: 32px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 3px 12px rgb(0 0 0 / 0.2);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reveal-handle::before,
.reveal-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid white;
  border-left: 2px solid white;
}

.reveal-handle::before {
  left: 7px;
  transform: translateY(-50%) rotate(-45deg);
}

.reveal-handle::after {
  right: 7px;
  transform: translateY(-50%) rotate(135deg);
}

.canvas-stage--single canvas {
  object-fit: fill;
}

.side-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
}

.side-stage figure {
  min-width: 0;
  margin: 0;
  background: #ede8df;
}

.side-stage canvas {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.side-stage figcaption {
  padding: 8px 10px;
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 760;
}

.visual-caption {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.checklist-panel > p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

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

.qa-list label {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.35;
}

.qa-list input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--success);
}

.checklist-button {
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--success);
  border-radius: 5px;
  background: transparent;
  color: var(--success);
  padding: 10px 12px;
  font-weight: 780;
  font-size: 0.78rem;
}

.checklist-caveat {
  margin: 10px 0 0 !important;
  font-size: 0.68rem !important;
}

.explanation,
.faq {
  display: grid;
  grid-template-columns: minmax(230px, 0.48fr) minmax(0, 1fr);
  gap: clamp(30px, 5vw, 80px);
  margin-top: 24px;
  padding: clamp(30px, 4vw, 58px);
  border-radius: var(--radius);
}

.section-copy h2 {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
  line-height: 1.04;
  margin-bottom: 12px;
}

.section-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.definition-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.definition-list div {
  min-height: 156px;
  padding: 8px 24px 22px 0;
  border-bottom: 1px solid var(--line);
}

.definition-list div:nth-child(even) {
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.definition-list div:nth-last-child(-n + 2) {
  border-bottom: 0;
  padding-top: 24px;
}

.definition-list dt {
  margin-bottom: 9px;
  font-weight: 820;
}

.definition-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.58;
}

.faq {
  margin-top: 0;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  background: #f0ebe2;
  box-shadow: none;
}

.faq-list {
  border-top: 1px solid var(--line);
}

.faq-list details {
  border-bottom: 1px solid var(--line);
}

.faq-list summary {
  position: relative;
  padding: 18px 42px 18px 0;
  color: var(--ink);
  font-weight: 760;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: 4px;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 400;
  transform: translateY(-50%);
}

.faq-list details[open] summary::after {
  content: "−";
}

.faq-list details p {
  max-width: 760px;
  margin: -4px 40px 18px 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.65;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 28px 20px 42px;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--ink);
  text-underline-offset: 3px;
}

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

  .results-layout {
    grid-template-columns: minmax(250px, 0.76fr) minmax(420px, 1.24fr);
  }

  .checklist-panel {
    grid-column: 1 / -1;
  }

  .qa-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
  }
}

@media (max-width: 820px) {
  body {
    background-image: none;
  }

  .site-header {
    min-height: 68px;
  }

  .page-intro {
    display: block;
  }

  .local-proof {
    max-width: 620px;
    margin-top: 18px;
  }

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

  .compare-control {
    order: 3;
  }

  .upload-card[data-upload-card="edited"] {
    order: 2;
  }

  .compare-control {
    gap: 8px;
  }

  .compare-arrow {
    display: none;
  }

  .compare-control p {
    max-width: none;
    min-height: auto;
  }

  .drop-zone {
    min-height: 260px;
  }

  .preflight-note,
  .explanation,
  .faq {
    grid-template-columns: 1fr;
  }

  .results-layout {
    grid-template-columns: 1fr;
  }

  .checklist-panel {
    grid-column: auto;
  }

  .qa-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: center;
    gap: 12px;
  }

  .brand-mark {
    display: none;
  }

  .brand {
    font-size: 1.02rem;
  }

  .header-note {
    display: flex;
    max-width: 145px;
    justify-content: flex-end;
    text-align: right;
    font-size: 0.72rem;
    line-height: 1.35;
  }

  .page-shell {
    padding-inline: 14px;
  }

  h1 {
    font-size: 2.25rem;
    line-height: 0.98;
  }

  .lede {
    font-size: 1rem;
  }

  .drop-zone {
    min-height: 232px;
    padding: 20px;
  }

  .results-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .visual-toolbar {
    display: grid;
  }

  .view-tabs {
    width: 100%;
  }

  .view-tab {
    flex: 1;
  }

  .opacity-control {
    grid-template-columns: 1fr auto;
  }

  .opacity-control input {
    grid-column: 1 / -1;
  }

  .canvas-stage {
    aspect-ratio: 1 / 1;
  }

  .side-stage {
    grid-template-columns: 1fr;
  }

  .definition-list {
    grid-template-columns: 1fr;
  }

  .definition-list div,
  .definition-list div:nth-child(even),
  .definition-list div:nth-last-child(-n + 2) {
    min-height: auto;
    padding: 20px 0;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .definition-list div:last-child {
    border-bottom: 0;
  }

  .site-footer {
    flex-direction: column;
    gap: 10px;
  }
}

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