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

html {
  scroll-behavior: smooth;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  .fade-in {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ── Theme Transition (applied by JS only, skipped for reduced-motion users) ── */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color 0.28s ease,
    color 0.22s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease !important;
}

/* ════════════════════════════════════════════
   THEME VARIABLES
   Default + [data-theme="dark"] = dark
   :root:not([data-theme]) + prefers light  = auto-light
   [data-theme="light"]                     = explicit light
════════════════════════════════════════════ */

:root,
[data-theme="dark"] {
  /* Backgrounds */
  --bg:          #0b0e0d;
  --bg-alt:      #0e1210;
  --bg-card:     #101613;
  --bg-footer:   #090c0b;
  --bg-header:   rgba(11, 14, 13, 0.96);
  --bg-nav-mob:  rgba(9, 12, 11, 0.98);

  /* Borders */
  --border:          #1a2320;
  --border-hover:    #2d4038;
  --border-footer:   #161d1b;
  --border-contact:  #1e3530;

  /* Text */
  --text-h:       #ffffff;
  --text-body:    #c4ccc9;
  --text-muted:   #7a9090;
  --text-subtle:  #5a7070;
  --text-faint:   #425555;
  --text-feature: #a8bfba;
  --text-nav:     #7a9090;
  --text-nav-h:   #d4e8e3;

  /* Accent (buttons, dots — same both themes) */
  --accent:      #0d9488;
  --accent-h:    #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.3);
  --focus:       #14b8a6;

  /* Interactive links / login pill / contact */
  --link:             #2dd4bf;
  --link-h:           #5eead4;
  --link-border:      rgba(45, 212, 191, 0.25);
  --link-border-h:    rgba(45, 212, 191, 0.55);
  --link-bg-h:        rgba(45, 212, 191, 0.06);
  --contact-border-h: rgba(45, 212, 191, 0.38);
  --contact-bg-h:     rgba(45, 212, 191, 0.04);

  /* Hero gradient */
  --hero-bg: linear-gradient(180deg, #0b0e0d 0%, #0e1511 55%, #0b0e0d 100%);

  /* Cards */
  --card-shadow:       none;
  --card-shadow-hover: 0 4px 28px rgba(0, 0, 0, 0.5);

  /* Security note */
  --security-bg:     transparent;
  --security-border: transparent;

  /* Theme toggle icon */
  --toggle-color:   #7a9090;
  --toggle-color-h: #c4ccc9;
  --toggle-bg-h:    rgba(255, 255, 255, 0.07);
}

/* Auto light (system prefers light, no explicit override) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg:          #f5f9f7;
    --bg-alt:      #ebf3ef;
    --bg-card:     #ffffff;
    --bg-footer:   #e0ece7;
    --bg-header:   rgba(245, 249, 247, 0.96);
    --bg-nav-mob:  rgba(238, 246, 242, 0.98);

    --border:         #c5dbd3;
    --border-hover:   #93bdb0;
    --border-footer:  #c5dbd3;
    --border-contact: #c5dbd3;

    --text-h:       #0c1e18;
    --text-body:    #213830;
    --text-muted:   #476860;
    --text-subtle:  #648878;
    --text-faint:   #88a89e;
    --text-feature: #213830;
    --text-nav:     #476860;
    --text-nav-h:   #0c1e18;

    --accent:      #0d9488;
    --accent-h:    #0f766e;
    --accent-glow: rgba(13, 148, 136, 0.2);
    --focus:       #0d9488;

    --link:             #0d9488;
    --link-h:           #0f766e;
    --link-border:      rgba(13, 148, 136, 0.28);
    --link-border-h:    rgba(13, 148, 136, 0.58);
    --link-bg-h:        rgba(13, 148, 136, 0.06);
    --contact-border-h: rgba(13, 148, 136, 0.38);
    --contact-bg-h:     rgba(13, 148, 136, 0.04);

    --hero-bg: linear-gradient(180deg, #f5f9f7 0%, #e8f2ed 55%, #f5f9f7 100%);

    --card-shadow:       0 1px 4px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);

    --security-bg:     rgba(13, 148, 136, 0.05);
    --security-border: rgba(13, 148, 136, 0.15);

    --toggle-color:   #577068;
    --toggle-color-h: #0c1e18;
    --toggle-bg-h:    rgba(0, 0, 0, 0.06);
  }
}

/* Explicit light */
[data-theme="light"] {
  --bg:          #f5f9f7;
  --bg-alt:      #ebf3ef;
  --bg-card:     #ffffff;
  --bg-footer:   #e0ece7;
  --bg-header:   rgba(245, 249, 247, 0.96);
  --bg-nav-mob:  rgba(238, 246, 242, 0.98);

  --border:         #c5dbd3;
  --border-hover:   #93bdb0;
  --border-footer:  #c5dbd3;
  --border-contact: #c5dbd3;

  --text-h:       #0c1e18;
  --text-body:    #213830;
  --text-muted:   #476860;
  --text-subtle:  #648878;
  --text-faint:   #88a89e;
  --text-feature: #213830;
  --text-nav:     #476860;
  --text-nav-h:   #0c1e18;

  --accent:      #0d9488;
  --accent-h:    #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.2);
  --focus:       #0d9488;

  --link:             #0d9488;
  --link-h:           #0f766e;
  --link-border:      rgba(13, 148, 136, 0.28);
  --link-border-h:    rgba(13, 148, 136, 0.58);
  --link-bg-h:        rgba(13, 148, 136, 0.06);
  --contact-border-h: rgba(13, 148, 136, 0.38);
  --contact-bg-h:     rgba(13, 148, 136, 0.04);

  --hero-bg: linear-gradient(180deg, #f5f9f7 0%, #e8f2ed 55%, #f5f9f7 100%);

  --card-shadow:       0 1px 4px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.1);

  --security-bg:     rgba(13, 148, 136, 0.05);
  --security-border: rgba(13, 148, 136, 0.15);

  --toggle-color:   #577068;
  --toggle-color-h: #0c1e18;
  --toggle-bg-h:    rgba(0, 0, 0, 0.06);
}

/* ── Body ── */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-body);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Focus States ── */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ── Container ── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.75rem;
}

/* ── Header ── */
.header {
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  height: 64px;
}

/* ── Brand / Logo ── */
.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: auto;
}

.brand-logo {
  height: 36px;
  width: auto;
  display: block;
}

/* Logo switching: dark logo visible by default (dark is default theme) */
.brand-logo--light { display: none; }
.brand-logo--dark  { display: block; }

/* Auto mode + system prefers light → show light logo */
@media (prefers-color-scheme: light) {
  html:not([data-theme]) .brand-logo--dark  { display: none; }
  html:not([data-theme]) .brand-logo--light { display: block; }
}

/* Explicit dark */
[data-theme="dark"] .brand-logo--dark  { display: block; }
[data-theme="dark"] .brand-logo--light { display: none; }

/* Explicit light */
[data-theme="light"] .brand-logo--dark  { display: none; }
[data-theme="light"] .brand-logo--light { display: block; }

/* ── Header Actions (theme toggle + hamburger group) ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  margin-left: 1.5rem;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: var(--toggle-color);
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--toggle-color-h);
  background: var(--toggle-bg-h);
}

/* ── Mobile Nav Toggle ── */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 5px;
  border-radius: 4px;
}

.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-body);
  border-radius: 1px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Navigation ── */
.nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-nav);
  transition: color 0.2s;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  color: var(--text-nav-h);
}

.nav-link--login {
  color: var(--link);
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--link-border);
  border-radius: 5px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-link--login:hover {
  color: var(--link-h);
  border-color: var(--link-border-h);
  background: var(--link-bg-h);
}

/* ── Hero ── */
.hero {
  padding: 8rem 0 6rem;
  text-align: center;
  background: var(--hero-bg);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-icon {
  height: 88px;
  width: auto;
  margin-bottom: 0.25rem;
  opacity: 0.92;
}

.hero-title {
  font-size: 3.75rem;
  font-weight: 800;
  color: var(--text-h);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.8;
}

/* ── Button ── */
.btn {
  display: inline-block;
  padding: 0.875rem 2.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s, transform 0.12s, box-shadow 0.2s;
  cursor: pointer;
  border: none;
  text-align: center;
  margin-top: 0.5rem;
}

.btn:active {
  transform: scale(0.97);
}

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

.btn--primary:hover {
  background: var(--accent-h);
  box-shadow: 0 4px 24px var(--accent-glow);
}

/* ── Sections ── */
.section {
  padding: 5rem 0;
}

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

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}

.section-title {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── Cards ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 960px;
  margin: 0 auto;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.75rem;
  box-shadow: var(--card-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--card-shadow-hover);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-h);
  margin-bottom: 0.6rem;
  letter-spacing: -0.01em;
}

.card-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ── Feature List (LIMS) ── */
.feature-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 3rem;
  max-width: 640px;
  margin: 0 auto;
}

.feature-item {
  font-size: 0.95rem;
  color: var(--text-feature);
  padding: 0.7rem 0 0.7rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.feature-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Security Note ── */
.security-note {
  text-align: center;
  padding: 1.1rem 1.5rem;
  max-width: 540px;
  margin: 0 auto;
  background: var(--security-bg);
  border: 1px solid var(--security-border);
  border-radius: 8px;
}

.security-note p {
  font-size: 0.9rem;
  color: var(--text-subtle);
  font-style: italic;
  line-height: 1.75;
}

/* ── Contact ── */
.contact-inner {
  text-align: center;
}

.contact-lead {
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.contact-email {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--link);
  padding: 0.875rem 2rem;
  border: 1px solid var(--border-contact);
  border-radius: 8px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.contact-email:hover {
  border-color: var(--contact-border-h);
  color: var(--link-h);
  background: var(--contact-bg-h);
}

/* ── Footer ── */
.footer {
  margin-top: auto;
  background: var(--bg-footer);
  border-top: 1px solid var(--border-footer);
  padding: 2.25rem 0;
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer p {
  font-size: 0.82rem;
  color: var(--text-subtle);
}

.footer-note {
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ── Fade-in ── */
.fade-in {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive — Tablet ── */
@media (max-width: 860px) {
  .cards-grid {
    grid-template-columns: 1fr;
    max-width: 500px;
  }

  .feature-list {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .hero-icon {
    height: 72px;
  }
}

/* ── Responsive — Mobile ── */
@media (max-width: 768px) {
  .brand-logo {
    height: 28px;
  }

  .header-actions {
    margin-left: 0.5rem;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
  }

  .hero {
    padding: 5rem 0 4rem;
  }

  .hero-icon {
    height: 60px;
  }

  .hero-title {
    font-size: 2.6rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .section {
    padding: 3.5rem 0;
  }

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

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

  .nav-toggle {
    display: flex;
  }

  .nav {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-nav-mob);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.75rem 1.5rem;
    gap: 0.9rem;
  }

  .nav.open {
    display: flex;
  }

  .nav-link--login {
    align-self: flex-start;
  }

  .header-inner {
    position: relative;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.1rem;
  }

  .btn {
    width: 100%;
    max-width: 280px;
  }

  .contact-email {
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
  }
}
