/* AutoGem site foundation. The layout loads this first on every page, so it
   owns the design tokens, fonts, base elements, layout widths, and the few
   components shared across page types. Page <style> blocks build on it and
   must not redefine tokens. */

/* ---- Fonts ---- */
/* Geist (SIL OFL 1.1, see /fonts/Geist-OFL.txt) carries the whole site:
   display weight for headings and regular weight for body copy, with the
   system stack as the fallback while the variable font loads. */
@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---- */
/* The theme script in layouts/app sets data-theme="light" or "dark" on
   <html> before first paint, from the visitor's choice or the system
   setting. Without JavaScript the site stays light. */
:root {
  color-scheme: light;
  --bg: #fbfafc;
  --bg-alt: #f5f2f9;
  --surface: #ffffff;
  --surface-2: #f8f6fb;
  --text: #191622;
  --text-2: #5d5969;
  --text-3: #706b7c;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: rgba(124, 58, 237, 0.075);
  --accent-line: rgba(124, 58, 237, 0.22);
  --on-accent: #fff;
  --border: #e9e6f0;
  --border-strong: #d8d3e3;
  --danger: #b00020;
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-img: 14px;
  --shadow-sm: 0 1px 2px rgba(25, 18, 42, 0.05);
  --shadow: 0 1px 2px rgba(25, 18, 42, 0.04), 0 12px 32px -14px rgba(25, 18, 42, 0.14);
  --shadow-img: 0 2px 4px rgba(25, 18, 42, 0.04), 0 32px 72px -28px rgba(25, 18, 42, 0.24);
  --font-body: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-body);
  /* Two widths for the whole site. --max-w is the layout box (header, footer,
     sections) and --prose-w the reading column; both include the 24px gutters. */
  --max-w: 1200px;
  --prose-w: 800px;
}

/* Dark theme (see the theme script in layouts/app). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0910;
  --bg-alt: #100e16;
  --surface: #16131d;
  --surface-2: #1c1824;
  --text: #f3f1f7;
  --text-2: #a8a2b6;
  --text-3: #9a94a8;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-soft: rgba(167, 139, 250, 0.11);
  --accent-line: rgba(167, 139, 250, 0.26);
  --on-accent: #140f24;
  --border: #26222f;
  --border-strong: #393246;
  --danger: #ff7b72;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 14px 36px -14px rgba(0, 0, 0, 0.55);
  --shadow-img: 0 2px 4px rgba(0, 0, 0, 0.3), 0 32px 72px -28px rgba(0, 0, 0, 0.7);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Set for one frame while the theme changes (see layouts/app). */
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

p { text-wrap: pretty; }

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  text-wrap: balance;
  font-optical-sizing: auto;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}

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

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

.container--narrow { max-width: var(--prose-w); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
              transform 0.12s ease, color 0.18s ease;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--text-3);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(49, 20, 100, 0.24), 0 10px 24px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 2px 4px rgba(49, 20, 100, 0.22), 0 14px 30px -12px color-mix(in srgb, var(--accent) 76%, transparent);
}
.btn--quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-2);
}
.btn--quiet:hover {
  background: var(--accent-soft);
  border-color: transparent;
  box-shadow: none;
  color: var(--text);
}
.btn--block { width: 100%; }

/* ---- Chrome Web Store button ---- */
.chrome-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px 9px 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dedbe6;
  box-shadow: var(--shadow-sm);
  color: #202124;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.chrome-download-btn:hover {
  border-color: #c4bfce;
  box-shadow: 0 2px 4px rgba(25, 18, 42, 0.06), 0 12px 28px -12px rgba(25, 18, 42, 0.24);
  transform: translateY(-1px);
}

.chrome-download-btn:active { transform: translateY(0) scale(0.985); }
.chrome-download-btn__logo { width: 34px; height: 34px; flex-shrink: 0; }
.chrome-download-btn__text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; gap: 2px; }
.chrome-download-btn__label { font-size: 11px; font-weight: 500; letter-spacing: 0.01em; color: #5f6368; }
.chrome-download-btn__product { font-size: 15.5px; font-weight: 700; letter-spacing: -0.015em; color: #202124; }

/* Hero-sized badge: larger mark and text, one quiet ambient shadow plus a
   faint brand ring so it still reads as the primary action. */
.chrome-download-btn--hero {
  gap: 14px;
  padding: 12px 22px 12px 14px;
  border-radius: 14px;
  border-color: color-mix(in srgb, var(--accent) 16%, #dedbe6);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 7%, transparent),
    0 1px 2px rgba(25, 18, 42, 0.06),
    0 16px 36px -18px rgba(25, 18, 42, 0.32);
}
.chrome-download-btn--hero .chrome-download-btn__logo { width: 42px; height: 42px; }
.chrome-download-btn--hero .chrome-download-btn__label { font-size: 11.5px; }
.chrome-download-btn--hero .chrome-download-btn__product { font-size: 17.5px; }
.chrome-download-btn--hero:hover {
  border-color: color-mix(in srgb, var(--accent) 28%, #c4bfce);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--accent) 10%, transparent),
    0 2px 4px rgba(25, 18, 42, 0.08),
    0 22px 46px -18px rgba(25, 18, 42, 0.34);
}

/* Dark theme (see the theme script in layouts/app). */
:where([data-theme="dark"]) .chrome-download-btn {
  background: #1d1926;
  border-color: #322c3e;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
:where([data-theme="dark"]) .chrome-download-btn:hover {
  background: #24202f;
  border-color: #443c53;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 14px 30px -14px rgba(0, 0, 0, 0.6);
}
:where([data-theme="dark"]) .chrome-download-btn__label { color: #b3abc7; }
:where([data-theme="dark"]) .chrome-download-btn__product { color: #f3f1f7; }
:where([data-theme="dark"]) .chrome-download-btn--hero {
  border-color: color-mix(in srgb, var(--accent) 24%, #322c3e);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 9%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 16px 36px -18px rgba(0, 0, 0, 0.6);
}
:where([data-theme="dark"]) .chrome-download-btn--hero:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, #443c53);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--accent) 13%, transparent),
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 22px 46px -18px rgba(0, 0, 0, 0.7);
}

/* ---- Screenshots ---- */
/* A soft shimmer shows while a screenshot loads; the global script in the
   layout adds .is-loaded to stop it. The sweep is a transformed pseudo
   element, so it animates on the compositor without repainting. */
.shot-frame {
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-img);
  box-shadow: var(--shadow);
}

.shot-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 6%, transparent) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shot-shimmer 1.6s ease-in-out infinite;
  pointer-events: none;
}

.shot-frame img { position: relative; }
.shot-frame.is-loaded::before { display: none; }

@keyframes shot-shimmer {
  to { transform: translateX(100%); }
}

/* Product screenshots are light-mode captures; dim them slightly so they
   do not outshine the headlines on a dark page. */
/* Dark theme (see the theme script in layouts/app). */
:where([data-theme="dark"]) .shot-frame img { filter: brightness(0.88); }

@media (prefers-reduced-motion: reduce) {
  .shot-frame::before { animation: none; display: none; }
}

/* ---- Reveal on scroll ---- */
/* Content is visible by default. The reveal script marks only elements that
   start below the fold as pending, so nothing on the first screen fades in
   late and pages still work without JavaScript. */
.reveal {
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.reveal--pending {
  opacity: 0;
  transform: translateY(16px);
}

/* ---- App pages (sign in, account, onboarding, pricing) ---- */
.app-main {
  max-width: var(--prose-w);
  margin: 0 auto;
  padding: 64px 24px 104px;
}

.app-main--center {
  min-height: min(640px, 72vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.page-head { text-align: center; margin-bottom: 40px; }

.page-head h1 {
  font-size: clamp(2.3rem, 6vw, 3.4rem);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin-bottom: 12px;
}

.page-head p {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.6;
  max-width: 48ch;
  margin: 0 auto;
  text-wrap: balance;
}

.app-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}

.app-card + .app-card { margin-top: 16px; }

.app-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin-bottom: 6px;
}

.app-card p { color: var(--text-2); font-size: 15px; }

.app-card--narrow { max-width: 448px; text-align: center; }

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.app-brand img { width: 36px; height: 36px; }

.app-card--narrow h1 {
  font-size: clamp(1.9rem, 5vw, 2.3rem);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 10px;
}

.app-card--narrow > p { max-width: 32ch; margin: 0 auto; }

.status-text { min-height: 20px; margin-top: 16px; font-size: 13px; color: var(--text-2); text-align: center; }
.error-text { min-height: 20px; margin-top: 16px; font-size: 13px; color: var(--danger); text-align: center; }
.error-text[hidden] { display: block; visibility: hidden; }

.check-list { list-style: none; display: grid; gap: 12px; }

.check-list li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.check-list svg {
  width: 22px;
  height: 22px;
  padding: 4.5px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 18px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

@media (max-width: 520px) {
  .app-main { padding: 36px 16px 64px; }
  .app-card { padding: 24px 20px; border-radius: 20px; }
}
