:root {
  --carbon: #0a0908;
  --ink: #14110f;
  --velvet: #1c1916;
  --ash: #2a2520;
  --smoke: #6f685e;
  --bone: #cfc8b8;
  --ivory: #f4efe4;

  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", -apple-system, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;

  --tracking-mono: 0.22em;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--carbon);
  color: var(--ivory);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ---------- site header (statisch, links terug naar henevor.com) ---------- */
.hv-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 18px clamp(20px, 3.2vw, 48px);
  border-bottom: 1px solid var(--ash);
  background: var(--carbon);
}
.hv-nav .logo {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 24px; letter-spacing: -0.025em; line-height: 1;
  color: var(--ivory); text-decoration: none;
}
.hv-nav .links {
  display: flex; gap: clamp(20px, 2.4vw, 36px);
  font-family: var(--mono); font-size: 11px; letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
}
.hv-nav .links a {
  color: var(--smoke); text-decoration: none; padding-bottom: 4px;
  border-bottom: 1.5px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
.hv-nav .links a:hover { color: var(--ivory); border-bottom-color: var(--bone); }
.hv-nav .hv-cta {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 18px; border: 1px solid var(--bone); border-radius: 999px;
  background: transparent; color: var(--ivory);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  transition: background 200ms ease, color 200ms ease;
}
.hv-nav .hv-cta:hover { background: var(--ivory); color: var(--carbon); }
.hv-nav .hv-cta .arr { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1; }
@media (max-width: 720px) {
  .hv-nav { flex-wrap: wrap; gap: 12px; }
  .hv-nav .links { order: 3; width: 100%; justify-content: flex-start; gap: 18px; }
}

.wrap {
  max-width: 1640px;
  margin: 0 auto;
  padding: clamp(24px, 3vw, 40px) clamp(20px, 3.2vw, 48px) 80px;
}

/* ---------- header ---------- */
.head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--ash);
  padding-bottom: 18px;
}
.wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -0.01em;
}
.kicker {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 12px;
  color: var(--smoke);
}

/* ---------- lede ---------- */
.lede {
  font-family: var(--serif);
  font-style: italic;
  font-size: 26px;
  line-height: 1.35;
  max-width: 720px;
  margin: 32px 0 40px;
  color: var(--ivory);
}

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---------- editor ---------- */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: var(--ink);
  background-image: repeating-linear-gradient(
    -45deg,
    transparent 0,
    transparent 11px,
    rgba(255, 255, 255, 0.018) 11px,
    rgba(255, 255, 255, 0.018) 12px
  );
  border: 1px solid var(--ash);
  overflow: hidden;
  cursor: default;
}
.stage.dragover { border-color: var(--bone); }
.stage.has-image { cursor: crosshair; }

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.dropmsg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}
.dropmsg-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  color: var(--ivory);
}
.dropmsg-sub {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 12px;
  color: var(--smoke);
}
.has-image .dropmsg { display: none; }

/* ---------- loupe ----------
   The loupe is placed diagonally next to the cursor/handle by JS,
   using CSS variables --lx / --ly (in stage CSS pixels). It snaps to
   one of four quadrants to stay inside the stage and out of the way
   of the finger or cursor. */
.loupe {
  position: absolute;
  left: 0;
  top: 0;
  width: 180px;
  height: 180px;
  border-radius: 999px;
  border: 1px solid var(--bone);
  box-shadow: 0 8px 36px rgba(0, 0, 0, 0.7);
  display: none;
  pointer-events: none;
  background: var(--ink);
  transform: translate(var(--lx, 0px), var(--ly, 0px));
  transition: transform 80ms linear;
  will-change: transform;
}
.loupe.active { display: block; }
@media (max-width: 760px) {
  .loupe { width: 148px; height: 148px; }
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}
.pill {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 12px;
  color: var(--ivory);
  background: transparent;
  border: 1px solid var(--ash);
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
  white-space: nowrap;
}
.pill:hover:not(:disabled) { border-color: var(--bone); }
.pill:disabled { color: var(--smoke); border-color: var(--ink); cursor: not-allowed; }
.status {
  margin-left: auto;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 11px;
  color: var(--smoke);
}

/* ---------- controls / sliders ---------- */
.controls {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 560px;
}
.control {
  display: grid;
  grid-template-columns: 120px auto 1fr 48px;
  align-items: center;
  gap: 14px;
}
.control-label {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 11px;
  color: var(--smoke);
}
.swatch {
  width: 18px;
  height: 18px;
  border: 1px solid var(--ash);
  background: var(--ivory);
}
.control:not(:has(.swatch)) input[type="range"] { grid-column: 2 / 4; }
.control-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--bone);
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 1px;
  background: var(--ash);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ivory);
  border: none;
  margin-top: -1px;
}
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ivory);
  border: none;
}
/* grotere, makkelijk te grijpen schuifknop op touch (iPhone/iPad) */
@media (pointer: coarse) {
  input[type="range"] { height: 4px; border-radius: 999px; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -11px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }
}

/* ---------- outputs ---------- */
.outputs-head {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 12px;
  color: var(--smoke);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ash);
  margin-bottom: 28px;
}
.cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px 28px;
  align-content: start;
}
.card { display: flex; flex-direction: column; }
.card-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}
.card-preview img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
  font-size: 11px;
  margin: 14px 0;
}
.card-meta .label { color: var(--ivory); }
.card-meta .dims { color: var(--smoke); }
.card .pill { width: 100%; text-align: center; }
.card.empty .card-preview { background: var(--ink); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }
  .lede {
    font-size: 22px;
    margin: 24px 0 32px;
  }
  .stage { aspect-ratio: 3 / 2; }
}

@media (max-width: 600px) {
  .head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .wordmark { font-size: 28px; }
  .toolbar .pill {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    white-space: normal;
    letter-spacing: 0.16em;
  }
  .status { margin-left: 0; flex-basis: 100%; }
  .control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
  }
  .control-label { flex: 1 1 100%; }
  .swatch { order: 2; }
  .control input[type="range"] {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
  }
  .control-val { order: 2; flex: 0 0 auto; }
  .cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px 16px; }
}
