/* racler.dev landing page. Plain CSS, system fonts, no third-party resources. Brand accent: #3B6B81. */

:root {
  --brand: #3b6b81;
  --brand-hover: #315a6d;
  --brand-soft: #68a8c5; /* lighter tint of the brand for text/links on dark: AA contrast on --background */
  --background: #0b1217;
  --surface: #101a21;
  --surface-raised: #131e26;
  --border: #1e2a31;
  --border-strong: #2a3a43;
  --text: #f3f6f7;
  --muted: #9aa7ae;
  --glow: rgba(59, 107, 129, 0.35);
  --radius: 14px;
  --radius-lg: 20px;
  --container: 1180px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --header-h: 64px;
  /* sections carry their own top padding, so the section edge may sit partly under the header: the heading then lands
     roughly 60-70px below the sticky bar. Used once, via scroll-margin-top (no stacking with scroll-padding). */
  --anchor-offset: calc(var(--header-h) - 24px);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1,
h2,
h3,
p,
ul,
ol,
figure,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

code,
.mono {
  font-family: var(--font-mono);
}

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

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 24px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 12px;
}

/* ---- Icons: local SVG files used as masks, so currentColor drives the colour ------------------------------- */
.icon {
  display: inline-block;
  flex: none;
  width: 1.25em;
  height: 1.25em;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
/* In index.html the icons are inline <svg> (same markup as assets/icons/*.svg): they paint wherever the page does,
   including file:// previews, where a CSS mask image is blocked as a cross-origin fetch. The mask rules below remain
   for icons that script creates (download, external link) and for the list bullets. */
svg.icon {
  background: none;
  -webkit-mask: none;
  mask: none;
  overflow: visible;
}
.icon-download {
  --icon: url("assets/icons/download.svg");
}
.icon-browser {
  --icon: url("assets/icons/browser.svg");
}
.icon-workspace {
  --icon: url("assets/icons/workspace.svg");
}
.icon-terminal {
  --icon: url("assets/icons/terminal.svg");
}
.icon-agent {
  --icon: url("assets/icons/agent.svg");
}
.icon-machine {
  --icon: url("assets/icons/machine.svg");
}
.icon-update {
  --icon: url("assets/icons/update.svg");
}
.icon-shield {
  --icon: url("assets/icons/shield.svg");
}
.icon-external-link {
  --icon: url("assets/icons/external-link.svg");
}
.icon-chevron-down {
  --icon: url("assets/icons/chevron-down.svg");
}

/* ---- Buttons & links --------------------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 22px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}
.btn-primary:hover {
  background: var(--brand-hover);
  box-shadow: 0 8px 28px -8px var(--glow);
}
.btn-lg {
  min-height: 54px;
  padding-inline: 28px;
  font-size: 1.0625rem;
}
.btn-sm {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 0.9375rem;
}
.btn.is-loading {
  background: rgba(59, 107, 129, 0.16);
  border-color: rgba(59, 107, 129, 0.45);
  color: var(--brand-soft);
  cursor: progress;
  box-shadow: none;
}
.btn.is-loading::before {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn.is-disabled {
  background: var(--surface-raised);
  border-color: var(--border-strong);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

.link-quiet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--brand-soft);
  font-weight: 500;
  text-decoration: none;
}
.link-quiet:hover {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---- Header ------------------------------------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 18, 23, 0.92);
  border-bottom: 1px solid var(--border);
}
@supports (backdrop-filter: blur(8px)) {
  .site-header {
    background: rgba(11, 18, 23, 0.78);
    backdrop-filter: blur(10px);
  }
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.brand-dev {
  color: var(--brand-soft);
}
.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover {
  color: var(--text);
  background: var(--surface);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 18px;
  height: 2px;
  margin: auto;
  background: currentColor;
  border-radius: 2px;
  content: "";
  transition: transform 0.2s;
}
.nav-toggle-bars {
  position: relative;
}
.nav-toggle-bars::before {
  position: absolute;
  top: -6px;
  left: 0;
}
.nav-toggle-bars::after {
  position: absolute;
  top: 6px;
  left: 0;
}
.nav-open .nav-toggle-bars {
  background: transparent;
}
.nav-open .nav-toggle-bars::before {
  transform: translateY(6px) rotate(45deg);
}
.nav-open .nav-toggle-bars::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---- Hero -------------------------------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 80px 0 56px;
  background:
    radial-gradient(ellipse 70% 55% at 80% 0%, rgba(59, 107, 129, 0.28), transparent 70%), var(--background);
  overflow: hidden;
}
.hero::before {
  /* the supplied brand background, only very subtly */
  position: absolute;
  inset: 0;
  background: url("assets/illustrations/brand-background.svg") center top / cover no-repeat;
  opacity: 0.22;
  content: "";
  pointer-events: none;
}
.hero > .container {
  position: relative;
}
.hero-copy {
  max-width: 900px;
  margin-inline: auto;
  text-align: center;
}
.eyebrow {
  margin-bottom: 14px;
  color: var(--brand-soft);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  font-size: clamp(2.25rem, 5.4vw, 4rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.03em;
}
.accent {
  color: var(--brand-soft);
}
.lead {
  max-width: 640px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
}

/* CTA (rendered by app.js; the static fallback is the same block with only "Open racler.dev") */
.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 168px; /* reserved so the metadata/device resolution never shifts the layout */
  margin-top: 34px;
}
.cta-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
}
.cta-title {
  font-size: 1.25rem;
  font-weight: 650;
}
.cta-meta {
  color: var(--muted);
  font-size: 0.9375rem;
}
.cta-trust {
  color: var(--muted);
  font-size: 0.875rem;
}
.cta-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
}
.cta-help {
  max-width: 460px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.cta-help strong {
  color: var(--text);
  font-weight: 600;
}
.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 560px;
}
.choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 88px;
  padding: 14px 18px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  text-align: left;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background-color 0.15s;
}
a.choice:hover {
  border-color: var(--brand);
  background: #16252e;
}
.choice.is-loading {
  color: var(--muted);
  cursor: progress;
}
.choice.is-disabled {
  color: var(--muted);
  cursor: not-allowed;
}
.choice-title {
  font-weight: 650;
}
.choice-hint,
.choice-meta {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---- Product frames: natural aspect ratio, restrained border/shadow, never stretched ------------------------- */
.product-frame {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 30px 80px -30px rgba(0, 0, 0, 0.8),
    0 0 90px -30px var(--glow);
}
.product-frame img {
  width: 100%;
  height: auto;
}
.hero-frame {
  max-width: 1160px;
  margin: 52px auto 0;
}

/* ---- Sections ---------------------------------------------------------------------------------------------- */
.section {
  padding: 92px 0;
}
.section-alt {
  background: linear-gradient(180deg, var(--surface), var(--background));
  border-block: 1px solid var(--border);
}
.section[id],
.hero[id] {
  scroll-margin-top: var(--anchor-offset);
}
.section-head {
  max-width: 720px;
  margin-bottom: 44px;
}
h2 {
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h3 {
  font-size: 1.125rem;
  font-weight: 650;
  line-height: 1.3;
}
.section-lead {
  margin-top: 16px;
  color: var(--muted);
  font-size: 1.125rem;
}

/* How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.step {
  position: relative;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  color: var(--brand-soft);
}
.step h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: rgba(59, 107, 129, 0.25);
  border: 1px solid var(--brand);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.step p,
.feature p,
.trust-grid p {
  color: var(--muted);
}

/* Split layouts (copy + screenshot) */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 64px;
}
.agent-split {
  margin-top: 80px;
  /* the Desktop Agent window is portrait: clearly smaller than the IDE screenshot, but not lost in whitespace */
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
}
.agent-split .split-copy {
  order: 0;
}
.split-copy h2,
.split-copy h3 {
  margin-bottom: 16px;
}
.split-copy h3 {
  font-size: clamp(1.375rem, 2.4vw, 1.75rem);
  letter-spacing: -0.01em;
}
.split-copy > p {
  color: var(--muted);
}
.check-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.check-list li {
  position: relative;
  padding-left: 30px;
}
.check-list li::before {
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 16px;
  height: 16px;
  background-color: var(--brand-soft);
  -webkit-mask: url("assets/icons/shield.svg") center / contain no-repeat;
  mask: url("assets/icons/shield.svg") center / contain no-repeat;
  content: "";
}
.machines-split {
  gap: 48px;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.5fr);
}

/* Features */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.feature,
.trust-grid li {
  padding: 24px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.feature:hover,
.trust-grid li:hover {
  border-color: var(--border-strong);
}
.feature .icon,
.trust-grid .icon {
  width: 26px;
  height: 26px;
  margin-bottom: 14px;
  color: var(--brand-soft);
}
.feature h3,
.trust-grid h3 {
  margin-bottom: 6px;
}

/* Security */
.arch-figure {
  max-width: 960px;
  margin: 0 auto 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.arch-svg {
  width: 100%;
  height: auto;
}
.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.trust-grid li {
  padding: 20px 22px;
}

/* Download: a constrained, centred block (heading, cards and helper share one axis) */
#download .section-head {
  margin-inline: auto;
  text-align: center;
}
#download .download-note {
  text-align: center;
}
.download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  max-width: 880px;
  margin-inline: auto;
}
.download-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
}
.download-sub {
  margin-top: -12px;
  color: var(--muted);
  font-size: 0.9375rem;
}
.download-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.download-facts dt {
  color: var(--muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.download-facts dd {
  min-height: 1.6em; /* no layout shift when the metadata arrives */
  font-family: var(--font-mono);
  font-size: 1rem;
}
.download-action {
  display: flex;
  min-height: 54px;
  margin-top: auto;
}
.download-action .btn {
  width: 100%;
}
.download-note {
  margin-top: 16px;
  color: var(--muted);
}
.disclosure {
  max-width: 880px;
  margin: 24px auto 0;
}
.disclosure-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--brand-soft);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.disclosure-btn:hover {
  color: var(--text);
}
.disclosure-btn .icon {
  transition: transform 0.2s;
}
.disclosure-btn[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}
.disclosure-panel {
  margin-top: 8px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
}
.disclosure-panel p + p {
  margin-top: 8px;
}
.disclosure-panel p:first-child {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.footer-brand {
  color: var(--muted);
  font-weight: 600;
}

/* ---- Responsive -------------------------------------------------------------------------------------------- */
@media (min-width: 1240px) {
  /* let the IDE screenshot breathe slightly beyond the text column */
  .hero-frame {
    width: calc(100% + 56px);
    max-width: none;
    margin-inline: -28px;
  }
}

@media (min-width: 1500px) {
  :root {
    --container: 1320px;
  }
  body {
    font-size: 1.125rem;
  }
  .hero-frame {
    width: 1328px;
    max-width: none;
    margin-inline: auto;
  }
}

@media (max-width: 1100px) {
  .machines-split {
    gap: 36px;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.3fr);
  }
}

@media (max-width: 960px) {
  .section {
    padding: 68px 0;
  }
  .hero {
    padding: 56px 0 48px;
  }
  .machines-split {
    gap: 32px;
  }
  .steps {
    grid-template-columns: 1fr;
  }
  .split,
  .machines-split,
  .agent-split {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .agent-split {
    margin-top: 56px;
  }
  .agent-frame {
    max-width: 400px;
  }
  .hero-frame {
    margin-top: 48px;
  }

  /* navigation collapses into a toggled panel (the toggle only appears once JavaScript is running) */
  .js .nav-toggle {
    display: inline-grid;
  }
  .js .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 8px 24px 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
  }
  .js.nav-open .site-nav {
    display: flex;
  }
  .js .site-nav a {
    min-height: 48px;
    padding: 0 4px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
  .header-actions {
    margin-left: auto;
  }
  .site-nav {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 1rem;
  }
  .container {
    padding-inline: 18px;
  }
  .header-inner {
    gap: 12px;
  }
  .brand-word {
    font-size: 1.0625rem;
  }
  /* the header action is duplicated by the hero CTA on phones: keep the bar uncluttered */
  .header-actions .btn {
    padding-inline: 12px;
    font-size: 0.875rem;
  }
  .hero {
    padding: 40px 0 48px;
  }
  /* keep the IDE readable: let the screenshot scroll sideways inside its own frame instead of shrinking to an
     illegible thumbnail (cropped, never stretched) */
  .hero-frame {
    margin-top: 36px;
    border-radius: 12px;
  }
  .hero-frame img {
    width: 170%;
    max-width: none;
    margin-left: -6%;
  }
  .hero::before {
    opacity: 0.12;
  }
  .cta {
    min-height: 0;
  }
  .cta-main {
    flex-direction: column;
    width: 100%;
  }
  .cta-main .btn,
  .choices {
    width: 100%;
  }
  .choices {
    grid-template-columns: 1fr;
  }
  .section {
    padding: 56px 0;
  }
  .section-head {
    margin-bottom: 32px;
  }
  #download .section-head {
    text-align: left;
    margin-inline: 0;
  }
  .agent-frame {
    max-width: 320px;
    margin-inline: auto;
  }
  .trust-grid li {
    padding: 18px 20px;
  }
  .download-grid {
    grid-template-columns: 1fr;
  }
  .machines-frame img {
    width: 150%;
    max-width: none;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

@media (forced-colors: active) {
  .btn-primary,
  .btn.is-disabled {
    border-color: ButtonText;
  }
}
