/* ==========================================================================
   NAAMS Standards – Redesigned UI
   Brand: USCAR Red (#C8102E) / USCAR Navy (#002D72)
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
  --uscar-red: #C8102E;
  --uscar-red-dark: #A00D24;
  --uscar-navy: #002D72;
  --uscar-navy-light: #003D99;
  --uscar-navy-dark: #001F50;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #6C757D;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
  --max-width: 1280px;
  --header-height: 72px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--uscar-navy); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--uscar-red); }

/* ---------- Skip Navigation ---------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 200;
  padding: 0.75rem 1.5rem;
  background: var(--uscar-navy);
  color: var(--white);
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
  color: var(--white);
}

/* ---------- Focus Visible ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--uscar-navy);
  outline-offset: 2px;
}

/* ---------- Visually Hidden (screen readers only) ---------- */
.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;
}

img { max-width: 100%; height: auto; display: block; }

/* ---------- Header / Navigation ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 3px solid var(--uscar-red);
  box-shadow: var(--shadow-sm);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-group img {
  height: 44px;
  width: auto;
}

.logo-group .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-group .brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--uscar-navy);
  letter-spacing: -0.02em;
}

.logo-group .brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.main-nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--gray-100);
  color: var(--uscar-navy);
}

.main-nav a.active {
  background: var(--uscar-navy);
  color: var(--white);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--gray-800);
  margin: 5px 0;
  transition: all 0.3s ease;
  transform-origin: center;
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero Section ---------- */
.hero {
  background: linear-gradient(135deg, var(--uscar-navy) 0%, var(--uscar-navy-dark) 100%);
  color: var(--white);
  padding: 4rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(200, 16, 46, 0.08);
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  line-height: 1.15;
}

.hero h1 span {
  color: var(--uscar-red);
}

.hero p {
  font-size: 1.125rem;
  color: rgba(255, 255, 255, 0.8);
  max-width: 600px;
  margin: 0 auto 2rem;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
}

.hero-badge .icon { font-size: 1.1rem; }

/* ---------- Search Bar (Hero) ---------- */
.search-wrapper {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.search-wrapper input {
  width: 100%;
  padding: 1rem 1.25rem 1rem 3rem;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 1rem;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}

.search-wrapper input::placeholder { color: rgba(255, 255, 255, 0.5); }
.search-wrapper input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.15);
}

.search-wrapper .search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.15rem;
  pointer-events: none;
}

/* ---------- Content Area ---------- */
.content-area {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  width: 100%;
}

/* ---------- Section Cards (Home) ---------- */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.section-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  border: 1px solid var(--gray-200);
}

.section-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.section-card .card-header {
  padding: 1.5rem 1.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-card .card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.section-card .card-icon.assembly { background: rgba(0, 45, 114, 0.08); color: var(--uscar-navy); }
.section-card .card-icon.stamping { background: rgba(200, 16, 46, 0.08); color: var(--uscar-red); }
.section-card .card-icon.overview { background: rgba(108, 117, 125, 0.08); color: var(--gray-600); }

.section-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gray-900);
}

.section-card h3 small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-top: 0.15rem;
}

.section-card .card-body {
  padding: 0 1.75rem 1.5rem;
}

.section-card .card-body p {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 1.25rem;
}

.section-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--uscar-navy);
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--uscar-navy);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.section-card .card-link:hover {
  background: var(--uscar-navy);
  color: var(--white);
}

.section-card .card-link.red {
  color: var(--uscar-red);
  border-color: var(--uscar-red);
}

.section-card .card-link.red:hover {
  background: var(--uscar-red);
  color: var(--white);
}

/* ---------- Chapter Table ---------- */
.chapter-section {
  margin-bottom: 3rem;
}

.chapter-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--uscar-navy);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-section h2 .accent-bar {
  display: inline-block;
  width: 4px;
  height: 28px;
  background: var(--uscar-red);
  border-radius: 2px;
}

.chapter-section .subtitle {
  font-size: 0.9rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
}

.chapter-table-wrapper {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.chapter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.chapter-table thead {
  background: var(--uscar-navy);
  color: var(--white);
}

.chapter-table thead th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.chapter-table tbody tr {
  border-bottom: 1px solid var(--gray-200);
  transition: background var(--transition);
}

.chapter-table tbody tr:last-child { border-bottom: none; }
.chapter-table tbody tr:hover { background: var(--gray-50); }

.chapter-table td {
  padding: 0.75rem 1.25rem;
  vertical-align: middle;
}

.chapter-table .chapter-code {
  font-weight: 700;
  color: var(--uscar-navy);
  font-size: 0.85rem;
  width: 80px;
}

.chapter-table .chapter-title {
  font-weight: 600;
  color: var(--gray-800);
}

.chapter-table .chapter-pages {
  color: var(--gray-600);
  font-size: 0.85rem;
  text-align: center;
  width: 80px;
}

.chapter-table .pdf-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--uscar-red);
  background: rgba(200, 16, 46, 0.06);
  transition: all var(--transition);
}

.chapter-table .pdf-link:hover {
  background: var(--uscar-red);
  color: var(--white);
}

.chapter-table .interactive-links {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.chapter-table .interactive-link {
  padding: 0.4rem 0.65rem;
  min-height: 44px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, #C8102E, #a00d24);
  transition: all var(--transition);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  box-shadow: 0 1px 3px rgba(200, 16, 46, 0.25);
}

.chapter-table .interactive-link::before {
  content: '\25A0';
  font-size: 0.6rem;
  opacity: 0.8;
}

.chapter-table .interactive-link:hover {
  background: linear-gradient(135deg, #a00d24, #7a0a1b);
  color: var(--white);
  box-shadow: 0 2px 6px rgba(200, 16, 46, 0.4);
}

/* ---------- Stats Bar ---------- */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 2rem 1.5rem;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--uscar-navy);
  line-height: 1;
}

.stat-value.red { color: var(--uscar-red); }

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* ---------- Info Banner ---------- */
.info-banner {
  background: linear-gradient(135deg, rgba(0, 45, 114, 0.03) 0%, rgba(200, 16, 46, 0.03) 100%);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
}

.info-banner h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--uscar-navy);
  margin-bottom: 0.5rem;
}

.info-banner p {
  font-size: 0.9rem;
  color: var(--gray-600);
  line-height: 1.7;
}

.info-banner a {
  font-weight: 600;
  color: var(--uscar-red);
}

/* ---------- Page-level Search ---------- */
.page-search {
  margin-bottom: 1.5rem;
  position: relative;
}

.page-search input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  font-size: 0.9rem;
  transition: all var(--transition);
}

.page-search input:focus {
  outline: none;
  border-color: var(--uscar-navy);
  box-shadow: 0 0 0 3px rgba(0, 45, 114, 0.1);
}

.page-search .search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}

.search-count {
  font-size: 0.8rem;
  color: var(--gray-600);
  margin-top: 0.5rem;
}

/* ---------- Overview Page ---------- */
.overview-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 3rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.overview-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--uscar-navy);
  margin: 2rem 0 1rem;
}

.overview-content h2:first-child { margin-top: 0; }

.overview-content p {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.overview-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.overview-content li {
  font-size: 0.95rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
  line-height: 1.7;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--uscar-navy-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 2rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-inner p {
  font-size: 0.8rem;
}

.footer-inner a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
}

.footer-inner a:hover { color: var(--white); }

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
}

.footer-links a:hover { color: var(--white); }

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
}

.breadcrumb a { color: var(--gray-600); font-weight: 600; }
.breadcrumb a:hover { color: var(--uscar-navy); }
.breadcrumb .sep { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-700); font-weight: 600; }

/* ---------- No Results ---------- */
.no-results {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--gray-600);
  font-style: italic;
  font-size: 0.95rem;
}

/* ---------- Contact Note ---------- */
.contact-note {
  color: var(--gray-600);
  font-size: 0.9rem;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --header-height: 60px; }

  .main-nav { display: none; }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--white);
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
  }

  .hamburger { display: block; }

  .hero { padding: 3rem 1.5rem; }
  .hero h1 { font-size: 1.75rem; }
  .hero p { font-size: 1rem; }

  .section-grid { grid-template-columns: 1fr; }

  .stats-bar { gap: 1.5rem; flex-wrap: wrap; }
  .stat-value { font-size: 1.5rem; }

  .chapter-table { font-size: 0.8rem; }
  .chapter-table th,
  .chapter-table td { padding: 0.5rem 0.75rem; }

  .footer-inner { flex-direction: column; text-align: center; }
  .footer-links { justify-content: center; }

  .overview-content { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .hero-badges { gap: 0.5rem; }
  .hero-badge { font-size: 0.75rem; padding: 0.35rem 0.75rem; }
}
