/* grapesjs-autosave — landing page.
   Deliberately committed to a single dark treatment: it matches the editor
   chrome the demos drop you into, and the product's story (a crash, a rescue)
   reads better against dark. Every colour is painted explicitly. */

:root {
  /* palette */
  --bg: #0a0c10;
  --bg-2: #0e1116;
  --surface: #14181f;
  --surface-2: #1a1f28;
  --line: #232a35;
  --line-soft: #1b212b;

  --fg: #eef1f6;
  --fg-2: #a8b2c1;
  --fg-3: #6f7b8c;

  --accent: #5b9cff;
  --accent-dim: #2f6ad9;
  --safe: #5fdd9d;
  --danger: #ff6b5e;
  --warn: #f5b955;

  /* type */
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --t-eyebrow: 0.72rem;
  --t-body: clamp(1rem, 0.96rem + 0.2vw, 1.075rem);
  --t-lead: clamp(1.06rem, 0.98rem + 0.42vw, 1.3rem);
  --t-h2: clamp(1.7rem, 1.25rem + 1.9vw, 2.7rem);
  --t-h3: clamp(1.05rem, 0.99rem + 0.3vw, 1.18rem);
  --t-hero: clamp(2.4rem, 1.2rem + 5.1vw, 4.9rem);

  /* space */
  --gut: clamp(1.15rem, 0.7rem + 2vw, 2.5rem);
  --section: clamp(4.5rem, 3rem + 7vw, 9rem);
  --max: 1180px;

  --r: 14px;
  --r-lg: 20px;

  --dur: 220ms;
  --dur-slow: 520ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Atmosphere: one soft light source behind the hero, plus a fine grain so the
   flat dark never reads as a plain #000 block. Both are decorative and inert. */
body::before {
  content: '';
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(60% 60% at 50% 0%, rgba(91, 156, 255, 0.16), transparent 70%),
    radial-gradient(40% 50% at 78% 12%, rgba(95, 221, 157, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

main,
header,
footer {
  position: relative;
  z-index: 1;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gut);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

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

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 1rem;
}

.eyebrow--accent {
  color: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.08;
  letter-spacing: -0.032em;
  margin: 0;
  text-wrap: balance;
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 12, 16, 0.76);
  border-bottom: 1px solid var(--line-soft);
}

.nav__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 60px;
}

.brand {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand span {
  color: var(--accent);
}

/* The section links are a convenience on a single-scroll page, and their
   intrinsic width can't shrink — below this they'd force the whole document to
   scroll sideways, so they're dropped rather than wrapped. */
.nav__links {
  display: none;
  gap: 1.5rem;
  margin-left: auto;
  font-size: 0.9rem;
}

@media (min-width: 720px) {
  .nav__links {
    display: flex;
  }
}

.nav__cta {
  margin-left: auto;
}

@media (min-width: 720px) {
  .nav__cta {
    margin-left: 0;
  }
}

.nav__links a {
  color: var(--fg-2);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.nav__links a:hover {
  color: var(--fg);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--dur) var(--ease),
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

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

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--accent);
  color: #06101f;
  font-weight: 650;
}

.btn--primary:hover {
  background: #74adff;
}

.btn--ghost {
  border-color: var(--line);
  color: var(--fg);
  background: var(--surface);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: #33404f;
}

.btn--sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.86rem;
}

/* ---------- hero ---------- */
.hero {
  padding-top: clamp(3.5rem, 2rem + 6vw, 6.5rem);
  padding-bottom: var(--section);
}

.hero__grid {
  display: grid;
  gap: clamp(2.5rem, 1rem + 5vw, 4.5rem);
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 980px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  }
}

.hero h1 {
  font-size: var(--t-hero);
  font-weight: 700;
}

.hero h1 em {
  font-style: normal;
  color: var(--safe);
}

.hero__lead {
  font-size: var(--t-lead);
  color: var(--fg-2);
  margin: 1.35rem 0 0;
  max-width: 34ch;
  text-wrap: pretty;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__meta {
  margin: 2.2rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.35rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-3);
}

.hero__meta li::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 0.55rem;
  border-radius: 50%;
  background: var(--safe);
  vertical-align: middle;
}

/* ---------- crash/restore stage ---------- */
.stage {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 70px -30px rgba(0, 0, 0, 0.85);
}

.stage__bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.015);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2c3543;
}

.stage__label {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-3);
  transition: color var(--dur) var(--ease);
}

.stage__body {
  position: relative;
  min-height: 268px;
  padding: 1.4rem;
  display: grid;
  align-content: start;
  gap: 0.85rem;
}

/* mock document blocks */
.blk {
  border-radius: 7px;
  background: #222a36;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
}

.blk--title {
  height: 26px;
  width: 68%;
  background: #334054;
}

.blk--line {
  height: 11px;
}
.blk--w90 { width: 90%; }
.blk--w75 { width: 75%; }
.blk--w60 { width: 60%; }

.blk--card {
  height: 62px;
  width: 100%;
  background: linear-gradient(90deg, #232c3a, #1d2531);
  border: 1px solid #2b3543;
}

/* the "gone" state */
.stage[data-state='crashed'] .blk {
  opacity: 0;
  transform: translateY(6px) scale(0.985);
}

.stage[data-state='crashed'] .stage__label { color: var(--danger); }
.stage[data-state='saving'] .stage__label { color: var(--warn); }
.stage[data-state='saved'] .stage__label,
.stage[data-state='restored'] .stage__label { color: var(--safe); }

/* recovery banner mock — mirrors the real plugin's banner */
.stage__banner {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translate(-50%, -14px);
  width: min(330px, calc(100% - 2.4rem));
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.7rem 0.8rem;
  border-radius: 11px;
  background: #232a35;
  border: 1px solid #333d4c;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity var(--dur-slow) var(--ease),
    transform var(--dur-slow) var(--ease);
}

.stage[data-state='offered'] .stage__banner {
  opacity: 1;
  transform: translate(-50%, 0);
}

.stage__banner strong {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.12rem;
}

.stage__banner p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--fg-2);
}

.pill {
  flex-shrink: 0;
  align-self: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.34rem 0.65rem;
  border-radius: 7px;
  background: var(--accent);
  color: #06101f;
}

/* save indicator */
.tick {
  position: absolute;
  right: 1.1rem;
  bottom: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--safe);
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.stage[data-state='saved'] .tick,
.stage[data-state='restored'] .tick {
  opacity: 1;
  transform: translateY(0);
}

.stage__replay {
  display: block;
  margin: 0.9rem auto 0;
}

/* ---------- sections ---------- */
.section {
  padding-block: var(--section);
  border-top: 1px solid var(--line-soft);
}

/* Anchor jumps must clear the sticky nav, or the heading lands underneath it. */
section[id] {
  scroll-margin-top: 76px;
}

.section__head {
  max-width: 62ch;
  margin-bottom: clamp(2.2rem, 1.2rem + 3vw, 3.6rem);
}

.section__head h2 {
  font-size: var(--t-h2);
  font-weight: 680;
}

.section__head p {
  color: var(--fg-2);
  font-size: var(--t-lead);
  margin: 1rem 0 0;
  text-wrap: pretty;
}

/* problem: pulled-in editorial column */
.problem p {
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.6rem);
  line-height: 1.45;
  letter-spacing: -0.015em;
  max-width: 26ch;
  margin: 0;
  text-wrap: balance;
}

.problem__grid {
  display: grid;
  gap: clamp(1.6rem, 1rem + 3vw, 3.5rem);
  grid-template-columns: 1fr;
}

@media (min-width: 860px) {
  .problem__grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.problem__aside {
  color: var(--fg-2);
  display: grid;
  gap: 1.1rem;
  margin: 0;
}

.problem__aside p {
  font-size: var(--t-body);
  line-height: 1.65;
  letter-spacing: 0;
  max-width: 52ch;
}

.mark {
  color: var(--fg);
  font-weight: 550;
}

/* ---------- bento ---------- */
.bento {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 258px), 1fr));
}

.card {
  position: relative;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  transition:
    transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  border-color: #31404f;
  background: var(--surface-2);
}

.card h3 {
  font-size: var(--t-h3);
  font-weight: 620;
  margin-bottom: 0.55rem;
  letter-spacing: -0.018em;
}

.card p {
  margin: 0;
  color: var(--fg-2);
  font-size: 0.94rem;
  line-height: 1.6;
}

.card__num {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--accent);
  display: block;
  margin-bottom: 0.9rem;
  letter-spacing: 0.1em;
}

.card--wide {
  grid-column: 1 / -1;
}

@media (min-width: 860px) {
  .card--span2 {
    grid-column: span 2;
  }
}

.card code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: #0d1117;
  border: 1px solid var(--line-soft);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  color: #b9c6d8;
}

/* ---------- table ---------- */
.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.82rem 1.1rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

thead th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.018);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: rgba(255, 255, 255, 0.022);
}

td code,
th code {
  font-family: var(--mono);
  font-size: 0.86em;
  color: #cfe0ff;
}

td:first-child code {
  color: var(--accent);
}

.muted {
  color: var(--fg-3);
}

/* ---------- demo cards ---------- */
.demos {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .demos {
    grid-template-columns: 1fr 1fr;
  }
}

.demo {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 1rem + 1.6vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(180deg, rgba(91, 156, 255, 0.055), transparent 55%),
    var(--surface);
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.demo:hover {
  transform: translateY(-4px);
  border-color: var(--accent-dim);
}

.demo h3 {
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.5rem);
  font-weight: 650;
  margin-bottom: 0.5rem;
}

.demo p {
  color: var(--fg-2);
  margin: 0 0 1.5rem;
  font-size: 0.94rem;
  flex: 1;
}

.demo__go {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.demo__go::after {
  content: ' →';
  transition: transform var(--dur) var(--ease);
  display: inline-block;
}

.demo:hover .demo__go::after {
  transform: translateX(4px);
}

/* ---------- cta ---------- */
.cta {
  text-align: center;
  padding-block: var(--section);
  border-top: 1px solid var(--line-soft);
}

.cta h2 {
  font-size: var(--t-h2);
  font-weight: 690;
  max-width: 18ch;
  margin-inline: auto;
}

.cta p {
  color: var(--fg-2);
  font-size: var(--t-lead);
  max-width: 48ch;
  margin: 1.1rem auto 2rem;
}

/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line-soft);
  padding-block: 2.5rem;
  color: var(--fg-3);
  font-size: 0.86rem;
}

.foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: center;
}

.foot a {
  color: var(--fg-2);
  text-decoration: none;
}

.foot a:hover {
  color: var(--fg);
}

.foot .spacer {
  flex: 1;
}

/* ---------- reveal on scroll ----------
   Gated behind `.js` so the hidden start state only ever exists when the
   script that undoes it is running. Without the gate, a JS error or a blocked
   script would leave half the page permanently invisible. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 620ms var(--ease),
    transform 620ms var(--ease);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

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

/* ---------- 404 ---------- */
.center-page {
  min-height: 78vh;
  display: grid;
  place-items: center;
  text-align: center;
}

.center-page h1 {
  font-size: clamp(3rem, 2rem + 6vw, 6rem);
  font-weight: 700;
}
