/* ==========================================================================
   Balserpe — Design System
   ========================================================================== */

/* ---------- Design Tokens ---------- */
:root {
  --color-primary: #0f2140;
  --color-accent: #0ea5e9;
  --color-accent-hover: #0284c7;
  --color-accent-light: #e0f2fe;
  --color-bg: #ffffff;
  --color-bg-alt: #f0f7ff;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-success: #16a34a;
  --color-error: #dc2626;
  --color-border: #cbd5e1;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --header-height: 72px;
  --max-width: 1140px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--color-accent-hover);
}

/* ---------- Typography ---------- */
h1, h2, h3 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-primary);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  margin-bottom: 0.5rem;
}

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

.section {
  padding: 80px 0;
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.section-title {
  text-align: center;
}

.section--alt {
  background-color: var(--color-bg-alt);
}

/* ---------- Skip Link ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--color-accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: 8px;
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--transition), transform var(--transition);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--accent {
  background-color: var(--color-accent);
  color: #fff;
}

.btn--accent:hover {
  background-color: var(--color-accent-hover);
  color: #fff;
}

.btn--outline {
  background-color: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}

.btn--outline:hover {
  background-color: var(--color-accent);
  color: #fff;
}

.btn--lg {
  padding: 16px 36px;
  font-size: 1.125rem;
}

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.wordmark {
  font-size: 2rem;
  line-height: 45px;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  text-transform: lowercase;
  letter-spacing: -0.02em;
}

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

.nav {
  display: none;
  align-items: center;
  gap: 32px;
}

.nav a:not(.btn) {
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: color var(--transition);
}

.nav a:not(.btn):hover {
  color: var(--color-accent);
}

/* Language switcher */
.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-switcher button {
  padding: 4px 8px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-switcher button:hover {
  color: var(--color-accent);
}

.lang-switcher button.active {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-primary);
  font-size: 1.5rem;
}

/* Mobile menu open state */
.nav.is-open {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--color-bg);
  box-shadow: var(--shadow-md);
  padding: 24px 16px;
  gap: 20px;
  z-index: 99;
}

/* ---------- Hero ---------- */
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  text-align: center;
  padding: 60px 0;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-accent-light) 100%);
}

.hero-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.hero h1 {
  text-align: center;
}

.hero-subtitle {
  margin-top: 16px;
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--color-text-muted);
  line-height: 1.6;
  text-align: center;
}

.hero .btn {
  margin-top: 32px;
}

/* ---------- Services ---------- */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  margin-top: 48px;
}

.service-card {
  padding: 32px 24px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
  transition: box-shadow var(--transition);
}

.service-card:hover {
  box-shadow: var(--shadow-md);
}

.service-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--color-accent-light);
  border-radius: var(--radius);
}

.service-icon svg {
  width: 32px;
  height: 32px;
  color: var(--color-accent);
}

.service-card p {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

/* ---------- Process ---------- */
.process-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  margin-top: 48px;
  counter-reset: step;
}

.process-step {
  text-align: center;
  counter-increment: step;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--color-accent);
  color: #fff;
  border-radius: 50%;
  font-size: 1.25rem;
  font-weight: 700;
}

.process-step p {
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  max-width: 260px;
  margin: 0 auto;
}

/* ---------- Why ---------- */
.why-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 48px;
  list-style: none;
}

.why-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  font-size: 1.0625rem;
}

.why-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  border-radius: 50%;
  margin-top: 2px;
}

.why-icon svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* ---------- Contact Form ---------- */
.form-section {
  text-align: center;
}

.form-subtitle {
  color: var(--color-text-muted);
  margin-top: 8px;
  font-size: 1.0625rem;
}

.contact-form {
  max-width: 640px;
  margin: 48px auto 0;
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text);
}

.form-group label .required {
  color: var(--color-error);
  margin-left: 2px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(42, 125, 225, 0.15);
}

.form-group textarea {
  min-height: 140px;
  resize: vertical;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-group input.field-error,
.form-group select.field-error,
.form-group textarea.field-error {
  border-color: var(--color-error);
}

.error-message {
  display: block;
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--color-error);
  min-height: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.form-submit {
  margin-top: 8px;
}

.form-submit .btn {
  width: 100%;
}

.form-success-message {
  text-align: center;
  padding: 48px 24px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
}

.form-success-message h3 {
  color: var(--color-success);
  margin-bottom: 8px;
}

.form-error-message {
  padding: 12px 16px;
  margin-bottom: 20px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--color-error);
  font-size: 0.9375rem;
}

/* Honeypot — hidden from real users */
.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* ---------- Products ---------- */
.nav a[aria-current="page"] {
  color: var(--color-accent);
}

.products-hero {
  text-align: center;
  background: linear-gradient(180deg, var(--color-bg) 0%, var(--color-accent-light) 100%);
}

.products-hero .hero-subtitle {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  max-width: 880px;
  margin: 0 auto;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px 24px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.product-card:hover {
  box-shadow: var(--shadow-md);
}

.product-icon {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.3);
}

.product-name {
  margin-bottom: 4px;
}

.product-tagline {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-accent-hover);
  margin-bottom: 12px;
}

.product-desc {
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.product-features {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.product-features li {
  position: relative;
  padding-left: 28px;
}

.product-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpolyline points='4 8 7 11 12 5' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.product-pricing {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 16px;
}

.product-store {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.store-soon {
  display: inline-flex;
  align-items: center;
  padding: 10px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent-hover);
  background: var(--color-accent-light);
  border: 1px dashed var(--color-accent);
  border-radius: 999px;
}

.store-badge img {
  width: 200px;
  height: auto;
}

.store-badge[hidden] {
  display: none;
}

.products-custom {
  text-align: center;
}

.products-custom .btn {
  margin-top: 28px;
}

/* ---------- Footer ---------- */
.footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  padding: 32px 0;
  font-size: 0.875rem;
}

/* Per-product legal links at the bottom of a product card (each product has its own policies) */
.product-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.product-legal a {
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.product-legal a:hover {
  color: var(--color-accent-hover);
}

/* ---------- Legal pages (AlertDocs privacy, terms, account deletion) ---------- */
.legal {
  max-width: 760px;
  line-height: 1.7;
  color: var(--color-text);
}

.legal h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  color: var(--color-primary);
  margin-bottom: 8px;
}

.legal h2 {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin: 32px 0 8px;
}

.legal p,
.legal ul,
.legal ol {
  margin-bottom: 12px;
}

.legal ul,
.legal ol {
  padding-left: 22px;
}

.legal li {
  margin-bottom: 6px;
}

.legal a {
  color: var(--color-accent-hover);
  overflow-wrap: anywhere;
}

.legal-meta {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}

/* ---------- Media Queries ---------- */

/* Small phones (up to 480px) */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .section {
    padding: 48px 0;
  }

  .hero {
    min-height: calc(80vh - var(--header-height));
    padding: 40px 0;
  }

  .btn--lg {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .wordmark {
    font-size: 1.5rem;
    line-height: 36px;
  }
}

/* Tablet (768px and up) */
@media (min-width: 768px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .process-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .why-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .product-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 28px;
    padding: 40px;
  }

  .product-icon {
    width: 96px;
    height: 96px;
    border-radius: 22px;
  }
}

/* Desktop (1024px and up) */
@media (min-width: 1024px) {
  .process-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Full menu bar only where the five links, languages and button fit */
  .mobile-menu-toggle {
    display: none;
  }

  .nav {
    display: flex;
    gap: 24px;
  }
}

@media (min-width: 1200px) {
  .nav {
    gap: 32px;
  }
}
