/*
 * app.css
 * Layout and components for the single page tool.
 */

.shell {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 42px);
}

/* ---------------------------------------------------------------- header */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--accent);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name {
  font-family: var(--serif);
  font-size: 21px;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.masthead-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.masthead-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}

.masthead-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------------ lede */

.lede {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(30px, 4.4vw, 58px) 0 clamp(26px, 3.4vw, 40px);
  align-items: end;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

.eyebrow-rule {
  display: inline-block;
  width: 26px;
  height: 1px;
  background: var(--rule-strong);
}

.lede h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(30px, 4.1vw, 53px);
  line-height: 1.04;
  letter-spacing: -0.022em;
  max-width: 19ch;
  text-wrap: balance;
}

.accent-word {
  font-style: italic;
  color: var(--accent);
}

.lede-text {
  margin-top: 16px;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: 15px;
}

.lede-facts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 0 4px 18px;
  border-left: 1px solid var(--rule);
}

.lede-facts li {
  display: flex;
  gap: 11px;
  font-size: 13px;
  color: var(--ink-soft);
  align-items: baseline;
}

.fact-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid var(--rule);
  background: var(--surface);
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  transform: translateY(1px);
}

/* -------------------------------------------------------------- workbench */

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 338px;
  gap: 16px;
  align-items: start;
  padding-bottom: 46px;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.stage-panel {
  position: sticky;
  top: 12px;
  z-index: 2;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow-card);
  animation: panel-in 400ms var(--ease) both;
}

.rail-view .panel:nth-child(1) {
  animation-delay: 40ms;
}

.rail-view .panel:nth-child(2) {
  animation-delay: 90ms;
}

.rail-controls .panel:nth-child(1) {
  animation-delay: 20ms;
}

.rail-controls .panel:nth-child(2) {
  animation-delay: 60ms;
}

.rail-controls .panel:nth-child(3) {
  animation-delay: 100ms;
}

.rail-controls .panel:nth-child(4) {
  animation-delay: 140ms;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.panel-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 17px;
  padding: 0 3px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  color: var(--accent);
  border: 1px solid var(--rule);
  background: var(--surface-2);
}

.panel-note {
  font-size: 11px;
  color: var(--ink-faint);
}

.count {
  font-size: 10.5px;
  color: var(--ink-faint);
  border: 1px solid var(--rule);
  padding: 0 5px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- source */

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 20px 14px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
  text-align: center;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease), transform 140ms var(--ease);
}

.dropzone:hover,
.dropzone:focus-within {
  background: #f1ece1;
  border-color: var(--accent);
}

.dropzone.is-dragging {
  background: var(--accent-wash);
  border-color: var(--accent);
  border-style: solid;
}

.dropzone-icon {
  color: var(--ink-soft);
  margin-bottom: 5px;
}

.dropzone-title {
  font-size: 13.5px;
  font-weight: 600;
}

.dropzone-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

.field-help {
  margin-top: 6px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
}

.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
  border-radius: 2px;
}

.file-main {
  min-width: 0;
}

.file-name {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- fields */

.field {
  margin-top: 14px;
}

.field:first-of-type {
  margin-top: 0;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.field-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  padding: 0 5px;
  min-width: 34px;
  text-align: center;
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-sub {
  margin-top: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--rule);
}

.input {
  width: 100%;
  margin-top: 5px;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: border-color 120ms var(--ease);
}

.input:hover {
  border-color: var(--rule-strong);
}

.input:focus {
  border-color: var(--accent);
  outline: none;
}

select.input {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 15px) 12px, calc(100% - 10px) 12px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  cursor: pointer;
}

/* Range inputs, kept simple and square. */
.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  margin: 9px 0 2px;
  height: 16px;
  background: transparent;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule-strong);
}

.range::-moz-range-track {
  height: 2px;
  background: var(--rule-strong);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
  transition: background-color 120ms var(--ease), transform 120ms var(--ease);
}

.range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.range:hover::-webkit-slider-thumb,
.range:focus::-webkit-slider-thumb {
  background: var(--accent);
  border-color: var(--accent);
}

.range:focus-visible {
  outline: none;
}

.range:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.input:disabled,
select.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--surface-2);
}

.seg-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--accent-wash);
}

/* Switch */
.switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 12.5px;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch-track {
  position: relative;
  width: 32px;
  height: 17px;
  flex: none;
  background: #dcd7ca;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  transition: transform 140ms var(--ease), background-color 140ms var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track .switch-knob {
  transform: translateX(15px);
  background: #fff;
  border-color: var(--accent);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.switch-plain {
  margin-top: 12px;
}

/* Swatches */
.swatches {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 2px;
  border: 1px solid var(--rule-strong);
  background: var(--swatch, #fff);
  position: relative;
  padding: 0;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease);
}

.swatch:hover {
  transform: translateY(-1px);
}

.swatch[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--ink);
}

.swatch-white {
  --swatch: #ffffff;
}

.swatch-black {
  --swatch: #000000;
}

.swatch-checker {
  background-image: linear-gradient(45deg, #cfcabd 25%, transparent 25%, transparent 75%, #cfcabd 75%),
    linear-gradient(45deg, #cfcabd 25%, transparent 25%, transparent 75%, #cfcabd 75%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  background-color: #fff;
}

.swatch-custom {
  overflow: hidden;
  cursor: pointer;
}

.swatch-custom input {
  position: absolute;
  inset: -6px;
  width: 200%;
  height: 200%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.advanced {
  margin-top: 14px;
  border-top: 1px dashed var(--rule);
  padding-top: 10px;
}

.advanced summary {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::after {
  content: "+";
  font-size: 13px;
  color: var(--ink-faint);
}

.advanced[open] summary::after {
  content: "\2212";
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), transform 90ms var(--ease),
    border-color 120ms var(--ease), opacity 120ms var(--ease);
}

.btn:hover:not(:disabled) {
  background: var(--ink);
  color: var(--surface);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover:not(:disabled) {
  background: #a53715;
  border-color: #a53715;
  color: #fff;
}

.btn-quiet {
  border-color: var(--rule-strong);
  background: var(--surface);
}

.btn-small {
  height: 27px;
  padding: 0 10px;
  font-size: 11.5px;
}

.btn-wide {
  width: 100%;
}

.text-button {
  margin-top: 9px;
  padding: 0;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}

.text-button:hover:not(:disabled) {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.text-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------ stage */

.stage-panel {
  padding-bottom: 12px;
}

.stage-head {
  border-bottom: 0;
  margin-bottom: 8px;
  padding-bottom: 0;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  background: var(--surface-2);
}

.seg-btn {
  padding: 5px 9px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  border-right: 1px solid var(--rule);
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}

.seg-btn:last-child {
  border-right: 0;
}

.seg-btn:hover {
  color: var(--ink);
  background: #f0eadf;
}

.seg-btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

.stage-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(340px, 56vh, 640px);
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background-color: var(--paper-deep);
  background-image: radial-gradient(rgba(23, 23, 26, 0.055) 1px, transparent 1px);
  background-size: 14px 14px;
  overflow: hidden;
}

.stage-canvas {
  display: none;
  max-width: 100%;
  max-height: 100%;
  background-color: #fff;
  background-image: linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  box-shadow: 0 2px 10px rgba(23, 23, 26, 0.09);
  transition: opacity 180ms var(--ease);
}

.stage-canvas.is-visible {
  display: block;
}

.stage-canvas.is-fresh {
  animation: canvas-in 220ms var(--ease) both;
}

@keyframes canvas-in {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}

.stage-empty {
  text-align: center;
  color: var(--ink-faint);
  max-width: 300px;
}

.empty-mark {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-bottom: 12px;
}

.empty-mark span {
  width: 12px;
  height: 26px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  transform: skewY(-12deg);
}

.empty-mark span:nth-child(2) {
  height: 34px;
  background: var(--accent-wash);
  border-color: #ddb9a8;
}

.empty-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.empty-text {
  font-size: 11.5px;
  margin-top: 2px;
}

.stage-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(251, 250, 246, 0.92);
  border: 1px solid var(--rule);
  padding: 2px 6px;
}

.stage-badge:empty {
  display: none;
}

.stage-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: rgba(251, 250, 246, 0.96);
  border: 1px solid var(--rule);
  padding: 8px 10px 9px;
}

.stage-progress-track {
  height: 2px;
  background: var(--rule);
  overflow: hidden;
}

.stage-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 200ms linear;
}

.stage-progress-label {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}

.stage-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding-top: 9px;
}

.stage-hint {
  font-size: 11.5px;
  color: var(--ink-faint);
}

.stage-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- layers */

.layers-panel {
  padding-bottom: 8px;
}

.layer-list {
  max-height: 246px;
  overflow-y: auto;
  margin-right: -6px;
  padding-right: 6px;
  scrollbar-width: thin;
}

.layer-row {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 4px 6px 4px 4px;
  border-left: 2px solid transparent;
  border-radius: 2px;
  text-align: left;
  transition: background-color 90ms linear, border-color 90ms linear;
}

.layer-row + .layer-row {
  border-top: 1px solid #ece7db;
}

.layer-row:hover,
.layer-row.is-hot {
  background: var(--accent-wash);
  border-left-color: var(--accent);
}

.layer-swatch {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(23, 23, 26, 0.22);
  border-radius: 1px;
}

.layer-name {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-nodes {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.layer-area {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  text-align: right;
}

.layer-empty {
  padding: 10px 4px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

/* ----------------------------------------------------------------- export */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-bottom: 12px;
}

.stats div {
  background: var(--surface);
  padding: 8px 9px;
}

.stats dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.stats dd {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.export-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
}

.warnings {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.warnings li {
  position: relative;
  padding-left: 13px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--warn);
}

.warnings li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 5px;
  height: 5px;
  background: currentColor;
  transform: rotate(45deg);
}

.warnings li.is-bad {
  color: var(--bad);
}

/* ------------------------------------------------------------- lower text */

.columns {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 60px);
  padding: 44px 0 10px;
  border-top: 1px solid var(--rule);
}

.section-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 25px;
  letter-spacing: -0.012em;
  margin-bottom: 18px;
}

.steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 26px;
}

.steps li {
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}

.step-index {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.steps h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 5px 0 4px;
}

.steps p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.side-notes {
  padding-left: clamp(0px, 2vw, 26px);
  border-left: 1px solid var(--rule);
}

.notes {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.notes li {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.notes strong {
  color: var(--ink);
  font-weight: 600;
}

/* ------------------------------------------------------------------ foot */

.site-foot {
  border-top: 1px solid var(--rule);
  margin-top: 40px;
  padding: 18px 0 30px;
}

.site-foot-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.foot-links {
  display: flex;
  gap: 16px;
}

.foot-links a {
  color: var(--ink-soft);
  text-decoration: none;
}

.foot-links a:hover {
  color: var(--accent);
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--ink);
  border-radius: 2px;
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  box-shadow: 0 6px 18px rgba(23, 23, 26, 0.12);
  animation: toast-in 180ms var(--ease) both;
}

.toast.is-error {
  border-left-color: var(--bad);
}

.toast.is-ok {
  border-left-color: var(--ok);
}

.toast.is-leaving {
  animation: toast-out 160ms var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

/* ------------------------------------------------------------ small parts */

kbd {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px 1px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink-soft);
}

.foot-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.foot-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  color: var(--ink-faint);
}

.foot-keys span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.panel-empty {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ink-faint);
}

/* The whole page takes a drop, so say so while a file is over it. */
.drop-veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  background: rgba(239, 236, 228, 0.88);
}

.drop-veil::before {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
}

.drop-veil-label {
  position: relative;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 10px 16px;
}

/* Corner ticks, the way a drafting sheet marks its edges. */
.stage-frame::before,
.stage-frame::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--rule-strong);
  border-style: solid;
  pointer-events: none;
  opacity: 0.8;
}

.stage-frame::before {
  top: 6px;
  left: 6px;
  border-width: 1px 0 0 1px;
}

.stage-frame::after {
  right: 6px;
  bottom: 6px;
  border-width: 0 1px 1px 0;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1120px) {
  .workbench {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .lede {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
}

@media (max-width: 920px) {
  .lede {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 20px;
  }

  .lede h1 {
    max-width: 24ch;
  }

  .lede-facts {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 22px;
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding: 12px 0 0;
  }

  .workbench {
    grid-template-columns: 1fr;
  }

  /* On a narrow screen the panels become direct children of the workbench, so
     the source picker sits first, then the preview and its layer list. */
  .rail-view,
  .rail-controls {
    display: contents;
  }

  .rail-controls .panel:nth-child(1) {
    order: 1;
  }

  .rail-view .panel:nth-child(1) {
    order: 2;
  }

  .rail-view .panel:nth-child(2) {
    order: 3;
  }

  .rail-controls .panel:nth-child(2) {
    order: 4;
  }

  .rail-controls .panel:nth-child(3) {
    order: 5;
  }

  .rail-controls .panel:nth-child(4) {
    order: 6;
  }

  .stage-panel {
    position: static;
  }

  .stage-frame {
    height: clamp(300px, 46vh, 460px);
  }

  .columns {
    grid-template-columns: 1fr;
  }

  .side-notes {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding-top: 22px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }

  .masthead-nav a {
    display: none;
  }

  .masthead-nav a:last-child {
    display: inline;
  }

  .masthead-inner {
    min-height: 58px;
  }

  .stage-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .seg-btn {
    padding: 5px 7px;
    font-size: 10.5px;
  }

  .stage-frame {
    padding: 8px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .export-buttons {
    grid-template-columns: 1fr 64px;
  }

  .layer-list {
    max-height: 200px;
  }

  .site-foot-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .stage-foot {
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 380px) {
  .brand-tag {
    display: none;
  }
}

/* ------------------------------------------------------------------- 404 */

.notfound {
  padding-top: 12vh;
  max-width: 720px;
}

.notfound h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(32px, 4.5vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 14px 0 10px;
}

.notfound-actions {
  margin-top: 24px;
}
