/**
 * Safegenus Lean Stylesheet
 * Self-contained, lightweight stylesheet combining essential Base UI hard-edge
 * elements with Safegenus layout and mobile optimizations.
 * Zero external CSS bloat.
 */

/* ==========================================================================
   1. Design Tokens (Strict Light Mode)
   ========================================================================== */

:root {
  --se-font-sans: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --se-font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Menlo, Consolas, monospace;

  /* Surfaces & Canvas */
  --se-bg-canvas: #ffffff;
  --se-bg-subtle: #fafafa;
  --se-bg-surface: #ffffff;
  --se-bg-muted: #f5f5f5;
  --se-bg-hover: #eeeeee;

  /* Borders */
  --se-border: #e5e5e5;
  --se-border-subtle: #f0f0f0;
  --se-border-strong: #000000;
  --se-border-focus: #CD1818;

  /* Text Colors (Full Black & Pure Neutral Tones) */
  --se-text-primary: #000000;
  --se-text-secondary: #222222;
  --se-text-muted: #666666;
  --se-text-inverse: #ffffff;

  /* Brand / Action Colors (SafeGenus Crimson #CD1818) */
  --se-primary: #CD1818;
  --se-primary-hover: #b31414;
  --se-primary-active: #961010;
  --se-primary-text: #ffffff;
  --se-primary-subtle: #fff5f5;
  --se-primary-muted: rgba(205, 24, 24, 0.08);
  --se-primary-border: rgba(205, 24, 24, 0.25);
  --se-danger: #CD1818;

  /* Shadows */
  --se-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --se-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --se-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

  /* Transitions */
  --se-transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --se-transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Enforce light color scheme even if OS requests dark */
@media (prefers-color-scheme: dark) {
  :root, html, body {
    color-scheme: light !important;
  }
}

/* ==========================================================================
   2. Strict Hard-Edge Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
  word-break: break-word;
  overflow-wrap: break-word;
}

html {
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--se-font-sans);
  background-color: var(--se-bg-canvas);
  color: var(--se-text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100vw;
}

main.site-main {
  flex: 1;
}

a {
  color: var(--se-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--se-transition-fast);
}

a:hover {
  color: var(--se-primary-hover);
}

:focus-visible {
  outline: 2px solid var(--se-primary);
  outline-offset: 2px;
}

/* ==========================================================================
   3. Essential SEUI Components (Buttons, Cards, Grids, Forms)
   ========================================================================== */

/* Buttons */
.se-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--se-font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  padding: 0.625rem 1rem;
  background-color: transparent;
  color: var(--se-text-primary);
  text-decoration: none;
  transition: background-color var(--se-transition-fast),
              border-color var(--se-transition-fast),
              color var(--se-transition-fast),
              transform var(--se-transition-fast);
}

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

.se-btn-primary {
  background-color: var(--se-primary);
  color: var(--se-primary-text);
  border-color: var(--se-primary);
}

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

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

.se-btn-outline {
  background-color: transparent;
  color: var(--se-primary);
  border-color: var(--se-primary);
}

.se-btn-outline:hover {
  background-color: var(--se-primary);
  border-color: var(--se-primary);
  color: var(--se-primary-text);
}

.se-btn-outline:active {
  background-color: var(--se-primary-active);
  border-color: var(--se-primary-active);
  color: var(--se-primary-text);
}

.se-btn-sm {
  font-size: 0.8125rem;
  padding: 0.45rem 0.75rem;
  gap: 0.4rem;
}

.se-btn-md {
  font-size: 0.875rem;
  padding: 0.625rem 1rem;
}

.se-btn-lg {
  font-size: 1rem;
  padding: 0.75rem 1.25rem;
  gap: 0.6rem;
}

.se-w-full {
  width: 100%;
}

/* Cards */
.se-card {
  background-color: var(--se-bg-surface);
  border: 1px solid var(--se-border);
  box-shadow: var(--se-shadow-xs);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.se-card-header {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--se-border);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.se-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--se-text-primary);
  letter-spacing: -0.015em;
  margin: 0;
}

.se-card-body {
  flex: 1;
}

.se-stat-card {
  padding: 1.25rem 1.5rem;
}

/* Grids */
.se-grid {
  display: grid;
  gap: 1.5rem;
}

.se-grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.se-grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Forms */
.se-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.se-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--se-text-primary);
  user-select: none;
}

.se-required {
  color: var(--se-danger);
}

.se-input,
.se-textarea,
.se-select {
  width: 100%;
  font-family: var(--se-font-sans);
  font-size: 0.875rem;
  color: var(--se-text-primary);
  background-color: var(--se-bg-surface);
  border: 1px solid var(--se-border);
  padding: 0.5625rem 0.75rem;
  line-height: 1.5;
  transition: border-color var(--se-transition-fast), box-shadow var(--se-transition-fast);
}

.se-input::placeholder,
.se-textarea::placeholder {
  color: var(--se-text-muted);
}

.se-input:hover,
.se-textarea:hover,
.se-select:hover {
  border-color: var(--se-primary-border);
}

.se-input:focus,
.se-input:focus-visible,
.se-textarea:focus,
.se-textarea:focus-visible,
.se-select:focus,
.se-select:focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border-color: var(--se-primary) !important;
  box-shadow: none !important;
}

.se-textarea {
  min-height: 5rem;
  resize: vertical;
}

.se-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2' stroke-linecap='square' stroke-linejoin='miter'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
  cursor: pointer;
}

/* ==========================================================================
   4. Header & Navigation (Right-Aligned Menu)
   ========================================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--se-bg-surface);
  border-bottom: 1px solid var(--se-border);
  backdrop-filter: blur(8px);
}

.site-nav__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.site-nav__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav__logo {
  height: 28px;
  width: auto;
  display: block;
}

.site-nav__nav {
  margin-left: auto;
}

.site-nav__menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--se-text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.25rem;
  border-bottom: 2px solid transparent;
  transition: all var(--se-transition-fast);
}

.site-nav__link:hover {
  color: var(--se-primary);
  border-bottom-color: var(--se-primary-border);
}

.site-nav__link.is-active {
  color: var(--se-primary);
  border-bottom-color: var(--se-primary);
  font-weight: 600;
}

.site-nav__toggle {
  display: none;
}

/* ==========================================================================
   5. Sections: Hero, Services, CTA
   ========================================================================== */

/* Hero */
.hero-section {
  padding: 5.5rem 1.5rem 4.5rem;
  border-bottom: 1px solid var(--se-border);
  background-color: var(--se-bg-canvas);
  position: relative;
}

.hero-content {
  max-width: 52rem;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
  margin-bottom: 1.5rem;
  color: var(--se-text-primary);
}

.hero-desc {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.65;
  color: var(--se-text-secondary);
  margin-bottom: 2rem;
  font-weight: 400;
}

/* Services */
.services-section {
  padding: 4.5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--se-text-primary);
  margin-bottom: 0.5rem;
}

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

.service-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--se-border);
  background-color: var(--se-bg-surface);
  transition: border-color var(--se-transition-fast),
              box-shadow var(--se-transition-fast),
              transform var(--se-transition-fast);
}

.service-card:hover {
  border-color: var(--se-primary);
  box-shadow: 0 6px 18px rgba(205, 24, 24, 0.08);
  transform: translateY(-2px);
}

.service-card:hover .service-card__title {
  color: var(--se-primary);
}

.service-card__body {
  padding: 1.75rem 1.5rem;
  flex: 1;
}

.service-card__title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--se-text-primary);
  margin-bottom: 0.75rem;
  letter-spacing: -0.015em;
  transition: color var(--se-transition-fast);
}

.service-card__desc {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--se-text-secondary);
  margin: 0;
}

/* Call to Action Strip */
.cta-strip {
  padding: 5rem 1.5rem;
  border-top: 1px solid var(--se-border);
  border-bottom: 1px solid var(--se-border);
  background-color: var(--se-bg-subtle);
  text-align: center;
}

.cta-content {
  max-width: 42rem;
  margin: 0 auto;
}

.cta-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--se-text-primary);
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

.cta-desc {
  font-size: 1.125rem;
  color: var(--se-text-secondary);
  margin-bottom: 1.75rem;
}

/* ==========================================================================
   6. Subpages & Legal Styling
   ========================================================================== */

.page-header {
  padding: 4.5rem 1.5rem 3rem;
  border-bottom: 1px solid var(--se-border);
  background-color: var(--se-bg-subtle);
}

.page-header__container {
  max-width: 800px;
  margin: 0 auto;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--se-text-primary);
  margin-bottom: 0.75rem;
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--se-text-secondary);
  line-height: 1.6;
  margin: 0;
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}

.legal-body h2,
.legal-body h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--se-text-primary);
}

.legal-body p {
  color: var(--se-text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

/* Branded Subpage Elements */
.page-icon-box {
  width: 52px;
  height: 52px;
  border: 1px solid var(--se-primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem auto;
  background-color: var(--se-primary-subtle);
  color: var(--se-primary);
}

.se-tag-mono {
  font-family: var(--se-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--se-primary);
  letter-spacing: 0.05em;
}

.contact-label-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.35rem;
}

.contact-email-link {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--se-primary);
  text-decoration: none;
  transition: color var(--se-transition-fast);
}

.contact-email-link:hover {
  color: var(--se-primary-hover);
  text-decoration: underline;
}

/* ==========================================================================
   7. Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--se-border);
  background-color: var(--se-bg-surface);
  padding: 4rem 1.5rem 2.5rem;
  margin-top: auto;
}

.site-footer__container {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.site-footer__col-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--se-text-muted);
  margin-bottom: 1.25rem;
}

.site-footer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.site-footer__link {
  font-size: 0.875rem;
  color: var(--se-text-secondary);
  text-decoration: none;
  transition: color var(--se-transition-fast);
}

.site-footer__link:hover {
  color: var(--se-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer__bottom {
  border-top: 1px solid var(--se-border);
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-footer__copyright {
  font-size: 0.8125rem;
  color: var(--se-text-muted);
  margin: 0;
}

/* ==========================================================================
   8. Responsive & Mobile Screen Optimizations (<= 768px)
   ========================================================================== */

@media (max-width: 768px) {
  /* Navbar Mobile */
  .site-nav__container {
    justify-content: space-between;
    gap: 1rem;
    height: 60px;
    padding: 0 1rem;
  }

  .site-nav__logo {
    height: 24px;
  }

  .site-nav__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid var(--se-border-strong);
    padding: 0.45rem 0.75rem;
    font-family: var(--se-font-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--se-text-primary);
    cursor: pointer;
    line-height: 1;
    user-select: none;
    transition: background-color var(--se-transition-fast), border-color var(--se-transition-fast);
  }

  .site-nav__toggle:hover,
  .site-nav__toggle:active {
    background-color: var(--se-primary-subtle);
    border-color: var(--se-primary);
    color: var(--se-primary);
  }

  .site-nav__toggle-icon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 14px;
    height: 11px;
    position: relative;
  }

  .site-nav__toggle-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: currentColor;
    transition: transform var(--se-transition-fast), opacity var(--se-transition-fast);
  }

  .site-nav.is-open .site-nav__toggle-icon span:nth-child(1) {
    transform: translateY(4.5px) rotate(45deg);
  }

  .site-nav.is-open .site-nav__toggle-icon span:nth-child(2) {
    opacity: 0;
  }

  .site-nav.is-open .site-nav__toggle-icon span:nth-child(3) {
    transform: translateY(-4.5px) rotate(-45deg);
  }

  .site-nav__nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--se-bg-surface);
    border-bottom: 2px solid var(--se-border-strong);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    padding: 0.75rem 1rem 1rem;
    z-index: 50;
  }

  .site-nav.is-open .site-nav__nav {
    display: block;
  }

  .site-nav__menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: 100%;
  }

  .site-nav__menu li {
    width: 100%;
  }

  .site-nav__link {
    display: block;
    width: 100%;
    padding: 0.85rem 0.75rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--se-border-subtle);
  }

  .site-nav__link:hover {
    background-color: var(--se-bg-subtle);
    color: var(--se-primary);
  }

  .site-nav__link.is-active {
    background-color: var(--se-primary-subtle);
    border-bottom-color: var(--se-border-subtle);
    border-left: 3px solid var(--se-primary);
    color: var(--se-primary);
    font-weight: 600;
  }

  /* Hero Mobile */
  .hero-section {
    padding: 3rem 1rem 2.5rem;
  }

  .hero-title {
    font-size: clamp(1.85rem, 6vw, 2.35rem);
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
  }

  .hero-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
  }

  .hero-content div[style*="display: flex"] {
    flex-direction: column;
    gap: 0.75rem !important;
    width: 100%;
  }

  .hero-content .se-btn {
    width: 100%;
    justify-content: center;
  }

  /* Services Mobile */
  .services-section {
    padding: 3rem 1rem;
  }

  .section-header {
    margin-bottom: 2.5rem;
  }

  .section-title {
    font-size: 1.65rem;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .service-card__body {
    padding: 1.25rem;
  }

  /* CTA Mobile */
  .cta-strip {
    padding: 3.5rem 1rem;
  }

  .cta-title {
    font-size: 1.65rem;
  }

  .cta-desc {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .cta-content .se-btn {
    width: 100%;
    justify-content: center;
  }

  /* Subpages Mobile */
  .page-header {
    padding: 2.5rem 1rem 2rem;
  }

  .page-title {
    font-size: 1.85rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .page-content {
    padding: 2rem 1rem;
  }

  /* Grids collapse */
  .se-grid-cols-1,
  .se-grid-cols-2,
  .se-grid-cols-3,
  .se-grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  /* Form & Inputs: 16px prevents iOS Safari auto-zoom */
  .se-input,
  .se-select,
  .se-textarea {
    font-size: 16px !important;
    padding: 0.65rem 0.75rem;
  }

  .se-card {
    padding: 1.25rem !important;
  }

  .se-card-header,
  .se-card-body,
  .se-card-footer {
    padding: 1rem 0 !important;
  }

  /* Footer Mobile */
  .site-footer {
    padding: 3rem 1rem 2rem;
  }

  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2.5rem;
  }

  .site-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
