:root {
  --bg: #f6f0e8;
  --bg-strong: #f0e4d8;
  --surface: rgba(255, 251, 247, 0.85);
  --surface-strong: #fffaf5;
  --border: rgba(41, 28, 17, 0.14);
  --text: #20150d;
  --muted: #6a5646;
  --accent: #ff6f3c;
  --accent-strong: #e54b17;
  --accent-soft: rgba(255, 111, 60, 0.12);
  --mint: #0f766e;
  --shadow: 0 24px 60px rgba(61, 28, 8, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --container: min(1180px, calc(100vw - 2rem));
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 111, 60, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.15), transparent 24%),
    linear-gradient(180deg, #fff9f4 0%, var(--bg) 48%, #efe2d2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(32, 21, 13, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 21, 13, 0.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

code,
pre {
  font-family: "IBM Plex Mono", monospace;
}

.page-shell {
  width: var(--container);
  margin: 0 auto;
  padding-bottom: 4rem;
}

.site-header {
  position: sticky;
  top: 0.8rem;
  z-index: 10;
  width: 100%;
  margin: 1rem auto 0;
  padding: 0.95rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 248, 242, 0.8);
  border: 1px solid rgba(41, 28, 17, 0.09);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(44, 24, 10, 0.08);
}

.brand {
  font-weight: 700;
  letter-spacing: -0.03em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
}

.section {
  margin-top: 2rem;
  padding: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.75rem;
  padding-top: 3rem;
  overflow: hidden;
}

.hero > *,
.generator-grid > * {
  min-width: 0;
}

.hero-copy h1,
.site-footer h2,
.section-heading h2 {
  margin: 0;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.hero-copy h1 {
  font-size: clamp(3.2rem, 8vw, 6.5rem);
  max-width: 11ch;
}

.eyebrow {
  margin: 0 0 0.7rem;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-strong);
}

.lede {
  max-width: 60ch;
  margin: 1.3rem 0 0;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--muted);
}

.lede span {
  color: var(--text);
}

.hero-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.75rem;
}

.hero-card,
.step-card,
.builder-section,
.preview-panel,
.spec-card,
.rule,
.example-card,
.faq-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(255, 251, 247, 0.92);
}

.hero-card {
  padding: 1.2rem;
}

.hero-card.accent {
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(15, 118, 110, 0.18));
}

.card-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
}

.hero-card p:last-child {
  margin: 0;
  line-height: 1.5;
}

.hero-actions,
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button,
.chip,
.remove-entry {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
}

.button.small {
  min-height: 2.5rem;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
}

.button.primary {
  color: #fff7f2;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 28px rgba(229, 75, 23, 0.3);
}

.button.secondary,
.chip,
.remove-entry {
  color: var(--text);
  background: rgba(255, 251, 247, 0.7);
  border: 1px solid var(--border);
}

.button:hover,
.chip:hover,
.remove-entry:hover,
.button:focus-visible,
.chip:focus-visible,
.remove-entry:focus-visible {
  transform: translateY(-1px);
}

.hero-preview {
  position: relative;
}

.hero-preview::after {
  content: "";
  position: absolute;
  right: -14%;
  bottom: -18%;
  width: 16rem;
  height: 16rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 111, 60, 0.34), transparent 65%);
  filter: blur(8px);
  pointer-events: none;
}

.code-window {
  position: relative;
  height: 100%;
  padding: 1rem;
  border-radius: calc(var(--radius-xl) - 6px);
  background: linear-gradient(180deg, #23150d 0%, #17100b 100%);
  color: #fff8f2;
  box-shadow: 0 24px 60px rgba(23, 16, 11, 0.34);
}

.code-window__bar {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.code-window__bar span {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: rgba(255, 248, 242, 0.4);
}

.code-window pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.7;
}

.section-heading {
  max-width: 46rem;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.section-heading p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.steps,
.spec-grid,
.spec-rules,
.examples-grid,
.faq-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.6rem;
}

.agent-handoff {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.4rem;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 111, 60, 0.08), rgba(15, 118, 110, 0.08));
}

.agent-handoff h3 {
  margin: 0 0 0.55rem;
  font-size: 1.2rem;
}

.agent-handoff p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.agent-handoff pre {
  margin: 0;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: #1d130d;
  color: #fff8f2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  font-size: 0.88rem;
}

.steps,
.spec-grid,
.spec-rules,
.examples-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.step-card,
.spec-card,
.rule,
.example-card,
.faq-item {
  padding: 1.2rem;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.step-card h3,
.builder-header h3,
.preview-header h3,
.spec-card h3,
.rule h3,
.example-card h3,
.faq-item h3 {
  margin: 0.95rem 0 0.45rem;
  font-size: 1.1rem;
}

.step-card p,
.spec-card p,
.rule p,
.example-card p,
.faq-item p,
.builder-header p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
}

.generator-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1.6rem;
  margin-bottom: 1.2rem;
}

.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.chip {
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
}

.chip.active {
  background: var(--accent-soft);
  border-color: rgba(229, 75, 23, 0.22);
  color: var(--accent-strong);
}

.toolbar-note {
  margin: 0;
  color: var(--muted);
}

.generator-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  align-items: start;
}

.generator-form {
  display: grid;
  gap: 1rem;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

label span {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  padding: 0.85rem 0.95rem;
  color: var(--text);
  background: #fffdf9;
  border: 1px solid rgba(41, 28, 17, 0.12);
  border-radius: var(--radius-sm);
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(255, 111, 60, 0.18);
  border-color: rgba(229, 75, 23, 0.36);
}

.builder-section {
  padding: 1rem;
}

.builder-header,
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.entry-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.entry-card {
  display: grid;
  gap: 0.9rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid rgba(41, 28, 17, 0.09);
}

.entry-fields {
  display: grid;
  gap: 0.8rem;
}

.remove-entry {
  justify-self: start;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
}

.preview-panel {
  position: sticky;
  top: 6.4rem;
  padding: 1rem;
}

.preview-code {
  margin: 1rem 0 0;
  padding: 1rem;
  min-height: 32rem;
  max-height: 42rem;
  overflow: auto;
  border-radius: var(--radius-md);
  background: #1d130d;
  color: #fff8f2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 0.88rem;
}

.status-message {
  min-height: 1.2rem;
  margin: 0.85rem 0 0;
  color: var(--mint);
  font-size: 0.95rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 2rem 2.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 111, 60, 0.12), rgba(15, 118, 110, 0.14));
  border: 1px solid rgba(41, 28, 17, 0.09);
}

.site-footer h2 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  max-width: 12ch;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 500ms ease,
    transform 500ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .hero,
  .generator-grid,
  .agent-handoff,
  .steps,
  .spec-grid,
  .spec-rules,
  .examples-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  .hero-copy h1 {
    max-width: 13ch;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: calc(100vw - 1rem);
  }

  .site-header,
  .generator-toolbar,
  .builder-header,
  .preview-header,
  .site-footer,
  .input-grid,
  .hero-points {
    grid-template-columns: 1fr;
  }

  .site-header,
  .generator-toolbar,
  .builder-header,
  .preview-header,
  .site-footer {
    display: grid;
  }

  .site-nav,
  .preview-actions {
    flex-wrap: wrap;
  }

  .section {
    padding: 1.25rem;
  }

  .hero {
    padding-top: 1.5rem;
  }

  .lede {
    max-width: 100%;
  }

  .hero-copy h1 {
    max-width: 6.5ch;
    font-size: clamp(2.25rem, 12vw, 3.5rem);
  }

  .site-footer h2,
  .section-heading h2 {
    font-size: clamp(1.8rem, 9vw, 2.8rem);
  }
}
