/* Visual effects layer: depth, glow and micro-interactions on top of
   site.css. Pure CSS where possible; effects.js only feeds pointer and scroll
   state. Every animation sits behind prefers-reduced-motion. */
:root {
  --card: light-dark(#fff, #181B25);
  --surface: light-dark(rgba(247, 247, 251, 0.72), rgba(15, 17, 23, 0.7));
  --accent-2: light-dark(#7C3AED, #C084FC);
  --accent-3: light-dark(#0284C7, #38BDF8);
  --glow: color-mix(in oklab, var(--accent) 55%, transparent);
  interpolate-size: allow-keywords;
}
html, body { overflow-x: clip; }
html { scroll-padding-top: 84px; }
body { -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; }
h1, h2, h3 { text-wrap: balance; }
section > .wrap > p, .lede { text-wrap: pretty; }
section h2 { letter-spacing: -0.035em; }

/* Glass header: sticky, frosts once the page scrolls. */
header.top { position: sticky; top: 0; z-index: 50; }
header.top::before {
  content: ''; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1;
  background: var(--surface); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--kraft); opacity: 0; transition: opacity 0.3s ease;
}
.scrolled header.top::before { opacity: 1; }

/* Hero backdrop: masked dot grid plus a soft aurora behind the demo. */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ''; position: absolute; z-index: -2; top: -140px; bottom: -60px; left: 50%; width: 100vw; transform: translateX(-50%);
  background-image: radial-gradient(circle at 1px 1px, light-dark(rgba(21, 24, 38, 0.13), rgba(241, 242, 247, 0.08)) 1px, transparent 0);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 65% 70% at 50% 40%, #000 25%, transparent 72%);
  pointer-events: none;
}
.hero::after {
  content: ''; position: absolute; z-index: -1; top: -60px; right: -12%; width: min(820px, 90vw); aspect-ratio: 1.2;
  background:
    radial-gradient(closest-side at 40% 40%, color-mix(in oklab, var(--accent) 34%, transparent), transparent),
    radial-gradient(closest-side at 70% 60%, color-mix(in oklab, var(--accent-3) 26%, transparent), transparent),
    radial-gradient(closest-side at 35% 75%, color-mix(in oklab, var(--accent-2) 24%, transparent), transparent);
  filter: blur(30px); pointer-events: none;
}
.eyebrow { background: var(--surface); backdrop-filter: blur(6px); }
.hero h1 { font-weight: 800; letter-spacing: -0.04em; }
.hero h1 em {
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 45%, var(--accent-3) 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Buttons: lit gradient, glow, shine sweep on hover. */
.cta {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 82%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 10px 28px -12px var(--glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.cta:hover { background: linear-gradient(180deg, var(--accent), var(--accent-d)); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 16px 36px -12px var(--glow); }
.cta::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform 0.7s ease;
}
.cta:hover::after { transform: translateX(120%); }
.cta.secondary { background: var(--surface); backdrop-filter: blur(6px); box-shadow: none; }
.cta.secondary:hover { background: color-mix(in oklab, var(--accent) 10%, var(--card)); }
.cta.secondary::after { display: none; }

/* Demo: glow underneath and terminal chrome. A light sweeps the popup border
   once whenever the licence state changes (demo.js adds .beam). */
@property --beam { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.popup { box-shadow: 0 40px 90px -40px var(--glow), 0 18px 50px -24px rgba(15, 17, 23, 0.4); }
.demo-log { position: relative; padding-top: 38px; border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 24px 60px -30px rgba(15, 17, 23, 0.6); }
.demo-log::before {
  content: ''; position: absolute; top: 14px; left: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: #FF5F57; box-shadow: 16px 0 0 #FEBC2E, 32px 0 0 #28C840;
}
pre { border: 1px solid rgba(255, 255, 255, 0.06); box-shadow: 0 24px 60px -34px rgba(15, 17, 23, 0.55); }

/* Stats: big numbers, hairline above. */
.stats { border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, var(--kraft), transparent) 1; margin-top: 24px; }
.stat b { font-size: 34px; font-weight: 800; letter-spacing: -0.04em; }

/* Cards: cursor spotlight on the border and surface. */
.card { position: relative; isolation: isolate; }
.card::before, .card::after { content: ''; position: absolute; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; }
.card::before {
  inset: -1px; padding: 1px;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 0%), var(--accent), transparent 45%);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.card::after {
  inset: 0; z-index: -1;
  background: radial-gradient(480px circle at var(--mx, 50%) var(--my, 0%), color-mix(in oklab, var(--accent) 9%, transparent), transparent 50%);
}
.card:hover::before, .card:hover::after { opacity: 1; }

/* Pricing: the featured plan gets a gradient border and glow. */
.plan.featured {
  border-color: transparent;
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(160deg, var(--accent), var(--accent-3) 45%, var(--kraft) 80%) border-box;
  box-shadow: 0 40px 80px -40px var(--glow);
}
.plan .price { font-weight: 800; letter-spacing: -0.04em; }
/* Launch price lands once as the card scrolls in: the old price is struck
   through, then the new one pops. motion.js adds .motion only when motion is
   welcome, and .in when the card is on screen. */
.motion .plan .price s { position: relative; text-decoration: none; }
.motion .plan .price s::after {
  content: ''; position: absolute; left: -3px; right: -3px; top: 54%; height: 2px; border-radius: 2px; background: currentColor;
  transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.4s ease 0.5s;
}
.motion .plan.in .price s::after { transform: scaleX(1); }
.motion .plan .price s + span { display: inline-block; opacity: 0; transform: translateY(8px) scale(0.9); transition: opacity 0.35s ease 0.9s, transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 0.9s; }
.motion .plan.in .price s + span { opacity: 1; transform: none; }

/* FAQ: plus/cross marker and a smooth open where ::details-content exists. */
.faq summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 22px; font-weight: 400; line-height: 1; color: var(--muted); transition: transform 0.3s ease, color 0.3s ease; }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq summary:hover { color: var(--accent); }

/* Theme switch: circular reveal from the toggle (theme.js sets the origin). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

@media (prefers-reduced-motion: no-preference) {
  .hero::after { animation: aurora 16s ease-in-out infinite alternate; }
  .popup.beam {
    border-color: transparent;
    background:
      linear-gradient(var(--card), var(--card)) padding-box,
      conic-gradient(from var(--beam), var(--kraft) 0 62%, var(--accent) 76%, var(--accent-3) 84%, var(--kraft) 94%) border-box;
    animation: beam 1.3s cubic-bezier(0.4, 0, 0.2, 1) 1;
  }
  .demo-tier.flip { animation: tier-flip 0.5s ease 1; }
  .faq details::details-content { block-size: 0; overflow: hidden; transition: block-size 0.35s ease, content-visibility 0.35s allow-discrete; }
  .faq details[open]::details-content { block-size: auto; }
  ::view-transition-new(root) { animation: theme-reveal 0.55s cubic-bezier(0.4, 0, 0.2, 1); }
}
@keyframes aurora { from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); } to { transform: translate3d(-6%, 4%, 0) rotate(12deg) scale(1.08); } }
@keyframes beam { from { --beam: -90deg; } to { --beam: 270deg; } }
@keyframes tier-flip { 40% { transform: scale(1.18); } }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0%)); }
  to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 100%) var(--vt-y, 0%)); }
}

/* Phones: keep the sticky header to one row so it doesn't eat the screen. */
@media (max-width: 560px) {
  header.top { flex-wrap: nowrap; padding: 12px 0; }
  .brand { font-size: 15px; gap: 8px; }
  .brand img { width: 28px; height: 28px; }
  nav { flex-wrap: nowrap; gap: 12px; }
  nav a { font-size: 13.5px; }
  html { scroll-padding-top: 64px; }
}

/* --- Round 2: section rhythm, the sale-to-key flow, one-shot reveals ------- */

/* Section kickers and tinted full-bleed bands behind alternating sections. */
.kicker {
  display: block; text-align: center; margin-bottom: 10px;
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent);
}
#inside, #compare { position: relative; isolation: isolate; }
#inside::before, #compare::before {
  content: ''; position: absolute; z-index: -1; inset: 0 calc(50% - 50vw);
  background:
    linear-gradient(90deg, transparent, var(--kraft), transparent) top / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, var(--kraft), transparent) bottom / 100% 1px no-repeat,
    radial-gradient(60% 80% at 50% 0%, color-mix(in oklab, var(--accent) 7%, transparent), transparent 70%),
    light-dark(#EFF0F7, #12141C);
  pointer-events: none;
}

/* Icon tiles on the why cards. */
.icon-tile {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, #4F46E5, #7C3AED 60%, #0284C7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 10px 22px -10px var(--glow);
}
.icon-tile svg { width: 20px; height: 20px; }

/* Sale-to-key flow: four steps joined by links that draw once. */
.flow {
  list-style: none; display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; align-items: center;
  gap: 0; margin: 0 auto 28px; max-width: 920px;
}
.flow-step {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
  background: var(--card); border: 1px solid var(--kraft); border-radius: 12px; padding: 12px 14px;
}
.flow-step svg { grid-row: span 2; width: 22px; height: 22px; color: var(--accent); }
.flow-step b { font-size: 13.5px; line-height: 1.2; }
.flow-step span { font-size: 12px; line-height: 1.3; color: var(--muted); }
.flow-step.end { border-color: transparent; background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, var(--accent), var(--accent-3)) border-box; }
.flow-link { position: relative; width: 28px; height: 2px; background: var(--kraft); }
.flow-link::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent), var(--accent-3)); transform-origin: 0 50%; }
.flow-link::after {
  content: ''; position: absolute; top: 50%; left: 0; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%;
  background: var(--accent-3); box-shadow: 0 0 10px var(--accent-3); opacity: 0;
}
@media (max-width: 760px) {
  .flow { grid-template-columns: 1fr; justify-items: stretch; }
  .flow-link { width: 2px; height: 14px; justify-self: center; }
  .flow-link::before { transform-origin: 50% 0; }
}

/* Tabs: one indicator that slides to the selected tab (tabs.js sets the vars). */
[role='tablist'].sliding { position: relative; }
[role='tablist'].sliding [role='tab'] { border-bottom-color: transparent; }
[role='tablist'].sliding::after {
  content: ''; position: absolute; bottom: -1px; left: 0; height: 2px; border-radius: 2px;
  width: var(--ind-w, 0); transform: translateX(var(--ind-x, 0));
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
}

/* Comparison: lift the PaidExtension column. */
th.us, td.us { position: relative; background: color-mix(in oklab, var(--accent) 9%, var(--card)); box-shadow: inset 1px 0 0 color-mix(in oklab, var(--accent) 35%, transparent), inset -1px 0 0 color-mix(in oklab, var(--accent) 35%, transparent); }
th.us { box-shadow: inset 1px 0 0 color-mix(in oklab, var(--accent) 35%, transparent), inset -1px 0 0 color-mix(in oklab, var(--accent) 35%, transparent), inset 0 3px 0 var(--accent); color: var(--accent); }
tbody tr { transition: background-color 0.2s ease; }
tbody tr:hover td:not(.us) { background: color-mix(in oklab, var(--accent) 4%, transparent); }

/* Marker card: tilts toward the cursor (effects.js sets --rx/--ry). */
.motion .card.try-card.tilt:hover { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-4px); transition: transform 0.1s linear, box-shadow 0.25s ease; }
.try-card img { box-shadow: 0 14px 30px -14px var(--glow); }

@media (prefers-reduced-motion: no-preference) {
  /* Headings settle in from a blur, once. effects.js adds .fx and .in. */
  .fx section > h2 { transition: opacity 0.7s ease, filter 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .fx section > h2:not(.in) { opacity: 0; filter: blur(8px); transform: translateY(10px); }
  .fx .flow-link::before { transform: scaleX(0); transition: transform 0.5s ease; }
  .fx .flow.in .flow-link::before { transform: scaleX(1); }
  .fx .flow.in .flow-link::after { animation: flow-dot 0.9s ease-in-out 1 both; }
  .fx .flow.in .flow-link:nth-of-type(2)::before, .fx .flow.in .flow-link:nth-of-type(2)::after { transition-delay: 0.45s; animation-delay: 0.45s; }
  .fx .flow.in .flow-link:nth-of-type(3)::before, .fx .flow.in .flow-link:nth-of-type(3)::after { transition-delay: 0.9s; animation-delay: 0.9s; }
  .fx .flow-step { transition: opacity 0.5s ease, transform 0.5s ease; }
  .fx .flow:not(.in) .flow-step { opacity: 0; transform: translateY(8px); }
  .fx .flow.in .flow-step:nth-of-type(2) { transition-delay: 0.3s; }
  .fx .flow.in .flow-step:nth-of-type(3) { transition-delay: 0.75s; }
  .fx .flow.in .flow-step:nth-of-type(4) { transition-delay: 1.2s; }
  [role='tablist'].sliding::after { transition: transform 0.35s cubic-bezier(0.3, 0.9, 0.3, 1), width 0.35s cubic-bezier(0.3, 0.9, 0.3, 1); }
  @media (max-width: 760px) {
    .fx .flow-link::before { transform: scaleY(0); }
    .fx .flow.in .flow-link::before { transform: scaleY(1); }
    .fx .flow.in .flow-link::after { animation-name: flow-dot-down; }
  }
}
@keyframes flow-dot { 0% { left: 0; opacity: 0; } 20%, 80% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
@keyframes flow-dot-down { 0% { left: 50%; top: 0; opacity: 0; } 20%, 80% { opacity: 1; } 100% { left: 50%; top: 100%; opacity: 0; } }
