/* Oneline — risograph print studio. See docs/DESIGN.md for the direction. */

:root {
  --paper: #ECE7DD;
  --paper-2: #E3DCCE;
  --surface: #F6F2EA;
  --ink: #191410;
  --ink-soft: #4A423A;
  --muted: #655A4C;
  --pink: #FF3D7F;
  --pink-ink: #B8154E;
  --blue: #2C6FEA;
  --success: #1F9E6A;
  --danger: #D7482B;

  --r-ctl: 4px;
  --r-panel: 10px;
  --shadow: 0 1px 0 #ffffffaa, 0 6px 20px -8px rgba(25, 20, 16, 0.28);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --font-display: "Space Grotesk", "Arial Black", sans-serif;
  --font-ui: Inter, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink-soft);
  background:
    radial-gradient(120% 80% at 50% -10%, #F2EDE3 0%, var(--paper) 55%, #E4DDCF 100%);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Paper grain overlay (fractal noise data-URI) */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body > *:not(.grain) { position: relative; z-index: 1; }

/* --- Masthead --- */
.masthead {
  padding: 40px 32px 8px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

.wordmark {
  text-decoration: none;
  display: inline-block;
}

.wordmark-ink {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 8vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: var(--ink);
}
/* Misregistered pink ghost — the riso two-drum signature */
.wordmark-ink::before {
  content: attr(data-text);
  position: absolute;
  left: -2px;
  top: 2px;
  color: var(--pink);
  z-index: -1;
  opacity: 0.9;
}

.tagline {
  margin: 10px 0 0;
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 46ch;
}

/* --- Studio layout --- */
.studio {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr);
  gap: 28px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  width: 100%;
  align-items: start;
}

/* --- The sheet (hero) --- */
.sheet-wrap { min-width: 0; }

.sheet-mat {
  position: relative;
  background: var(--surface);
  border: 1px solid #d8cfbe;
  border-radius: var(--r-panel);
  padding: 18px;
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

#sheet {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  background: var(--surface);
}

.press-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  opacity: 0;
  transform: translateX(-40%);
}
.sheet-mat.solving .press-bar {
  opacity: 1;
  animation: press 1.2s var(--ease) infinite;
}
@keyframes press {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.status {
  margin: 12px 2px 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* --- Control rail --- */
.rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 24px;
}

.panel {
  background: var(--surface);
  border: 1px solid #ddd4c3;
  border-radius: var(--r-panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel-note {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--pink);
  background: var(--surface);
  text-align: center;
  transition: background 160ms var(--ease), transform 160ms var(--ease);
}
.dropzone.dragover { background: #FFE7EF; transform: scale(1.01); border-style: solid; }
.dropzone.loaded { border-color: var(--success); }
.dropzone.loaded .drop-title::after { content: " ✓"; color: var(--success); }
.dropzone.error { border-color: var(--danger); background: #FBEAE6; }
.drop-label { display: block; cursor: pointer; }
.drop-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: var(--ink);
}
.drop-hint { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Sliders */
.control { margin-bottom: 16px; }
.control:last-of-type { margin-bottom: 4px; }
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.control-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--pink-ink);
  font-variant-numeric: tabular-nums;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  /* 44px tall hit area for touch, painted as a thin 8px bar via the
     track pseudo-elements below so the visual weight stays light. */
  height: 44px;
  background: transparent;
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  box-shadow: inset 0 1px 2px rgba(25, 20, 16, 0.18);
}
.slider::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--paper-2);
  box-shadow: inset 0 1px 2px rgba(25, 20, 16, 0.18);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px; /* centers the 22px thumb on the 8px track */
  border-radius: 50%;
  background: var(--pink);
  border: 3px solid var(--surface);
  box-shadow: 0 2px 6px -1px rgba(224, 30, 99, 0.55);
  transition: transform 120ms var(--ease), background 160ms var(--ease);
}
.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pink);
  border: 3px solid var(--surface);
  box-shadow: 0 2px 6px -1px rgba(224, 30, 99, 0.55);
  transition: transform 120ms var(--ease), background 160ms var(--ease);
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.12); background: #ff5590; }
.slider:hover::-moz-range-thumb { transform: scale(1.12); background: #ff5590; }
.slider:active::-webkit-slider-thumb { transform: scale(0.94); background: var(--pink-ink); }
.slider:active::-moz-range-thumb { transform: scale(0.94); background: var(--pink-ink); }
.slider:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.slider:disabled { opacity: 0.5; cursor: not-allowed; }

/* Select */
.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.control-row .control-label { margin-bottom: 0; flex: 0 0 auto; }
.select-wrap { position: relative; flex: 1; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.select {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #d8cfbe;
  border-radius: var(--r-ctl);
  padding: 11px 34px 11px 12px;
  min-height: 44px;
  cursor: pointer;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.select:hover { border-color: var(--ink); }
.select:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Sample gallery */
.gallery { display: flex; gap: 10px; flex-wrap: wrap; }
.sample {
  flex: 1;
  min-width: 84px;
  min-height: 44px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid #d8cfbe;
  border-radius: var(--r-ctl);
  padding: 10px 8px;
  cursor: pointer;
  transition: transform 120ms var(--ease), border-color 160ms var(--ease), background 160ms var(--ease);
}
.sample:hover { border-color: var(--pink); background: #FFE7EF; transform: translateY(-2px); }
.sample:active { transform: translateY(0); }
.sample.active { border-color: var(--pink); background: var(--pink-ink); color: #fff; }
.sample:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Stats */
.stats { display: flex; gap: 12px; }
.stat {
  flex: 1;
  background: var(--paper-2);
  border-radius: var(--r-ctl);
  padding: 12px;
  text-align: center;
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat-lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* Buttons */
.actions { display: flex; gap: 12px; }
.btn {
  flex: 1;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 15px;
  padding: 14px 16px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 48px;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 160ms var(--ease);
}
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn-primary {
  background: var(--pink-ink);
  color: #fff;
  box-shadow: 0 3px 0 #8f0f3c;
}
.btn-primary:hover { background: #c0184d; }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #8f0f3c; }
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: #d8cfbe;
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.ok { background: var(--success); color: #fff; border-color: var(--success); }

/* --- Below-the-fold explainer --- */
.explainer {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 32px 40px;
  width: 100%;
  color: var(--ink-soft);
  line-height: 1.65;
}
.explainer h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  color: var(--ink);
  margin: 40px 0 12px;
}
.explainer h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  margin: 20px 0 4px;
}
.explainer p { margin: 0 0 14px; }
.explainer ol { margin: 0 0 14px; padding-left: 22px; }
.explainer li { margin-bottom: 8px; }
.explainer strong { color: var(--ink); }
.explainer .faq p { margin: 0 0 16px; }

/* --- Footer --- */
.footer {
  padding: 20px 32px 32px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.footer a { color: var(--pink-ink); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer .dot { color: #cbbfad; }

/* --- Responsive --- */
@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .rail { position: static; }
  .masthead { padding-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-mat.solving .press-bar { animation: none; opacity: 0.6; }
  * { scroll-behavior: auto; }
}
