/* Revline onboarding — design system ported from revlinehq.com.
   Tokens, the two optical Newsreader cuts, and the type utilities are lifted
   verbatim from the site's app/globals.css so the two surfaces cannot drift.
   Written as plain CSS on purpose: a Worker serving one stylesheet does not
   need a build step, and the token list is the contract, not the tooling. */

@font-face {
  font-family: "FiraVar";
  src: url("/fonts/fira-code-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader Display";
  src: url("/fonts/newsreader-display-roman.woff2") format("woff2");
  font-weight: 500 700;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader Text";
  src: url("/fonts/newsreader-text-roman.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --ink: #141110;
  --ink-lift: #1c1917;
  --ink-lift-2: #26211f;
  --paper: #f2ede3;
  --paper-deep: #eae3d5;
  --cream: #f5f1ed;
  --cream-dim: #a89f94;
  --graphite: #5e574f;
  --redline: #e8342a;
  --redline-deep: #cc2e25;

  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  /* Two optical cuts. Display is drawn at opsz 72, text at opsz 16; picking
     the wrong one is the difference between a display serif and a spindly one. */
  --font-display: "Newsreader Display", Georgia, "Times New Roman", serif;
  --font-text-serif: "Newsreader Text", Georgia, "Times New Roman", serif;
  --font-mono: "FiraVar", ui-monospace, SFMono-Regular, monospace;

  --shell: 60rem;
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--redline-deep);
  color: var(--cream);
}

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

[data-surface="dark"] :focus-visible {
  outline-color: var(--redline);
}

/* ---------- type utilities (site parity) ---------- */

.display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.02;
  text-wrap: balance;
  margin: 0;
  font-size: clamp(2rem, 1.35rem + 2.6vw, 3.25rem);
}

.display-3 {
  font-family: var(--font-text-serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.22;
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.75vw, 1.75rem);
}

.serif-read {
  font-family: var(--font-text-serif);
  font-weight: 400;
  line-height: 1.6;
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
}

.serif-read strong,
.serif-read b {
  font-weight: 650;
}

.copy {
  font-size: 1.0625rem;
  line-height: 1.65;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  margin: 0;
}

.mono-label-sm {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.mono-data {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.mono-figure {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---------- worlds ---------- */

.band {
  background: var(--ink);
  color: var(--cream);
  background-image: radial-gradient(
    ellipse 80% 60% at 72% 18%,
    color-mix(in srgb, var(--ink-lift-2) 90%, transparent),
    transparent 62%
  );
}

.band .eyebrow {
  color: var(--cream-dim);
}

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

@media (min-width: 48rem) {
  .shell {
    padding-inline: 3rem;
  }
}

.band-inner {
  padding-block: 3.5rem 3rem;
}

@media (min-width: 48rem) {
  .band-inner {
    padding-block: 5rem 4rem;
  }
}

/* The site's signature: a 2px redline hairline where the two worlds meet.
   This is the whole red budget on the page apart from the primary button. */
.boundary {
  height: 2px;
  background: var(--redline);
}

.body-inner {
  padding-block: 3rem 5rem;
}

@media (min-width: 48rem) {
  .body-inner {
    padding-block: 4rem 6rem;
  }
}

.lede {
  margin: 1.5rem 0 0;
  max-width: 56ch;
  color: var(--cream);
}

.band h1 {
  max-width: 18ch;
}

.meta-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgb(245 241 237 / 0.16);
  color: var(--cream-dim);
}

.meta-rail span {
  color: var(--cream);
}

/* ---------- steps ---------- */

.step {
  border-top: 1px solid rgb(20 17 16 / 0.14);
  padding-block: 2.5rem;
}

.step:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.step-head .eyebrow {
  color: var(--graphite);
}

.step-state {
  color: var(--graphite);
  white-space: nowrap;
}

.step-state[data-done="true"] {
  color: var(--ink);
}

.step h2 {
  margin: 0 0 0.75rem;
}

.step-note {
  color: var(--graphite);
  max-width: 62ch;
  margin: 0 0 2rem;
}

/* A completed section collapses to its summary. The client is not made to
   re-read a form they have already filled in to reach the one they have not. */
.summary {
  background: var(--paper-deep);
  padding: 1.25rem 1.5rem;
  display: grid;
  gap: 0.75rem 2rem;
}

@media (min-width: 40rem) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.summary div {
  min-width: 0;
}

.summary dt {
  color: var(--graphite);
  margin-bottom: 0.25rem;
}

.summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* ---------- forms ---------- */

form {
  margin: 0;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 2rem;
}

legend {
  display: block;
  width: 100%;
  padding: 0 0 0.625rem;
  margin-bottom: 1.5rem;
  color: var(--graphite);
  border-bottom: 1px solid rgb(20 17 16 / 0.14);
}

.field {
  display: block;
  margin-bottom: 1.5rem;
}

.grid-2 {
  display: grid;
  gap: 0 1.5rem;
}

@media (min-width: 40rem) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.field > .label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.field .hint {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  letter-spacing: 0;
  text-transform: none;
  color: var(--graphite);
  margin-top: 0.5rem;
}

/* 1rem is the iOS auto-zoom floor. Every input on this page is at or above it;
   dropping to 15px makes Safari zoom the viewport on focus and the client
   spends the rest of the form pinching back out. */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid rgb(20 17 16 / 0.22);
  border-radius: 0;
  padding: 0.75rem 0.875rem;
  min-height: 3rem;
  transition: border-color 160ms var(--ease-expo);
  appearance: none;
}

input[inputmode="numeric"],
.mono-input {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: rgb(20 17 16 / 0.42);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--redline-deep);
}

input[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--redline-deep);
  border-left-width: 3px;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--graphite) 50%),
    linear-gradient(135deg, var(--graphite) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.5rem;
}

.error {
  display: block;
  color: var(--redline-deep);
  margin-top: 0.375rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem;
  background: var(--paper-deep);
  cursor: pointer;
}

.check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0.125rem 0 0;
  accent-color: var(--redline-deep);
}

.check span {
  min-width: 0;
}

/* ---------- buttons ---------- */

/* The site's Cta: redline-deep fill, mono label, no radius, 44px+ tall. */
.btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 1rem 2.25rem;
  background: var(--redline-deep);
  color: var(--cream);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: opacity 160ms var(--ease-expo);
}

.btn:hover {
  opacity: 0.9;
}

.btn:active {
  opacity: 0.82;
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgb(20 17 16 / 0.3);
}

.btn-quiet:hover {
  border-color: var(--ink);
  opacity: 1;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.actions .note {
  color: var(--graphite);
  max-width: 34ch;
  padding-left: 0.875rem;
  border-left: 1px solid rgb(20 17 16 / 0.25);
  line-height: 1.9;
}

/* ---------- panels ---------- */

.panel {
  background: var(--paper-deep);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.panel-dark {
  background: var(--ink);
  color: var(--cream);
  padding: 2rem 1.5rem;
}

.panel-dark .eyebrow {
  color: var(--cream-dim);
}

.panel h3 {
  margin: 0 0 0.5rem;
}

.panel p:last-child {
  margin-bottom: 0;
}

.rule-left {
  border-left: 2px solid var(--ink);
  padding-left: 1.25rem;
}


/* ---------- admin ---------- */

.admin {
  background: var(--paper);
  --shell: 84rem;
}

.admin-bar {
  background: var(--ink);
  color: var(--cream);
  padding-block: 1.25rem;
}

.admin-bar .shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-bar a {
  color: var(--cream);
}

.table-wrap {
  overflow-x: auto;
  margin-bottom: 2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 44rem;
}

th,
td {
  text-align: left;
  padding: 0.875rem 1rem 0.875rem 0;
  border-bottom: 1px solid rgb(20 17 16 / 0.14);
  vertical-align: top;
}

th {
  color: var(--graphite);
  border-bottom-color: rgb(20 17 16 / 0.3);
  white-space: nowrap;
}

td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.chip {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border: 1px solid rgb(20 17 16 / 0.3);
  color: var(--graphite);
  white-space: nowrap;
}

.chip[data-status="provisioned"] {
  border-color: var(--ink);
  color: var(--ink);
}

.chip[data-status="paid"] {
  border-color: var(--ink);
  color: var(--ink);
}

.chip[data-status="needs_attention"] {
  border-color: var(--redline-deep);
  color: var(--redline-deep);
}

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

.timeline li {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgb(20 17 16 / 0.1);
}

@media (max-width: 40rem) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

.timeline time {
  color: var(--graphite);
}

.timeline pre {
  margin: 0.375rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--graphite);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.action-card {
  background: var(--paper-deep);
  border-left: 2px solid var(--redline-deep);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.action-card[data-resolved="1"] {
  border-left-color: rgb(20 17 16 / 0.2);
  opacity: 0.6;
}

.action-card pre {
  margin: 0.5rem 0 1rem;
  white-space: pre-wrap;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.copy-link {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.copy-link code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--paper-deep);
  padding: 0.625rem 0.75rem;
  overflow-wrap: anywhere;
  flex: 1 1 20rem;
}

.stack {
  display: grid;
  gap: 0.75rem;
}

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

.section-gap {
  margin-top: 3rem;
}

h2,
h3 {
  font-family: var(--font-text-serif);
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.22;
}

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

.link-out {
  text-decoration-color: var(--redline-deep);
}

/* ---------- login ---------- */

.login-card {
  background: var(--paper-deep);
  padding: 2rem 1.5rem;
  max-width: 26rem;
}

@media (min-width: 40rem) {
  .login-card {
    padding: 2.5rem;
  }
}

.login-card .field {
  margin-bottom: 1.5rem;
}

.admin-bar form {
  display: inline;
}

.admin-bar .signout {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: none;
  border: 0;
  border-bottom: 1px solid rgb(245 241 237 / 0.4);
  color: var(--cream);
  padding: 0 0 2px;
  cursor: pointer;
  min-height: 44px;
}

.admin-bar .signout:hover {
  border-bottom-color: var(--cream);
}
