/* ezmesh.ai.kr - common.css
   Shared tokens and components, carried over from ezauto.ai.kr common.css
   (same LDS brand family). Bootstrap is not used: the few pieces ezauto took
   from it (.container, .container-xxl, .fixed-top, reboot basics) are defined
   here, so the layout also holds on closed networks. */

/* ===== DESIGN TOKENS ===== */
:root {
  /* Colors (ezauto) */
  --color-primary: #d20001;
  --color-primary-dark: #a10001;
  --color-accent: #d20001;
  --color-text: #1a1a1a;
  --color-text-secondary: #555555;
  --color-bg: #ffffff;
  --color-surface: #f8f9fa;
  --color-border: #e0e0e0;
  --color-error: #e74c3c;
  --color-visited: #4a235a;
  /* ezmesh additions */
  --color-callout: #1b7f7f;   /* numbered callouts in the console screenshots */
  --color-logo: #3f4453;      /* ezmesh wordmark */

  /* Spacing (8px base) */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;
  --space-3xl: 80px;
  --space-4xl: 96px;
  --space-section: 80px;

  /* Layout */
  --nav-h: 70px;
  --radius: 8px;
  --radius-lg: 12px;

  /* Typography */
  --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
  --text-h1: clamp(2.5rem, 5vw, 3.5rem);
  --text-h2: clamp(1.5rem, 1.1rem + 2vw, 2rem);
  --text-h3: 1.25rem;
  --text-body: 1rem;
  --text-caption: 0.875rem;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--color-text-secondary);
  overflow-x: hidden;
  padding-top: var(--nav-h);
  background: var(--color-bg);
  word-break: keep-all;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: 0.5rem;
}

h1 {
  font-size: var(--text-h1);
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: var(--text-h2);
  font-weight: 700;
  line-height: 1.3;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  line-height: 1.4;
}

p {
  margin-top: 0;
  margin-bottom: var(--space-sm);
}

small {
  font-size: 0.875em;
}

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

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

a:visited {
  color: var(--color-visited);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

svg {
  vertical-align: middle;
}

button {
  font-family: inherit;
}

table {
  border-collapse: collapse;
}

[hidden] {
  display: none !important;
}

main:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== LAYOUT (replaces Bootstrap grid containers) ===== */
.container,
.container-xxl {
  width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
  margin-right: auto;
  margin-left: auto;
}

@media (max-width: 575.98px) {
  .container,
  .container-xxl {
    padding-right: 1rem;
    padding-left: 1rem;
  }
}

@media (min-width: 576px) { .container { max-width: 540px; } }
@media (min-width: 768px) { .container { max-width: 720px; } }
@media (min-width: 992px) { .container { max-width: 960px; } }
@media (min-width: 1200px) { .container { max-width: 1140px; } }
@media (min-width: 1400px) {
  .container,
  .container-xxl { max-width: 1320px; }
}

.fixed-top {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1030;
}

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-sm);
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 4px;
  z-index: 9999;
  font-size: var(--text-caption);
}

.skip-link:focus,
.skip-link:visited {
  color: #fff;
}

.skip-link:focus {
  top: var(--space-xs);
}

/* ===== FOCUS RING ===== */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== NAVBAR ===== */
.ezauto-navbar {
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 1000;
  transition: background var(--transition-base), box-shadow var(--transition-base);
  height: var(--nav-h);
}

.ezauto-navbar.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: var(--nav-h);
}

.ezauto-nav-logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
}

.logo-image {
  height: 26px;
  width: auto;
}

.ezauto-nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.ezauto-nav-menu .nav-link,
.ezauto-nav-menu .nav-link:visited {
  display: block;
  color: var(--color-text);
  font-weight: 500;
  text-decoration: none;
  padding: 0.5rem 0;
  position: relative;
  transition: color var(--transition-base);
  font-size: var(--text-caption);
}

.ezauto-nav-menu .nav-link:hover,
.ezauto-nav-menu .nav-link.active {
  color: var(--color-accent);
}

.ezauto-nav-menu .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--transition-base);
}

.ezauto-nav-menu .nav-link:hover::after,
.ezauto-nav-menu .nav-link.active::after {
  width: 100%;
}

/* Plain text link on the right of a minimal navbar (404) */
.nav-home-link,
.nav-home-link:visited {
  color: var(--color-text);
  font-size: var(--text-caption);
  font-weight: 500;
  padding: 0.5rem 0;
}

.nav-home-link:hover {
  color: var(--color-accent);
}

/* Mobile nav toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-xs);
  color: var(--color-text);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

/* ===== BUTTONS ===== */
.btn-primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: var(--color-primary);
  color: #fff;
  font-size: var(--text-body);
  font-weight: 600;
  font-family: var(--font-family);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), transform 0.1s ease, box-shadow var(--transition-fast);
  min-height: 44px;
}

.btn-primary-cta:visited {
  color: #fff;
}

.btn-primary-cta:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(210, 0, 1, 0.3);
  color: #fff;
}

.btn-primary-cta:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: transparent;
  color: var(--color-primary);
  font-size: var(--text-body);
  font-weight: 600;
  font-family: var(--font-family);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition-fast), transform 0.1s ease, border-color var(--transition-fast);
  min-height: 44px;
}

.btn-secondary-cta:visited {
  color: var(--color-primary);
}

.btn-secondary-cta:hover {
  background: var(--color-surface);
  border-color: var(--color-accent);
  color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-secondary-cta:active {
  transform: translateY(0) scale(0.98);
}

/* Light variant for dark backgrounds */
.btn-primary-cta.on-dark,
.btn-primary-cta.on-dark:visited {
  background: #fff;
  color: var(--color-primary);
}

.btn-primary-cta.on-dark:hover {
  background: var(--color-surface);
  color: var(--color-primary-dark);
}

.btn-secondary-cta.on-dark,
.btn-secondary-cta.on-dark:visited {
  border-color: rgba(255, 255, 255, 0.6);
  color: #fff;
}

.btn-secondary-cta.on-dark:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

/* ===== SECTION TITLE ===== */
.section-label {
  display: block;
  text-align: center;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.section-title {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.section-desc {
  text-align: center;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-xl);
  color: var(--color-text-secondary);
}

.section-title + .section-desc {
  margin-top: calc(-1 * var(--space-md));
}

/* ===== FOOTER (shared) ===== */
.footer {
  background: var(--color-text);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-3xl) 0 var(--space-lg);
}

.footer h2 {
  color: #fff;
  font-size: var(--text-caption);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer ul li {
  margin-bottom: var(--space-xs);
}

.footer a,
.footer a:visited {
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--text-caption);
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: #fff;
}

.footer :focus-visible {
  outline-color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  text-align: center;
  font-size: var(--text-caption);
}

.footer-bottom p {
  margin: 0;
}

.nowrap {
  white-space: nowrap;
}

/* Minimal footer (404) */
.footer-min {
  padding: var(--space-lg) 0;
}

.footer-min .footer-bottom {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

/* ===== 404 ===== */
.notfound {
  min-height: calc(100vh - var(--nav-h) - 90px);
  display: flex;
  align-items: center;
  text-align: center;
  padding: var(--space-3xl) 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.notfound-code {
  font-size: clamp(4rem, 14vw, 7rem);
  font-weight: 700;
  line-height: 1;
  color: var(--color-primary);
  font-family: var(--font-mono);
  margin-bottom: var(--space-sm);
}

.notfound-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-lg);
}

/* ===== ANIMATIONS ===== */
/* 1. Hero reveal */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 2. Section entrance. main.js adds .reveal-ready to <html> only when it can
   also reveal the sections again, so content never stays hidden without JS. */
.animate-on-scroll {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal-ready .animate-on-scroll:not(.visible) {
  opacity: 0;
  transform: translateY(20px);
}

/* Stagger children */
.animate-on-scroll.visible .stagger-child:nth-child(1) { transition-delay: 0ms; }
.animate-on-scroll.visible .stagger-child:nth-child(2) { transition-delay: 100ms; }
.animate-on-scroll.visible .stagger-child:nth-child(3) { transition-delay: 200ms; }
.animate-on-scroll.visible .stagger-child:nth-child(4) { transition-delay: 300ms; }

/* 3. Count-up handled in JS */

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

  html {
    scroll-behavior: auto;
  }

  .animate-on-scroll,
  .reveal-ready .animate-on-scroll:not(.visible) {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn-primary-cta:hover,
  .btn-secondary-cta:hover {
    transform: none;
  }
}

/* ===== MOBILE NAV ===== */
@media (max-width: 767.98px) {
  :root {
    --space-section: 48px;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .ezauto-nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    gap: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: var(--space-xs) var(--space-sm) var(--space-sm);
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
  }

  .ezauto-nav-menu.show {
    display: flex;
  }

  .ezauto-nav-menu .nav-link,
  .ezauto-nav-menu .nav-link:visited {
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
    min-height: 44px;
    display: flex;
    align-items: center;
    font-size: var(--text-body);
  }

  .ezauto-nav-menu li:last-child .nav-link {
    border-bottom: none;
  }

  .ezauto-nav-menu .nav-link::after {
    display: none;
  }

  /* Without JS the toggle cannot work: show the five links in a second row
     of a non-fixed header instead of hiding them. */
  html.no-js {
    scroll-padding-top: 0;
  }

  .no-js body {
    padding-top: 0;
  }

  .no-js .ezauto-navbar {
    position: static;
    height: auto;
  }

  .no-js .nav-inner {
    flex-wrap: wrap;
    align-content: flex-start;
    height: auto;
    padding-top: var(--space-sm);
  }

  .no-js .mobile-toggle {
    display: none;
  }

  .no-js .ezauto-nav-menu {
    display: flex;
    position: static;
    flex-basis: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 var(--space-md);
    padding: 0 0 var(--space-xs);
    background: transparent;
    box-shadow: none;
    border-top: 0;
    max-height: none;
  }

  .no-js .ezauto-nav-menu .nav-link,
  .no-js .ezauto-nav-menu .nav-link:visited {
    border-bottom: 0;
    padding: 8px 0;
  }
}
