/* TTY — Refract. Shared stylesheet.
   An image API rendered as a terminal session. Warm cream paper, near-black ink,
   one monospaced face carrying every word, ASCII bracket markers for iconography,
   and color confined to the dark terminal blocks alone. No sans, no serif, no
   shadow, no gradient, no pill. */

/* ============================================================= Fonts */
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/jetbrains-mono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/jetbrains-mono-500.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/jetbrains-mono-700.woff2") format("woff2");
}

/* ============================================================ Tokens */
:root {
  /* Surfaces & ink (cream chrome) */
  --canvas: #fdfcfc;
  --surface-soft: #f8f7f7;
  --surface-card: #f1eeee;
  --ink: #201d1d;
  --ink-deep: #0f0000;
  --charcoal: #302c2c;
  --body: #424245;
  --mute: #646262;
  --stone: #6e6e73;
  --ash: #9a9898;
  --hairline: rgba(15, 0, 0, 0.12);
  --hairline-strong: #646262;

  /* Terminal surface + syntax voltage (dark blocks only) */
  --tui-bg: #201d1d;
  --tui-bg-elevated: #302c2c;
  --on-dark: #fdfcfc;
  --on-dark-mute: #9a9898;
  --tui-ok: #30d158;
  --tui-key: #5ac8fa;
  --tui-warn: #ffb340;

  /* One face, every role */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;

  /* Spacing (8px base, fine steps for inline gaps) */
  --s1: 1px;
  --s4: 4px;
  --s8: 8px;
  --s12: 12px;
  --s16: 16px;
  --s24: 24px;
  --s32: 32px;
  --s48: 48px;
  --s64: 64px;
  --s96: 96px;

  /* Radii — two values only */
  --r: 4px; /* every interactive element */
  /* containers are 0px, always */

  --container: 960px;
  --frame: 1100px;
}

/* ============================================================= Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  font-feature-settings: "zero" 1; /* slashed zero — global, inherited by every role */
  -webkit-font-smoothing: antialiased;
}
img {
  max-width: 100%;
  display: block;
}
[hidden] {
  display: none !important;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ======================================================== Type roles */
.display-xl {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
}
.display-l {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}
.heading {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  margin: 0;
}
.man-head {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  text-transform: uppercase;
  margin: 0 0 var(--s16);
  padding-bottom: var(--s8);
  border-bottom: 1px solid var(--hairline);
}
.body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
}
.body-strong {
  font-weight: 500;
}
.lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--body);
  margin: 0;
  max-width: 60ch;
}
.caption {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--mute);
}
.eyebrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--mute);
  margin: 0 0 var(--s12);
}
code,
.mono {
  font-family: var(--mono);
}
.tok {
  color: var(--ink);
} /* inline literal API token on cream — ink, never blue */

/* ========================================================= Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--s24);
  padding-right: var(--s24);
}
.frame {
  max-width: var(--frame);
}
.section {
  padding-top: var(--s96);
  padding-bottom: var(--s96);
  border-bottom: 1px solid var(--hairline);
}
.section:last-of-type {
  border-bottom: 0;
}
.section-head {
  margin-bottom: var(--s32);
}
.section-head .lead {
  margin-top: var(--s12);
}

/* ============================================================= Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--canvas);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  height: 56px;
  padding: 0 var(--s24);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s16);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s8);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.wordmark .wm-block {
  color: var(--ink);
}
.nav-tabs {
  display: flex;
  gap: var(--s8);
}
.nav-tab {
  font-size: 16px;
  font-weight: 500;
  color: var(--mute);
  text-decoration: none;
  padding: 6px 6px;
  line-height: 1;
}
.nav-tab[aria-current="page"] {
  color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink);
}
.nav-actions {
  display: flex;
  gap: var(--s8);
  align-items: center;
}
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 36px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r);
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
}
.nav-menu {
  display: none;
  padding: var(--s16) var(--s24) var(--s24);
  border-top: 1px solid var(--hairline);
}
.nav-menu.open {
  display: block;
}
.nav-menu .nav-tab {
  display: block;
  padding: var(--s12) 0;
}
.nav-menu .nav-actions {
  margin-top: var(--s16);
}

/* ========================================================= Buttons */
.btn {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  line-height: 2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r);
  padding: 4px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--canvas);
}
.btn-primary:active {
  background: var(--ink-deep);
}
.btn-secondary {
  background: var(--canvas);
  color: var(--ink);
  border-color: var(--hairline-strong);
}
.btn-nav {
  font-size: 14px;
  padding: 2px 14px;
  line-height: 1.9;
}
.btn-block {
  display: flex;
  width: 100%;
}

/* ========================================================= Badges */
.badge-status {
  display: inline-block;
  background: var(--surface-card);
  color: var(--ink);
  font-size: 14px;
  border-radius: var(--r);
  padding: 2px 8px;
  margin-bottom: var(--s16);
}

/* =============================================== Light install snippet */
.snippet {
  background: var(--surface-card);
  color: var(--ink);
  border-radius: var(--r);
  padding: var(--s12) var(--s16);
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s16);
  overflow-x: auto;
}
.snippet code {
  white-space: nowrap;
}
.snippet-copy {
  flex: none;
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--mute);
  font-family: var(--mono);
  font-size: 13px;
  border-radius: var(--r);
  padding: 2px 10px;
  cursor: pointer;
}

/* ======================================================= Terminal */
.terminal {
  background: var(--tui-bg);
  color: var(--on-dark);
  border-radius: 0;
  padding: var(--s24) var(--s32);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: auto;
}
.terminal .tui-hint {
  color: var(--on-dark-mute);
  font-size: 13px;
  padding-bottom: var(--s16);
  margin-bottom: var(--s16);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  gap: var(--s16);
}
.terminal pre {
  margin: 0;
  font-family: var(--mono);
  white-space: pre;
}
.terminal .banner {
  color: var(--on-dark);
  font-size: 10px;
  line-height: 1.05;
  margin-bottom: var(--s16);
  white-space: pre;
  overflow-x: auto;
}
.prompt-row {
  background: var(--tui-bg-elevated);
  border-radius: var(--r);
  padding: var(--s8) var(--s12);
  margin: var(--s16) 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.t-ok {
  color: var(--tui-ok);
}
.t-key {
  color: var(--tui-key);
}
.t-warn {
  color: var(--tui-warn);
}
.t-mute {
  color: var(--on-dark-mute);
}
.tui-line {
  white-space: nowrap;
}
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  background: var(--tui-ok);
  vertical-align: -0.16em;
  margin-left: 2px;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* =============================================== Capability rows */
.cap-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}
.cap-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s12);
  padding: var(--s16) 0;
  border-bottom: 1px solid var(--hairline);
}
.cap-row .mark {
  color: var(--ink);
  font-weight: 500;
}
.cap-row .cap-label {
  font-weight: 500;
}
.cap-row .cap-desc {
  color: var(--body);
  margin-top: var(--s4);
}
.cap-row .cap-eg {
  color: var(--ink);
  margin-top: var(--s8);
  font-size: 15px;
}

/* ==================================================== Playground */
.pg {
  padding: var(--s32);
}
.pg-tabs {
  display: flex;
  gap: var(--s8);
  margin-bottom: var(--s16);
}
.pg-tab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--on-dark-mute);
  font-family: var(--mono);
  font-size: 14px;
  border-radius: var(--r);
  padding: 2px 12px;
  cursor: pointer;
}
.pg-tab[aria-pressed="true"] {
  color: var(--on-dark);
  border-color: var(--tui-ok);
}
.pg-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s16);
  margin-bottom: var(--s16);
}
.pg-pane figcaption {
  color: var(--on-dark-mute);
  font-size: 13px;
  margin-bottom: var(--s8);
}
.pg-frame {
  background: #0e0c0c;
  border-radius: var(--r);
  overflow: hidden;
  width: 100%;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
/* source: the whole original, scaled to fit with air around it */
.pg-frame > img.pg-src {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
/* result: an inner box shaped to the output w:h, scaling within the fixed frame
   so both panes keep the same height while the resize stays visible */
.pg-result-box {
  overflow: hidden;
  border-radius: 2px;
}
.pg-result-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.pg-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s12) var(--s24);
  margin: var(--s16) 0;
  padding-top: var(--s16);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.pg-ctl {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.pg-ctl > label {
  color: var(--on-dark-mute);
  font-size: 13px;
}
.pg-ctl .pg-key {
  color: var(--tui-key);
}
.pg-row {
  display: flex;
  align-items: center;
  gap: var(--s8);
}
.pg-input,
.pg-select {
  background: var(--tui-bg-elevated);
  color: var(--on-dark);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--r);
  font-family: var(--mono);
  font-size: 14px;
  padding: 4px 8px;
}
.pg-input:focus-visible,
.pg-select:focus-visible,
.pg-tab:focus-visible,
.pg-step:focus-visible {
  outline: 2px solid var(--on-dark);
  outline-offset: 2px;
}
.pg-input {
  width: 7ch;
  text-align: right;
}
.pg-step {
  background: var(--tui-bg-elevated);
  color: var(--on-dark);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--r);
  font-family: var(--mono);
  width: 26px;
  height: 26px;
  cursor: pointer;
  line-height: 1;
}
.pg-range {
  width: 100%;
  accent-color: var(--tui-ok);
}
.pg-ctl.is-disabled {
  opacity: 0.4;
}
.pg-hex {
  width: 9ch;
  text-transform: uppercase;
}
.pg-cmd {
  margin-top: var(--s16);
}
.tag-neg {
  color: var(--tui-warn);
}

/* ==================================================== Stats readout */
.readout {
  border-top: 1px solid var(--hairline);
}
.readout-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s16);
  padding: var(--s16) 0;
  border-bottom: 1px solid var(--hairline);
}
.readout-row .fig {
  color: var(--mute);
  font-size: 14px;
  flex: none;
}
.readout-row .label {
  color: var(--body);
  flex: 1;
  padding: 0 var(--s16);
}
.readout-row .value {
  color: var(--ink);
  font-weight: 500;
  text-align: right;
  flex: none;
}

/* ==================================================== Options table */
.opt-wrap {
  overflow-x: auto;
}
.opt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.opt-table th {
  text-align: left;
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 500;
  color: var(--mute);
  padding: var(--s8) var(--s16) var(--s8) 0;
  border-bottom: 1px solid var(--hairline-strong);
  white-space: nowrap;
}
.opt-table td {
  vertical-align: top;
  padding: var(--s12) var(--s16) var(--s12) 0;
  border-bottom: 1px solid var(--hairline);
  color: var(--body);
}
.opt-table td.opt-name {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
.opt-table td.opt-values {
  color: var(--body);
  white-space: nowrap;
}
.tag-mono {
  display: inline-block;
  background: var(--surface-card);
  color: var(--mute);
  font-size: 12px;
  border-radius: var(--r);
  padding: 1px 8px;
}

/* ===================================================== Quickstart */
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}
.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s16);
  padding: var(--s16) 0;
  border-bottom: 1px solid var(--hairline);
}
.step:last-child {
  border-bottom: 0;
}
.step .step-mark {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
.step .step-body {
  min-width: 0;
}
.step .step-body .terminal,
.step .step-body .snippet {
  margin-top: var(--s12);
}

/* ===================================================== Pricing */
.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s16);
}
.tier {
  border: 1px solid var(--hairline);
  padding: var(--s24);
  display: flex;
  flex-direction: column;
  gap: var(--s16);
}
.tier-name {
  font-size: 16px;
  font-weight: 700;
}
.tier-price {
  font-size: 24px;
  font-weight: 700;
}
.tier-price .per {
  font-size: 14px;
  font-weight: 400;
  color: var(--mute);
}
.tier-quota {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s8);
}
.tier-quota li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s8);
  color: var(--body);
  font-size: 15px;
}
.tier-quota .mark {
  color: var(--ink);
}
.note-block {
  color: var(--body);
  max-width: 70ch;
}
.note-block p + p {
  margin-top: var(--s12);
}

/* ========================================================= FAQ */
.faq {
  border-top: 1px solid var(--hairline);
}
.faq details {
  border-bottom: 1px solid var(--hairline);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s12);
  padding: var(--s12) 0;
  font-weight: 500;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq .faq-mark {
  color: var(--ink);
}
.faq .faq-mark::before {
  content: "[+]";
}
.faq details[open] .faq-mark::before {
  content: "[-]";
}
.faq .faq-answer {
  color: var(--body);
  padding: 0 0 var(--s16) calc(3ch + var(--s12));
  max-width: 70ch;
}

/* ========================================================= Footer */
.footer {
  border-top: 1px solid var(--hairline);
  padding: var(--s32) 0;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s24);
  margin-bottom: var(--s16);
}
.footer-links a {
  color: var(--mute);
  text-decoration: none;
  font-size: 14px;
}
.footer-legal {
  display: flex;
  justify-content: space-between;
  gap: var(--s16);
  flex-wrap: wrap;
  color: var(--mute);
  font-size: 14px;
  padding-top: var(--s16);
  border-top: 1px solid var(--hairline);
}

/* ================================================= Shared spacing */
.stack > * + * {
  margin-top: var(--s24);
}
.hero {
  padding-top: var(--s64);
}
.hero-actions {
  display: flex;
  gap: var(--s12);
  flex-wrap: wrap;
  margin: var(--s24) 0;
}
.cta-band {
  text-align: left;
}
.cta-band .display-l {
  margin-bottom: var(--s16);
}

/* ===================================================== Responsive */
@media (max-width: 900px) {
  .tiers {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .nav-tabs {
    display: none;
  }
  .nav-toggle {
    display: flex;
  }
}
@media (max-width: 640px) {
  .display-xl {
    font-size: 28px;
  }
  .display-l {
    font-size: 20px;
  }
  .section {
    padding-top: var(--s64);
    padding-bottom: var(--s64);
  }
  .pg-panes {
    grid-template-columns: 1fr;
  }
  .pg-frame {
    height: 200px;
  }
  .pg-controls {
    grid-template-columns: 1fr;
  }
  .terminal {
    padding: var(--s16) var(--s16);
    font-size: 14px;
  }
  .readout-row {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s4);
  }
  .readout-row .label {
    padding: 0;
  }
  .readout-row .value {
    text-align: left;
  }
}

/* =============================================== Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .caret {
    animation: none;
    opacity: 1;
  }
}
