:root {
  --sage-mist: #eef4ec;
  --paper: #f6f0e4;
  --vellum: #fff9ee;
  --paper-deep: #e9dec9;
  --rule: #d8cbb8;
  --sepia: #55463a;
  --faded-ink: #645548;
  --pressed-leaf: #34462f;
  --moss-wash: #e7eddd;
  --bluebell: #5f7890;
  --foxglove: #9b3f55;
  --marigold: #c08a3e;
  --shadow-paper: 0 1px 0 rgba(85, 70, 58, 0.08);
  --ease-paper: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sepia);
  background:
    linear-gradient(90deg, rgba(216, 203, 184, .24) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, rgba(255, 249, 238, .68), rgba(238, 244, 236, .76)),
    var(--sage-mist);
  font-family: "Alegreya Sans", system-ui, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.studio {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.topbar,
.workspace,
.examples {
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(255, 249, 238, .92);
  box-shadow: var(--shadow-paper);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 22px;
}

.brand-block {
  max-width: 760px;
}

.brand-block p:last-child {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--faded-ink);
  font-size: 18px;
  line-height: 1.4;
}

.topbar-nav {
  display: flex;
  gap: 8px;
}

.topbar-nav a {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--vellum);
  color: var(--sepia);
  font-weight: 700;
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
}

.kicker {
  margin: 0 0 8px;
  color: var(--pressed-leaf);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--sepia);
  font-family: "Spectral", Georgia, serif;
  letter-spacing: 0;
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 19px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  grid-template-areas:
    "settings conversation"
    "settings brief";
  margin-top: 16px;
  overflow: visible;
  align-items: stretch;
}

.settings-panel,
.conversation-panel,
.brief-ledger {
  min-width: 0;
  padding: 18px;
}

.settings-panel {
  grid-area: settings;
  border-right: 1px solid var(--rule);
  align-self: start;
}

.conversation-panel {
  grid-area: conversation;
  border-bottom: 1px solid var(--rule);
  background:
    radial-gradient(circle at 12% 12%, rgba(83, 107, 71, .08), transparent 26%),
    var(--vellum);
}

.brief-ledger {
  grid-area: brief;
  background: color-mix(in srgb, var(--paper) 62%, var(--sage-mist));
}

.panel-head {
  display: block;
  margin-bottom: 14px;
}

.conversation-head {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.segmented legend {
  color: var(--pressed-leaf);
  font-size: 12px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--vellum);
  color: var(--sepia);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.38;
}

input::placeholder,
textarea::placeholder {
  color: #746658;
}

input:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--bluebell);
  box-shadow: 0 0 0 3px rgba(95, 120, 144, .2);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--vellum);
  color: var(--faded-ink);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 12px;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: var(--pressed-leaf);
  background: #dbe8d2;
  color: var(--sepia);
}

.toggle-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
  color: var(--faded-ink);
  cursor: pointer;
}

.toggle-row > input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
  overflow: hidden;
  appearance: none;
}

.toggle-control {
  width: 42px;
  height: 24px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  position: relative;
  transition: background 160ms var(--ease-paper), border-color 160ms var(--ease-paper);
}

.toggle-control::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--vellum);
  border: 1px solid var(--rule);
  content: "";
  transition: transform 160ms var(--ease-paper), border-color 160ms var(--ease-paper);
}

.toggle-row input:checked + .toggle-control {
  border-color: var(--pressed-leaf);
  background: #dbe8d2;
}

.toggle-row input:checked + .toggle-control::after {
  border-color: var(--pressed-leaf);
  transform: translateX(18px);
}

.toggle-row strong {
  display: block;
  color: var(--sepia);
}

.toggle-row small {
  display: block;
  margin-top: 2px;
  color: var(--faded-ink);
  line-height: 1.25;
}

.question-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.question-rail li {
  list-style: none;
  min-height: 30px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--vellum);
  color: var(--faded-ink);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 11px;
  white-space: nowrap;
}

.question-rail li::marker {
  content: "";
}

.question-rail li.active {
  border-color: var(--bluebell);
  color: var(--bluebell);
}

.question-rail li.done {
  border-color: var(--pressed-leaf);
  background: var(--moss-wash);
  color: var(--pressed-leaf);
}

.transcript {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 144px;
  max-height: 210px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(216, 203, 184, .76);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 249, 238, .82), rgba(246, 240, 228, .7)),
    color-mix(in srgb, var(--vellum) 76%, var(--sage-mist));
}

.bubble {
  width: fit-content;
  max-width: min(620px, 82%);
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--faded-ink);
  line-height: 1.38;
  box-shadow: 0 1px 0 rgba(85, 70, 58, .08);
  background: rgba(255, 253, 247, .94);
}

.bubble.user {
  align-self: flex-end;
  background: #e7eef2;
  color: var(--sepia);
}

.bubble.assistant {
  background: #fffaf0;
}

.bubble a {
  color: var(--pressed-leaf);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

.chat-input textarea {
  min-height: 126px;
  border-color: color-mix(in srgb, var(--bluebell) 52%, var(--rule));
  background: #fffdf7;
  font-size: 18px;
}

.reply-button,
.btn {
  min-height: 42px;
  border-radius: 4px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms var(--ease-paper), background 160ms var(--ease-paper), border-color 160ms var(--ease-paper);
}

.reply-button {
  justify-self: end;
  min-width: 96px;
  min-height: 38px;
  border: 1px solid var(--rule);
  background: var(--vellum);
  color: var(--sepia);
}

.btn {
  border: 1px solid transparent;
}

.reply-button:hover,
.btn:hover {
  transform: translateY(-1px);
}

.reply-button:disabled,
.btn:disabled {
  cursor: wait;
  opacity: .62;
  transform: none;
}

.btn.primary {
  background: #34462f;
  color: #fff9ee;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 22px;
  gap: 0;
  margin: 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(216, 203, 184, .78);
}

.summary-list dt {
  color: var(--pressed-leaf);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 11px;
}

.summary-list dd {
  min-width: 0;
  margin: 0;
  color: var(--faded-ink);
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.art-plan {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.art-plan p:last-child {
  margin: 8px 0 0;
  color: var(--faded-ink);
  line-height: 1.35;
}

.generate-button {
  width: 100%;
  min-height: 64px;
  margin-top: 12px;
  font-size: 20px;
}

.checkout-note {
  margin: 8px 0 0;
  color: var(--faded-ink);
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
}

.brief-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.brief-status {
  margin: 2px 0 0;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--vellum);
  color: var(--faded-ink);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 8px 10px;
  white-space: nowrap;
}

.examples {
  margin-top: 16px;
  padding: 18px;
}

.agent-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: rgba(255, 249, 238, .92);
  box-shadow: var(--shadow-paper);
}

.agent-prompt-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.agent-prompt-wrap textarea {
  min-height: 132px;
  color: var(--faded-ink);
  background: #fffdf7;
  font-family: "Alegreya Sans", system-ui, sans-serif;
  line-height: 1.35;
}

.btn.secondary {
  border: 1px solid var(--rule);
  background: var(--vellum);
  color: var(--sepia);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 14px;
}

.section-head p:last-child {
  max-width: 660px;
  margin: 0;
  color: var(--faded-ink);
  line-height: 1.35;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.example-grid article {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--vellum);
  overflow: hidden;
}

.example-grid img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.example-grid span {
  display: block;
  padding: 9px 10px;
  color: var(--sepia);
  font-family: "Recursive Mono", ui-monospace, monospace;
  font-size: 11px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
  }

  .brief-ledger {
    grid-area: brief;
  }

  .conversation-panel {
    border-right: 0;
  }

  .transcript {
    min-height: 144px;
    max-height: 210px;
  }

  .example-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .studio {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
  }

  .topbar,
  .section-head {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: 30px;
  }

  .brand-block p:last-child {
    font-size: 16px;
  }

  .question-rail {
    width: 100%;
  }

  .question-rail li {
    padding: 8px 4px;
    text-align: center;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "settings"
      "conversation"
      "brief";
  }

  .settings-panel {
    border-right: 0;
  }

  .conversation-panel {
    border: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }

  .conversation-head {
    display: grid;
  }

  .transcript {
    min-height: 136px;
    max-height: 210px;
  }

  .summary-list,
  .summary-list div,
  .agent-prompt-wrap {
    grid-template-columns: 1fr;
  }

  .agent-prompt-wrap .btn {
    width: 100%;
  }

  .brief-head {
    display: grid;
  }

  .example-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
