/* WaterTight – mobile-first. Base = small screens, then min-width for tablet/desktop */
:root {
  --bg: #0a0f1a;
  --bg-elevated: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-muted: rgba(14, 165, 233, 0.15);
  --border: rgba(255, 255, 255, 0.06);
  --success: #22c55e;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --max-width: 1200px;
  --touch-min: 44px;
  /* Theme-dependent (dark default) */
  --nav-bg: rgba(10, 15, 26, 0.92);
  --hero-glow-start: rgba(14, 165, 233, 0.08);
  --hero-glow-end: rgba(14, 165, 233, 0.05);
  --btn-primary-fg: #fff;
  --card-border-hover: rgba(14, 165, 233, 0.3);
  --card-border-active: rgba(14, 165, 233, 0.4);
}

/* Light theme */
html[data-theme="light"] {
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --surface: #e2e8f0;
  --surface-hover: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --accent: #0284c7;
  --accent-hover: #0ea5e9;
  --accent-muted: rgba(2, 132, 199, 0.15);
  --border: rgba(0, 0, 0, 0.16);
  --nav-bg: rgba(241, 245, 249, 0.92);
  --hero-glow-start: rgba(2, 132, 199, 0.06);
  --hero-glow-end: rgba(2, 132, 199, 0.04);
  --btn-primary-fg: #fff;
  --card-border-hover: rgba(2, 132, 199, 0.35);
  --card-border-active: rgba(2, 132, 199, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}

/* ----- Mobile first: layout & spacing ----- */
.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
  z-index: 1;
}

@media (min-width: 480px) {
  .wrap { padding: 0 20px; }
}
@media (min-width: 768px) {
  .wrap { padding: 0 24px; }
}

/* ----- Navigation: mobile = hamburger + drawer ----- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--touch-min);
  padding: 12px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--touch-min) - 24px);
  gap: 16px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  padding: 8px 0;
  flex-shrink: 0;
}
.logo:hover { color: var(--text); }
.logo span { color: var(--accent); }

/* Hamburger visible by default (mobile) */
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.nav-toggle:hover { background: var(--surface-hover); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle[aria-expanded="true"] { background: var(--surface-hover); }

/* Nav links: drawer on mobile */
.nav-links {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-elevated);
  padding: calc(var(--touch-min) + 16px) 16px 24px;
  overflow-y: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transform: translateX(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  -webkit-overflow-scrolling: touch;
}
.nav-links.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}
.nav-links a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 14px 16px;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}
.nav-links a:hover,
.nav-links a:focus { color: var(--text); background: var(--surface); }
.nav-cta-demo {
  border: 1px solid var(--accent);
  color: var(--accent) !important;
  text-align: center;
}
.nav-cta-demo:hover { background: var(--accent-muted); color: var(--accent-hover) !important; }
.nav-cta {
  margin-top: 8px;
  background: var(--accent);
  color: var(--btn-primary-fg) !important;
  text-align: center;
}
.nav-cta:hover { background: var(--accent-hover) !important; }
.nav-drawer-close { display: block; }
.nav-drawer-close button {
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-height: var(--touch-min);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s, background 0.2s;
}
.nav-drawer-close button:hover { color: var(--text); background: var(--surface-hover); }
@media (min-width: 768px) {
  .nav-drawer-close { display: none; }
}

/* Desktop: hide hamburger, show horizontal nav – single line, no wrap */
@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-links {
    position: static;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    padding: 0;
    overflow: visible;
    background: transparent;
    transform: none;
    opacity: 1;
    visibility: visible;
    gap: 2px;
    flex-shrink: 0;
  }
  .nav-links a {
    padding: 8px 10px;
    min-height: 0;
    font-size: 0.875rem;
    white-space: nowrap;
  }
  .nav-cta { margin-top: 0; margin-left: 6px; }
  .nav-cta-demo { margin-top: 0; margin-left: 2px; }
}
@media (min-width: 768px) {
  .site-nav { padding: 14px 0; }
  .site-nav .wrap { min-height: 40px; }
  .logo { font-size: 1.4rem; }
}

/* ----- Hero & page header ----- */
.page-hero { position: relative; overflow: hidden; }
.page-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 80%;
  height: 120%;
  background: radial-gradient(ellipse at 30% 20%, var(--hero-glow-start) 0%, transparent 50%);
  pointer-events: none;
}
.page-hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 60%;
  height: 80%;
  background: radial-gradient(ellipse at 70% 80%, var(--hero-glow-end) 0%, transparent 50%);
  pointer-events: none;
}

/* Mobile: compact hero */
main .page-hero .wrap {
  padding-top: 32px;
  padding-bottom: 40px;
}
.page-header .wrap { padding-top: 32px; padding-bottom: 28px; }

@media (min-width: 480px) {
  main .page-hero .wrap { padding-top: 40px; padding-bottom: 48px; }
  .page-header .wrap { padding-top: 40px; padding-bottom: 36px; }
}
@media (min-width: 768px) {
  main .page-hero .wrap { padding-top: 56px; padding-bottom: 64px; }
  .page-header .wrap { padding-top: 48px; padding-bottom: 40px; }
}

/* ----- Typography: mobile base ----- */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}
h2 {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 6px; }
.tagline, .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 100%;
  margin-bottom: 20px;
  line-height: 1.55;
}
.lead { font-size: 1.125rem; color: var(--text-muted); margin-bottom: 24px; }

@media (min-width: 480px) {
  h1 { font-size: 2rem; margin-bottom: 14px; }
  h2 { font-size: 1.5rem; }
  .tagline, .subtitle { font-size: 1.0625rem; margin-bottom: 24px; }
}
@media (min-width: 768px) {
  h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 16px; }
  h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); margin-bottom: 12px; }
  h3 { font-size: 1.25rem; }
  .tagline, .subtitle { font-size: 1.125rem; max-width: 56ch; }
  .lead { font-size: 1.25rem; max-width: 42ch; }
}

/* ----- Buttons: touch-friendly on mobile ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 1rem;
  min-height: var(--touch-min);
  padding: 12px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 2px; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--btn-primary-fg); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

@media (min-width: 768px) {
  .btn { padding: 14px 28px; min-height: 0; }
  .btn:active { transform: none; }
  .btn:hover { transform: none; }
}

/* ----- Home hero feature list (mobile) ----- */
.hero-features {
  list-style: none;
  margin-bottom: 28px;
}
.hero-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.hero-features li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 0.45em;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  .hero-features { margin-bottom: 32px; }
  .hero-features li { margin-bottom: 14px; font-size: 1rem; }
}

/* ----- Feature grid: single column on mobile ----- */
.feature-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 32px 0 24px;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.feature-card:active { border-color: var(--card-border-active); }
.feature-card .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.feature-card .icon svg { width: 24px; height: 24px; }
.feature-card h3 { margin-bottom: 6px; font-size: 1.125rem; }
.feature-card p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}
.feature-card a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  margin-top: 10px;
  padding: 4px 0;
  min-height: var(--touch-min);
  align-items: center;
  transition: gap 0.2s;
}
.feature-card a:hover { gap: 10px; }

@media (min-width: 480px) {
  .feature-grid { gap: 20px; margin: 40px 0 32px; }
  .feature-card { padding: 24px; }
  .feature-card .icon { width: 48px; height: 48px; }
  .feature-card .icon svg { width: 26px; height: 26px; }
}
@media (min-width: 768px) {
  .feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin: 48px 0;
  }
  .feature-card:hover {
    border-color: var(--card-border-hover);
    transform: translateY(-2px);
  }
  .feature-card:active { transform: none; }
}
@media (min-width: 1024px) {
  .feature-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* ----- Section blocks ----- */
.section { padding: 40px 0; }
.section-alt { background: var(--bg-elevated); }
.section-head {
  text-align: center;
  max-width: 100%;
  margin: 0 auto 32px;
}
.section-head .tagline { margin-left: auto; margin-right: auto; }

@media (min-width: 480px) {
  .section { padding: 48px 0; }
  .section-head { margin-bottom: 40px; }
}
@media (min-width: 768px) {
  .section { padding: 64px 0; }
  .section-head { max-width: 640px; margin-bottom: 48px; }
}
@media (min-width: 1024px) {
  .section { padding: 80px 0; }
}

/* ----- CTA row (home): stack on mobile ----- */
.cta-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin-top: 24px;
}
.cta-row .btn { width: 100%; justify-content: center; }
@media (min-width: 480px) {
  .cta-row { flex-direction: row; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
  .cta-row .btn { width: auto; }
}

/* ----- Footer: stack on mobile ----- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 24px;
  margin-top: 40px;
}
.site-footer .wrap {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: flex-start;
}
.footer-brand .logo { font-size: 1.2rem; }
.footer-brand p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 8px;
  max-width: 100%;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 4px 0;
  min-height: var(--touch-min);
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  width: 100%;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

@media (min-width: 768px) {
  .site-footer { padding: 48px 0 32px; margin-top: 64px; }
  .site-footer .wrap {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 32px;
  }
  .footer-brand p { max-width: 28ch; }
  .footer-links a { min-height: 0; padding: 0; }
  .footer-bottom { padding-top: 24px; }
}

/* ----- Page header (inner pages) ----- */
.page-header h1 { margin-bottom: 8px; }
.page-header .tagline { margin-bottom: 0; }

/* ----- Prose (feature/demo/contact content) ----- */
.prose {
  max-width: 100%;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}
.prose p { margin-bottom: 14px; }
.prose ul { margin: 14px 0; padding-left: 1.35em; }
.prose li { margin-bottom: 6px; }
.prose h2 { margin-top: 24px; margin-bottom: 10px; }
.prose h2:first-child { margin-top: 0; }

@media (min-width: 768px) {
  .prose { max-width: 72ch; }
  .prose p { margin-bottom: 16px; }
  .prose ul { margin: 16px 0; }
  .prose li { margin-bottom: 8px; }
}

/* ----- Forms: full width, touch-friendly ----- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  font-family: var(--font);
  font-size: 16px; /* avoids zoom on focus on iOS */
  padding: 14px 16px;
  min-height: var(--touch-min);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); opacity: 0.8; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-group textarea {
  min-height: 140px;
  resize: vertical;
}
.form-actions { margin-top: 24px; }
.form-actions .btn { width: 100%; min-height: var(--touch-min); }
.form-note { font-size: 0.8125rem; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }

@media (min-width: 480px) {
  .form-actions .btn { width: auto; }
}

/* ----- Pricing: single column on mobile ----- */
.pricing-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 28px;
}
.pricing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  transition: border-color 0.2s;
}
.pricing-card:active { border-color: var(--card-border-hover); }
.pricing-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pricing-card .badge {
  position: absolute;
  top: -10px;
  left: 20px;
  background: var(--accent);
  color: var(--btn-primary-fg);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.pricing-card h3 { margin-bottom: 6px; }
.pricing-card .price {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 14px 0 6px;
}
.pricing-card .price span { font-size: 0.9375rem; font-weight: 500; color: var(--text-muted); }
.pricing-card ul { list-style: none; margin: 20px 0; }
.pricing-card ul li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.pricing-card ul li svg { flex-shrink: 0; color: var(--success); width: 20px; height: 20px; }
.pricing-card .btn {
  width: 100%;
  margin-top: 8px;
  justify-content: center;
  min-height: var(--touch-min);
}

@media (min-width: 480px) {
  .pricing-grid { gap: 24px; margin-top: 32px; }
  .pricing-card { padding: 28px; }
  .pricing-card .price { font-size: 2rem; margin: 16px 0 8px; }
}
@media (min-width: 768px) {
  .pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 40px;
  }
  .pricing-card:hover { border-color: var(--card-border-hover); transform: translateY(-2px); }
  .pricing-card:active { transform: none; }
}
@media (min-width: 1024px) {
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Form / content wrap max-width on inner pages (mobile first = full width) */
.wrap-narrow { max-width: 100%; }
@media (min-width: 480px) {
  .wrap-narrow { max-width: 520px; }
}

/* Theme toggle (sun/moon in nav) */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
  -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { background: var(--surface-hover); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-dark { display: none; }
.theme-toggle .icon-light { display: block; }
html[data-theme="light"] .theme-toggle .icon-dark { display: block; }
html[data-theme="light"] .theme-toggle .icon-light { display: none; }
@media (min-width: 768px) {
  .theme-toggle { margin-left: 6px; }
}

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.mt-0 { margin-top: 0; }
.mb-2 { margin-bottom: 16px; }
