@font-face {
  font-family: "Boogy Brut";
  src: url("/assets/boogy.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Satoshi";
  src: url("/assets/satoshi.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Satoshi";
  src: url("/assets/satoshi-medium.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  --cherry: #480924;
  --wine: #74304e;
  --berry: #a0617b;
  --paper: #f4eedf;
  --paper-raised: #fbf8ef;
  --ink: #32101f;
  --muted: #705766;
  --line: rgba(72, 9, 36, 0.16);
  --success: #285c4d;
  --error: #8b2929;
  --focus: #a0617b;
  --display: "Boogy Brut", Georgia, serif;
  --sans: "Satoshi", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
}

button,
a,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  transform: translateY(-5rem);
  padding: 0.7rem 1rem;
  background: var(--cherry);
  color: white;
}

.skip-link:focus {
  transform: none;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.75rem;
  padding-inline: max(5vw, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(244, 238, 223, 0.92);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--display);
  font-size: 1.65rem;
  text-decoration: none;
}

.environment,
.status-chip,
.read-only {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

main,
footer {
  width: min(1120px, 90vw);
  margin-inline: auto;
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  align-items: end;
  gap: clamp(2rem, 6vw, 6rem);
  padding: clamp(2.75rem, 5vw, 4.5rem) 0 2.25rem;
}

.eyebrow,
.section-label {
  margin: 0 0 0.75rem;
  color: var(--wine);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p,
blockquote,
dl,
dd {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 400;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(3rem, 5vw, 4.75rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 1;
}

.lede {
  max-width: 430px;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.15rem);
  line-height: 1.6;
}

.notice {
  min-height: 3.2rem;
  margin: 0 0 1.5rem;
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--berry);
  background: rgba(160, 97, 123, 0.08);
}

.notice[data-state="success"] {
  border-color: var(--success);
  color: var(--success);
}

.notice[data-state="error"] {
  border-color: var(--error);
  color: var(--error);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(270px, 0.62fr) minmax(0, 1.38fr);
  border: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: 0 18px 55px rgba(72, 9, 36, 0.08);
}

.context,
.task {
  padding: clamp(1.5rem, 4vw, 3rem);
}

.context {
  background: var(--cherry);
  color: var(--paper-raised);
}

.context .section-label,
.context .privacy-note {
  color: #d5b9c6;
}

.source-copy {
  max-width: 30ch;
  color: #e3d5dc;
  line-height: 1.6;
}

.access-label {
  margin-top: 2.5rem;
}

.permissions {
  margin: 0 0 2rem;
}

.permissions div {
  padding: 1rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.17);
}

.permissions dt {
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.permissions code {
  color: white;
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
}

.permissions dd,
.privacy-note,
.task-copy,
.hint,
.muted,
.handoff {
  color: var(--muted);
  line-height: 1.65;
}

.permissions dd {
  color: #e3d5dc;
}

.permissions dd code {
  color: #d5b9c6;
}

.task__heading,
.results__heading,
.actions,
.post__meta,
.post__footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.status-chip[data-state="connected"] {
  border-color: rgba(40, 92, 77, 0.35);
  color: var(--success);
}

.task-copy {
  max-width: 54ch;
  margin-bottom: 2rem;
}

.source-picker {
  margin: 1.75rem 0 1rem;
  border-block: 1px solid var(--line);
  padding-block: 1rem;
}

.field-heading,
.source-row,
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.field-heading p {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.field-heading .section-label {
  display: block;
  margin-bottom: 0.25rem;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--wine);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}

.source-row {
  justify-content: flex-start;
  min-height: 2.75rem;
  border-top: 1px solid var(--line);
}

.source-row input,
.post__select input,
.selection-bar input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--cherry);
}

.source-row__query {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding-inline: 0;
  background: transparent;
}

.source-row__mode {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
}

.add-source {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.6rem;
  margin-top: 1rem;
}

input[type="text"],
select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.65rem 0.8rem;
  background: white;
  color: var(--ink);
}

.run-settings {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.run-settings select {
  min-width: 5rem;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid var(--cherry);
  border-radius: 0.35rem;
  padding: 0.78rem 1.1rem;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 150ms ease-out,
    background 150ms ease-out;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button--primary {
  background: var(--cherry);
  color: white;
}

.button--quiet {
  background: transparent;
  color: var(--cherry);
}

.connected-as {
  margin-bottom: 1.5rem;
  color: var(--success);
}

.test-post {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.test-post summary {
  padding: 1rem 0;
  color: var(--wine);
  cursor: pointer;
  font-weight: 600;
}

.seed {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: white;
}

blockquote {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1.25;
}

.hint {
  font-size: 0.9rem;
}

.actions {
  justify-content: flex-start;
  margin-top: 1.5rem;
}

.results {
  margin-top: 1.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.selection-bar {
  margin-top: 1.5rem;
  padding-block: 1rem;
  border-block: 1px solid var(--line);
}

.selection-bar label,
.post__select {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.read-only {
  color: var(--success);
}

.post {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border-left: 4px solid var(--berry);
  background: white;
}

.post__select {
  margin-bottom: 1rem;
  color: var(--wine);
}

.post__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.post__text {
  margin: 1.4rem 0;
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.5vw, 2rem);
  line-height: 1.2;
}

.post__footer {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.post__footer a {
  color: var(--wine);
  font-weight: 600;
}

.handoff {
  max-width: 70ch;
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.run-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.5fr) auto;
  align-items: center;
  gap: 2rem;
  margin-top: 1.5rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}

.run-panel h2,
.run-panel p {
  margin-bottom: 0.4rem;
}

progress {
  width: 100%;
  height: 0.7rem;
  accent-color: var(--cherry);
}

.empty-title {
  margin-bottom: 0.5rem;
  font-family: var(--display);
  font-size: 1.5rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 3rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}

@media (max-width: 760px) {
  body {
    background: var(--paper);
  }

  .masthead {
    padding-inline: 1rem;
  }

  main,
  footer {
    width: min(100% - 2rem, 680px);
  }

  h1 {
    font-size: clamp(3rem, 14vw, 4.25rem);
  }

  .page-heading,
  .workspace {
    grid-template-columns: 1fr;
  }

  .page-heading {
    gap: 1.5rem;
    padding-block: 3rem 2rem;
  }

  .add-source,
  .run-panel {
    grid-template-columns: 1fr;
  }

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

  .task__heading,
  .results__heading,
  .selection-bar,
  .post__footer,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
