:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --ink: #1d1f24;
  --muted: #6b6f78;
  --line: #e4e0d6;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e5efe9;
  --danger: #b3261e;
  --ok: #2f7a4d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
main { max-width: 1080px; margin: 0 auto; padding: 0 16px 64px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; }
h2 { font-size: 1.5rem; margin: 0 0 16px; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1080px; margin: 0 auto; padding: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.25rem var(--serif); color: var(--ink); text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 1.05rem;
}
.topnav { display: flex; align-items: center; gap: 12px; }
.topnav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.chip {
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 4px 12px; font-size: .85rem; font-weight: 600; white-space: nowrap;
}

/* buttons */
.btn {
  font: 600 .95rem var(--sans); border: 1px solid transparent; border-radius: 10px;
  padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }

/* hero */
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; padding: 40px 0 56px; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); margin: 0 0 18px; }
.hero h1 em { color: var(--accent); font-style: italic; }
.lead { font-size: 1.1rem; color: #3b3f47; margin: 0 0 12px; }
.formats { color: var(--muted); font-size: .9rem; margin: 0 0 24px; }

/* before/after */
.compare { position: relative; margin: 0; aspect-ratio: 3 / 3.6; user-select: none; }
.doc {
  position: absolute; inset: 0 0 28px 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; box-shadow: var(--shadow); padding: 7% 8%; font-size: clamp(9px, 1.25vw, 13px);
  display: flex; flex-direction: column; gap: 5%; overflow: hidden;
}
.doc-after { clip-path: inset(0 0 0 50%); }
.doc-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.doc-head b { font-family: var(--serif); font-size: 1.25em; letter-spacing: .02em; }
.doc-head span { color: var(--muted); }
.row { display: grid; grid-template-columns: 34% 1fr; align-items: end; gap: 8px; }
.row label { color: #444; }
.row i { border-bottom: 1px solid #999; height: 1.2em; }
.row i.short { width: 50%; }
.grid { display: grid; grid-template-columns: 2fr 1fr 1fr; border: 1px solid #999; }
.grid span { padding: 4px 6px; border: 1px solid #ddd; }
.grid span:nth-child(-n+3) { background: #f1efe9; font-weight: 600; }
.sign { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }
.sign span:first-child { border-top: 1px solid #999; padding-top: 4px; width: 40%; color: #444; }
.stamp {
  border: 2px solid #3a63b8; color: #3a63b8; border-radius: 50%; width: 4.2em; height: 4.2em;
  display: grid; place-items: center; font-weight: 700; transform: rotate(-12deg); opacity: .8;
}
#compare-range {
  position: absolute; inset: 0 0 28px 0; width: 100%; height: calc(100% - 28px); margin: 0;
  opacity: 0; cursor: ew-resize; z-index: 3;
}
.compare-handle {
  position: absolute; top: 0; bottom: 28px; left: 50%; width: 2px; background: var(--accent);
  pointer-events: none; z-index: 2;
}
.compare-handle::after {
  content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 15px; box-shadow: var(--shadow);
}
.compare figcaption {
  position: absolute; bottom: 0; left: 0; right: 0; display: flex; justify-content: space-between;
  color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
}

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px; margin: 0 auto 28px; max-width: 720px;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: 32px 16px; cursor: pointer;
  transition: border-color .15s, background .15s; margin-bottom: 18px;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent); }
.dz-icon { font-size: 1.8rem; color: var(--accent); }
.dropzone small { color: var(--muted); }
.langs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; margin-bottom: 18px; }
.langs label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
select, input[type=email], input[type=text] {
  font: 1rem var(--sans); padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); width: 100%;
}
select:focus, input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.swap { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; height: 44px; width: 44px; cursor: pointer; font-size: 1.1rem; }
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; margin: 0;
  max-height: 260px; overflow-y: auto; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.combo-list li { padding: 8px 11px; border-radius: 7px; cursor: pointer; font-size: .95rem; color: var(--ink); }
.combo-list li.active, .combo-list li:hover { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); }
.combo-list li.sel { font-weight: 600; }
.combo-list li.empty { color: var(--muted); cursor: default; }
.msg { min-height: 1.4em; margin: 12px 0 0; font-size: .92rem; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }
.muted { color: var(--muted); }

/* jobs */
.jobs { list-style: none; margin: 0; padding: 0; }
.job { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.job:first-child { border-top: 0; }
.job-main { flex: 1; min-width: 180px; }
.job-name { font-weight: 600; word-break: break-all; }
.job-meta { color: var(--muted); font-size: .85rem; }
.job-error { color: var(--danger); font-size: .85rem; }
.job-actions { display: flex; gap: 8px; }
.status { font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eee; color: #555; }
.status-done { background: var(--accent-soft); color: var(--accent); }
.status-failed { background: #fbe9e7; color: var(--danger); }
.status-running, .status-queued { background: #fff4d6; color: #8a6100; }

/* connected sites / API keys */
.key-form { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.key-form > .btn { align-self: flex-start; }
.kind-widget, .kind-secret { display: flex; flex-direction: column; gap: 10px; }
.kind-tabs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-top: 4px; }
.kind-tab { border: 0; background: none; padding: 6px 14px; border-radius: 8px; font: 600 .9rem var(--sans); color: var(--muted); cursor: pointer; }
.kind-tab.active { background: var(--accent); color: var(--accent-ink); }
.pays { display: flex; flex-direction: column; gap: 6px; }
.pays label { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; cursor: pointer; }
.pays input { margin-top: 4px; }
.caps { display: flex; gap: 12px; flex-wrap: wrap; }
.caps label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
.caps input { width: 140px; font: 1rem var(--sans); padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.key-form input[type=text] { width: 100%; }
code.snippet, .key-new code.snippet { white-space: pre-wrap; background: #1f2328; color: #e8e6e1; padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.key-new { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; margin-top: 12px; }
.key-new p { margin: 0 0 8px; }
.key-new label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.key-new code, .job-meta code {
  display: block; font: .85rem ui-monospace, Consolas, monospace; color: var(--ink);
  word-break: break-all; user-select: all;
}
.job-meta code { display: inline; }

/* pricing */
.pricing { text-align: center; padding-top: 24px; }
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 300px)); gap: 20px; justify-content: center; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; text-align: center; }
.plan-main { border-color: var(--accent); box-shadow: var(--shadow); }
.plan h3 { margin: 0 0 8px; }
.price { font: 600 2.4rem var(--serif); margin: 0 0 4px; }
.fine { color: var(--muted); font-size: .85rem; }

.tool-intro { margin: -4px 0 16px; }

/* preview result */
#preview-result { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.preview-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-head h3 { margin: 0; }
.preview-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.preview-imgs figure { margin: 0; }
.preview-imgs figcaption { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
.preview-imgs img { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; display: block; min-height: 120px; }
.preview-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 16px; background: var(--accent-soft); border-radius: 12px; padding: 16px 18px; }
.preview-cta-title { font-weight: 600; color: var(--ink); }

/* business section */
.business { margin-top: 48px; padding: 36px 28px; background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.biz-head { max-width: 700px; }
.eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.biz-head h2 { margin: 0 0 8px; }
.biz-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0; }
.biz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.biz-card h3 { margin: 0 0 8px; }
.biz-card ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.biz-card li { margin-bottom: 4px; }
.biz-card code.snippet { font-size: .76rem; }
.biz-pricing { margin-top: 12px; }
.biz-pricing h3 { margin: 0 0 4px; }
#biz-plans { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
#biz-plans .plan { padding: 22px 18px; }
.biz-start { text-align: center; margin-top: 24px; }
.biz-start .fine { margin-top: 10px; }

/* floating buttons (home + back to top) */
.fab-group { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .12s ease; }
.fab:hover { transform: translateY(-2px); background: var(--accent-soft); }
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab-home { color: var(--accent); }

.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; }

/* dialogs */
.dialog { border: 0; border-radius: var(--radius); padding: 28px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(20, 22, 26, .4); }
.dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#auth-code { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }
.dialog-wide { width: min(1200px, calc(100vw - 32px)); height: min(90vh, 1000px); display: none; flex-direction: column; }
.dialog-wide[open] { display: flex; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.view-head h2 { margin: 0; font-size: 1.15rem; word-break: break-all; }
.view-cols, .view-page { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.view-cols { margin-top: 12px; }
.view-cols h3 { margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--sans); }
.view-pages { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.view-page img {
  width: 100%; aspect-ratio: 1 / 1.414; object-fit: contain; display: block;
  border: 1px solid var(--line); border-radius: 6px; background: #fafafa;
}
.view-page img[src] { aspect-ratio: auto; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 16px; }
  .plans, #biz-plans, .biz-cards, .preview-imgs { grid-template-columns: minmax(0, 1fr); }
  .view-cols, .view-page { gap: 8px; }
  .card { padding: 20px; }
  .business { padding: 24px 18px; }
  .topnav a { display: none; }
  .fab-group { right: 12px; bottom: 12px; }
}
