:root {
  --paper: #f6f0e3;
  --ink: #18221f;
  --sea: #0f6e74;
  --rust: #c65f32;
  --sage: #6f8f65;
  --line: #1b2d2a;
  --panel: rgba(246, 240, 227, 0.84);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 18%, rgba(15, 110, 116, 0.18), transparent 36%),
    radial-gradient(circle at 88% 10%, rgba(198, 95, 50, 0.2), transparent 38%),
    linear-gradient(155deg, #fbf7ee 0%, #efe2ca 52%, #f5eddc 100%);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      120deg,
      rgba(24, 34, 31, 0.028) 0,
      rgba(24, 34, 31, 0.028) 1px,
      transparent 1px,
      transparent 19px
    );
  opacity: 0.42;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.1rem 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.hero {
  border: 1px solid rgba(24, 34, 31, 0.2);
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 1.2rem;
}

.manifesto {
  border: 1px solid rgba(24, 34, 31, 0.2);
  background: rgba(248, 242, 230, 0.72);
  padding: 0.95rem 1.2rem;
  font-size: 0.92rem;
  line-height: 1.46;
  color: #203330;
}

.manifesto p {
  margin: 0;
  max-width: 72ch;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: #355a52;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
  margin: 0.4rem 0;
  color: #162928;
}

.statement {
  margin: 0;
  max-width: 68ch;
  line-height: 1.5;
  font-size: 0.99rem;
}

.canvas-shell {
  border: 1px solid rgba(24, 34, 31, 0.3);
  background: rgba(255, 253, 249, 0.68);
  min-height: 52vh;
}

#sketch-holder {
  width: 100%;
  height: min(74vh, 860px);
}

.controls {
  border: 1px solid rgba(24, 34, 31, 0.2);
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

.control-group {
  padding: 0.7rem;
  border: 1px solid rgba(24, 34, 31, 0.2);
  background: rgba(255, 253, 249, 0.6);
}

.label {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.71rem;
  color: #355a52;
}

.seed-value {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
}

.row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

button {
  flex: 1;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #f8f4e9;
  color: var(--ink);
  padding: 0.46rem 0.58rem;
  font-family: inherit;
  font-size: 0.82rem;
  transition: background 150ms ease, transform 150ms ease;
}

button:hover {
  background: #e6dbc2;
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

label {
  display: block;
  font-size: 0.82rem;
  margin: 0.2rem 0;
}

.compact-label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  min-width: 84px;
}

select {
  flex: 1;
  border: 1px solid var(--line);
  background: #f8f4e9;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 0.35rem 0.45rem;
}

select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--sea);
  margin-bottom: 0.4rem;
}

.export-status {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.78rem;
  color: #24423d;
}

.export-status.error {
  color: #7f3021;
}

.reveal-1,
.reveal-2,
.reveal-3 {
  opacity: 0;
  transform: translateY(12px);
  animation: emerge 800ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.reveal-2 {
  animation-delay: 90ms;
}

.reveal-3 {
  animation-delay: 180ms;
}

@keyframes emerge {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 980px) {
  .layout {
    grid-template-columns: minmax(420px, 1fr) 320px;
    grid-template-areas:
      "hero hero"
      "manifesto manifesto"
      "canvas controls";
  }

  .hero {
    grid-area: hero;
  }

  .canvas-shell {
    grid-area: canvas;
  }

  .manifesto {
    grid-area: manifesto;
  }

  .controls {
    grid-area: controls;
    align-content: start;
  }
}

body.reduced-motion .atmosphere {
  opacity: 0.2;
}

body.reduced-motion .reveal-1,
body.reduced-motion .reveal-2,
body.reduced-motion .reveal-3 {
  animation: none;
  opacity: 1;
  transform: none;
}

@media (max-width: 640px) {
  .row {
    flex-direction: column;
  }

  #sketch-holder {
    height: 56vh;
  }
}

#sketch-holder canvas {
  display: block;
  width: 100%;
  height: 100%;
}

button.layer-off {
  background: #d9cfc0;
  color: #7a7060;
}

.centered-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
