/*
 * OpaqueShare marketing site — single stylesheet.
 *
 * Design goals: corporate/serious but approachable. Strong typographic
 * hierarchy, generous whitespace, mobile-first. Zero JavaScript, zero
 * build step — just system fonts + one CSS file behind Caddy.
 *
 * Palette derives from the mobile app's Material 3 color scheme, which
 * uses `ColorScheme.fromSeed(seedColor: Colors.deepPurple)`
 * (see client/lib/app.dart). The values below are the light-theme
 * roles M3 generates from that seed: `primary`, `onSurface`,
 * `onSurfaceVariant`, `outline`, `surface`, `surfaceVariant`,
 * `tertiary`. Keeping these in sync means a user coming from the app
 * lands on a website that visually feels like the same product.
 */

:root {
  /* M3 surface tones — very light purple-tinted whites. */
  --color-bg: #fef7ff;              /* M3 surface */
  --color-bg-muted: #f2ecf5;        /* between surface and surfaceVariant — differentiates section bands */
  --color-bg-card: #ffffff;

  /* M3 on-surface text tones. */
  --color-fg: #1d1b20;              /* M3 onSurface */
  --color-fg-muted: #49454e;        /* M3 onSurfaceVariant */
  --color-fg-subtle: #7a757f;       /* M3 outline */

  /* M3 primary — deep-purple-seeded, tone 40. This is the color the
     app's FilledButton renders in — matches the mobile CTA colour. */
  --color-primary: #65558f;
  --color-primary-hover: #544675;   /* ~tone 32 */
  --color-primary-container: #e9ddff;
  --color-on-primary-container: #210f47;

  /* M3 tertiary — used sparingly for callouts + accents. */
  --color-accent: #7d5260;

  --color-border: #e7e0eb;          /* M3 outlineVariant */

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max-width: 72rem;
  --content-width: 44rem;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* --- layout primitives ------------------------------------------- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- header ------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  background: var(--color-bg);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.brand:hover { color: var(--color-primary); }

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--color-fg-muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--color-primary); }

/* --- hero --------------------------------------------------------- */

.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  background: var(--color-bg);
}

.hero h1 {
  font-size: 2.5rem;
  line-height: 1.15;
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
  color: var(--color-fg);
}

.hero .tagline {
  font-size: 1.2rem;
  color: var(--color-fg-muted);
  max-width: 40rem;
  margin: 0 auto 2rem;
}

.cta-group {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* --- buttons ------------------------------------------------------ */

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background-color 0.15s, border-color 0.15s;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-bg-card);
  color: var(--color-fg);
  border-color: var(--color-border);
}

.btn-secondary:hover { border-color: var(--color-fg-muted); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- auth surfaces (password-reset, verify-email) ----------------- */
/*
 * Used by the branded fallback pages when an email link is opened
 * outside the installed app. Layout mirrors the marketing pages —
 * same header, same container — with a narrow card in the middle.
 */

.auth-shell {
  padding: 3rem 1rem;
  min-height: 60vh;
}

.auth-card {
  max-width: 28rem;
  margin: 0 auto;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin: 0 0 0.75rem;
}

.auth-card .lede {
  color: var(--color-fg-muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-app-banner {
  max-width: 28rem;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  background: var(--color-primary-container);
  color: var(--color-on-primary-container);
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.auth-app-banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-fg-muted);
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--color-fg);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.field input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -1px;
  border-color: var(--color-primary);
}

.field-hint {
  margin: -0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--color-fg-subtle);
}

.auth-status {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.4;
}

.auth-status.is-error {
  background: #fdecec;
  color: #7d1e1e;
  border: 1px solid #f2c2c2;
}

.auth-status.is-success {
  background: #e8f5ec;
  color: #1e5a2e;
  border: 1px solid #c2e0c8;
}

.auth-status.is-loading {
  background: var(--color-bg-muted);
  color: var(--color-fg-muted);
}

.auth-card .btn {
  width: 100%;
}

/* --- feature grid ------------------------------------------------- */

.features {
  padding: 3rem 0 4rem;
  background: var(--color-bg-muted);
}

.features h2 {
  text-align: center;
  font-size: 1.75rem;
  margin: 0 0 2.5rem;
  letter-spacing: -0.02em;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

.feature {
  padding: 1.75rem;
  /* Pure-white card on the tinted section background so cards read
     as elevated. Border stays subtle. */
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.feature h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--color-fg);
}

.feature p {
  margin: 0;
  color: var(--color-fg-muted);
  font-size: 0.95rem;
}

/* --- how it works ------------------------------------------------- */

.how {
  padding: 4rem 0;
  background: var(--color-bg);
}

.how h2 {
  text-align: center;
  font-size: 1.75rem;
  margin: 0 0 2.5rem;
  letter-spacing: -0.02em;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 2rem;
}

.step {
  text-align: center;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.step p {
  margin: 0;
  color: var(--color-fg-muted);
  font-size: 0.95rem;
}

/* --- legal / content pages ---------------------------------------- */

.legal {
  padding: 3rem 0 5rem;
  background: var(--color-bg);
}

.legal h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

.legal .updated {
  color: var(--color-fg-subtle);
  font-size: 0.9rem;
  margin: 0 0 2rem;
}

.legal h2 {
  font-size: 1.35rem;
  margin: 2.5rem 0 0.75rem;
  letter-spacing: -0.01em;
  color: var(--color-fg);
}

.legal h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
  color: var(--color-fg);
}

.legal p, .legal li {
  color: var(--color-fg-muted);
}

.legal ul, .legal ol {
  padding-left: 1.5rem;
  margin: 0.5rem 0 1rem;
}

.legal li {
  margin-bottom: 0.35rem;
}

.legal a {
  color: var(--color-primary);
  text-decoration: underline;
}

.legal code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-muted);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.legal .callout {
  background: var(--color-bg-muted);
  border-left: 3px solid var(--color-accent);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.legal .callout p:last-child { margin-bottom: 0; }

/* --- footer ------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  background: var(--color-bg-muted);
  font-size: 0.9rem;
  color: var(--color-fg-subtle);
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links a {
  color: var(--color-fg-muted);
  text-decoration: none;
}

.footer-links a:hover { color: var(--color-primary); }

.footer-brand strong { color: var(--color-fg); }

/* --- responsive --------------------------------------------------- */

@media (max-width: 640px) {
  .hero h1 { font-size: 1.9rem; }
  .hero .tagline { font-size: 1.05rem; }
  .site-nav { gap: 1rem; font-size: 0.9rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .cta-group { flex-direction: column; }
  .btn { text-align: center; }
}
