/* Landing page: sign-in, plans, FAQ. Requires base.css. */

html { scroll-behavior: smooth; }

/* Backdrop: slow aurora light over a fading grid */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  will-change: transform;
  animation: drift 30s ease-in-out infinite alternate;
}

.aurora-1 {
  top: -38vmax;
  left: -18vmax;
  background: radial-gradient(closest-side, var(--aurora-1), transparent);
}

.aurora-2 {
  top: -34vmax;
  right: -22vmax;
  background: radial-gradient(closest-side, var(--aurora-2), transparent);
  animation-duration: 38s;
  animation-direction: alternate-reverse;
}

.aurora-3 {
  bottom: -48vmax;
  left: 15vmax;
  background: radial-gradient(closest-side, var(--aurora-3), transparent);
  animation-duration: 46s;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(7vmax, 5vmax, 0) scale(1.15); }
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 75% 60% at 50% 0%, #000 30%, transparent 100%);
}

/* The home page's dot field (js/dot-field.js): it replaces the grid there, and fades out the
   same way, strongest under the hero. */
.dot-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(ellipse 95% 85% at 50% 30%, #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 95% 85% at 50% 30%, #000 45%, transparent 100%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Top bar */

/* Stays at the top. Clear over the hero; once the page scrolls, login.js adds .is-scrolled and
   it gets a frosted background and a hairline. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s, border-color 0.25s, backdrop-filter 0.25s;
}
.topbar.is-scrolled {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.topbar-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand nav cta";
  align-items: center;
  column-gap: 28px;
  /* The logo lines up with the 1200 px content; the menu sits 60% closer to the right edge. */
  --side: max(0px, (100% - 1200px) / 2);
  padding: 14px calc(24px + var(--side) * 0.4) 14px calc(24px + var(--side));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

/* The brand gradient mark (theme="aurora") with a soft glow of the page's aurora behind it. */
.hero-mark {
  view-transition-name: kayts-mark; /* flies to the chat's greeting (base.css, "Page transitions") */
  width: 116px;
  height: 116px;
  margin-bottom: 26px;
  filter: drop-shadow(0 10px 32px var(--aurora-1)) drop-shadow(0 0 18px var(--aurora-2));
}

@media (max-width: 560px) {
  .hero-mark { width: 92px; height: 92px; margin-bottom: 20px; }
}

.brand-mark { display: block; width: 28px; height: 28px; flex: none; }

.brand-name {
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}


.brand { grid-area: brand; }

.topnav {
  grid-area: nav;
  display: flex;
  justify-content: flex-end;
  gap: 24px;
}

.topnav a {
  position: relative;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.topnav a:hover,
.topnav a[aria-current="true"] { color: var(--text); }

/* The section in view: a small dot under its link (set by login.js). */
.topnav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: translateX(-50%) scale(0.4);
  transition: opacity 0.2s, transform 0.2s;
}
.topnav a[aria-current="true"]::after { opacity: 1; transform: translateX(-50%) scale(1); }

.nav-cta {
  grid-area: cta;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, transform 0.15s;
}
.nav-cta:hover { background: var(--accent-hover); }
.nav-cta:active { transform: scale(0.97); }

/* Hero */

main { flex: 1; width: 100%; }

.hero {
  min-height: calc(100dvh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px 56px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}

.eyebrow-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.eyebrow-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  80%, 100% { transform: scale(1.8); opacity: 0; }
}

h1 {
  margin: 0 0 18px;
  font-weight: 600;
  font-size: clamp(2.4rem, 6.4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.rotator {
  display: grid;
  margin-top: 0.06em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.1em;
  letter-spacing: -0.015em;
}

.rotator-item {
  grid-area: 1 / 1;
  padding: 0 0.08em 0.12em;
  background: linear-gradient(100deg, var(--grad-a), var(--grad-b) 60%, var(--grad-c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translateY(0.3em);
  filter: blur(8px);
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.6s;
}

.rotator-item.is-active { opacity: 1; transform: none; filter: none; }
.rotator-item.is-leaving { opacity: 0; transform: translateY(-0.3em); filter: blur(8px); }

.lead {
  margin: 0 0 36px;
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.1rem;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Card */

.card {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 420px;
  padding: 22px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, -20%), var(--spot), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }

.card p { margin: 0 0 20px; color: var(--muted); overflow-wrap: anywhere; }

/* Controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn-google {
  background: var(--text);
  color: var(--bg);
}
.btn-google:hover:not(:disabled) { opacity: 0.88; }

.g-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
}
.g-icon svg { width: 16px; height: 16px; }

.providers {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.btn-provider {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-provider:hover:not(:disabled) {
  border-color: var(--muted);
  background: color-mix(in srgb, var(--text) 5%, transparent);
}
.btn-provider svg { width: 18px; height: 18px; }

/* Provider name with an optional second line ("Coming soon"). */
.provider-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
.provider-soon {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
}

/* Providers listed in AUTH_PROVIDERS_SOON (config.js): visible, grey, not clickable. */
.btn-provider.is-soon,
.btn-provider.is-soon:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: var(--muted);
  border-color: var(--border);
  background: color-mix(in srgb, var(--muted) 6%, transparent);
}
.btn-provider.is-soon svg { filter: grayscale(1); opacity: 0.55; }
.btn-provider.is-soon .provider-tag { background: color-mix(in srgb, var(--muted) 12%, transparent); }

.btn-orcid { margin-top: 10px; white-space: nowrap; }

@media (max-width: 420px) {
  .btn-orcid .provider-tag { display: none; }
}

.provider-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, #A6CE39 18%, transparent);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
}

.stack { display: flex; flex-direction: column; gap: 8px; }

.btn-link {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
}
.btn-link:hover:not(:disabled) { color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--muted); }

/* CAPTCHA widget (Cloudflare Turnstile), only while a sign-in attempt needs it. */
.captcha { display: flex; justify-content: center; margin-top: 12px; }
.captcha:empty { display: none; }

.email-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.email-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.email-row input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.email-row input::placeholder { color: var(--muted); }

.btn-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s;
}
.btn-icon:hover:not(:disabled) { background: var(--accent-hover); }
.btn-icon:hover:not(:disabled) svg { transform: translateX(2px); }
.btn-icon:disabled { opacity: 0.6; cursor: progress; }
.btn-icon svg { width: 20px; height: 20px; transition: transform 0.15s; }

.btn:focus-visible,
.btn-icon:focus-visible,
.topnav a:focus-visible,
.nav-cta:focus-visible,
.footer a:focus-visible,
.faq-item summary:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.status {
  max-width: 420px;
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.status[data-type="error"] { color: var(--error); }
.status[data-type="success"] { color: var(--success); }

/* Sections */

.section {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 96px 16px;
  scroll-margin-top: 8px;
}

.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
}

.section-eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-title {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.section-lead {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}

/* Features and privacy: cards with a line icon */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.privacy-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.feature {
  padding: 26px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
}
.feature-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.feature p {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-wrap: pretty;
}

.fine-print {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.fine-print.center { margin-top: 28px; text-align: center; }

/* Research: the story on the left, an example in a technical window on the right */

.research {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  align-items: center;
  gap: 56px;
  max-width: 1100px;
}

.research .section-lead { margin-bottom: 20px; }

/* Where sources come from: ResearchGate, DOI, own files */
.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
  padding: 0;
  list-style: none;
}
.source-chips li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 500;
}
.source-chips svg {
  width: 20px;
  height: 20px;
  padding: 2px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ResearchGate's "R^G" mark in its brand teal */
.rg-mark {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: start;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  padding-top: 3px;
  border-radius: 5px;
  background: #00ccbb;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.rg-mark sup { font-size: 0.68em; line-height: 1; vertical-align: 0; }

.check-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.check-list li { display: flex; align-items: flex-start; gap: 10px; }

.check-list svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.research-demo {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
}

/* The example as a technical window: a title bar like an editor's, the chat, then a plot of the
   paper's numbers. When the section scrolls into view the example plays like the chat (login.js):
   the question comes in, the working indicator runs, the answer streams in, and then the plot
   draws itself: grid lines sweep in, the formula types out, both lines are plotted, the points
   land and the values appear. Without the reveal (reduced motion) everything simply stands there. */
.tech-window {
  gap: 0;
  padding: 0;
  overflow: hidden;
  --tw-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --tw-plain: color-mix(in srgb, var(--text) 42%, transparent);
}
.tw-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  color: var(--muted);
  font-family: var(--tw-mono);
  font-size: 0.74rem;
}
.tw-dots { display: flex; gap: 6px; }
.tw-dots i { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--text) 16%, transparent); }
.tw-dots i:first-child { background: color-mix(in srgb, var(--grad-b) 70%, transparent); }
.tw-title { flex: 1; text-align: center; }
.tw-status { display: inline-flex; align-items: center; gap: 6px; }
.tw-live { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 20%, transparent); }
.tw-body { display: flex; flex-direction: column; gap: 16px; padding: 20px 22px 22px; }

.tw-plot {
  margin: 4px 0 0;
  padding: 14px 14px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--text) 10%, transparent) 1px, transparent 0) 0 0 / 12px 12px,
    var(--input-bg);
}
.tw-formula {
  margin: 0 0 6px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
}
.tw-formula sub { font-size: 0.6em; }
.tw-chart { display: block; width: 100%; height: auto; overflow: visible; }
.tw-grid line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.tw-ticks text { fill: var(--muted); font-family: var(--tw-mono); font-size: 8px; text-anchor: end; }
.tw-ticks .tw-x { text-anchor: middle; }
.tw-ticks .tw-unit { text-anchor: start; }
.tw-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 1; }
.tw-line.tw-plain { stroke: var(--tw-plain); }
.tw-line.tw-res { stroke: var(--accent); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 55%, transparent)); }
.tw-points circle { stroke: var(--input-bg); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; }
.tw-points .tw-plain { fill: var(--tw-plain); }
.tw-points .tw-res { fill: var(--accent); }
.tw-labels text { font-family: var(--tw-mono); font-size: 8.5px; }
.tw-labels .tw-plain { fill: var(--muted); }
.tw-labels .tw-res { fill: var(--accent); font-weight: 600; }
.tw-labels .tw-val { font-size: 8px; }
.tech-window figcaption { margin-top: 6px; color: var(--muted); font-size: 0.78rem; }

/* Until the example answer has streamed in (login.js adds .is-answered), the plot waits hidden. */
.js-reveal .research-demo:not(.is-answered) :is(.tw-formula, .tw-chart, figcaption) { visibility: hidden; }
.js-reveal .research-demo.is-answered figcaption { animation: tw-fade 0.4s 2.5s both; }
.js-reveal .research-demo.is-answered .tw-grid line {
  transform-box: fill-box;
  transform-origin: left;
  animation: tw-sweep 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(1) { animation-delay: 0.1s; }
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(2) { animation-delay: 0.15s; }
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(3) { animation-delay: 0.2s; }
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(4) { animation-delay: 0.25s; }
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(5) { animation-delay: 0.3s; }
.js-reveal .research-demo.is-answered .tw-grid line:nth-child(6) { animation-delay: 0.35s; }
.js-reveal .research-demo.is-answered .tw-ticks { animation: tw-fade 0.5s 0.45s both; }
.js-reveal .research-demo.is-answered .tw-formula span {
  display: inline-block;
  animation: tw-type 1s steps(18, end) 0.35s both;
}
.js-reveal .research-demo.is-answered .tw-points circle { animation: tw-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.js-reveal .research-demo.is-answered .tw-points circle:not(.tw-end) { animation-delay: 0.8s; }
.js-reveal .research-demo.is-answered .tw-line.tw-plain { animation: tw-draw 1s cubic-bezier(0.65, 0, 0.35, 1) 0.9s both; }
.js-reveal .research-demo.is-answered .tw-line.tw-res { animation: tw-draw 1.2s cubic-bezier(0.65, 0, 0.35, 1) 1.1s both; }
.js-reveal .research-demo.is-answered .tw-points .tw-plain.tw-end { animation-delay: 1.85s; }
.js-reveal .research-demo.is-answered .tw-points .tw-res.tw-end { animation-delay: 2.25s; }
.js-reveal .research-demo.is-answered .tw-labels .tw-plain { animation: tw-fade 0.4s 1.95s both; }
.js-reveal .research-demo.is-answered .tw-labels .tw-res { animation: tw-fade 0.4s 2.35s both; }

@keyframes tw-sweep { from { transform: scaleX(0); } }
@keyframes tw-fade { from { opacity: 0; } }
@keyframes tw-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes tw-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes tw-pop { from { transform: scale(0); } }

/* The works search as in the chat (chat.css, .works-search and .work): the query, one result
   with its citations, and "Add", which turns into "Added" and the source number. */
.demo-works {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--input-bg);
  overflow: hidden;
}
.demo-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.demo-search svg,
.demo-cites svg { flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.demo-search svg { width: 16px; height: 16px; color: var(--muted); }
.demo-query { white-space: nowrap; }
.demo-work { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.demo-work .demo-source-title { color: color-mix(in srgb, var(--accent) 80%, var(--text)); font-weight: 500; }
.demo-cites { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; }
.demo-cites svg { width: 12px; height: 12px; }
.demo-badge {
  flex: none;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* "Add" and "Added" share one cell, and the source number keeps its place while hidden, so
   adding doesn't rewrap the title or move the window. */
.demo-add {
  display: inline-grid;
  flex: none;
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border-strong));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 0.8rem;
  font-weight: 500;
  transition: opacity 0.2s, background-color 0.2s;
}
.demo-works.is-added .demo-add { opacity: 0.6; background: transparent; }
.demo-add > span { grid-area: 1 / 1; text-align: center; }
.demo-works.is-added .demo-add-off,
.demo-works:not(.is-added) .demo-add-on,
.demo-works:not(.is-added) .demo-source-num { visibility: hidden; }
.js-reveal .demo-works.is-added .demo-source-num { animation: tw-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1); }

.demo-source-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.demo-source-title { font-size: 0.92rem; font-weight: 600; }
.demo-source-meta { color: var(--muted); font-size: 0.8rem; }

.demo-source-num,
.cite {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}
.cite { vertical-align: 0.1em; }

.demo-question {
  align-self: flex-end;
  max-width: 85%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  font-size: 0.92rem;
}

/* The answer with the chat's assistant mark beside it (chat.css, .msg-avatar). */
.demo-reply { display: flex; gap: 12px; }
.demo-mark { display: block; flex: none; width: 24px; height: 24px; margin-top: 1px; }

.demo-answer { position: relative; flex: 1; min-width: 0; font-size: 0.92rem; }
.demo-answer p { margin: 0 0 10px; }
.demo-answer p:last-child { margin-bottom: 0; }

/* The example playing like the chat (login.js). The question comes in like a sent message; the
   answer's words keep their place while hidden, so nothing below moves as it streams in. */
.js-reveal .research.is-visible .demo-query { display: inline-block; animation: tw-type 0.8s steps(22, end) 0.5s both; }
.js-reveal .research.is-visible .demo-work { animation: demo-in 0.35s 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.js-reveal .research.is-visible .demo-question { animation: demo-in 0.35s 2.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.js-reveal .research.is-visible .demo-mark { animation: demo-in 0.35s 3.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.demo-answer .demo-word { opacity: 0; }
.demo-answer .demo-word.is-on { opacity: 1; transition: opacity 0.18s; }
.js-reveal .research-demo:not(.is-answered) .demo-answer .cite { visibility: hidden; }
.js-reveal .research-demo.is-answered .demo-answer .cite { animation: tw-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
@keyframes demo-in { from { opacity: 0; transform: translateY(6px); } }

/* The chat's "working" indicator (chat.css): star in the accent colour, a verb with a light
   sweeping across it. It sits over the first line until the answer starts. */
.demo-answer .working { position: absolute; top: 0; left: 0; display: inline-flex; align-items: baseline; gap: 8px; }
.working-glyph { display: inline-block; width: 1.1em; color: var(--accent); text-align: center; }
.working-verb {
  background: linear-gradient(90deg, var(--accent) 0 40%, color-mix(in srgb, var(--accent) 35%, var(--text)) 50%, var(--accent) 60% 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: working-shimmer 2.2s linear infinite;
}
@keyframes working-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* The chat's typing caret after the last word written (chat.css, .is-streaming). Placed outside
   the flow, so it can't push a word onto the next line. */
.demo-word.is-last { position: relative; }
.demo-word.is-last::after {
  content: "";
  position: absolute;
  left: 100%;
  bottom: 0.1em;
  width: 0.5em;
  height: 1em;
  margin-left: 0.15em;
  border-radius: 2px;
  background: var(--accent);
  animation: caret-blink 1s steps(2, start) infinite;
}
@keyframes caret-blink { to { visibility: hidden; } }

/* Plans */

.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}

.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

/* Gradient hairline around the featured plan (Pro). */
.plan-featured { border-color: transparent; box-shadow: var(--shadow); }
.plan-featured::before {
  content: "";
  position: absolute;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(140deg, var(--grad-a), var(--grad-b), var(--grad-c));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.plan-name {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.plan-desc {
  min-height: 3em;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.plan-price {
  display: flex;
  white-space: nowrap;
  align-items: baseline;
  gap: 6px;
  margin: 0;
}

.price {
  font-size: clamp(2rem, 2.6vw, 2.4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.price .cur {
  margin-right: 4px;
  color: var(--muted);
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: 0.9em;
}

.per { color: var(--muted); font-size: 0.9rem; }

.plan-billing {
  min-height: 1.4em;
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 0.82rem;
}

.plan-cta { margin-bottom: 24px; }
.plan-cta:disabled { cursor: not-allowed; opacity: 0.55; }

.plan-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
  font-size: 0.92rem;
}

.plan-features li { display: flex; align-items: flex-start; gap: 10px; }
.plan-features .plan-incl { color: var(--muted); font-size: 0.85rem; }

.plan-features svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 3px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plans-note {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* FAQ */

.faq {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
  gap: 56px;
  max-width: 1080px;
}

.faq-head {
  position: sticky;
  top: 32px;
  align-self: start;
  align-items: flex-start;
  margin: 0;
  text-align: left;
}

.faq-list { border-top: 1px solid var(--border); }
.faq-item { border-bottom: 1px solid var(--border); }

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 4px;
  font-size: 1.02rem;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
  transition: color 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--accent); }

.faq-icon { position: relative; flex: none; width: 14px; height: 14px; }
.faq-icon::before,
.faq-icon::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s;
}
.faq-icon::after { transform: rotate(90deg); }
.faq-item[open] .faq-icon::after { transform: rotate(0deg); }

.faq-answer p {
  max-width: 62ch;
  margin: 0;
  padding: 0 4px 22px;
  color: var(--muted);
}

/* Scroll reveal (enabled by login.js only when motion is allowed). */
.js-reveal .on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.js-reveal .on-scroll.is-visible { opacity: 1; transform: none; }

/* Trust points */

.trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.trust li { display: inline-flex; align-items: center; gap: 7px; }

.trust svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Footer */

.footer {
  width: calc(100% - 32px);
  max-width: 1128px;
  margin: 40px auto 0;
  padding: 48px 0 28px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 40px;
}

.footer-brand { max-width: 300px; }
.footer-brand p { margin: 14px 0 18px; }

.footer-cta {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.footer-cta::after { content: " →"; }
.footer-cta:hover { color: var(--accent-hover); }

.footer-links { display: flex; gap: 72px; }

.footer-links h2 {
  margin: 4px 0 14px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0;
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-links a:hover { color: var(--text); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}

.footer-build { margin-left: 12px; color: var(--muted); font-variant-numeric: tabular-nums; opacity: 0.8; }

/* Entrance */

.reveal { animation: reveal 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.hero .reveal:nth-child(2) { animation-delay: 0.06s; }
.hero .reveal:nth-child(3) { animation-delay: 0.12s; }
.hero .reveal:nth-child(4) { animation-delay: 0.18s; }
.hero .reveal:nth-child(5) { animation-delay: 0.24s; }
.hero .reveal:nth-last-child(1) { animation-delay: 0.32s; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(14px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .faq-icon::before, .faq-icon::after { transition: none; }
  .aurora, .eyebrow-dot::after, .reveal { animation: none; }
  .rotator-item, .btn, .btn-icon, .card::before, .topbar, .topnav a::after, .nav-cta { transition: none; }
}

@media (max-width: 1080px) {
  .privacy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Six links no longer fit next to the logo: they move to their own row and scroll sideways,
   and the button stays next to the logo. */
@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand . cta" "nav nav nav";
    row-gap: 6px;
  }
  .topnav {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-right: 24px;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }
  /* The menu covers more of each section's top here. */
  .section { scroll-margin-top: 48px; }
  .topnav::-webkit-scrollbar { display: none; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .research { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .research-copy { text-align: center; }
  .source-chips { justify-content: center; }
  .research .check-list { max-width: 520px; margin: 0 auto; text-align: left; }
}

@media (max-width: 860px) {
  .faq { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .faq-head { position: static; align-items: center; text-align: center; }
  .footer-inner { flex-direction: column; }
}

/* Mobile */

@media (max-width: 600px) {
  .topnav { gap: 18px; }
  .section { padding: 72px 16px; }
  .plans { grid-template-columns: minmax(0, 1fr); }
  .plan-desc { min-height: 0; }
  .hero-mark { width: 64px; height: 64px; margin-bottom: 18px; }
  .topbar-inner { padding: 12px 16px 4px; }
  .hero { padding: 24px 16px 40px; }
  .lead { font-size: 1rem; margin-bottom: 28px; }
  .card { padding: 18px; }
  .trust { flex-direction: column; align-items: center; }
  .feature-grid,
  .privacy-grid { grid-template-columns: minmax(0, 1fr); }
  .research-demo:not(.tech-window) { padding: 16px; }
  .tw-body { padding: 16px; }
  .demo-work { flex-wrap: wrap; row-gap: 8px; }
  .demo-work .demo-source-text { flex-basis: 100%; }
  .footer-links { gap: 48px; }
}

/* Signed-in card: greeting, latest chats, the way back in. */

/* The cards that take the sign-in card's place, and the latest chats once they load, come in
   like the chat's dialogs (chat.css, settings-in). */
@media (prefers-reduced-motion: no-preference) {
  #sent-card,
  #session-card,
  .session-recent { animation: card-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.session-card { padding: 24px; }

.session-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.session-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b) 60%, var(--grad-c));
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 600;
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--grad-a) 70%, transparent);
}
.session-who { min-width: 0; }
.session-who h2 { margin: 0 0 2px; font-size: 1.15rem; overflow-wrap: anywhere; }
.card .session-email {
  margin: 0;
  overflow: hidden;
  font-size: 0.88rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.session-recent { margin: 0 0 18px; }
.card .session-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.session-chats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.session-chats a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.session-chats li + li a { margin-top: 4px; }
.session-chats a:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.session-chat-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.92rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.session-chat-time { flex: none; color: var(--muted); font-size: 0.78rem; }

.session-open svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s;
}
.session-open:hover svg { transform: translateX(3px); }

.card .session-switch {
  margin: 14px 0 0;
  font-size: 0.86rem;
  text-align: center;
}
.session-logout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
  cursor: pointer;
}
.session-logout:hover { text-decoration-color: currentColor; }
.session-chats a:focus-visible,
.session-logout:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Waitlist (LAUNCH_MODE "waitlist" in js/config.js): replaces the sign-in card before launch. */
.waitlist-card .waitlist-lead { margin-bottom: 16px; }
.waitlist-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  cursor: pointer;
}
.waitlist-consent input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.waitlist-consent a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.waitlist-consent a:hover { color: var(--text); }
.waitlist-check {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b) 60%, var(--grad-c));
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--grad-a) 70%, transparent);
}
.waitlist-check svg { width: 22px; height: 22px; fill: none; stroke: #ffffff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#waitlist-done p { margin-bottom: 8px; }
#waitlist-done .btn-link { padding: 0; min-height: 32px; }
