/* ===== CSS Reset & Variables ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0ea5e9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --bg: #f8fafc;
  --bg-white: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .10);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --max-w: 1200px;
  --transition: .2s ease;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

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

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

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

ul {
  list-style: none;
}

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

.section {
  padding: 60px 0;
}

.section-sm {
  padding: 40px 0;
}

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

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  text-transform: uppercase;
  color: var(--text);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.logo:hover {
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  border-radius: 2px;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  color: #fff;
  padding: 80px 0 70px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero p {
  font-size: 1.1rem;
  opacity: .9;
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
  margin-top: 40px;
}

.hero-stat {
  text-align: center;
}

.hero-stat strong {
  display: block;
  font-size: 2rem;
  font-weight: 800;
}

.hero-stat span {
  font-size: .85rem;
  opacity: .8;
}

/* Search */
.search-wrap {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

.search-wrap input {
  width: 100%;
  padding: 14px 50px 14px 18px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  outline: none;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.search-wrap button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  border: none;
  border-radius: 50px;
  width: 38px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.search-wrap button:hover {
  background: var(--primary-dark);
}

.search-wrap button svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* Category Cards */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.cat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  transition: all var(--transition);
}

.cat-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.cat-card .cat-icon {
  font-size: 2rem;
  width: 50px;
  height: 50px;
  margin: 0 auto 10px;
}

.cat-card h3 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.cat-card span {
  font-size: .8rem;
  color: var(--text-muted);
}

/* Resource Cards */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.resource-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.resource-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-title {
  flex: 1;
}

.card-title h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.cat-badge {
  font-size: .72rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
}

.card-desc {
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 16px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-size: .72rem;
  background: var(--border-light);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
  border: none;
  cursor: pointer;
}

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

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* Section Titles */
.section-title {
  text-align: center;
  margin-bottom: 40px;
}

.section-title h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 8px;
}

.section-title p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

.section-title .line {
  width: 48px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  margin: 12px auto 0;
}

/* Intro Block */
.intro-block {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 860px;
  margin: 0 auto;
}

.intro-block p {
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.8;
}

.intro-block p:last-child {
  margin-bottom: 0;
}

/* Resource Detail */
.detail-hero {
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  padding: 48px 0;
}

.detail-hero-inner {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.detail-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
}

.detail-meta h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.detail-meta .cat-badge {
  margin-bottom: 12px;
}

.detail-meta p {
  color: var(--text-muted);
  max-width: 600px;
}

.detail-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.detail-body {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  padding: 48px 0;
}

.detail-main h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 28px 0 12px;
  color: var(--text);
}

.detail-main h2:first-child {
  margin-top: 0;
}

.detail-main p {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 12px;
}

.detail-main ul {
  padding-left: 0;
}

.detail-main ul li {
  color: var(--text-muted);
  padding: 6px 0 6px 20px;
  position: relative;
  line-height: 1.6;
}

.detail-main ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-size: .85rem;
}

.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.sidebar-card h3 {
  font-size: .95rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.pros-cons-list li {
  padding: 6px 0 6px 22px;
  position: relative;
  font-size: .875rem;
  color: var(--text-muted);
}

.pros-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #16a34a;
  font-weight: 700;
}

.cons-list li::before {
  content: '✗';
  position: absolute;
  left: 0;
  color: #dc2626;
  font-weight: 700;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: .875rem;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row span:first-child {
  color: var(--text-muted);
}

.info-row span:last-child {
  font-weight: 500;
}

/* Category Page */
.cat-hero {
  background: var(--primary-light);
  border-bottom: 1px solid var(--border);
  padding: 48px 0;
}

.cat-hero-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.cat-hero-icon {
  font-size: 3rem;
  width: 80px;
  height: 80px;
}

.cat-hero h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.cat-hero p {
  color: var(--text-muted);
}

/* Legal */
.legal-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 60px 20px;
}

.legal-content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.legal-content .updated {
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 40px;
}

.legal-content h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 32px 0 12px;
}

.legal-content p,
.legal-content li {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 10px;
}

.legal-content ul {
  padding-left: 20px;
  list-style: disc;
}

/* About / Contact */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
}

.contact-form {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
  background: var(--bg);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
  color: var(--text-muted);
  padding: 16px 0;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-muted);
}

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

.breadcrumb .sep {
  color: var(--text-light);
}

/* Footer */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 60px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-brand .logo {
  color: #fff;
  margin-bottom: 12px;
}

.footer-brand p {
  font-size: .875rem;
  line-height: 1.7;
  max-width: 260px;
}

.footer-col h4 {
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul li a {
  color: #94a3b8;
  font-size: .875rem;
  transition: color var(--transition);
}

.footer-col ul li a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid #1e293b;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
}

.footer-bottom p {
  color: #64748b;
}

/* Back to Top */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
}

#back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

#back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

#back-to-top svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* Search Results Dropdown */
#search-results {
  display: none;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 360px;
  overflow-y: auto;
  position: absolute;
  width: 100%;
  z-index: 50;
}

#search-results.active {
  display: block;
}

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition);
  display: block;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--primary-light);
}

.search-result-item strong {
  display: block;
  font-size: .9rem;
  color: var(--text);
}

.search-result-item span {
  font-size: .8rem;
  color: var(--text-muted);
}

.search-no-result {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .9rem;
}

/* Responsive */
@media (max-width: 900px) {
  .detail-body {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    box-shadow: var(--shadow);
    height: 100vh;
  }

  .cat-hero-inner {
    flex-direction: column;
    align-items: self-start;
  }

  .cat-hero-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero {
    padding: 50px 0 40px;
  }

  .hero-stats {
    gap: 24px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .detail-hero-inner {
    flex-direction: column;
  }

  .resources-grid {
    grid-template-columns: 1fr;
  }

  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section {
    padding: 40px 0;
  }

  .intro-block {
    padding: 24px;
  }
}