/* ============================================================
   OpenRobo — single-page community site
   Canada Red accent · light + dark · modern robotic feel
   No frameworks, no build step.
   ============================================================ */

:root {
  /* Brand */
  --red: #d52b1e; /* Canada Red */
  --red-bright: #ff2e3f;
  --red-soft: rgba(213, 43, 30, 0.12);

  /* Typography */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Layout */
  --maxw: 1180px;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Light theme (default) ---------- */
:root,
[data-theme="light"] {
  --bg: #f7f8fa;
  --bg-elev: #ffffff;
  --bg-grid: rgba(15, 23, 42, 0.045);
  --surface: rgba(255, 255, 255, 0.7);
  --field-bg: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0d1220;
  --text-muted: #4b5566;
  --text-faint: #7b8494;
  --ok: #167a4d;
  --shadow: 0 20px 45px -25px rgba(15, 23, 42, 0.35);
  --hero-glow: radial-gradient(
    60% 55% at 70% 15%,
    rgba(213, 43, 30, 0.16),
    transparent 70%
  );
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: #0b0e14;
  --bg-elev: #10151f;
  --bg-grid: rgba(255, 255, 255, 0.04);
  --surface: rgba(255, 255, 255, 0.04);
  --field-bg: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text: #eef1f6;
  --text-muted: #a5afc0;
  --text-faint: #6b7688;
  --ok: #4ecf92;
  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
  --hero-glow: radial-gradient(
    60% 55% at 70% 15%,
    rgba(255, 46, 63, 0.22),
    transparent 70%
  );
}

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

html {
  scroll-behavior: smooth;
  /* keep #share from landing under the sticky nav */
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
  background-image: linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 46px 46px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
  top: 12px;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 88px 0;
}

.section.pt0 {
  padding-top: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 18px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--red);
}

.eyebrow.center {
  justify-content: center;
}

.section-title {
  font-size: clamp(1.8rem, 3.4vw, 2.7rem);
  max-width: 22ch;
}

.section-lead {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 60ch;
}

.text-center {
  text-align: center;
}

.text-center .section-title,
.text-center .section-lead {
  margin-left: auto;
  margin-right: auto;
}

.mt-44 {
  margin-top: 44px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease),
    border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    opacity 0.2s var(--ease);
}

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

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 30px -12px rgba(213, 43, 30, 0.7);
}

.btn-primary:hover {
  background: var(--red-bright);
  transform: translateY(-2px);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn[disabled]:hover {
  background: var(--red);
  transform: none;
}

.btn .arrow {
  flex: none;
  transition: transform 0.2s var(--ease);
}

.btn:hover:not([disabled]) .arrow {
  transform: translateX(3px);
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.brand b {
  color: var(--red);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-cta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.theme-toggle:hover {
  border-color: var(--red);
  color: var(--red);
  transform: rotate(-12deg);
}

/* only show the correct theme icon */
[data-theme="dark"] .icon-moon {
  display: none;
}
[data-theme="light"] .icon-sun {
  display: none;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 84px 0 72px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--hero-glow);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.1rem);
  margin-bottom: 20px;
}

.hero h1 .accent {
  color: var(--red);
}

.hero-lead {
  font-size: 1.18rem;
  color: var(--text-muted);
  max-width: 52ch;
  margin-bottom: 30px;
}

.hero-cta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-note {
  margin: 22px 0 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-faint);
}

/* Hero visual */
.hero-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--bg-elev) 92%, var(--red) 8%),
    var(--bg-elev)
  );
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-visual .scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent,
    color-mix(in srgb, var(--red) 22%, transparent),
    transparent
  );
  height: 40%;
  animation: scan 4.5s var(--ease) infinite;
  opacity: 0.6;
}

@keyframes scan {
  0% {
    transform: translateY(-60%);
  }
  100% {
    transform: translateY(180%);
  }
}

.hero-visual svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.node {
  animation: pulse 2.8s ease-in-out infinite;
}
.node:nth-of-type(2) {
  animation-delay: 0.4s;
}
.node:nth-of-type(3) {
  animation-delay: 0.8s;
}
.node:nth-of-type(4) {
  animation-delay: 1.2s;
}
.node:nth-of-type(5) {
  animation-delay: 1.6s;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- Who's here strip ---------- */
.audience {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.audience-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 26px;
  padding: 26px 0;
}

.audience-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.audience-item {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.audience-item .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}

/* ---------- Cards / grids ---------- */
.grid {
  display: grid;
  gap: 22px;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.card {
  position: relative;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

.card.sm {
  padding: 22px;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--red-soft);
  color: var(--red);
  margin-bottom: 18px;
}

.card h3 {
  font-size: 1.22rem;
  margin-bottom: 8px;
}

.card p {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin: 0;
}

.card-stack {
  display: grid;
  gap: 16px;
}

/* ---------- Split feature ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 22px 0 0;
  display: grid;
  gap: 14px;
}

.feature-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: var(--text-muted);
}

.feature-list .check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--red-soft);
  color: var(--red);
  margin-top: 3px;
}

.split-media {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* ---------- The form ---------- */
.form-band {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  padding: 56px;
  border: 1px solid var(--border);
  background: linear-gradient(
    140deg,
    color-mix(in srgb, var(--bg-elev) 85%, var(--red) 15%),
    var(--bg-elev)
  );
}

.form-band::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    50% 80% at 50% 0%,
    rgba(213, 43, 30, 0.18),
    transparent 70%
  );
  pointer-events: none;
}

.form-head {
  position: relative;
  text-align: center;
  margin-bottom: 40px;
}

.form-head .section-title,
.form-head .section-lead {
  margin-left: auto;
  margin-right: auto;
}

.form {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  gap: 26px;
}

.field {
  display: grid;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.field > label,
.captcha-label {
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--text);
  padding: 0;
}

.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text);
  background: var(--field-bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  resize: vertical;
  min-height: 168px;
  line-height: 1.6;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.field [aria-invalid="true"] {
  border-color: var(--red);
}

.hint {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-faint);
}

.counter {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  white-space: nowrap;
}

/* honeypot — off-screen but not display:none, so bots still fill it */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.captcha {
  min-height: 65px;
}

.captcha-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.form-legal {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-faint);
  max-width: 32ch;
}

/* Stays in the DOM even while empty, so the aria-live region is already in the
   accessibility tree when a message lands in it. Empty, it collapses to nothing. */
.form-status {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.6;
}

.form-status.err {
  color: var(--red);
}

.form-status.ok {
  color: var(--ok);
}

/* thank-you state, swapped in after a successful send */
.form-done {
  position: relative;
  max-width: 620px;
  margin: 0 auto;
  text-align: center;
  padding: 12px 0 8px;
}

.form-done:focus {
  outline: none;
}

.form-done .done-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
}

.form-done h3 {
  font-size: 1.5rem;
}

.form-done p {
  color: var(--text-muted);
  margin: 0;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 48px 0 30px;
}

.footer-inner {
  display: grid;
  justify-items: center;
  text-align: center;
}

.footer-brand {
  font-size: 1.1rem;
}

.footer-lead {
  color: var(--text-muted);
  font-size: 0.96rem;
  max-width: 46ch;
  margin: 14px 0 0;
}

.footer-bottom {
  width: 100%;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-faint);
  font-size: 0.88rem;
}

.footer-flag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-visual {
    max-width: 420px;
  }
  .split {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .form-band {
    padding: 40px 28px;
  }
  /* the CTA lives in the hero and in the form — one copy in the nav is plenty */
  .nav-cta {
    display: none;
  }
}

@media (max-width: 640px) {
  .section {
    padding: 60px 0;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .form-band {
    padding: 32px 20px;
    border-radius: 18px;
  }
  .hero-cta {
    flex-direction: column;
  }
  .hero-cta .btn {
    width: 100%;
  }
  .btn {
    white-space: normal;
  }
  .audience-inner {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
