/* Fable Code install block — landing + login.
 * Premium minimal: paper background, one dark terminal card, platform tabs.
 * All motion is CSS-only and fully disabled under prefers-reduced-motion.
 */
.install {
  --install-ink: #211d19;
  --install-paper: #f6f1e7;
  --install-line: #d9d0c1;
  --install-accent: #98512b;
  position: relative;
  width: min(100%, 880px);
  min-width: 0;
  margin: clamp(8px, 2vw, 20px) auto clamp(28px, 4vw, 48px);
  padding: clamp(22px, 3.4vw, 36px);
  border: 1px solid var(--install-line);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 42%),
    var(--install-paper);
  box-shadow: 0 24px 60px rgba(37, 35, 31, 0.09), 0 2px 8px rgba(37, 35, 31, 0.05);
  overflow: hidden;
  animation: install-rise 760ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

/* Slow light sweep across the top edge — the only continuous motion. */
.install::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--install-accent), #d9a05b, var(--install-accent), transparent);
  background-size: 200% 100%;
  animation: install-sheen 7s linear infinite;
  opacity: 0.85;
}

/* The login pages lay .auth-panel out as a grid item of .auth. Its
 * default min-width:auto lets the nowrap install command stretch the whole
 * page past the viewport on narrow screens (measured: 630px layout on a
 * 390px viewport). Allow the panel to shrink; the terminal scrolls
 * internally instead. */
.auth > .auth-panel {
  min-width: 0;
}

.install-eyebrow {
  margin: 0 0 8px;
  color: var(--install-accent);
  font: 600 11px/1.4 var(--sans, system-ui, sans-serif);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.install-title {
  margin: 0;
  font: 400 clamp(30px, 4.4vw, 44px)/1.05 var(--serif, Georgia, serif);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.install-sub {
  max-width: 56ch;
  margin: 10px 0 0;
  color: #69655e;
  font: 400 15px/1.6 var(--sans, system-ui, sans-serif);
}

.install-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 460px;
  margin-top: 24px;
  padding: 4px;
  border-radius: 12px;
  background: #ece5d6;
}

.install-tab {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #69655e;
  font: 600 13.5px/1 var(--sans, system-ui, sans-serif);
  cursor: pointer;
  transition: background 220ms ease, color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.install-tab-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.install-platform-note {
  max-width: 62ch;
  margin: 10px 0 0;
  color: #737373;
  font: 400 11.5px/1.6 var(--sans, system-ui, sans-serif);
}

.install-tab:hover {
  color: var(--install-ink);
}

.install-tab.is-active {
  background: #fffdf8;
  color: var(--install-ink);
  box-shadow: 0 1px 3px rgba(37, 35, 31, 0.14), 0 0 0 1px rgba(37, 35, 31, 0.06);
}

.install-tab:active { transform: scale(0.97); }

.install-tab:focus-visible,
.install-copy:focus-visible,
.install-link:focus-visible {
  outline: 2px solid var(--install-accent);
  outline-offset: 3px;
}

/* Terminal window: chrome bar (traffic-light dots + label + copy) above
 * the command row, like the install blocks on the Codex and Kimi CLI
 * pages. The copy button lives in the bar so the command row stays clean. */
.install-terminal {
  min-width: 0;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 14px;
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(152, 81, 43, 0.28), rgba(152, 81, 43, 0) 55%),
    var(--install-ink);
  color: #f6f1e7;
  box-shadow: 0 14px 34px rgba(33, 29, 25, 0.28);
  animation: install-terminal-in 640ms 120ms var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both;
}

.install-terminal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid rgba(246, 241, 231, 0.12);
}

.install-terminal-dots {
  display: inline-flex;
  flex: none;
  gap: 6px;
}

.install-terminal-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.install-terminal-dots i:nth-child(1) { background: #ff5f57; }
.install-terminal-dots i:nth-child(2) { background: #febc2e; }
.install-terminal-dots i:nth-child(3) { background: #28c840; }

.install-terminal-label {
  flex: 1 1 auto;
  min-width: 0;
  color: #a89e90;
  font: 600 12px/1 var(--sans, system-ui, sans-serif);
  letter-spacing: 0.02em;
}

.install-terminal-body {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 14px 16px;
}

.install-prompt {
  flex: none;
  color: #e8b48c;
  font: 600 15px/1 var(--mono, ui-monospace, monospace);
  user-select: none;
}

.install-command {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  color: #f6f1e7;
  font: 400 14px/1.55 var(--mono, ui-monospace, monospace);
  white-space: nowrap;
  /* One click selects the whole command, so copy-paste needs no
   * careful dragging across the terminal. */
  user-select: all;
}

.install-command::-webkit-scrollbar {
  display: none;
}

/* Blinking caret at the end of the command. */
.install-command::after {
  content: "▍";
  margin-left: 2px;
  color: #e8b48c;
  animation: install-caret 1.4s steps(2, start) infinite;
}

.install-copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(246, 241, 231, 0.28);
  border-radius: 10px;
  background: rgba(246, 241, 231, 0.1);
  color: #f6f1e7;
  font: 600 13px/1 var(--sans, system-ui, sans-serif);
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.install-copy:hover {
  background: rgba(246, 241, 231, 0.18);
  transform: translateY(-1px);
}

.install-copy:active {
  transform: translateY(0);
}

.install-copy.is-copied {
  border-color: #8fb573;
  background: rgba(143, 181, 115, 0.22);
}

.install-copy-icon {
  font-style: normal;
}

.install-note {
  margin: 16px 0 0;
  color: #69655e;
  font: 400 13.5px/1.65 var(--sans, system-ui, sans-serif);
}

/* Three numbered steps: copy, paste, run. */
.install-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #525252;
  font: 400 13px/1.55 var(--sans, system-ui, sans-serif);
}

.install-step-number {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--install-line);
  border-radius: 50%;
  background: #fffdf8;
  color: var(--install-ink);
  font: 600 11px/1 var(--sans, system-ui, sans-serif);
}

.install-steps code {
  color: var(--install-ink);
  font: 600 12.5px/1.55 var(--mono, ui-monospace, monospace);
}

.install-note strong {
  color: var(--install-ink);
  font-weight: 600;
}

.install-link {
  color: var(--install-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.install-link:hover {
  color: var(--install-ink);
}

.install-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Compact variant used on the login pages (narrow column). */
.install--compact {
  width: 100%;
  margin: 0 0 28px;
  padding: clamp(18px, 3vw, 24px);
}

.install--compact .install-title {
  font-size: clamp(24px, 3.4vw, 30px);
}

.install--compact .install-tabs {
  max-width: none;
}

@keyframes install-rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes install-terminal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes install-sheen {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

@keyframes install-caret {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .install {
    border-radius: 16px;
  }

  .install-terminal-body {
    gap: 8px;
    padding-left: 12px;
  }

  .install-terminal-label {
    display: none;
  }

  .install-steps {
    grid-template-columns: 1fr;
  }

  .install-command {
    font-size: 12.5px;
  }

  .install-copy {
    padding: 0 12px;
  }

  .install-copy-label {
    display: none;
  }

  .install-copy::after {
    content: "Copy";
  }

  .install-copy.is-copied::after {
    content: "Copied";
  }
}

@media (prefers-reduced-motion: reduce) {
  .install,
  .install::before,
  .install-terminal,
  .install-command::after {
    animation: none;
  }

  .install-tab,
  .install-copy {
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ————— White variant on the rebuilt landing page ————— */
.fable-landing .install {
  --install-ink: #141414;
  --install-paper: #ffffff;
  --install-line: #e8e8e8;
  --install-accent: #141414;
  background: var(--install-paper);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.07), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.fable-landing .install::before {
  background: linear-gradient(90deg, transparent, #d4d4d4, #737373, #d4d4d4, transparent);
}

.fable-landing .install-sub,
.fable-landing .install-note { color: #737373; }

.fable-landing .install-tabs { background: #f5f5f5; }
.fable-landing .install-tab { color: #737373; }
.fable-landing .install-tab:hover { color: var(--install-ink); }
.fable-landing .install-tab.is-active {
  background: #fff;
  color: var(--install-ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.fable-landing .install-terminal {
  background:
    radial-gradient(120% 140% at 12% 0%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 55%),
    var(--install-ink);
  color: #fff;
}

.fable-landing .install-terminal-bar {
  border-bottom-color: rgba(255, 255, 255, 0.14);
}

.fable-landing .install-terminal-label { color: #a3a3a3; }
.fable-landing .install-prompt { color: #a3a3a3; }

.fable-landing .install-steps li { color: #737373; }

.fable-landing .install-step-number {
  border-color: var(--lm-border);
  background: #fff;
}
.fable-landing .install-command { color: #fff; }
.fable-landing .install-command::after { color: #a3a3a3; }

.fable-landing .install-copy {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.fable-landing .install-copy:hover { background: rgba(255, 255, 255, 0.18); }
.fable-landing .install-link { color: var(--install-ink); }

/* ————— Small notes under the command ————— */
.install-notes {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.install-notes li {
  position: relative;
  margin: 6px 0 0;
  padding-left: 14px;
  color: #737373;
  font: 400 11.5px/1.6 var(--sans, system-ui, sans-serif);
}

.install-notes li::before {
  position: absolute;
  left: 0;
  color: #a3a3a3;
  content: "·";
}

.install-notes code {
  color: #525252;
  font: 400 11px/1.6 var(--mono, ui-monospace, monospace);
}
