/* =========================================================================
   Night Shift Web Development
   Brand palette: 181818 / 7D7D7D / 2F1242 / 6C4FD6 / 1D082F
   Dark-first (it is in the name); light mode is white + the same purple.
   Theme is set on <html data-theme="dark|light"> by the inline script in each
   page head, so there is no flash on load and no :root/@media duplication.
   ========================================================================= */

/* Display face: Bricolage Grotesque (SIL OFL 1.1, see fonts/OFL.txt). Variable
   latin subset, self-hosted -- no third-party request on the critical path.
   Used for headings and brand marks only; body copy stays on the system stack,
   which costs nothing to load and reads better at small sizes. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-grotesque.woff2') format('woff2');
  font-weight: 400 800;
  font-stretch: 100%;
  font-display: swap;
  font-style: normal;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root,
:root[data-theme='dark'] {
  --bg: #0f0f11;
  --bg-elevated: #17151d;
  --bg-sunken: #0a0a0c;
  --panel: #1a1622;
  --panel-hover: #221c2e;
  --border: #2a2336;
  --border-strong: #3b3049;

  --text: #f4f2f7;
  --text-muted: #a49db2;
  --text-faint: #7d7d7d;

  --purple: #7f63e0;
  --purple-strong: #6c4fd6;
  --purple-soft: #2f1242;
  --purple-ink: #1d082f;
  --on-purple: #ffffff;

  --success: #4ade80;
  --success-bg: #10281a;
  --warn: #fbbf24;
  --warn-bg: #2c2210;
  --danger: #f87171;
  --danger-bg: #2d1417;

  --glow: radial-gradient(60% 60% at 50% 0%, rgba(108, 79, 214, 0.32), transparent 70%);
  --shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.9);
  --shadow-lift: 0 26px 60px -26px rgba(108, 79, 214, 0.55);
  --card-sheen: linear-gradient(160deg, rgba(127, 99, 224, 0.09), transparent 55%);

  --font-display: 'Bricolage Grotesque', 'Segoe UI Variable Display', ui-sans-serif,
    system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue',
    Arial, sans-serif;
}

:root[data-theme='light'] {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-sunken: #f6f4fa;
  --panel: #ffffff;
  --panel-hover: #faf8fe;
  --border: #e6e1ef;
  --border-strong: #d3cae2;

  --text: #181818;
  --text-muted: #5d5769;
  --text-faint: #7d7d7d;

  --purple: #5d3fce;
  --purple-strong: #6c4fd6;
  --purple-soft: #f0ebfd;
  --purple-ink: #2f1242;
  --on-purple: #ffffff;

  --success: #15803d;
  --success-bg: #e8f8ee;
  --warn: #a16207;
  --warn-bg: #fdf5e2;
  --danger: #b91c1c;
  --danger-bg: #fdecec;

  --glow: radial-gradient(60% 60% at 50% 0%, rgba(108, 79, 214, 0.14), transparent 70%);
  --shadow: 0 16px 40px -24px rgba(47, 18, 66, 0.35);
  --shadow-lift: 0 24px 55px -28px rgba(108, 79, 214, 0.45);
  --card-sheen: linear-gradient(160deg, rgba(108, 79, 214, 0.05), transparent 55%);
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

@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(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 32;
  line-height: 1.12;
  letter-spacing: -0.024em;
  font-weight: 750;
}
h1 { font-variation-settings: 'opsz' 72; }
h1 { font-size: clamp(2.1rem, 1.3rem + 3.4vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.7vw, 2.35rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1em; }

:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--purple-strong);
  color: var(--on-purple);
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- layout ---------- */

.wrap {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
}
.wrap--narrow { width: min(720px, 100% - 2.5rem); }

.section { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.section--tight { padding: clamp(2.5rem, 5vw, 4rem) 0; }

.eyebrow {
  margin: 0 0 0.9rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--purple);
}

.lede {
  font-size: clamp(1.02rem, 0.97rem + 0.3vw, 1.16rem);
  color: var(--text-muted);
  max-width: 60ch;
}

/* ---------- header ---------- */

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

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 68px;
}

.brand {
  font-family: var(--font-display);
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.brand:hover { text-decoration: none; }
.brand img { width: 32px; height: 32px; }
:root[data-theme='dark'] .brand img { filter: drop-shadow(0 0 12px rgba(127, 99, 224, 0.35)); }
.brand__name { font-size: 0.98rem; }
.brand__name span { color: var(--purple); }

.nav {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}
.nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 550;
}
.nav a:hover { color: var(--text); text-decoration: none; }

@media (max-width: 780px) {
  .nav--marketing a[data-optional] { display: none; }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.72rem 1.3rem;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.14s ease, background-color 0.14s ease, border-color 0.14s ease,
    box-shadow 0.14s ease, opacity 0.14s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-busy='true'] { opacity: 0.6; cursor: not-allowed; }

.btn--primary {
  background: var(--purple-strong);
  color: var(--on-purple);
  box-shadow: var(--shadow-lift);
}
.btn--primary:hover:not([disabled]) { background: var(--purple); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover:not([disabled]) { background: var(--panel-hover); border-color: var(--purple); }

.btn--quiet {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding-inline: 0.4rem;
}
.btn--quiet:hover:not([disabled]) { color: var(--text); }

.btn--block { width: 100%; }
.btn--lg { padding: 0.95rem 1.7rem; font-size: 1rem; }

/* theme toggle */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex: none;
}
.theme-toggle:hover { color: var(--text); border-color: var(--purple); }
.theme-toggle svg { width: 17px; height: 17px; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
:root[data-theme='light'] .theme-toggle .icon-sun { display: none; }
:root[data-theme='light'] .theme-toggle .icon-moon { display: block; }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: clamp(3.5rem, 8vw, 7rem) 0 clamp(3rem, 6vw, 5rem);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: -30% 0 auto;
  height: 620px;
  background: var(--glow);
  pointer-events: none;
}
.hero__inner { position: relative; }
.hero h1 { max-width: 16ch; }
.hero h1 em {
  font-style: normal;
  color: var(--purple);
}
.hero .lede { margin-top: 1.2rem; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 2rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.6rem;
  margin-top: 2.2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-faint);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero__meta span::before {
  content: '';
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--purple);
}

/* ---------- cards / grids ---------- */

.grid { display: grid; gap: 1.1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card {
  position: relative;
  background: var(--panel);
  background-image: var(--card-sheen);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 0.4rem; }
.card p { color: var(--text-muted); margin-bottom: 0; font-size: 0.95rem; }
.card__num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--purple);
  display: block;
  margin-bottom: 0.7rem;
}

/* ---------- pricing ---------- */

.pricing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 900px) {
  .pricing { grid-template-columns: 1fr; }
}

.price-card {
  background: var(--panel);
  background-image: var(--card-sheen);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lift);
}

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px dashed var(--border);
}
.price-line:last-of-type { border-bottom: 0; }
.price-line__label { font-weight: 600; }
.price-line__label small {
  display: block;
  font-weight: 450;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.price-line__amount {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 48;
  font-size: 1.85rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.price-line__amount small {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--text-faint);
  letter-spacing: 0;
}

.price-total {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  background: var(--purple-soft);
  color: var(--text);
  font-size: 0.88rem;
}
:root[data-theme='dark'] .price-total { color: #ddd3f2; }

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}
.checklist li {
  position: relative;
  padding-left: 1.85rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.checklist li::before {
  content: '';
  position: absolute;
  left: 0; top: 0.42em;
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  background: var(--purple-soft);
  border: 1px solid var(--purple-strong);
}
.checklist li::after {
  content: '';
  position: absolute;
  left: 0.36rem; top: 0.66em;
  width: 0.32rem; height: 0.62rem;
  border: solid var(--purple);
  border-width: 0 2px 2px 0;
  transform: rotate(42deg);
}

/* ---------- FAQ ---------- */

.faq details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0 1.2rem;
  margin-bottom: 0.7rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 620;
  padding: 1.05rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+';
  color: var(--purple);
  font-size: 1.3rem;
  line-height: 1;
  flex: none;
}
.faq details[open] summary::after { content: '\2212'; }
.faq details p {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding-bottom: 1.1rem;
  margin: 0;
  max-width: 68ch;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2.2rem 0;
  margin-top: 2rem;
  color: var(--text-faint);
  font-size: 0.86rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.site-footer a { color: var(--text-muted); }

/* ---------- auth pages ---------- */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2.5rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.auth-shell::before {
  content: '';
  position: absolute;
  inset: -35% 0 auto;
  height: 640px;
  background: var(--glow);
  pointer-events: none;
}

.auth-card {
  position: relative;
  width: min(430px, 100%);
  background: var(--panel);
  background-image: var(--card-sheen);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lift);
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.auth-card > p { color: var(--text-muted); font-size: 0.94rem; }

.auth-brand {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-brand img { width: 34px; height: 34px; }
.auth-brand span em { font-style: normal; color: var(--purple); }

.auth-footnote {
  margin: 1.4rem 0 0;
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-faint);
}

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

.field { margin-bottom: 1.05rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 620;
  margin-bottom: 0.4rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  font-size: 0.96rem;
  color: var(--text);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 0.68rem 0.8rem;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--purple) 24%, transparent);
}
.field__hint {
  margin: 0.38rem 0 0;
  font-size: 0.8rem;
  color: var(--text-faint);
}
.field__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.field__row a { font-size: 0.82rem; }

/* ---------- messages ---------- */

.msg {
  border-radius: 10px;
  padding: 0.78rem 0.95rem;
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
  border: 1px solid transparent;
}
.msg[hidden] { display: none; }
.msg--error { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.msg--ok { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.msg--warn { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.92rem;
}
.banner strong { display: block; color: var(--text); }
.banner--danger { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

/* ---------- app chrome (dashboard / account / admin) ---------- */

.app-main { padding: clamp(1.8rem, 4vw, 3rem) 0 4rem; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.8rem;
}
.page-head h1 { font-size: clamp(1.7rem, 1.4rem + 1.2vw, 2.2rem); margin: 0; }
.page-head p { margin: 0.3rem 0 0; color: var(--text-muted); font-size: 0.94rem; }

/* status pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  border: 1px solid var(--border-strong);
  background: var(--bg-sunken);
  color: var(--text-muted);
  white-space: nowrap;
}
.pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill--pending { color: var(--warn); border-color: var(--warn); background: var(--warn-bg); }
.pill--progress { color: var(--purple); border-color: var(--purple); background: var(--purple-soft); }
.pill--live { color: var(--success); border-color: var(--success); background: var(--success-bg); }
.pill--bad { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

/* progress rail for build status */
.rail {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.4rem 0 0.4rem;
}
.rail__step {
  border-top: 3px solid var(--border-strong);
  padding-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}
.rail__step strong { display: block; font-size: 0.9rem; color: var(--text-muted); font-weight: 620; }
.rail__step[data-state='done'] { border-top-color: var(--purple-strong); }
.rail__step[data-state='done'] strong { color: var(--text); }
.rail__step[data-state='current'] { border-top-color: var(--purple); }
.rail__step[data-state='current'] strong { color: var(--purple); }

.stat {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.68rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
}
.stat:last-child { border-bottom: 0; }
.stat dt { color: var(--text-muted); margin: 0; }
.stat dd { margin: 0; font-weight: 600; text-align: right; }

dl { margin: 0; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 560px;
}
th, td {
  text-align: left;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 700;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel-hover); }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-faint);
  font-size: 0.93rem;
}

/* loading shimmer */
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  color: transparent;
  user-select: none;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- success page ---------- */

.success-mark {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--purple-soft);
  border: 1px solid var(--purple-strong);
  margin-bottom: 1.3rem;
}
.success-mark svg { width: 30px; height: 30px; color: var(--purple); }

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.6rem 0 0;
  display: grid;
  gap: 0.9rem;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 2.6rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -0.1rem;
  width: 1.75rem; height: 1.75rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid var(--purple-strong);
  font-size: 0.8rem;
  font-weight: 700;
}
.steps li strong { color: var(--text); font-weight: 620; }
