:root {
  --paper: #f4efe6;
  --paper-deep: #ebe4d6;
  --ink: #15130f;
  --ink-soft: #57514a;
  --rule: rgba(21, 19, 15, 0.14);
  --rule-strong: rgba(21, 19, 15, 0.32);
  --accent: #ff4a1c;
  --accent-ink: #c8330d;
  --ok: #1f7a4a;
  --sans: "Helvetica Neue", "Inter", "Neue Haas Grotesk Text", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --gutter: clamp(20px, 4.5vw, 64px);
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -60px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  z-index: 10;
}
.skip:focus { top: 12px; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.brand {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.22em;
  text-decoration: none;
}

.nav-link {
  font-size: 15px;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.nav-link[aria-current="page"] { border-color: var(--accent); }
.nav-link:hover { border-color: var(--ink); }

/* ---------- Intro ---------- */

.intro {
  padding: clamp(40px, 7vw, 96px) var(--gutter) clamp(32px, 5vw, 64px);
  max-width: 1440px;
  margin: 0 auto;
}

.stage-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 28px;
  font-size: 15px;
  color: var(--ink-soft);
}
.stage-label .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 74, 28, 0.16);
}

h1 {
  margin: 0;
  font-size: clamp(48px, 9vw, 132px);
  line-height: 0.94;
  letter-spacing: -0.045em;
  font-weight: 700;
  max-width: 11ch;
}

.lede {
  margin: 28px 0 0;
  max-width: 40em;
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---------- Studio ---------- */

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.85fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
  padding: 0 var(--gutter) clamp(56px, 8vw, 112px);
  max-width: 1440px;
  margin: 0 auto;
}

.preview {
  margin: 0;
  position: sticky;
  top: 24px;
}

.stage {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--paper-deep);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: background-color 0.3s var(--ease);
}

.stage-canvas {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 0;
}

.stage-canvas canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  transition: opacity 0.35s var(--ease), filter 0.35s var(--ease);
}

.stage-canvas canvas.is-result {
  width: 100%;
  height: auto;
  box-shadow: 0 1px 0 rgba(21, 19, 15, 0.06), 0 24px 60px -30px rgba(21, 19, 15, 0.45);
}

.stage[data-state="source"] .stage-canvas canvas {
  box-shadow: 0 24px 60px -34px rgba(21, 19, 15, 0.4);
}

.stage[data-state="stale"] .stage-canvas canvas {
  opacity: 0.38;
  filter: grayscale(0.6);
}

.stage[data-state="failed"] .stage-canvas canvas {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.stage-canvas canvas.is-entering {
  animation: develop 0.9s var(--ease) both;
}

@keyframes develop {
  from { clip-path: inset(0 0 100% 0); opacity: 0.2; }
  to   { clip-path: inset(0 0 0 0); opacity: 1; }
}

.stage-drop {
  position: absolute;
  inset: 12px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  background: rgba(244, 239, 230, 0.86);
  font-size: 22px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.stage.is-dragging .stage-drop { opacity: 1; }

.stage-busy {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}
.stage-busy span {
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent);
  animation: busy 1.1s var(--ease) infinite;
}
.stage[data-state="generating"] .stage-busy { opacity: 1; }
.stage[data-state="generating"] .stage-canvas canvas { opacity: 0.55; }

@keyframes busy {
  from { transform: translateX(-100%); }
  to   { transform: translateX(260%); }
}

.caption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  font-size: 15px;
  border-top: 1px solid var(--ink);
  margin-top: 0;
}
#caption-state { font-weight: 600; }
.caption-dest {
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ---------- Controls ---------- */

.controls { display: grid; gap: 0; }

.step {
  border: 0;
  margin: 0;
  padding: 0 0 28px;
  min-width: 0;
}
.step + .step { padding-top: 26px; border-top: 1px solid var(--rule); }

legend {
  padding: 0;
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
legend .num {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

.sources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.source {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 8px 8px 12px;
  background: transparent;
  border: 1px solid var(--rule);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s var(--ease), transform 0.25s var(--ease), background-color 0.2s var(--ease);
}
.source:hover { border-color: var(--ink); transform: translateY(-2px); }
.source.is-active { border-color: var(--ink); background: #fffdf8; box-shadow: inset 0 -3px 0 var(--accent); }
.source-upload:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

.thumb {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--paper-deep);
  overflow: hidden;
}
.thumb canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb-upload {
  display: grid;
  place-items: center;
  border: 1px dashed var(--rule-strong);
  background: transparent;
  color: var(--ink-soft);
}

.source-name {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
  min-width: 0;
}
.source-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-name small {
  font-weight: 400;
  font-size: 13px;
  color: var(--ink-soft);
}

.field { display: grid; gap: 10px; }

.field-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--ink-soft);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  background: rgba(255, 74, 28, 0.12);
}
.badge[hidden] { display: none; }

input[type="url"] {
  width: 100%;
  padding: 14px 0 12px;
  border: 0;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  font-size: 20px;
  letter-spacing: -0.01em;
  transition: border-color 0.2s var(--ease);
}
input[type="url"]:focus { outline: none; border-color: var(--accent); }
input[type="url"][aria-invalid="true"] { border-color: var(--accent); }

.note {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.note[hidden] { display: none; }

.field-error {
  margin: 0;
  font-size: 15px;
  color: var(--accent-ink);
  font-weight: 600;
}

.range-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
output {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  --fill: 60%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(to right, var(--ink) var(--fill), var(--rule-strong) var(--fill));
}
input[type="range"]::-moz-range-track { height: 3px; background: var(--rule-strong); }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9.5px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform 0.2s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"]:focus-visible { outline-offset: 6px; }

.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ---------- Actions ---------- */

.actions {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  padding-top: 8px;
}

.btn {
  position: relative;
  min-height: 58px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  font-size: 17px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-secondary { background: transparent; }
.btn-secondary:hover:not(:disabled) { background: var(--ink); color: var(--paper); }

.btn:disabled { cursor: not-allowed; opacity: 0.38; }
.btn-primary[aria-busy="true"] { opacity: 1; cursor: progress; }
.btn-primary[aria-busy="true"] .btn-label::after {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 10px;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status {
  margin-top: 16px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.45;
  border-left: 3px solid var(--ink);
  background: #fffdf8;
}
.status[hidden] { display: none; }
.status[data-tone="ok"] { border-color: var(--ok); }
.status[data-tone="warn"] { border-color: var(--accent); }
.status[data-tone="error"] { border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.status p { margin: 0; }
.status p + p { margin-top: 6px; }

/* ---------- Checks ---------- */

.checks {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--ink);
}
.checks-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.checks h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -0.015em; }
.checks-sub { margin: 0; font-size: 15px; color: var(--ink-soft); }

.checks-list {
  list-style: none;
  margin: 14px 0 14px;
  padding: 0;
}
.checks-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 16px;
}
.checks-list .size { font-variant-numeric: tabular-nums; font-weight: 600; }
.checks-list .result { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.checks-list .result::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
}
.checks-list li[data-ok="true"] .result { color: var(--ok); font-weight: 600; }
.checks-list li[data-ok="true"] .result::before { background: var(--ok); border-color: var(--ok); }
.checks-list li[data-ok="false"] .result { color: var(--accent-ink); font-weight: 600; }
.checks-list li[data-ok="false"] .result::before { background: var(--accent); border-color: var(--accent); }
.checks-list li[data-ok="pending"] .result::before { animation: pulse 1s ease-in-out infinite alternate; border-color: var(--accent); }
.checks-list li.is-fresh { animation: tick 0.5s var(--ease) both; }
.checks-list li.is-fresh:nth-child(2) { animation-delay: 0.08s; }
.checks-list li.is-fresh:nth-child(3) { animation-delay: 0.16s; }

@keyframes pulse { to { background: var(--accent); } }
@keyframes tick { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ---------- How it works ---------- */

.how {
  border-top: 1px solid var(--ink);
  padding: clamp(28px, 4vw, 48px) var(--gutter);
  max-width: 1440px;
  margin: 0 auto;
}
.how-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 56px);
}
.how-list li { display: flex; gap: 16px; align-items: baseline; }
.how-num {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.04em;
}
.how-list p { margin: 0; color: var(--ink-soft); }
.how-list strong { color: var(--ink); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
  color: var(--ink-soft);
}
.footer span:first-child { font-weight: 800; letter-spacing: 0.22em; color: var(--ink); }

.boot-error {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: 24px;
  padding: 16px 20px;
  background: var(--ink);
  color: var(--paper);
  border-left: 4px solid var(--accent);
  font-size: 16px;
  z-index: 20;
}
.boot-error[hidden] { display: none; }
.boot-error code { font-family: var(--mono); color: #ffb39e; }

/* ---------- Entrance motion ---------- */

.reveal {
  animation: rise 0.8s var(--ease) both;
}
.intro .reveal:nth-child(2) { animation-delay: 0.06s; }
.intro .reveal:nth-child(3) { animation-delay: 0.14s; }
.studio .preview.reveal { animation-delay: 0.2s; }
.studio .controls.reveal { animation-delay: 0.3s; }
.how-list li.reveal:nth-child(1) { animation-delay: 0.4s; }
.how-list li.reveal:nth-child(2) { animation-delay: 0.48s; }
.how-list li.reveal:nth-child(3) { animation-delay: 0.56s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
  .how-list { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}

@media (max-width: 480px) {
  .actions { grid-template-columns: minmax(0, 1fr); }
  .source-name small { display: none; }
  .caption { flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
  .source:hover { transform: none; }
  .stage-busy span { width: 100%; transform: none; }
}

.stage-canvas canvas { image-rendering: auto; }

.compare-tools{display:flex;gap:8px;align-items:center;padding:12px 0;flex-wrap:wrap}
.compare-tools button{font:inherit;border:1px solid #c8c1b5;background:transparent;padding:8px 12px;cursor:pointer}
.compare-tools button[aria-pressed="true"]{background:#171613;color:#fff;border-color:#171613}
.compare-tools span{font-size:12px;color:#6c675f;margin-left:auto}

#corner{width:100%;margin:8px 0 16px;padding:12px;background:transparent;color:var(--ink);border:1px solid #c8c1b5;font:inherit}

#launch-details .field{margin-top:14px} textarea{font:inherit;width:100%;padding:12px;border:1px solid var(--line,#ccc);background:transparent;color:inherit;border-radius:4px} #launch-review h2,#launch-invoice h2{font-size:20px;margin-bottom:12px} #launch-review .btn,#launch-invoice .btn{margin-top:16px} #launch-invoice{overflow-wrap:anywhere} #accept-costs{width:auto;margin:0 6px 0 0} #launch-details button{margin-top:12px} [hidden]{display:none!important}
