/* ========================================
   Cơ Khí An Khang — Global stylesheet
   Mobile-first. Test from 360px → desktop.
   ======================================== */

:root {
  --c-primary: #0d2c4d;
  --c-primary-dark: #081f37;
  --c-primary-light: #1e4a78;
  --c-accent: #e85d04;
  --c-accent-dark: #c14a02;
  --c-text: #1a1a1a;
  --c-text-muted: #5a6470;
  --c-bg: #ffffff;
  --c-bg-alt: #f5f7fa;
  --c-border: #d8dee6;
  --c-shadow: 0 2px 8px rgba(13, 44, 77, 0.08);
  --c-shadow-lg: 0 8px 24px rgba(13, 44, 77, 0.12);
  --radius: 6px;
  --radius-lg: 12px;
  --container: 1200px;
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-accent); }
button { cursor: pointer; font: inherit; border: none; background: none; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 16px;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--c-shadow);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 8px;
  flex-wrap: nowrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--c-primary);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--c-primary);
  color: #fff;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1rem;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logo-text > span { overflow: hidden; text-overflow: ellipsis; }
.logo-text small {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--c-text-muted);
  display: none; /* ẩn subtitle ở mobile để dành chỗ cho logo + flag */
}

/* Mobile nav toggle */
.nav-toggle {
  display: block;
  width: 40px;
  height: 40px;
  position: relative;
  z-index: 110;
  flex-shrink: 0;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  position: absolute;
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-primary);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle span { left: 9px; top: 50%; transform: translateY(-50%); }
.nav-toggle span::before { content: ""; top: -7px; }
.nav-toggle span::after  { content: ""; top:  7px; }
.nav-toggle.is-open span { background: transparent; }
.nav-toggle.is-open span::before { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.is-open span::after  { transform: rotate(-45deg) translate(5px, -5px); }

.main-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90; /* thấp hơn .site-header (100) để header luôn ở trên */
  background: var(--c-bg);
  padding: 24px 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  border-bottom: 1px solid var(--c-border);
  overflow-y: auto;
}
.main-nav.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.main-nav ul { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.main-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--c-text);
  font-weight: 500;
}
.main-nav a:hover, .main-nav a.is-active {
  background: var(--c-bg-alt);
  color: var(--c-primary);
}

/* Language switcher (2 flags) */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  flex-shrink: 0;
}
.lang-btn {
  width: 32px;
  height: 24px;
  border-radius: 3px;
  overflow: hidden;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  border: 2px solid transparent;
  padding: 0;
  background: var(--c-bg-alt);
  display: grid;
  place-items: center;
}
.lang-btn:hover { opacity: 0.85; transform: scale(1.05); }
.lang-btn.is-active {
  opacity: 1;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 1px rgba(232, 93, 4, 0.2);
}
.lang-btn svg { width: 100%; height: 100%; display: block; }

/* ========== Hero ========== */
.hero {
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-primary-dark) 100%);
  color: #fff;
  padding: 56px 0 64px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top right, rgba(232, 93, 4, 0.18), transparent 60%);
  pointer-events: none;
}
.hero-content { position: relative; max-width: 720px; }
.hero h1 {
  font-size: 1.85rem;
  line-height: 1.2;
  margin-bottom: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.hero p {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 24px;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary {
  background: var(--c-accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--c-accent-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--c-shadow-lg);
}
.btn-outline {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}
.btn-outline:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: #fff;
}
.btn-secondary {
  background: var(--c-bg-alt);
  color: var(--c-primary);
  border-color: var(--c-border);
}
.btn-secondary:hover {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}
.btn-block { width: 100%; }

/* ========== Sections ========== */
section { padding: 56px 0; }
section.alt { background: var(--c-bg-alt); }

.section-head { text-align: center; margin-bottom: 36px; }
.section-head h2 {
  font-size: 1.6rem;
  color: var(--c-primary);
  margin-bottom: 8px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.section-head p { color: var(--c-text-muted); max-width: 640px; margin: 0 auto; }

/* ========== Service cards ========== */
.feature-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
.feature {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.feature:hover {
  transform: translateY(-3px);
  box-shadow: var(--c-shadow-lg);
  border-color: var(--c-primary-light);
}
.feature-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--c-bg-alt);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--c-accent);
  font-size: 1.5rem;
}
.feature h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--c-primary);
}
.feature p { color: var(--c-text-muted); font-size: 0.92rem; }

/* ========== Category chips ========== */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}
.category-tab {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--c-bg-alt);
  color: var(--c-text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid var(--c-border);
  transition: all 0.15s ease;
}
.category-tab:hover { color: var(--c-primary); border-color: var(--c-primary-light); }
.category-tab.is-active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* ========== Product grid ========== */
.product-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, 1fr);
}

.product-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--c-shadow-lg);
}
.product-img {
  aspect-ratio: 4 / 3;
  background: var(--c-bg-alt);
  overflow: hidden;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .product-img img { transform: scale(1.04); }
.product-body { padding: 12px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--c-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.product-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--c-primary);
  line-height: 1.3;
}
.product-card .btn {
  margin-top: auto;
  padding: 8px 12px;
  font-size: 0.85rem;
}

/* ========== Contact info / cards ========== */
.contact-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
.contact-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
}
.contact-card h3 {
  color: var(--c-primary);
  margin-bottom: 12px;
  font-size: 1.1rem;
}
.contact-card .meta {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--c-text);
  font-size: 0.95rem;
}
.contact-card .meta strong { color: var(--c-primary); }
.contact-card .meta .icon { color: var(--c-accent); flex-shrink: 0; margin-top: 2px; }

/* ========== Form ========== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-primary);
}
.form-group label .req { color: var(--c-accent); }
.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 14px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--c-bg);
  color: var(--c-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--c-primary-light);
  box-shadow: 0 0 0 3px rgba(30, 74, 120, 0.12);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form .hint { color: var(--c-text-muted); font-size: 0.85rem; }

/* ========== Footer ========== */
.site-footer {
  background: var(--c-primary-dark);
  color: rgba(255,255,255,0.85);
  padding: 48px 0 24px;
  font-size: 0.92rem;
}
.footer-grid {
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr;
  margin-bottom: 32px;
}
.site-footer h4 {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 14px;
  font-weight: 700;
}
.site-footer a { color: rgba(255,255,255,0.85); }
.site-footer a:hover { color: var(--c-accent); }
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.site-footer .meta { display: block; margin-bottom: 6px; font-size: 0.9rem; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: 20px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
}
.footer-credit {
  margin-top: 10px;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
}
.footer-credit a {
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  border-bottom: 1px dotted rgba(255,255,255,0.3);
}
.footer-credit a:hover { color: var(--c-accent); border-bottom-color: var(--c-accent); }

/* ========== Floating contact ========== */
.float-contact {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}
.float-contact a {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.4rem;
  box-shadow: var(--c-shadow-lg);
  transition: transform 0.15s ease;
}
.float-contact a:hover { transform: scale(1.08); color: #fff; }
.float-contact .phone { background: #16a34a; }
.float-contact .zalo  { background: #0068ff; font-weight: 800; font-size: 0.9rem; }

/* ========== Utility ========== */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 32px; }
.lead { font-size: 1.05rem; color: var(--c-text-muted); }

/* ========== Responsive ========== */
@media (min-width: 640px) {
  .hero { padding: 80px 0 96px; }
  .hero h1 { font-size: 2.4rem; }
  .product-grid { grid-template-columns: repeat(3, 1fr); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; }
  .section-head h2 { font-size: 2rem; }
  section { padding: 80px 0; }
  .logo { font-size: 1.05rem; gap: 10px; }
  .logo-text small { display: block; } /* hiện subtitle khi đủ chỗ */
}

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .main-nav {
    position: static;
    top: auto; left: auto; right: auto; bottom: auto;
    z-index: auto;
    padding: 0;
    background: transparent;
    border: none;
    overflow: visible;
    flex: 1;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .main-nav ul {
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
  }
  .main-nav a { padding: 10px 14px; font-size: 0.95rem; }
  .lang-switcher { margin-left: 16px; margin-right: 0; }
  .hero h1 { font-size: 2.8rem; }
  .product-grid { grid-template-columns: repeat(4, 1fr); }
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
  .contact-form-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
  }
}
