:root {
  --paper: #F1EFE8;
  --paper-panel: #FBFAF6;
  --ink: #19181A;
  --ink-soft: #4A4842;
  --line: #D8D4C8;
  --c: #0E7C86;
  --m: #B23A6B;
  --y: #C9971F;
  --k: #19181A;
  --radius: 3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  min-height: 100vh;
  position: relative;
}

/* --- registration marks (print alignment crosshairs) --- */
.reg-mark {
  position: fixed;
  width: 26px;
  height: 26px;
  opacity: 0.35;
  pointer-events: none;
  z-index: 5;
}
.reg-mark::before, .reg-mark::after {
  content: "";
  position: absolute;
  background: var(--ink);
}
.reg-mark::before { top: 50%; left: 0; width: 100%; height: 1px; transform: translateY(-50%); }
.reg-mark::after { left: 50%; top: 0; height: 100%; width: 1px; transform: translateX(-50%); }
.reg-tl { top: 18px; left: 18px; }
.reg-br { bottom: 18px; right: 18px; }

/* --- masthead --- */
.masthead {
  padding: 48px 24px 32px;
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  max-width: 880px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
}
.brand-mark img {
  display: block;
  border-radius: 6px;
}
.brand-name-accent {
  color: #C0392B;
}

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 18px 0 0;
  max-width: 26ch;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.crumb-nav {
  margin-top: 14px;
  font-size: 12px;
}
.crumb-nav a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.crumb-nav a:hover { color: var(--ink); }
.crumb-nav span { color: var(--line); margin: 0 6px; }
.tagline {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
  max-width: 60ch;
}

/* --- workshop layout --- */
.workshop {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.bench-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.bench-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 14px 16px;
  text-align: left;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.bench-tab-sub {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-soft);
  opacity: 0.7;
  margin-top: 2px;
}
.bench-tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--m);
}
.bench-tab:hover:not(.is-active) { color: var(--ink); }

.bench-panel { display: none; padding-top: 32px; }
.bench-panel.is-active { display: block; }

.wizard-step { display: none; }
.wizard-step.is-active { display: block; }

.step-flag {
  font-size: 12px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink-soft);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}
.step-flag span {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
  font-size: 11px;
  border-radius: var(--radius);
  padding: 2px 8px;
  margin-right: 8px;
}

.upload-grid {
  max-width: 480px;
}

.drop-zone-lg {
  padding: 44px 20px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  margin-bottom: 20px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.back-btn:hover { color: var(--ink); }

.panel-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
}
@media (max-width: 720px) {
  .panel-grid { grid-template-columns: 1fr; }
}

.field-group { margin-bottom: 22px; }
.field-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.toggle-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toggle-opt {
  text-align: left;
  background: var(--paper-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.toggle-opt small {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 2px;
}
.toggle-opt.is-active {
  border-color: var(--ink);
  background: #fff;
}
#scale-toggle { flex-direction: row; }
#scale-toggle .toggle-opt { flex: 1; text-align: center; }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper-panel);
  padding: 28px 14px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease;
}
.drop-zone:hover, .drop-zone.is-dragover { border-color: var(--ink); }
.drop-icon { font-size: 20px; color: var(--ink-soft); }
.drop-text { font-size: 13px; color: var(--ink); }
.drop-hint { font-size: 11px; color: var(--ink-soft); font-family: 'IBM Plex Mono', monospace; }

.run-btn {
  width: 100%;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--radius);
  padding: 13px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.run-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.run-btn:not(:disabled):hover { opacity: 0.85; }

.note {
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 12px;
}

.preview-frame {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 640px;
}
@media (max-width: 520px) {
  .preview-frame { grid-template-columns: 1fr; }
}
.preview-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.preview-label {
  font-size: 11px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
}
.preview-canvas {
  aspect-ratio: 1 / 1;
  background: var(--paper-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.preview-canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.preview-empty {
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0.6;
  padding: 0 16px;
  text-align: center;
}

.dims {
  font-size: 12px;
  color: var(--ink-soft);
  font-family: 'IBM Plex Mono', monospace;
  margin: 12px 0 0;
}

.detail-compare {
  margin-top: 18px;
}
.detail-compare-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.detail-crop-slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail-crop-box {
  background: var(--paper-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail-crop-box canvas {
  display: block;
  image-rendering: pixelated;
}

.download-btn {
  display: inline-block;
  margin-top: 16px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}
.download-btn:hover { background: var(--ink); color: var(--paper); }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 24, 26, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.loading-overlay.is-visible { display: flex; }
.loading-box {
  background: var(--paper-panel);
  border-radius: var(--radius);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--ink);
}
.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--m);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.colophon {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.format-picker {
  margin-top: 16px;
}
.format-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.format-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper-panel);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.format-btn:hover { background: var(--ink); color: var(--paper); }
.format-btn .format-note {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-soft);
  max-width: 20ch;
  white-space: normal;
  line-height: 1.3;
}
.format-btn:hover .format-note { color: var(--paper); opacity: 0.8; }

.about-seo {
  border-top: 1px solid var(--line);
  background: var(--paper-panel);
}
.about-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 56px;
}
.about-inner h2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 22px;
  margin: 36px 0 12px;
}
.about-inner h2:first-child { margin-top: 0; }
.about-inner h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 20px 0 6px;
}
.about-inner p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0 0 4px;
  max-width: 68ch;
}

/* ---- ad slots ----
   Fixed min-heights reserve space before the ad script runs, so slots
   loading in later don't shift any surrounding content (avoids CLS,
   which Google's Core Web Vitals penalize). */
.ad-slot {
  max-width: 728px;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--paper-panel);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.ad-slot-banner { min-height: 90px; }
.ad-slot-rectangle { min-height: 250px; max-width: 300px; }
.ad-label {
  font-size: 10px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink-soft);
  opacity: 0.6;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 480px) {
  .ad-slot-banner { min-height: 50px; }
}
