/* ==========================================================================
   Riff Apps — site.css
   Palette sampled directly from the logo artwork.
   ========================================================================== */

:root {
  /* Brand ink */
  --navy:        #0A1C3E;
  --navy-deep:   #061128;
  --navy-soft:   #122850;
  --navy-line:   #1D3462;

  /* Spectrum, sampled from the R ribbon and app tiles */
  --cyan:        #00B4F0;
  --blue:        #0A78F0;
  --indigo:      #1A2FD2;
  --violet:      #7A2BE8;
  --magenta:     #B516C8;
  --amber:       #F59B3C;
  --green:       #4CC45C;

  /* Surfaces */
  --paper:       #F5F7FC;
  --paper-warm:  #FFFFFF;
  --paper-line:  #DCE3F0;

  /* Text */
  --on-dark:       #EAF0FC;
  --on-dark-muted: #9DB0D4;
  --on-light:       #16233F;
  --on-light-muted: #4C5E82;

  --spectrum: linear-gradient(90deg, var(--cyan) 0%, var(--blue) 26%, var(--indigo) 48%, var(--violet) 74%, var(--magenta) 100%);

  --measure: 68ch;
  --shell: 1200px;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0:  clamp(1rem, 0.97rem + 0.16vw, 1.08rem);
  --step-1:  clamp(1.2rem, 1.13rem + 0.34vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.36rem + 0.68vw, 1.95rem);
  --step-3:  clamp(1.9rem, 1.62rem + 1.4vw, 2.8rem);
  --step-4:  clamp(2.3rem, 1.85rem + 2.1vw, 3.7rem);
}

/* --------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--navy);
  color: var(--on-dark);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3, h4, .display {
  font-family: "Outfit", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin: 0;
  font-weight: 700;
}

/* The wordmark pairs a heavy and a hairline geometric. Headlines echo it. */
.light { font-weight: 200; letter-spacing: -0.03em; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--cyan); color: var(--navy-deep);
  padding: 10px 16px; border-radius: var(--radius-s);
  font-weight: 600; text-decoration: none;
  transition: top .18s ease;
}
.skip:focus { top: 12px; }

/* -------------------------------------------------------------- layout -- */
.shell {
  width: min(100% - 2.5rem, var(--shell));
  margin-inline: auto;
}
@media (max-width: 600px) { .shell { width: min(100% - 1.75rem, var(--shell)); } }

.band { padding: clamp(3.5rem, 7vw, 6.5rem) 0; }
.band-tight { padding: clamp(2.5rem, 4vw, 3.5rem) 0; }
.band-paper { background: var(--paper); color: var(--on-light); }
.band-deep { background: var(--navy-deep); }

/* The spectrum works as a structural rule marking section boundaries,
   not as background decoration. */
.rule { height: 2px; background: var(--spectrum); border: 0; margin: 0; }
.rule-soft { height: 1px; background: var(--navy-line); border: 0; margin: 0; }

.lede { font-size: var(--step-1); line-height: 1.5; color: var(--on-dark-muted); max-width: 46ch; font-weight: 300; }
.band-paper .lede { color: var(--on-light-muted); }

.measure { max-width: var(--measure); }

.section-head { display: grid; gap: 1rem; margin-bottom: clamp(2rem, 4vw, 3rem); max-width: 56ch; }
.section-head h2 { font-size: var(--step-3); }
.section-head p { color: var(--on-dark-muted); margin: 0; }
.band-paper .section-head p { color: var(--on-light-muted); }

/* ------------------------------------------------------------- topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--navy) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--navy-line);
}
.topbar-inner {
  display: flex; align-items: center; gap: 1.5rem;
  min-height: 74px;
}
.brand {
  display: inline-flex; align-items: center; gap: .7rem;
  text-decoration: none; color: var(--on-dark);
  font-family: "Outfit", sans-serif; font-size: 1.28rem; letter-spacing: -0.02em;
  margin-right: auto;
}
.brand img { width: 40px; height: auto; }
.brand b { font-weight: 700; }
.brand span { font-weight: 200; }

.nav { display: flex; align-items: center; gap: .35rem; }
.nav a {
  text-decoration: none; color: var(--on-dark-muted);
  padding: .55rem .8rem; border-radius: var(--radius-s);
  font-size: .95rem; font-weight: 500;
  transition: color .15s ease, background .15s ease;
}
.nav a:hover { color: var(--on-dark); background: var(--navy-soft); }
.nav a[aria-current="page"] { color: var(--on-dark); }
.nav a[aria-current="page"]::after {
  content: ""; display: block; height: 2px; margin-top: 4px;
  background: var(--spectrum); border-radius: 2px;
}

.menu-btn {
  display: none; background: none; border: 1px solid var(--navy-line);
  border-radius: var(--radius-s); color: var(--on-dark);
  width: 44px; height: 40px; cursor: pointer;
  align-items: center; justify-content: center;
}
.menu-btn svg { width: 20px; height: 20px; }

@media (max-width: 900px) {
  .menu-btn { display: inline-flex; }
  .nav {
    position: fixed; inset: 74px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--navy-deep);
    border-bottom: 1px solid var(--navy-line);
    padding: .6rem 1.25rem 1.25rem;
    transform: translateY(-120%);
    transition: transform .26s ease;
    max-height: calc(100dvh - 74px); overflow-y: auto;
  }
  .nav[data-open="true"] { transform: translateY(0); }
  .nav a { padding: .85rem .4rem; border-bottom: 1px solid var(--navy-soft); border-radius: 0; }
  .nav .btn { margin-top: 1rem; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }

/* -------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .8rem 1.35rem; border-radius: 999px;
  font-family: "Outfit", sans-serif; font-weight: 600; font-size: 1rem;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  background: var(--spectrum); color: #fff;
  transition: filter .16s ease, transform .16s ease;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent; color: var(--on-dark);
  border-color: var(--navy-line);
}
.btn-ghost:hover { border-color: var(--cyan); filter: none; background: var(--navy-soft); }
.band-paper .btn-ghost { color: var(--on-light); border-color: var(--paper-line); }
.band-paper .btn-ghost:hover { background: #fff; border-color: var(--blue); }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }

.textlink {
  color: var(--cyan); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--cyan) 45%, transparent);
  padding-bottom: 1px; font-weight: 500;
}
.textlink:hover { border-bottom-color: var(--cyan); }
.band-paper .textlink { color: var(--indigo); border-bottom-color: color-mix(in srgb, var(--indigo) 40%, transparent); }

/* ----------------------------------------------------------------- hero -- */
.hero { position: relative; overflow: hidden; }
.hero-grid {
  display: grid; gap: clamp(2rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  align-items: center;
  padding: clamp(3rem, 6vw, 5.5rem) 0 clamp(3.5rem, 6vw, 6rem);
}
@media (max-width: 940px) { .hero-grid { grid-template-columns: 1fr; } }

.hero h1 { font-size: var(--step-4); margin-bottom: 1.4rem; }
.hero .lede { max-width: 44ch; margin-bottom: 2rem; }

.hero-stats {
  display: grid; gap: 1.4rem 2rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2.6rem; padding-top: 1.6rem;
  border-top: 1px solid var(--navy-line);
}
.hero-stats div { display: grid; gap: .15rem; align-content: start; }
@media (max-width: 620px) { .hero-stats { grid-template-columns: 1fr; } }
.hero-stats dt, .hero-stats strong {
  font-family: "Outfit", sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--on-dark);
}
.hero-stats span { font-size: .86rem; color: var(--on-dark-muted); }

.hero-canvas-wrap {
  position: relative; aspect-ratio: 1 / 1;
  max-width: 520px; width: 100%; margin-inline: auto;
}
.hero-canvas-wrap canvas { width: 100%; height: 100%; border-radius: var(--radius-l); }
.hero-mark {
  position: absolute; inset: 0; margin: auto;
  width: 46%; height: auto; pointer-events: none;
  filter: drop-shadow(0 18px 40px rgba(6, 17, 40, .55));
}
@media (max-width: 940px) { .hero-canvas-wrap { max-width: 380px; } }

/* ---------------------------------------------------------------- tiles -- */
/* Content blocks echo the staggered app tiles in the mark: deliberately
   unequal sizes rather than a uniform card grid. */
.tile-set { display: grid; gap: 1.25rem; grid-template-columns: repeat(6, 1fr); }
@media (max-width: 860px) { .tile-set { grid-template-columns: repeat(2, 1fr); } }

.tile {
  grid-column: span 2;
  background: var(--navy-soft);
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-m);
  padding: 1.6rem 1.5rem;
  display: grid; gap: .6rem; align-content: start;
}
.tile-wide { grid-column: span 3; }
.tile-full { grid-column: span 6; }
@media (max-width: 860px) {
  .tile, .tile-wide { grid-column: span 2; }
  .tile-full { grid-column: span 2; }
}
.tile h3 { font-size: var(--step-1); }
.tile p { color: var(--on-dark-muted); font-size: .96rem; margin: 0; }
.band-paper .tile { background: #fff; border-color: var(--paper-line); }
.band-paper .tile p { color: var(--on-light-muted); }

.tile-chip {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: .35rem;
}
.tile-chip svg { width: 20px; height: 20px; stroke: #fff; fill: none; stroke-width: 1.7; }
.c-cyan   { background: linear-gradient(150deg, var(--cyan), var(--blue)); }
.c-blue   { background: linear-gradient(150deg, var(--blue), var(--indigo)); }
.c-violet { background: linear-gradient(150deg, var(--violet), var(--magenta)); }
.c-amber  { background: linear-gradient(150deg, var(--amber), #E8663C); }
.c-green  { background: linear-gradient(150deg, var(--green), #24A36B); }
.c-indigo { background: linear-gradient(150deg, var(--indigo), var(--violet)); }

/* -------------------------------------------------------------- projects -- */
.project {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding: clamp(2rem, 4vw, 3rem) 0;
}
.project + .project { border-top: 1px solid var(--navy-line); }
.band-paper .project + .project { border-top-color: var(--paper-line); }
@media (max-width: 860px) { .project { grid-template-columns: 1fr; } }

.project h3 { font-size: var(--step-2); margin-bottom: .6rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.2rem 0; }

.pill {
  font-size: .78rem; font-weight: 500; letter-spacing: .01em;
  padding: .32rem .7rem; border-radius: 999px;
  border: 1px solid var(--navy-line); color: var(--on-dark-muted);
  background: color-mix(in srgb, var(--navy-soft) 60%, transparent);
}
.band-paper .pill { border-color: var(--paper-line); color: var(--on-light-muted); background: #fff; }
.pill-live { border-color: color-mix(in srgb, var(--green) 55%, transparent); color: var(--green); }
.pill-build { border-color: color-mix(in srgb, var(--amber) 55%, transparent); color: var(--amber); }

/* Stylised product frame — a phone silhouette lifted from the mark */
.frame {
  position: relative; border-radius: var(--radius-l);
  background: linear-gradient(160deg, var(--navy-soft), var(--navy-deep));
  border: 1px solid var(--navy-line);
  padding: 1.4rem; overflow: hidden;
}
.band-paper .frame { background: linear-gradient(160deg, #fff, #EDF1FA); border-color: var(--paper-line); }
.frame::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--spectrum);
}
.frame-rows { display: grid; gap: .6rem; }
.frame-row {
  display: flex; align-items: center; gap: .7rem;
  background: color-mix(in srgb, var(--navy) 55%, transparent);
  border: 1px solid var(--navy-line);
  border-radius: 10px; padding: .7rem .85rem; font-size: .88rem;
}
.band-paper .frame-row { background: #fff; border-color: var(--paper-line); }
.frame-row i {
  width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--blue);
}
.frame-row span { margin-left: auto; color: var(--on-dark-muted); font-variant-numeric: tabular-nums; font-size: .82rem; }
.band-paper .frame-row span { color: var(--on-light-muted); }
.frame-bar { height: 6px; border-radius: 999px; background: var(--navy-line); overflow: hidden; flex: 1; max-width: 90px; }
.band-paper .frame-bar { background: var(--paper-line); }
.frame-bar i { display: block; height: 100%; width: 60%; border-radius: 999px; background: var(--spectrum); }

/* --------------------------------------------------------------- steps --- */
/* Numbered only because delivery genuinely is a sequence. */
.steps { counter-reset: step; display: grid; gap: 0; }
.step {
  counter-increment: step;
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr);
  gap: 1.2rem; padding: 1.6rem 0;
  border-top: 1px solid var(--navy-line);
}
.band-paper .step { border-top-color: var(--paper-line); }
.step:last-child { border-bottom: 1px solid var(--navy-line); }
.band-paper .step:last-child { border-bottom-color: var(--paper-line); }
.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: "Outfit", sans-serif; font-weight: 200; font-size: 1.8rem;
  color: var(--cyan); line-height: 1;
}
.band-paper .step::before { color: var(--indigo); }
.step h3 { font-size: var(--step-1); margin-bottom: .35rem; }
.step p { color: var(--on-dark-muted); margin: 0; max-width: 62ch; }
.band-paper .step p { color: var(--on-light-muted); }

/* ------------------------------------------------------------------ cta -- */
.cta {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem; align-items: center;
  background: linear-gradient(140deg, var(--navy-soft), var(--navy-deep));
  border: 1px solid var(--navy-line);
  border-radius: var(--radius-l);
  padding: clamp(1.8rem, 4vw, 3rem);
}
@media (max-width: 780px) { .cta { grid-template-columns: 1fr; } }
.cta h2 { font-size: var(--step-2); margin-bottom: .6rem; }
.cta p { color: var(--on-dark-muted); margin: 0; max-width: 50ch; }

/* ----------------------------------------------------------------- form -- */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; }
.field label { font-size: .9rem; font-weight: 500; color: var(--on-dark); }
.band-paper .field label { color: var(--on-light); }
.field input, .field select, .field textarea {
  font: inherit; font-size: .98rem;
  background: var(--navy-deep); color: var(--on-dark);
  border: 1px solid var(--navy-line); border-radius: var(--radius-s);
  padding: .8rem .9rem; width: 100%;
}
.band-paper .field input, .band-paper .field select, .band-paper .field textarea {
  background: #fff; color: var(--on-light); border-color: var(--paper-line);
}
.field textarea { min-height: 150px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--cyan); }
.field-hint { font-size: .82rem; color: var(--on-dark-muted); }
.band-paper .field-hint { color: var(--on-light-muted); }
.form-row { display: grid; gap: 1.1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.check { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; font-size: .9rem; }
.check input { width: 18px; height: 18px; margin-top: .2rem; accent-color: var(--blue); }
.form-note { font-size: .86rem; color: var(--on-dark-muted); }
.band-paper .form-note { color: var(--on-light-muted); }

/* ----------------------------------------------------------------- docs -- */
.doc-head { background: var(--navy-deep); padding: clamp(2.5rem, 5vw, 4rem) 0 clamp(2rem, 4vw, 3rem); }
.doc-head h1 { font-size: var(--step-3); margin-bottom: .8rem; }
.doc-head p { color: var(--on-dark-muted); max-width: 58ch; margin: 0; }
.doc-updated { font-size: .86rem; color: var(--on-dark-muted); margin-top: 1.2rem; }

.doc-layout {
  display: grid; grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}
@media (max-width: 900px) { .doc-layout { grid-template-columns: 1fr; } }

.doc-nav { align-self: start; position: sticky; top: 100px; font-size: .92rem; }
@media (max-width: 900px) { .doc-nav { position: static; } }
.doc-nav h2 { font-size: .95rem; font-weight: 600; margin-bottom: .8rem; }
.doc-nav ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; counter-reset: toc; }
.doc-nav a {
  display: block; text-decoration: none; color: var(--on-light-muted);
  padding: .35rem .6rem; border-left: 2px solid var(--paper-line); line-height: 1.4;
}
.doc-nav a:hover { color: var(--on-light); border-left-color: var(--blue); background: #fff; }

.prose { max-width: 72ch; }
.prose h2 {
  font-size: var(--step-2); margin: 2.6rem 0 .9rem;
  scroll-margin-top: 100px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: var(--step-1); margin: 1.8rem 0 .6rem; font-weight: 600; }
.prose p, .prose li { color: var(--on-light-muted); }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.1em; display: grid; gap: .45rem; }
.prose li::marker { color: var(--blue); }
.prose strong { color: var(--on-light); font-weight: 600; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; font-size: .94rem; }
.prose th, .prose td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--paper-line); vertical-align: top; }
.prose th { font-weight: 600; color: var(--on-light); background: #fff; }
.prose td { color: var(--on-light-muted); }
.callout {
  background: #fff; border: 1px solid var(--paper-line);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-s); padding: 1.1rem 1.3rem; margin: 1.5rem 0;
  font-size: .95rem;
}
.callout p { margin-bottom: .6rem; }
.callout p:last-child { margin-bottom: 0; }

.legal-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; }
.legal-card {
  background: #fff; border: 1px solid var(--paper-line); border-radius: var(--radius-m);
  padding: 1.3rem 1.4rem; text-decoration: none; color: var(--on-light);
  display: grid; gap: .4rem; align-content: start;
  transition: border-color .15s ease;
}
.legal-card:hover { border-color: var(--blue); }
.legal-card strong { font-family: "Outfit", sans-serif; font-size: 1.08rem; font-weight: 600; }
.legal-card span { font-size: .9rem; color: var(--on-light-muted); line-height: 1.5; }

/* --------------------------------------------------------------- footer -- */
.footer { background: var(--navy-deep); padding: clamp(3rem, 5vw, 4.5rem) 0 2rem; }
.footer-grid {
  display: grid; gap: 2.5rem;
  grid-template-columns: 1.6fr repeat(3, 1fr);
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

.footer h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1.1rem; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.footer a { color: var(--on-dark-muted); text-decoration: none; font-size: .95rem; }
.footer a:hover { color: var(--on-dark); }
.footer-about p { color: var(--on-dark-muted); font-size: .95rem; max-width: 34ch; }
.footer-brand { display: inline-flex; align-items: center; gap: .7rem; margin-bottom: 1rem; text-decoration: none; }
.footer-brand img { width: 38px; }
.footer-brand span { font-family: "Outfit", sans-serif; font-size: 1.2rem; }

.footer-base {
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center;
  margin-top: 3rem; padding-top: 1.5rem;
  border-top: 1px solid var(--navy-line);
  font-size: .86rem; color: var(--on-dark-muted);
}
.footer-base p { margin: 0; }
.footer-tagline {
  font-family: "Outfit", sans-serif; font-weight: 300;
  letter-spacing: .34em; font-size: .72rem; color: var(--on-dark-muted);
  margin-left: auto;
}
@media (max-width: 700px) { .footer-tagline { margin-left: 0; } }

/* -------------------------------------------------------------- utility -- */
.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;
}
.stack-lg { display: grid; gap: clamp(2rem, 4vw, 3rem); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
@media (max-width: 880px) { .contact-grid { grid-template-columns: 1fr; } }

.kv { display: grid; gap: 1.4rem; }
.kv div { display: grid; gap: .25rem; }
.kv dt { font-size: .85rem; color: var(--on-dark-muted); }
.kv dd { margin: 0; font-family: "Outfit", sans-serif; font-size: 1.05rem; }
.band-paper .kv dt { color: var(--on-light-muted); }
