/* ==========================================================================
   Rivet — base design system
   Shared by every page: tokens, type, buttons, forms, cards, nav, footer.
   ========================================================================== */

:root {
  /* ---- ground: a violet-black, not a neutral black ---- */
  --ink:       #0A0711;
  --ink-2:     #0E0A17;
  --surface:   #16101F;
  --surface-2: #1D1529;
  --surface-3: #271C36;
  --line:      #2C2139;
  --line-dim:  #1E1628;

  /* ---- text: every pair below validated to WCAG AA, see tools/contrast.py ---- */
  --text:   #F6F3FA;   /* 18.2:1 on --ink */
  --text-2: #BDB3CC;   /*  9.9:1 */
  --text-3: #A99DBA;   /*  7.3:1 on --surface */
  --text-4: #8F82A3;   /*  5.6:1 */
  --text-5: #7C6F90;   /*  4.3:1 — large or secondary text only */

  /* ---- brand: sampled from the Rivet mark (#A040E0 -> #5030E0) ---- */
  --violet:      #AE62F8;   /* 5.6:1 on --ink; the readable accent */
  --violet-hi:   #C083FF;
  --violet-deep: #7C3AED;   /* for white-on-fill, 5.2:1 */
  --indigo:      #6D4AEA;
  --grad:        linear-gradient(135deg, #C083FF 0%, #A040E0 50%, #5030E0 100%);
  --grad-soft:   linear-gradient(135deg, rgba(174,98,248,.16), rgba(109,74,234,.10));
  --violet-dim:  rgba(174, 98, 248, 0.13);

  --warn:   #FFB454;
  --danger: #FF7A8A;
  --ok:     #5BE59A;

  --radius:    20px;
  --radius-sm: 14px;
  --radius-lg: 26px;

  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --body:    "Instrument Sans", system-ui, -apple-system, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --shadow:      0 18px 50px -18px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 0 40px -8px rgba(160, 64, 224, 0.45);
  --player-h: 88px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only a UA `display: none`, so ANY component rule
   setting display (flex/grid/block) silently defeats it — and an invisible
   element with layout still swallows clicks meant for whatever is underneath.
   This makes hidden mean hidden everywhere. Use .sr-only when you want an
   element present for screen readers but not visible. */
[hidden] { display: none !important; }

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--display);
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.04;
}
p, ul, ol, figure { margin: 0; }
img { max-width: 100%; display: block; }

a { color: var(--text); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--violet); }

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

::selection { background: var(--violet); color: var(--ink); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- layout helpers ---------- */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding-inline: 24px; }
.wrap--narrow { max-width: 760px; }
.row { display: flex; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; }
.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;
}

.mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow { color: var(--violet); }
.muted { color: var(--text-3); }
.dim   { color: var(--text-4); }

.section { padding-block: clamp(56px, 7.5vw, 110px); }
.section--alt { background: var(--ink-2); border-block: 1px solid var(--line-dim); }
.section--tight { padding-block: clamp(40px, 5vw, 72px); }

.h1 { font-size: clamp(38px, 7vw, 86px); font-weight: 800; }
.h2 { font-size: clamp(29px, 4.2vw, 52px); font-weight: 700; }
.h3 { font-size: clamp(22px, 2.6vw, 32px); font-weight: 700; }
.lede {
  margin-top: 18px; color: var(--text-2);
  font-size: clamp(16px, 1.5vw, 17.5px); line-height: 1.6; max-width: 62ch;
}

.rule { height: 1px; background: var(--line); border: 0; margin-block: 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  border: 1px solid transparent;
  background: none;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: transform .14s ease, background .18s ease, border-color .18s ease, color .18s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

.btn--fill { background: var(--violet); color: var(--ink); }
.btn--fill:hover { background: var(--violet-hi); color: var(--ink); }
.btn--ghost { border-color: #35353F; color: var(--text); }
.btn--ghost:hover { border-color: var(--violet); color: var(--violet); }
.btn--outline { border-color: var(--violet); color: var(--violet); }
.btn--outline:hover { background: var(--violet); color: var(--ink); }
.btn--quiet { color: var(--text-2); }
.btn--quiet:hover { color: var(--text); background: var(--surface-2); }
.btn--sm { min-height: 44px; padding: 0 20px; font-size: 15px; }
.btn--xs { min-height: 36px; padding: 0 14px; font-size: 13.5px; gap: 7px; }
.btn--block { width: 100%; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-3);
  background: var(--surface);
}
.pill--accent { border-color: var(--violet); color: var(--violet); background: var(--violet-dim); }
.pill--promoted { border-color: #45454F; color: var(--text-4); }
.pill--solid { background: var(--violet); color: var(--ink); border-color: var(--violet); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card--pad { padding: 28px; }
.card--hover { transition: border-color .18s ease, transform .18s ease; }
.card--hover:hover { border-color: #3A3A46; transform: translateY(-2px); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.field__hint { font-size: 12.5px; color: var(--text-5); line-height: 1.5; }
.field__error { font-size: 12.5px; color: var(--danger); min-height: 1em; }

.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  background: var(--ink);
  border: 1px solid #32323C;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  transition: border-color .16s ease, background .16s ease;
}
.textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #5E5E68; }
.input:hover, .select:hover, .textarea:hover { border-color: #44444F; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--violet); background: var(--ink-2);
}
.input[aria-invalid="true"] { border-color: var(--danger); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8A94' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
}

/* choice cards (radio group that looks like cards) */
.choice { position: relative; display: block; cursor: pointer; }
.choice input {
  position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%;
  margin: 0; cursor: pointer;
}
.choice__box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 24px;
  height: 100%;
  transition: border-color .16s ease, background .16s ease;
}
.choice input:hover + .choice__box { border-color: #44444F; }
.choice input:focus-visible + .choice__box { outline: 2px solid var(--violet); outline-offset: 3px; }
.choice input:checked + .choice__box {
  border-color: var(--violet);
  background: linear-gradient(0deg, var(--violet-dim), var(--violet-dim)), var(--surface);
}
.choice__tick {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid #44444F; flex: none;
  display: grid; place-items: center;
}
.choice input:checked + .choice__box .choice__tick {
  border-color: var(--violet); background: var(--violet);
}
.choice__tick svg { opacity: 0; }
.choice input:checked + .choice__box .choice__tick svg { opacity: 1; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 46px; height: 27px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid #3A3A46;
  position: relative; transition: background .18s ease, border-color .18s ease; flex: none;
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--text-3); transition: transform .18s ease, background .18s ease;
}
.switch input:checked + .switch__track { background: var(--violet); border-color: var(--violet); }
.switch input:checked + .switch__track::after { transform: translateX(19px); background: var(--ink); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--violet); outline-offset: 3px; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand__name {
  font-family: var(--display); font-weight: 800;
  font-size: 21px; letter-spacing: -0.035em;
}

/* ---------- site nav (marketing pages) ---------- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(10, 10, 12, .82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-dim);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding-block: 16px;
}
.nav__links { display: flex; gap: 28px; align-items: center; font-size: 15px; color: var(--text-2); }
.nav__cta { display: flex; gap: 10px; align-items: center; }
.nav__burger { display: none; width: 44px; height: 44px; border: 0; background: none; cursor: pointer; place-items: center; }

@media (max-width: 940px) {
  .nav__links { display: none; }
  .nav__links.is-open {
    display: flex; position: absolute; inset: 100% 0 auto 0;
    flex-direction: column; align-items: flex-start; gap: 0;
    background: var(--ink-2); border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
  }
  .nav__links.is-open a { padding-block: 14px; width: 100%; font-size: 16px; }
  .nav__burger { display: grid; }
  .nav__cta .is-login { display: none; }
}

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line-dim); padding-block: 48px 36px; }
.footer__top { gap: 36px 48px; justify-content: space-between; }
.footer__about { flex: 1 1 240px; }
.footer__col { flex: 0 1 150px; }
.footer__col .mono { color: var(--text-4); margin-bottom: 14px; display: block; }
.footer__links { display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--text-3); }
.footer__legal { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line-dim); }
.footer__legal p { color: #6A6A73; font-size: 13px; }

/* ---------- misc ---------- */
.toast-host {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--player-h) + 20px); z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
  pointer-events: none; width: calc(100% - 32px); max-width: 460px;
}
.toast {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 13px 22px; font-size: 14.5px;
  box-shadow: var(--shadow); animation: toast-in .26s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast--ok { border-color: var(--violet); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ==========================================================================
   Rivet brand components
   ========================================================================== */

/* The mark is wider than tall (240x174). Height is the fixed dimension and
   width follows, so the R and its waveform never get squashed. */
.brand__mark {
  height: 32px; width: auto; flex: none; display: block;
  filter: drop-shadow(0 0 14px rgba(160, 64, 224, .45));
}
.brand__word { display: flex; flex-direction: column; line-height: 1; }
.brand__name {
  font-family: var(--display); font-weight: 800;
  font-size: 20px; letter-spacing: 0.02em;
}
.brand__sub {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: .42em;
  color: var(--text-4); margin-top: 4px; text-transform: uppercase;
}

/* gradient type — only ever on large display text, never body copy */
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  /* if background-clip:text is unsupported the text still paints violet */
  -webkit-text-fill-color: transparent;
}
@supports not (background-clip: text) {
  .grad-text { color: var(--violet); -webkit-text-fill-color: var(--violet); }
}

.btn--fill {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 24px -8px rgba(160, 64, 224, .7);
}
.btn--fill:hover { filter: brightness(1.12); color: #fff; }
.btn--outline { border-color: var(--violet); color: var(--violet); }
.btn--outline:hover { background: var(--violet); color: #0A0711; }

/* a soft violet bloom used behind hero and feature art */
.bloom {
  position: absolute; border-radius: 50%; pointer-events: none;
  filter: blur(90px); opacity: .5; z-index: 0;
}
.bloom--violet { background: radial-gradient(circle, #A040E0, transparent 70%); }
.bloom--indigo { background: radial-gradient(circle, #5030E0, transparent 70%); }

.hairline {
  height: 1px; border: 0;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}
