*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchored panels land below the sticky header instead of under it. */
  scroll-padding-top: 104px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ol,
ul,
figure {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--button-light);
  color: var(--on-light);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* Layout */

.wrap {
  width: 100%;
  max-width: calc(var(--content-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--wide {
  max-width: calc(var(--header-width) + var(--gutter) * 2);
}

main {
  padding-bottom: 96px;
}

main > .wrap > * + * {
  margin-top: var(--section-gap);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 92px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.wordmark img {
  width: 48px;
  height: 48px;
}

.wordmark__text {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  font-size: 26px;
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.wordmark__text span:last-child {
  font-weight: 450;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.handle {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--chip);
  color: #dcdcd7;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn--outline {
  border-color: var(--text);
  background: transparent;
  color: var(--text);
}

.btn--outline:hover {
  background: var(--text);
  color: var(--on-light);
}

.btn--light {
  background: var(--button-light);
  color: var(--on-light);
}

.btn--light:hover {
  background: #ffffff;
}

.btn--sm {
  min-height: 44px;
  padding: 0 22px;
  font-size: 15px;
}

/* Hero */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 32px;
  padding-top: 40px;
}

.hero h1 {
  font-size: clamp(40px, 6.2vw, 64px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.hero p {
  margin-top: 14px;
  max-width: 34em;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1.5;
}

.hero__mascot {
  width: 220px;
  height: 220px;
  margin-right: 8px;
}

/* Notice */

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #d4d4cf;
  font-size: 15px;
  line-height: 1.55;
}

/* The section gap is tuned for panels; the notice sits close to the hero. */
main > .wrap > .notice {
  margin-top: 32px;
}

.notice svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--accent);
}

.notice a {
  color: var(--accent);
  text-underline-offset: 3px;
}

/* Cards */

.card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #0c0c0c;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.card__icon {
  flex: none;
  width: 40px;
  height: 40px;
  color: #cfcfca;
}

.card__body {
  flex: 1;
  min-width: 0;
}

.card__title {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.card__text {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.45;
}

.card__arrow {
  flex: none;
  width: 26px;
  height: 26px;
  color: var(--text);
  transition: transform 0.15s ease;
}

.card:hover .card__arrow {
  transform: translateX(3px);
}

.card--primary {
  padding: 30px 32px;
}

.section-label h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-label p {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 16px;
}

.resources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
  margin-top: 20px;
}

.resources .card {
  align-items: flex-start;
  min-height: 154px;
  padding: 32px 28px;
}

.resources .card__body {
  align-self: center;
}

.resources .card__arrow {
  align-self: center;
}

.resources .card__title {
  font-size: 22px;
}

/* Panels */

.panel {
  padding: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}

.panel__head h2 {
  font-size: clamp(28px, 3.4vw, 36px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.panel__head p {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 17px;
}

.panel__controls {
  display: flex;
  flex: none;
  gap: 12px;
}

/* Data table */

.table-wrap {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.data-table th {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-strong);
  background: #1f1f1f;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 18px 20px;
  background: var(--surface-raised);
  color: #d9d9d4;
  vertical-align: top;
  line-height: 1.5;
}

.data-table tr + tr td {
  border-top: 1px solid var(--border);
}

.data-table td:first-child {
  white-space: nowrap;
}

.data-table .col-action {
  width: 1%;
  text-align: right;
}

.name {
  color: var(--accent);
  font-weight: 700;
}

.badge {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  vertical-align: 1px;
  white-space: nowrap;
}

.badge--danger {
  border-color: var(--danger-soft);
  color: var(--danger);
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
}

/* Icon buttons */

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--button-light);
  color: var(--on-light);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.icon-btn:hover {
  background: #ffffff;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-btn--ghost {
  background: var(--chip);
  color: var(--text);
}

.icon-btn--ghost:hover {
  background: #333333;
}

.icon-btn .icon-check {
  display: none;
}

.icon-btn.is-copied .icon-copy {
  display: none;
}

.icon-btn.is-copied .icon-check {
  display: block;
}

/* Code blocks */

.code {
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-sunken);
}

.code pre {
  margin: 0;
  padding: 36px 40px;
  overflow-x: auto;
  color: var(--code-text);
  font-size: 14.5px;
  line-height: 1.75;
  tab-size: 2;
}

.code .icon-btn {
  position: absolute;
  top: 16px;
  right: 16px;
}

.code .tok-k {
  color: var(--code-keyword);
}

.code .tok-s {
  color: var(--code-string);
}

.code .tok-c {
  color: var(--code-comment);
}

.code .tok-p {
  color: var(--accent);
}

.code--tight pre {
  padding: 18px 64px 18px 22px;
}

.code--tight .icon-btn {
  top: 50%;
  transform: translateY(-50%);
}

/* Transcript inside a code block */

.chat {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 20px;
  white-space: pre-wrap;
  overflow-x: visible;
}

.chat .who {
  font-weight: 600;
}

.chat .who--you {
  color: var(--code-keyword);
}

.chat .who--bot {
  color: var(--accent);
}

.chat .gap {
  grid-column: 1 / -1;
  color: var(--code-comment);
}

.chat .btns {
  color: var(--code-string);
}

/* Tabs and segmented toggle */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab {
  min-height: 34px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  background: var(--chip);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--button-light);
  color: var(--on-light);
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--chip);
}

.segmented .tab {
  min-height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.segmented .tab[aria-selected="true"] {
  background: var(--button-light);
  color: var(--on-light);
}

[role="tabpanel"][hidden] {
  display: none;
}

/* Setup steps */

.steps {
  list-style: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 20px;
  padding: 24px;
  background: var(--surface-raised);
}

.step + .step {
  border-top: 1px solid var(--border);
}

.step__num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius-pill);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.step h3 {
  padding-top: 5px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.step p {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.55;
}

.step p a {
  color: var(--text);
  text-underline-offset: 3px;
}

.step .code {
  margin-top: 14px;
  border-radius: var(--radius-md);
}

.step kbd,
.inline-code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--chip);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.callout {
  margin-top: 20px;
  color: var(--text-faint);
  font-size: 14px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 28px 40px;
  color: var(--text-faint);
  font-size: 14px;
}

.site-footer a {
  color: var(--text-muted);
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--text);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

/* 404 */

.lost {
  display: grid;
  justify-items: start;
  gap: 18px;
  padding-top: 80px;
}

.lost img {
  width: 160px;
  height: 160px;
}

.lost h1 {
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.045em;
}

.lost p {
  color: var(--text-muted);
  font-size: 18px;
}

/* Responsive */

@media (max-width: 960px) {
  .resources {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .resources .card {
    min-height: 0;
    align-items: center;
  }

  .hero__mascot {
    width: 160px;
    height: 160px;
  }
}

@media (max-width: 760px) {
  .site-header__inner {
    min-height: 72px;
  }

  .handle {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 16px;
  }

  .hero__mascot {
    grid-row: 1;
    width: 112px;
    height: 112px;
    margin: 0 0 0 -8px;
  }

  .panel {
    padding: 24px 18px;
  }

  .panel__head {
    flex-direction: column;
    margin-bottom: 24px;
  }

  .card,
  .card--primary {
    padding: 20px;
    gap: 16px;
  }

  .card__icon {
    width: 32px;
    height: 32px;
  }

  .card__title,
  .resources .card__title {
    font-size: 19px;
  }

  .card__text {
    font-size: 15px;
  }

  .code pre {
    padding: 24px 20px;
    font-size: 13px;
  }

  .code--tight pre {
    padding: 14px 60px 14px 16px;
  }

  .chat {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .chat .who {
    margin-top: 12px;
  }

  .chat .who:first-child {
    margin-top: 0;
  }

  .step {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 20px 18px;
  }

  .step h3 {
    padding-top: 0;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .btn--sm {
    padding: 0 16px;
  }

  .btn--sm .btn__long {
    display: none;
  }

  .wordmark img {
    width: 40px;
    height: 40px;
  }

  .wordmark__text {
    font-size: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

.code--spaced {
  margin-top: 24px;
}

.data-table--middle td {
  vertical-align: middle;
  padding-block: 14px;
}

@media (max-width: 760px) {
  /* On phones the copy button gets its own row so it never covers code;
     code keeps its line breaks and scrolls inside its box. */
  .code:not(.code--tight) pre {
    padding-top: 64px;
    font-size: 12.5px;
  }
}

@media (max-width: 760px) {
  .chat .gap {
    margin-top: 12px;
  }
}

@media (max-width: 900px) {
  /* Tables become stacked label and value rows on narrow screens. */
  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    padding: 16px 18px;
    background: var(--surface-raised);
  }

  .data-table tr + tr {
    border-top: 1px solid var(--border);
  }

  .data-table td,
  .data-table tr + tr td {
    padding: 4px 0;
    border: 0;
    background: transparent;
    white-space: normal;
  }

  .data-table td:first-child {
    white-space: normal;
  }

  .data-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--text-faint);
    font-size: 12px;
    font-weight: 500;
  }

  .data-table td:first-child::before {
    display: none;
  }

  .data-table .col-action {
    width: 100%;
    text-align: left;
  }

  .data-table--middle tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 12px;
  }

  .data-table--middle td,
  .data-table--middle tr + tr td {
    padding-block: 2px;
  }

  .data-table--middle td:nth-child(2) {
    grid-column: 1 / -1;
    order: 3;
  }

  .data-table--middle .col-action {
    width: auto;
  }
}

.sprite {
  position: absolute;
}

/* ------------------------------------------------------------------
   Wide screens: use the width instead of leaving empty side margins.
   ------------------------------------------------------------------ */

@media (min-width: 1100px) {
  .hero {
    padding-top: 56px;
  }

  .hero h1 {
    font-size: clamp(64px, 5.4vw, 92px);
  }

  .hero p {
    font-size: 20px;
  }

  .hero__mascot {
    width: clamp(240px, 20vw, 320px);
    height: auto;
  }

  /* Both example conversations side by side; the toggle is not needed. */
  #how {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
  }

  #how .panel__head {
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }

  #how .panel__controls {
    display: none;
  }

  #how [role="tabpanel"][hidden] {
    display: block;
  }

  #how [role="tabpanel"]::before {
    display: block;
    padding: 22px 40px 0;
    color: var(--text-faint);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  #panel-post::before {
    content: "Saved post";
  }

  #panel-task::before {
    content: "Task";
  }

  #how .code pre {
    padding-top: 16px;
  }

  /* Setup steps in two columns. */
  .steps {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
  }

  .step + .step {
    border-top: 0;
  }

  /* Developers: install commands beside the code sample. */
  #developers {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    grid-template-rows: auto auto 1fr auto;
    column-gap: 24px;
    align-items: start;
  }

  #developers .panel__head,
  #developers .callout {
    grid-column: 1 / -1;
  }

  #developers .tabs {
    grid-column: 1;
    grid-row: 2;
  }

  #developers [role="tabpanel"] {
    grid-column: 1;
    grid-row: 3;
  }

  #developers .code--spaced {
    grid-column: 2;
    grid-row: 2 / 4;
    margin-top: 0;
  }
}

@media (min-width: 1400px) {
  /* Commands and privacy share a row. */
  main > .wrap {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
    column-gap: 32px;
  }

  main > .wrap > * {
    grid-column: 1 / -1;
  }

  main > .wrap > #commands {
    grid-column: 1;
  }

  main > .wrap > #privacy {
    grid-column: 2;
  }
}

/* Big monitors: scale the whole page so it reads like a laptop layout
   instead of a narrow strip of small text. */
@media (min-width: 1800px) {
  body {
    zoom: 1.12;
  }
}

@media (min-width: 2300px) {
  body {
    zoom: 1.35;
  }
}

@media (min-width: 3000px) {
  body {
    zoom: 2;
  }
}
