/* ============================================================
   base.css — MesserSoft Website Base Styles
   Imports: tokens.css (must be loaded first)
   ============================================================ */

/* ── Reset ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; font-size: 120%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Global focus rings (design system tokens) ───────────────────── */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.btn-primary:focus-visible,
.btn-red:focus-visible,
.btn-signin:focus-visible {
  outline-color: var(--focus-ring-red);
}

/* ── Typography ─────────────────────────────────────────────────── */
h1 { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; line-height: 1.3; }
p  { color: var(--text2); line-height: 1.7; }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Layout helpers ─────────────────────────────────────────────── */
.container {
  max-width: var(--max-w, 1160px);
  margin-inline: auto;
  padding-inline: var(--section-px, 28px);
}
.section { padding-block: var(--section-py, 96px); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--r);
  font-size: 0.9375rem;
  font-weight: 600;
  transition: background var(--duration-base), color var(--duration-base),
              box-shadow var(--duration-base), transform 0.12s;
  border: none;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 7px 16px; font-size: 0.8125rem; }

/* Primary (red) */
.btn-red,
.btn-primary {
  background: var(--brand-red);
  color: #fff;
}
.btn-red:hover,
.btn-primary:hover {
  background: #cc2a25;
  box-shadow: 0 4px 16px rgba(229,49,43,0.35);
}

/* Outline white (on dark backgrounds) */
.btn-outline-white {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.55);
}
.btn-outline-white:hover { background: rgba(255,255,255,0.1); border-color: #fff; }

/* Outline blue */
.btn-outline-blue,
.btn-outline {
  background: transparent;
  color: var(--brand-blue);
  border: 1.5px solid var(--brand-blue);
}
.btn-outline-blue:hover,
.btn-outline:hover { background: var(--brand-blue); color: #fff; }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--brand-blue);
  padding: 10px 0;
  font-weight: 600;
  border: none;
}
.btn-ghost:hover { color: var(--brand-blue-dark); }

/* Size variants */
.btn-sm { padding: 4px 16px; font-size: var(--text-sm); }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ── Navigation ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: var(--z-nav);
  background: var(--brand-blue);
  display: flex;
  align-items: center;
  transition: box-shadow var(--duration-nav), background var(--duration-nav);
}
.nav.scrolled {
  background: var(--brand-blue-dark);
  box-shadow: 0 2px 24px rgba(0,0,0,0.3);
}
.nav-inner {
  max-width: var(--max-w, 1160px);
  margin-inline: auto;
  padding-inline: var(--section-px, 28px);
  width: 100%;
  display: flex;
  align-items: center;
}
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 40px;
}
.nav-logo img { height: 43px; width: auto; }
.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}
.nav-link {
  color: rgba(255,255,255,0.78);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 7px;
  transition: color var(--duration-base), background var(--duration-base);
  position: relative;
}
.nav-link:hover,
.nav-link.active { color: #fff; }
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 14px; right: 14px;
  height: 2px;
  background: var(--brand-red);
  border-radius: 2px;
}
.nav-link:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
  border-radius: 7px;
}

/* Solutions dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.78);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color var(--duration-base), background var(--duration-base);
}
.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active { color: #fff; }
.nav-dropdown-toggle:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
}
.nav-dropdown-toggle svg { width: 14px; height: 14px; transition: transform var(--duration-base); }
.nav-dropdown.open .nav-dropdown-toggle svg { transform: rotate(180deg); }

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 260px;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-dropdown);
  padding: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity var(--duration-base), transform var(--duration-base);
  z-index: var(--z-dropdown);
}
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.nav-dropdown-item {
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  border-radius: 8px;
  transition: background var(--duration-base);
}
.nav-dropdown-item:hover { background: var(--bg); }
.nav-dropdown-item span:first-child {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9375rem;
}
.nav-dropdown-item span:last-child {
  font-size: 0.8125rem;
  color: var(--text3);
  font-family: 'JetBrains Mono', monospace;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* ── Language toggle ────────────────────────────────────────────── */
.lang-toggle {
  position: relative;
}
.lang-toggle > summary {
  list-style: none;
  cursor: pointer;
}
.lang-toggle > summary::-webkit-details-marker { display: none; }
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.lang-toggle-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.24);
}
.lang-toggle[open] .lang-toggle-btn {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
}
.lang-toggle-icon { opacity: 0.85; }
.lang-toggle-caret {
  opacity: 0.7;
  transition: transform var(--duration-fast);
}
.lang-toggle[open] .lang-toggle-caret { transform: rotate(180deg); }
.lang-toggle:focus-within .lang-toggle-btn {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
}
.lang-toggle-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 140px;
  background: var(--brand-blue-deeper, #0b1a2c);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r);
  padding: 6px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  z-index: calc(var(--z-nav) + 2);
  display: flex;
  flex-direction: column;
}
.lang-toggle-item {
  padding: 8px 12px;
  color: rgba(255,255,255,0.85);
  font-size: 0.875rem;
  border-radius: 6px;
  text-decoration: none;
  display: block;
}
.lang-toggle-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.lang-toggle-item.active {
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-weight: 600;
}

/* Burger */
.nav-burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  background: none;
  border: none;
}
.nav-burger:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--r-sm);
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--duration-base), opacity var(--duration-base);
}

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  background: var(--brand-blue-deeper);
  color: rgba(255,255,255,0.72);
  padding-block: var(--space-16, 64px) var(--space-10, 40px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1.2fr;
  gap: 48px;
}
.footer-col-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 16px;
}
.footer-logo { height: 28px; margin-bottom: 16px; }
.footer-tagline { font-size: 0.9375rem; color: rgba(255,255,255,0.6); line-height: 1.6; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.65);
  transition: color var(--duration-base);
}
.footer-links a:hover { color: #fff; }
.footer-links a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
  border-radius: 2px;
}
.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.65);
  margin-bottom: 10px;
}
.footer-contact-item svg { flex-shrink: 0; margin-top: 3px; }
.footer-social { display: flex; gap: 12px; margin-top: 20px; }
.footer-social a {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.6);
  transition: border-color var(--duration-base), color var(--duration-base), background var(--duration-base);
}
.footer-social a:hover { border-color: rgba(255,255,255,0.5); color: #fff; background: rgba(255,255,255,0.07); }
.footer-social a:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
}
.footer-bottom {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.35);
  flex-wrap: wrap;
  gap: 10px;
}
.footer-bottom a { color: rgba(255,255,255,0.45); }
.footer-bottom a:hover { color: rgba(255,255,255,0.75); }

/* ── Reveal animation ───────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--duration-reveal, 0.55s) var(--ease-base),
              transform var(--duration-reveal, 0.55s) var(--ease-base);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ── Video Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--overlay-black-88, rgba(0,0,0,0.88));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-modal, 0.25s);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  position: relative;
  width: min(90vw, 960px);
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.modal-box video { width: 100%; display: block; }
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 38px; height: 38px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--duration-base);
}
.modal-close:hover { background: rgba(255,255,255,0.3); }
.modal-close:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-white);
  outline-offset: var(--focus-ring-offset);
}

/* ── Toast container ────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 48px);
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg, #fff);
  border: 1px solid var(--border, #dde6ef);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  pointer-events: all;
  animation: toast-in 0.2s cubic-bezier(0.34,1.56,0.64,1) forwards;
}
.toast.removing {
  animation: toast-out 0.18s ease forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(24px); }
}
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: var(--text-sm, 0.875rem); font-weight: 600; color: var(--text); margin-bottom: 2px; }
.toast-message { font-size: var(--text-sm, 0.875rem); color: var(--text2); margin: 0; line-height: 1.5; }
.toast-close {
  background: none; border: none; color: var(--text3); cursor: pointer;
  padding: 2px; line-height: 1; flex-shrink: 0; transition: color var(--duration-fast);
}
.toast-close:hover { color: var(--text); }
.toast-success { border-left: 3px solid #22c55e; }
.toast-error   { border-left: 3px solid var(--brand-red); }
.toast-warning { border-left: 3px solid #f59e0b; }
.toast-info    { border-left: 3px solid var(--brand-blue); }
.toast-success .toast-icon { color: #22c55e; }
.toast-error   .toast-icon { color: var(--brand-red); }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info    .toast-icon { color: var(--brand-blue); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --section-py: 60px; --section-px: 20px; }

  .nav-links,
  .nav-actions { display: none; }
  .nav-burger { display: flex; }

  .nav.mobile-open {
    height: auto;
    background: var(--brand-blue-dark);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .nav.mobile-open .nav-inner {
    flex-wrap: wrap;
    align-items: flex-start;
    padding-bottom: 20px;
  }
  .nav.mobile-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 8px 0 0;
    gap: 4px;
    order: 10;
  }
  .nav.mobile-open .nav-actions {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 16px 0 0;
    gap: 8px;
    order: 11;
  }
  .nav.mobile-open .nav-actions .btn { width: 100%; justify-content: center; }

  /* Solutions dropdown: inline on mobile, no absolute flyout */
  .nav.mobile-open .nav-dropdown { width: 100%; text-align: center; }
  .nav.mobile-open .nav-dropdown-toggle { width: 100%; justify-content: center; }
  .nav.mobile-open .nav-dropdown-menu {
    position: static;
    opacity: 1;
    pointer-events: all;
    transform: none;
    display: none;
    flex-direction: column;
    box-shadow: none;
    border-radius: var(--r);
    background: rgba(255,255,255,0.08);
    padding: 4px 0;
    margin-top: 4px;
    min-width: 0;
  }
  .nav.mobile-open .nav-dropdown.open .nav-dropdown-menu {
    display: flex;
  }
  .nav.mobile-open .nav-dropdown-item {
    padding: 10px 16px;
    border-radius: 6px;
    align-items: center;
    text-align: center;
  }
  .nav.mobile-open .nav-dropdown-item:hover { background: rgba(255,255,255,0.08); }
  .nav.mobile-open .nav-dropdown-item span:first-child { color: #fff; }
  .nav.mobile-open .nav-dropdown-item span:last-child  { color: rgba(255,255,255,0.5); }

  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }

  .toast-container { bottom: 16px; right: 16px; left: 16px; max-width: none; width: auto; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
