/*
 * Querlyn website and account portal stylesheet.
 *
 * Identity: light and editorial — a bright canvas, generous whitespace, a soft gradient mesh behind
 * the hero, Geist for text with Instrument Serif italic accents in display headings, and the desktop
 * app's dark terminal (#10141b, mint accent) inside product illustrations. The page follows the
 * visitor's light or dark preference. One brand accent (teal); red and amber appear only as status
 * colours (errors, draft notices). Fonts are self-hosted (/static, SIL OFL): no external requests.
 * Every text pair meets WCAG 2.2 AA (4.5:1) in both themes; borders of form controls and focus
 * rings meet 3:1.
 *
 * The page CSP forbids inline styles, so pages use these classes and element styles only.
 * Shared vocabulary for the account pages: form elements, `.button` / `button` (primary) and
 * `.secondary`, `.notice` and `.notice.error`, `.card`, `table`, `.muted`, `.visually-hidden`.
 * Layouts: `.portal` (signed-in pages with a sidebar), `.auth` (sign-in and similar, one centred
 * card), `.prose` (documents).
 *
 * Spacing uses longhand margins on components so a component class never cancels the spacing
 * of a layout class it is combined with (e.g. `class="section notice"`).
 */

/* ---- Fonts --------------------------------------------------------------------------------- */

@font-face {
  font-family: "Geist";
  src: url("/static/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("/static/geist-mono.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/static/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---- Tokens -------------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --font-serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;

  --bg: #ffffff;
  --bg-subtle: #f7f8fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #1e1f22;
  --muted: #5f6266;
  --line: #dfe1e5;
  --line-strong: #c9ccd1;
  --field: #8c9096;
  --accent: #2b63d9;
  --accent-hover: #1f4fb5;
  --accent-tint: #e8efff;
  --on-accent: #ffffff;
  --ink: #1e1f22;
  --on-ink: #ffffff;
  --ink-hover: #2b2d30;
  --error: #c7222d;
  --error-tint: #fef3f2;
  --draft: #8f5a00;
  --draft-tint: #fffaeb;
  --focus: #2b63d9;
  --selection: #d4e2ff;

  /* Soft colour wash behind the hero and the sign-in card. */
  --mesh-1: rgba(43, 99, 217, 0.22);
  --mesh-2: rgba(126, 166, 255, 0.30);
  --mesh-3: rgba(167, 139, 250, 0.26);
  --mesh-4: rgba(56, 189, 248, 0.16);

  /* The desktop app's Querlyn Dark palette, the same in both themes, for the product illustration. */
  --app-bg: #1e1f22;
  --app-panel: #2b2d30;
  --app-line: #393b40;
  --app-text: #dfe1e5;
  --app-muted: #a8abb0;
  --app-accent: #7ea6ff;
  --app-selection: #2e436e;
  --app-overlay-line: #4e5157;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, 0.04), 0 24px 48px -12px rgba(16, 24, 40, 0.18);

  --shell: 1120px;
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1e1f22;
    --bg-subtle: #232427;
    --surface: #2b2d30;
    --surface-raised: #313338;
    --text: #dfe1e5;
    --muted: #a8abb0;
    --line: #393b40;
    --line-strong: #4e5157;
    --field: #7c8087;
    --accent: #7ea6ff;
    --accent-hover: #a9c3ff;
    --accent-tint: rgba(126, 166, 255, 0.08);
    --on-accent: #10131a;
    --ink: #dfe1e5;
    --on-ink: #1e1f22;
    --ink-hover: #ffffff;
    --error: #ff8a93;
    --error-tint: rgba(240, 68, 56, 0.12);
    --draft: #e0a846;
    --draft-tint: rgba(247, 144, 9, 0.12);
    --focus: #7ea6ff;
    --selection: #2e436e;

    --mesh-1: rgba(84, 138, 247, 0.16);
    --mesh-2: rgba(126, 166, 255, 0.12);
    --mesh-3: rgba(139, 92, 246, 0.14);
    --mesh-4: rgba(56, 189, 248, 0.08);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.4), 0 32px 64px -16px rgba(0, 0, 0, 0.7);
  }
}

/* ---- Base ---------------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  /* Long addresses and names wrap rather than widening the page past a phone's screen. */
  overflow-wrap: break-word;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: 5rem;
}

[hidden] {
  display: none !important;
}

[id] {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

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

::selection {
  background: var(--selection);
  color: var(--text);
}

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

/* ---- Type ---------------------------------------------------------------------------------- */

h1,
h2,
h3 {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  margin-top: 3.5rem;
  font-size: clamp(2.1rem, 1.6rem + 2vw, 3rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.35rem, 1.2rem + 0.6vw, 1.7rem);
  letter-spacing: -0.025em;
}

h3 {
  font-size: 1.08rem;
  letter-spacing: -0.012em;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

ol,
ul {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.35rem;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 600;
}

/* A serif italic accent inside display headings ("Every session, <em class="serif">organized</em>"). */
.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

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

code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-subtle);
  overflow-wrap: anywhere;
}

pre {
  margin: 0 0 1rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  line-height: 1.5;
}

pre code {
  padding: 0;
  border: 0;
  background: none;
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.lede {
  font-size: clamp(1.08rem, 1rem + 0.35vw, 1.22rem);
  line-height: 1.55;
  color: var(--muted);
}

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

.prose {
  max-width: 46rem;
}

.prose h1 {
  margin-bottom: 1rem;
}

.section {
  margin-top: 3rem;
}

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

/* A small label above a heading: "In development". */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.3rem 0.8rem 0.3rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.eyebrow__tag {
  white-space: nowrap;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ---- Layout -------------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--on-ink);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  width: 28px;
  height: 28px;
  flex: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.site-nav a[aria-current] {
  color: var(--text);
  background: var(--bg-subtle);
}

.site-nav .site-nav__account {
  margin-left: 0.5rem;
  padding: 0.45rem 1rem;
  background: var(--ink);
  color: var(--on-ink);
}

.site-nav .site-nav__account:hover,
.site-nav .site-nav__account[aria-current] {
  background: var(--ink-hover);
  color: var(--on-ink);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 2rem;
  padding-top: 3.5rem;
  padding-bottom: 3rem;
}

.site-footer__about p {
  max-width: 22rem;
  margin-top: 0.75rem;
}

.site-footer__title {
  margin: 0 0 0.85rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: 0.5rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

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

.site-footer__legal {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.site-footer__legal p {
  margin: 0;
}

/* ---- Buttons ------------------------------------------------------------------------------- */

.button,
button,
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.button:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--ink-hover);
  border-color: var(--ink-hover);
  color: var(--on-ink);
  text-decoration: none;
}

.button:active,
button:active {
  transform: translateY(1px);
}

.button.secondary,
button.secondary,
input.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover,
input.secondary:hover {
  border-color: var(--field);
  background: var(--bg-subtle);
  color: var(--text);
}

.button.danger,
button.danger {
  border-color: var(--error);
  background: var(--error);
  color: #ffffff;
}

@media (prefers-color-scheme: dark) {
  .button.danger,
  button.danger {
    color: #2a0a07;
  }
}

.button.danger:hover,
button.danger:hover {
  filter: brightness(0.92);
  background: var(--error);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0 0;
}

/* ---- Home ---------------------------------------------------------------------------------- */

/* The wash of colour behind the hero and the sign-in card: layered radial gradients, no images. */
.mesh {
  position: relative;
  isolation: isolate;
  /* The wash reaches past the sides: clip it here (never on <main>, which would cut off wide
     content elsewhere). `clip` makes no scroll container; older browsers fall back to hidden. */
  overflow-x: hidden;
  overflow-x: clip;
}

.mesh::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -12rem -20vw auto;
  height: 46rem;
  background:
    radial-gradient(38% 42% at 18% 28%, var(--mesh-1), transparent 70%),
    radial-gradient(34% 40% at 82% 18%, var(--mesh-2), transparent 70%),
    radial-gradient(36% 38% at 64% 62%, var(--mesh-3), transparent 72%),
    radial-gradient(28% 34% at 30% 76%, var(--mesh-4), transparent 70%);
  filter: blur(8px);
  pointer-events: none;
}

.hero {
  padding: 5.5rem 0 1rem;
  text-align: center;
}

.hero__text {
  max-width: 50rem;
  margin: 0 auto;
}

.hero__title {
  margin: 0 0 1.25rem;
  font-size: clamp(2.6rem, 1.5rem + 4.6vw, 4.6rem);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.hero__title .serif {
  font-size: 1.08em;
  letter-spacing: -0.02em;
}

.hero .lede {
  max-width: 38rem;
  margin: 0 auto 0.75rem;
}

.hero .actions {
  justify-content: center;
}

.hero__note {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Blinks four times (under five seconds, WCAG 2.2.2), then stays lit. */
.cursor {
  display: inline-block;
  width: 0.48em;
  height: 0.82em;
  margin-left: 0.08em;
  vertical-align: -0.04em;
  border-radius: 2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) 4;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }

  .button,
  button {
    transition: none;
  }
}

/* The product illustration: the desktop prototype's window in Querlyn Dark, with its command palette
   open over empty panes (the prototype has no database connections yet). */
.product {
  max-width: 64rem;
  margin: 3.75rem auto 0;
}

.app {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: var(--radius-lg);
  background: var(--app-bg);
  color: var(--app-text);
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  text-align: left;
}

.app__bar {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  height: 42px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--app-line);
  background: var(--app-panel);
}

.app__dots {
  display: flex;
  gap: 6px;
}

.app__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--app-line);
}

.app__tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app__tabs li + li {
  margin-top: 0;
}

.app__tabs li {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  color: var(--app-muted);
}

.app__tabs .is-active {
  background: var(--app-bg);
  color: var(--app-text);
}

.app__body {
  display: grid;
  grid-template-columns: 13rem 1fr;
  min-height: 21rem;
}

.app__side {
  border-right: 1px solid var(--app-line);
  background: var(--app-panel);
}

.app__status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 1rem;
  border-top: 1px solid var(--app-line);
  background: var(--app-panel);
  color: var(--app-muted);
  font-size: 0.75rem;
}

/* The command palette: the prototype's keyboard-first centre, drawn over the panes. */
.palette {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  width: min(28rem, calc(100% - 2rem));
  overflow: hidden;
  border: 1px solid var(--app-overlay-line);
  border-radius: var(--radius);
  background: var(--app-panel);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
  transform: translateX(-50%);
}

.palette__input {
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--app-line);
  color: var(--app-muted);
}

.palette__input::before {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-right: 0.45rem;
  vertical-align: -0.18em;
  background: var(--app-accent);
}

.palette__list {
  margin: 0;
  padding: 0.35rem;
  list-style: none;
}

.palette__list li + li {
  margin-top: 0;
}

.palette__item {
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
}

.palette__item.is-active {
  background: var(--app-selection);
}

.product__caption {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

/* A status readout (the desktop terminal palette). */
.pane {
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: var(--radius);
  background: var(--app-bg);
  color: var(--app-text);
  box-shadow: var(--shadow);
}

.pane__bar {
  display: flex;
  margin: 0;
  padding: 0.55rem 0.75rem 0;
  border-bottom: 1px solid var(--app-line);
  background: var(--app-panel);
}

.pane__tab {
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--app-line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: var(--app-bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.readout {
  margin: 0;
  padding: 1rem 1.15rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
}

.readout div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
}

.readout div + div {
  margin-top: 0.4rem;
}

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

.readout dd {
  margin: 0;
}

.readout div:first-child dd {
  color: var(--app-accent);
}

/* Section headers on the home page: a small accent label, a heading, a sentence. */
.section-head {
  max-width: 40rem;
  margin: 0 auto 2.5rem;
  text-align: center;
}

.section-head .lede {
  margin-bottom: 0;
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pillars > li + li {
  margin-top: 0;
}

.pillar {
  display: flex;
  flex-direction: column;
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.pillar:hover {
  box-shadow: var(--shadow);
}

.pillar p:last-of-type {
  margin-bottom: 0;
}

.pillar__icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 1.1rem;
  border-radius: 11px;
  background: var(--accent-tint);
  color: var(--accent);
}

.pillar__icon svg {
  width: 22px;
  height: 22px;
}

.pillar--planned {
  background: var(--bg-subtle);
  box-shadow: none;
}

.pillar .status {
  margin-top: auto;
  padding-top: 1.25rem;
}

.callout {
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(60% 120% at 0% 0%, var(--mesh-1), transparent 60%),
    radial-gradient(50% 120% at 100% 100%, var(--mesh-2), transparent 60%),
    var(--surface);
}

.callout h2 {
  max-width: 34rem;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout p {
  max-width: 40rem;
  color: var(--muted);
}

/* The closing call to action on the home page: an ink panel in light mode, a tinted surface in
   dark mode (an inverted white panel would glare). */
.cta {
  --cta-bg: var(--ink);
  --cta-text: var(--on-ink);
  --cta-muted: rgba(255, 255, 255, 0.78);
  --cta-button: #ffffff;
  --cta-on-button: #0b1020;
  --cta-outline: rgba(255, 255, 255, 0.45);
  margin-top: 5rem;
  padding: 3.5rem 2rem;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: var(--cta-bg);
  color: var(--cta-text);
  text-align: center;
}

@media (prefers-color-scheme: dark) {
  .cta {
    --cta-bg:
      radial-gradient(60% 140% at 0% 0%, var(--mesh-1), transparent 60%),
      radial-gradient(60% 140% at 100% 100%, var(--mesh-3), transparent 60%),
      var(--surface-raised);
    --cta-text: var(--text);
    --cta-muted: var(--muted);
    --cta-button: var(--ink);
    --cta-on-button: var(--on-ink);
    --cta-outline: var(--line-strong);
    border-color: var(--line);
  }
}

.cta h2 {
  color: var(--cta-text);
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.3rem);
}

.cta p {
  max-width: 34rem;
  margin-left: auto;
  margin-right: auto;
  color: var(--cta-muted);
}

.cta .actions {
  justify-content: center;
}

.cta .button {
  border-color: var(--cta-button);
  background: var(--cta-button);
  color: var(--cta-on-button);
}

.cta .button:hover {
  filter: brightness(0.94);
  background: var(--cta-button);
  color: var(--cta-on-button);
}

.cta .button.secondary {
  border-color: var(--cta-outline);
  background: transparent;
  color: var(--cta-text);
}

.cta .button.secondary:hover {
  filter: none;
  background: color-mix(in srgb, var(--cta-text) 10%, transparent);
  color: var(--cta-text);
}

/* ---- Status markers ------------------------------------------------------------------------ */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.status--available {
  color: var(--accent);
}

.status--available::before {
  border-color: var(--accent);
  background: var(--accent);
}

.status--limited::before {
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.status--planned {
  color: var(--muted);
}

.feature-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 2.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.feature-list li + li {
  margin-top: 0.6rem;
}

.feature-list li::before {
  content: "";
  position: absolute;
  top: 1.2rem;
  left: 1rem;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--field);
  border-radius: 50%;
}

.feature-list--available li::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.feature-list--planned li {
  background: var(--bg-subtle);
  color: var(--muted);
}

/* ---- Docs, changelog, legal, error --------------------------------------------------------- */

.toc {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.toc .toc__title {
  margin: 0 0 0.6rem;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.toc ul {
  columns: 2;
  column-gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc li {
  margin: 0 0 0.35rem;
  break-inside: avoid;
}

.changelog {
  position: relative;
  margin: 2rem 0 0;
  padding: 0 0 0 1.75rem;
  list-style: none;
  border-left: 1px solid var(--line-strong);
}

.changelog > li {
  position: relative;
}

.changelog > li + li {
  margin-top: 2.5rem;
}

/* Each entry is a dot on the timeline. */
.changelog > li::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: calc(-1.75rem - 6px);
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.entry__date {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.entry h2 {
  font-size: 1.2rem;
}

.draft-banner {
  margin: 2rem 0 0;
  padding: 0.9rem 1.15rem;
  border: 1px solid color-mix(in srgb, var(--draft) 35%, transparent);
  border-radius: var(--radius);
  background: var(--draft-tint);
  color: var(--draft);
}

.draft-banner p {
  margin: 0;
}

.draft-banner strong {
  color: var(--draft);
}

.placeholder h2 {
  color: var(--muted);
}

.section.placeholder {
  padding: 1.25rem 1.4rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.facts {
  display: grid;
  gap: 0;
  margin: 0 0 1.5rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.facts div {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) 2fr;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.facts div + div {
  border-top: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-weight: 500;
}

.facts dd {
  margin: 0;
}

.facts code {
  word-break: break-all;
}

.error-page {
  max-width: 34rem;
  margin: 4rem auto 0;
  text-align: center;
}

/* ---- Components shared with the account pages ---------------------------------------------- */

.notice {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  background: var(--accent-tint);
  color: var(--text);
}

.notice.error {
  border-color: color-mix(in srgb, var(--error) 35%, transparent);
  background: var(--error-tint);
  color: var(--error);
}

.card > .notice:last-child {
  margin-bottom: 0;
}

.notice h2 {
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}

.card {
  margin: 0 0 1.25rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card > :last-child {
  margin-bottom: 0;
}

.card > h1:first-child {
  margin-top: 0;
}

.card h2 {
  margin-bottom: 0.6rem;
  font-size: 1.12rem;
  letter-spacing: -0.015em;
}

.card h3 {
  margin-top: 1.25rem;
  font-size: 1rem;
}

/* Every table sits in one of these, so a table wider than a phone scrolls inside its box
   instead of pushing its last column (often a button) off the screen. */
.table-scroll {
  margin: 0 0 1rem;
  overflow-x: auto;
}

.table-scroll > table {
  margin-bottom: 0;
}

table {
  width: 100%;
  margin: 0 0 1rem;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.93rem;
}

caption {
  padding: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: left;
}

th,
td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

thead th {
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Help topics (rendered from the desktop's help folder, O-39): column alignment as classes (the
   page CSP allows no inline styles), Note and Warning call-outs, and menu paths. */
th.align-right,
td.align-right {
  text-align: right;
}

th.align-center,
td.align-center {
  text-align: center;
}

.help-callout {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--accent-tint);
}

.help-callout--warning {
  border-color: color-mix(in srgb, var(--error) 35%, transparent);
  background: var(--error-tint);
}

.help-callout > :last-child {
  margin-bottom: 0;
}

.menu-path {
  font-weight: 600;
}

.help-search {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0 0 2rem;
}

.help-search label {
  flex-basis: 100%;
}

.help-search input {
  flex: 1 1 14rem;
}

.help-topics li > p {
  margin: 0.15rem 0 0.75rem;
  color: var(--muted);
}

.help-results li > p {
  margin: 0.15rem 0 0.75rem;
  color: var(--muted);
}

.help-crumbs,
.help-version {
  color: var(--muted);
  font-size: 0.9rem;
}

td form {
  margin: 0;
}

td form > button {
  margin-top: 0;
}

/* Forms */

form {
  margin: 0 0 1rem;
}

form > * {
  margin-top: 0;
  margin-bottom: 0;
}

form > * + * {
  margin-top: 0.75rem;
}

label {
  display: block;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 550;
}

label + input,
label + textarea,
label + select {
  margin-top: 0.4rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="search"],
input[type="url"],
input[type="number"],
input:not([type]),
select,
textarea {
  display: block;
  width: 100%;
  max-width: 30rem;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--field);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  /* A real outline: forced-colours mode draws it, and it needs no colour mixing. */
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

textarea {
  max-width: 40rem;
  min-height: 9rem;
  resize: vertical;
}

input[autocomplete="one-time-code"] {
  max-width: 12rem;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  letter-spacing: 0.25em;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0 0.5rem 0 0;
  vertical-align: -0.15rem;
  accent-color: var(--accent);
}

input[type="radio"] + label,
input[type="checkbox"] + label {
  display: inline;
  font-weight: 500;
}

fieldset {
  margin: 0;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

legend {
  padding: 0 0.4rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

form > button,
form > .button,
form > input[type="submit"] {
  margin-top: 1.25rem;
}

/* The QR code keeps a white backing in dark mode so it scans. */
.qr {
  display: block;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 12rem));
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.codes li + li {
  margin-top: 0;
}

.recovery-code {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-align: center;
}

/* Support request bodies keep the sender's line breaks. */
.support-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A support thread (SP10): the customer's messages, and replies from Querlyn support marked by an
   accent rule; staff-only notes in the console get a dashed outline. */
.support-thread {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.support-message {
  margin: 0 0 0.9rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.support-message--staff {
  border-left: 4px solid var(--accent);
}

.support-message--internal {
  border-style: dashed;
}

.support-message__meta {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- The signed-in portal: a sidebar and a content column ---------------------------------- */

.portal {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 3rem;
  padding-top: 2.75rem;
}

.portal__nav {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  align-self: start;
}

.portal__title {
  margin: 0 0 0.6rem 0.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.portal__nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal__nav li + li {
  margin-top: 0.1rem;
}

.portal__nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
  text-decoration: none;
}

.portal__nav a:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.portal__nav a[aria-current] {
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

.portal__nav svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.portal__content {
  min-width: 0;
  max-width: 50rem;
}

.portal__content > h1:first-child {
  margin-top: 0;
}

/* The overview's status tiles. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1.75rem 0 2rem;
  padding: 0;
  list-style: none;
}

.tiles > li + li {
  margin-top: 0;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.tile__label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.tile__value {
  margin: 0;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tile__value--good {
  color: var(--accent);
}

.tile__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.tile__action {
  margin: auto 0 0;
  padding-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---- Sign-in and similar: one card in the middle of a soft wash ---------------------------- */

.auth {
  display: grid;
  place-items: start center;
  /* Block padding only: the shell's side gutter keeps the card off a phone's edges. */
  padding-block: 4.5rem 2rem;
}

.auth__card {
  width: 100%;
  max-width: 28rem;
  padding: 2.25rem 2.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
}

.auth__card > :last-child {
  margin-bottom: 0;
}

.auth__card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.65rem;
  letter-spacing: -0.03em;
}

.auth__card .card {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: none;
}

.auth__card input[type="email"],
.auth__card input[type="password"],
.auth__card input[type="text"],
.auth__card input:not([type]) {
  max-width: none;
}

.auth__card form > button,
.auth__card form > input[type="submit"] {
  width: 100%;
}

.auth__card details {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.auth__card summary {
  color: var(--muted);
  font-size: 0.92rem;
  cursor: pointer;
}

.auth__aside {
  max-width: 28rem;
  margin: 1.25rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Passkey controls are driven by /static/passkeys.js rather than a form: the same rhythm as forms. */
.passkey > * {
  margin-top: 0;
  margin-bottom: 0;
}

.passkey > * + * {
  margin-top: 0.75rem;
}

.passkey > label + input {
  margin-top: 0.4rem;
}

.passkey > button {
  margin-top: 1.25rem;
}

/* In a sign-in card, the passkey option sits under the password form, set apart by a rule. */
.auth__card .passkey {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.auth__card .passkey > p:first-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth__card .passkey > button {
  margin-top: 0.75rem;
}

.auth__card .passkey + p,
.auth__card form + p {
  margin-top: 1.25rem;
  font-size: 0.92rem;
}

/* ---- Small screens ------------------------------------------------------------------------- */

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

  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }

  .site-footer__about {
    grid-column: 1 / -1;
  }

  .portal {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1.5rem;
  }

  .portal__nav {
    position: static;
    margin: 0 -1.5rem;
    padding: 0 1.5rem 0.25rem;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
  }

  .portal__title {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .portal__nav ul {
    display: flex;
    gap: 0.25rem;
  }

  .portal__nav li + li {
    margin-top: 0;
  }

  .portal__nav a {
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  /* Two or three rows tall here: a sticky header would cover a third of a small screen and the
     targets of in-page links. */
  .site-header {
    position: static;
  }

  [id] {
    scroll-margin-top: 1rem;
  }

  .site-header__inner {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
  }

  /* Every link stays visible: the list wraps under the brand rather than scrolling sideways. */
  .site-nav {
    width: 100%;
  }

  .site-nav ul {
    gap: 0.1rem 0;
  }

  .site-nav a {
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
  }

  .site-nav .site-nav__account {
    margin-left: 0.25rem;
    padding: 0.4rem 0.9rem;
  }

  .eyebrow {
    flex-wrap: wrap;
    justify-content: center;
    border-radius: 14px;
    font-size: 0.8rem;
  }

  .hero {
    padding-top: 3.5rem;
  }

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

  .app__side {
    display: none;
  }

  .callout,
  .cta {
    padding: 1.75rem 1.4rem;
  }

  .toc ul {
    columns: 1;
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .auth {
    padding-top: 2rem;
  }

  .auth__card {
    padding: 1.6rem 1.3rem;
  }

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

/* ---- Forced colours (Windows high contrast): keep the drawn markers visible --------------- */

@media (forced-colors: active) {
  .cursor,
  .changelog > li::before,
  .status--available::before,
  .feature-list--available li::before {
    forced-color-adjust: none;
    background: CanvasText;
  }

  .status::before,
  .feature-list li::before {
    border-color: CanvasText;
  }

  .mesh::before {
    display: none;
  }

  /* Backgrounds vanish in forced colours: underline the current page and section instead. */
  .site-nav a[aria-current],
  .portal__nav a[aria-current] {
    text-decoration: underline 2px;
    text-underline-offset: 0.3em;
  }
}

/* A platform's requirements, under its name in the downloads table. */
.status-table__note {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 400;
}

.section--wide {
  margin-top: 6rem;
}
