:root {
  --ink: #0b0b0c;
  --ink-2: #6e6e73;
  --ink-3: #a1a1a6;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --line: #e3e3e6;
  --ok: #1d7a4c;
  --err: #c5301f;
  --pad: clamp(20px, 5vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f5f5f7;
    --ink-2: #98989d;
    --ink-3: #6e6e73;
    --bg: #000000;
    --bg-2: #141416;
    --line: #2a2a2d;
    --ok: #4cd080;
    --err: #ff6a5a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------- shell ---------------------------- */

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--pad); height: 52px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 600; letter-spacing: -0.02em; font-size: 1.05rem; }
.bar-note { font-size: 0.74rem; color: var(--ink-2); letter-spacing: 0.02em; }

.hero {
  max-width: 980px; margin: 0 auto;
  padding: clamp(60px, 13vw, 140px) var(--pad) clamp(40px, 8vw, 80px);
}
h1 {
  margin: 0 0 24px;
  font-size: clamp(2.6rem, 8vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.lede {
  margin: 0; max-width: 34ch;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  line-height: 1.42; color: var(--ink-2);
  letter-spacing: -0.012em;
}
.lede.sm { font-size: 1.02rem; max-width: 52ch; margin-bottom: 36px; }

main { max-width: 980px; margin: 0 auto; padding: 0 var(--pad); }

.step {
  padding: clamp(52px, 9vw, 96px) 0;
  border-top: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-3);
}

h2 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 4.6vw, 3rem);
  line-height: 1.06; letter-spacing: -0.03em; font-weight: 700;
}

/* ---------------------------- forms ---------------------------- */

.fields {
  display: grid; gap: 26px 32px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 32px;
}
.field.wide { margin-top: 32px; max-width: 640px; }

label {
  display: block; margin-bottom: 8px;
  font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}

input[type="text"], input[type="password"], select, textarea {
  width: 100%; padding: 13px 0; font: inherit; color: var(--ink);
  background: transparent; border: none;
  border-bottom: 1px solid var(--line); border-radius: 0;
  transition: border-color 0.18s ease;
}
select {
  appearance: none; cursor: pointer; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 11px) calc(50% + 1px), calc(100% - 6px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-bottom-color: var(--ink);
}
input[type="file"] {
  font-size: 0.9rem; color: var(--ink-2);
  padding: 0; border: none; margin-bottom: 16px;
}
input[type="file"]::file-selector-button {
  font: inherit; font-size: 0.85rem; font-weight: 600;
  margin-right: 14px; padding: 9px 16px; cursor: pointer;
  color: var(--ink); background: var(--bg-2);
  border: none; border-radius: 100px;
}

.note {
  margin: 8px 0 0;
  font-size: 0.84rem; line-height: 1.45; color: var(--ink-2);
  max-width: 48ch;
}

/* ---------------------------- buttons ---------------------------- */

button {
  font: inherit; font-size: 0.97rem; font-weight: 600; cursor: pointer;
  padding: 13px 30px; border: none; border-radius: 100px;
  background: var(--ink); color: var(--bg);
  letter-spacing: -0.01em;
  transition: opacity 0.18s ease, background 0.18s ease;
}
button:hover { opacity: 0.82; }
button:active { opacity: 0.65; }
button:disabled { opacity: 0.32; cursor: not-allowed; }

button.ghost {
  background: transparent; color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
button.ghost:hover { background: var(--bg-2); opacity: 1; }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 0; }

.tabs { display: flex; gap: 8px; margin: 32px 0 22px; }
.tab {
  padding: 9px 20px; font-size: 0.88rem;
  background: var(--bg-2); color: var(--ink-2);
}
.tab.active { background: var(--ink); color: var(--bg); }

/* ---------------------------- grids ---------------------------- */

.grid { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); }
.grid.stories { grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); }
.grid.styles  { grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); }

.pick {
  display: block; width: 100%; text-align: left;
  padding: 22px 20px; border-radius: 0; letter-spacing: -0.01em;
  background: var(--bg); color: var(--ink);
  font-size: 1rem; font-weight: 600;
  transition: background 0.16s ease;
}
.pick:hover { background: var(--bg-2); opacity: 1; }
.pick[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.pick[aria-pressed="true"] small,
.pick[aria-pressed="true"] .tag { color: inherit; opacity: 0.7; }

.pick small {
  display: block; margin-top: 7px;
  font-size: 0.82rem; font-weight: 400; line-height: 1.4; color: var(--ink-2);
}
.pick .tag {
  display: block; margin-top: 10px;
  font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}

.pick.style { padding: 0; }
.pick.style .pick-body { display: block; padding: 18px 20px 22px; }
.swatch {
  display: block; width: 100%; aspect-ratio: 1;
  object-fit: cover; background: var(--bg-2);
}
.swatch.empty {
  display: grid; place-items: center;
  background: repeating-linear-gradient(45deg,
    var(--bg-2), var(--bg-2) 10px, var(--bg) 10px, var(--bg) 20px);
}
.swatch.empty span {
  font-size: 0.68rem; font-weight: 500; color: var(--ink-3);
  letter-spacing: 0.1em; text-transform: uppercase;
}

/* ---------------------------- output ---------------------------- */

.figure {
  display: block; padding: 13px 0;
  font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em;
  border-bottom: 1px solid var(--line);
}

.status { margin: 22px 0 0; font-size: 0.92rem; color: var(--ink-2); min-height: 1.3em; }
.status.err { color: var(--err); }
.status.ok  { color: var(--ok); }

.log {
  list-style: none; margin: 22px 0 0; padding: 0;
  font-size: 0.82rem; color: var(--ink-2);
  max-height: 200px; overflow-y: auto;
}
.log li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.log li.bad { color: var(--err); }

#photo-preview img, #sheet-holder img {
  max-width: 260px; display: block; margin: 20px 0; border-radius: 4px;
}
#sheet-holder { min-height: 40px; }

#pages {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line);
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin-top: 36px;
}
.page-card { background: var(--bg); }
.page-card img {
  width: 100%; display: block; aspect-ratio: 1;
  object-fit: cover; background: var(--bg-2);
}
.page-card .body { padding: 16px 18px 20px; }
.page-card .num {
  font-size: 0.66rem; font-weight: 600; color: var(--ink-3);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.page-card p { margin: 8px 0 14px; font-size: 0.89rem; line-height: 1.45; }
.page-card button { padding: 8px 16px; font-size: 0.8rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em; background: var(--bg-2); padding: 2px 7px; border-radius: 5px;
}

.hidden { display: none; }

footer {
  max-width: 980px; margin: 0 auto;
  padding: 44px var(--pad) 72px;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 0.8rem; line-height: 1.6;
}
footer p { margin: 0; max-width: 60ch; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .fields { gap: 22px; }
}
