/*
 * The server-rendered platform pages (landing, sign-in, sign-out, Proposal
 * confirm, errors), in the console's "Signal" colours. The values mirror
 * the @theme tokens in web/src/styles.css; change both together. System
 * fonts only: the console's bundled fonts sit behind sign-in.
 */
:root {
  color-scheme: dark;
  --ground: #0b0d10;
  --surface: #12161b;
  --line: #232a33;
  --box: #1c2229;
  --ink: #e8ecef;
  --muted: #9aa4af;
  --accent: #c6f432;
  --on-accent: #0b0d10;
  --radius-box: 12px;
  --radius-button: 8px;
  --focus: 0 0 0 2px #0b0d10, 0 0 0 4px #c6f432;
  --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* How long the Share link's "Opening…" page waits before it shows: the one place to change it. */
  --pp-reveal-delay: 400ms;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

header {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

/* The account area (landing.html), as the console's: inline from 768 px,
   on phones a menu behind the email's initial. */
.account-bar,
details.account {
  margin-left: auto;
}

.account-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0 8px;
  padding-left: 16px;
}

details.account {
  display: none;
  position: relative;
}

@media (max-width: 767px) {
  .account-bar {
    display: none;
  }

  details.account {
    display: block;
  }
}

details.account summary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

details.account summary::-webkit-details-marker {
  display: none;
}

details.account summary:focus-visible {
  border-radius: 50%;
}

.account-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 18rem;
  max-width: calc(100vw - 2rem);
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--box);
  border-radius: var(--radius-box);
  background: var(--surface);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4);
}

.account-bar .email,
.account-menu .email {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.account-bar a,
.account-menu a,
.account-bar button,
.account-menu button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: transparent;
  color: var(--ink);
  font: 500 1rem var(--sans);
  text-decoration: none;
}

.account-bar a,
.account-bar button {
  border-color: transparent;
  color: var(--muted);
}

.account-bar a:hover,
.account-bar button:hover {
  color: var(--ink);
  opacity: 1;
}

.account-bar form,
.account-menu form {
  display: block;
  margin: 0;
}

.account-menu a,
.account-menu form {
  margin-top: 12px;
}

.account-menu button {
  width: 100%;
}

.brand svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  max-width: 640px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid var(--box);
  border-radius: var(--radius-box);
  background: var(--surface);
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  main {
    margin: 24px 16px;
    padding: 24px 20px;
  }
}

/* A desktop gives the landing's CLI steps room to sit on one line each. */
@media (min-width: 960px) {
  main:has(ol.steps) {
    max-width: 800px;
  }
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

h3 {
  margin: 20px 0 6px;
  font-size: 1rem;
}

p {
  margin: 0 0 16px;
}

.muted,
dt {
  color: var(--muted);
}

a {
  color: var(--accent);
  text-underline-offset: 4px;
}

/* The outline shows only in forced-colors mode, which drops the shadow. */
:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus);
  border-radius: 4px;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

/* Inline code is a chip that moves to the next line whole, so a short
   command never breaks inside (pplane login --device, at its "--"); only
   one wider than the line, a long URL say, still wraps inside. */
code {
  display: inline-block;
  max-width: 100%;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--ground);
}

pre {
  overflow-x: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--ground);
  white-space: pre-wrap;
}

/* A Config on the Proposal page: monospace like any pre, a long one scrolls. */
pre.config {
  max-height: 24rem;
  overflow: auto;
}

dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 16px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* A Setting value's source on the Proposal page ("default", "set here"). */
.pill {
  display: inline-block;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85em;
  white-space: nowrap;
}

ul.values {
  margin: 0 0 4px;
}

ul {
  padding-left: 1.2em;
}

ul.orgs,
ul.choices {
  display: grid;
  gap: 8px;
  padding: 0;
  list-style: none;
}

ul.orgs li {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  color: var(--muted);
}

ul.orgs a {
  font-weight: 600;
}

/* Commands to type: one per box, wrapped at spaces (a URL also after its
   path's slashes), with a copy button in the top-right corner that the command
   wraps around. */
ol.steps {
  display: grid;
  gap: 16px;
  margin: 0 0 24px;
  padding-left: 1.2em;
}

ol.steps li::marker {
  color: var(--muted);
}

.cmd {
  display: flow-root; /* holds the floated button */
  margin-top: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--ground);
}

.cmd code {
  display: block;
  padding: 6px 0;
  border: 0;
  background: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* A word, or a URL's segment (with a pipe that follows it), breaks only when it
   alone is wider than the box. */
.cmd code span {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* A URL host's last letter and its slash, which never part (UI-16). */
.cmd code span span {
  display: inline;
  white-space: nowrap;
}

/* A 320 px phone fits the platform's URL, with the install URL's slash,
   on one line only a size down and with a narrower left margin. */
@media (max-width: 359px) {
  .cmd {
    padding-left: 8px;
  }

  .cmd code {
    font-size: 0.8em;
  }
}

/* A longer text to copy (Start here's AGENTS.md section) in a command box:
   the box is its frame, and it wraps around the copy button. */
.cmd pre {
  margin: 0;
  padding: 6px 0;
  border: 0;
  background: none;
  overflow-wrap: anywhere;
}

.cmd code::before {
  content: '$ ';
  color: var(--muted);
}

/* Buttons: the accent for the action a page is for, an outline for the rest. */
button,
.button,
ul.choices a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-button);
  background: var(--accent);
  color: var(--on-accent);
  font: 600 0.95rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

button:hover,
.button:hover,
ul.choices a:hover {
  opacity: 0.9;
}

form[action$='/reject'] button,
button[value='deny'],
.button.secondary,
button.copy {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

/* One text line tall, so a long first word moves under it without leaving
   a gap; its tap target stays 44 px through the ::after. */
button.copy {
  position: relative;
  float: right;
  min-width: 64px;
  min-height: 28px;
  margin-left: 8px;
  padding: 0 10px;
  font-size: 13px;
}

button.copy::after {
  content: '';
  position: absolute;
  inset: -9px; /* from inside the 1 px border: 26 + 18 = 44 px */
}

/* The shared button rule sets display, which would show a hidden one. */
button.copy[hidden] {
  display: none;
}

form {
  display: inline-block;
  margin: 8px 12px 16px 0;
}

/* The consent page's form holds the whole page. */
form[action='/oauth/authorize'] {
  display: block;
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* A phone's own select is short and ignores min-height, so this one is
   drawn here, its chevron from the wrapper (the consent CSP allows no
   data: image). */
.select {
  position: relative;
  display: block;
}

.select::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-button);
  background: var(--ground);
  color: var(--ink);
  font: 0.95rem var(--sans);
  appearance: none;
}

/*
 * Content that shows only after --pp-reveal-delay, so a page that's gone
 * within a moment never flashes. Hidden, not removed: the layout doesn't
 * jump, and screen readers and the keyboard reach it once it shows. The
 * step is instant (no fade), so reduced motion needs nothing.
 */
.pp-reveal {
  visibility: hidden;
  animation: pp-reveal 0s var(--pp-reveal-delay) forwards;
}

@keyframes pp-reveal {
  to {
    visibility: visible;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
