:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f9fafb;
  color: #1f2937;
  line-height: 1.6;
  --primary: #0f62fe;
  --primary-dark: #0353e9;
  --accent-green: #2e7d32;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-light: #e5e7eb;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --urgent: #d97706;
  --error: #dc2626;
  --success: #059669;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-light);
  color: var(--text-primary);
  font-weight: 400;
  font-size: 16px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  background: var(--text-primary);
  color: white;
  border-radius: 8px;
  padding: 10px 14px;
}

.skip-link:focus {
  top: 12px;
  color: white;
}

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

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.875rem, 5vw, 2.5rem);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 1.875rem);
}

h3 {
  font-size: 1.125rem;
}

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

a:hover,
a:focus {
  color: var(--primary-dark);
  text-decoration: underline;
}

a:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

button:focus,
input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.header,
.footer {
  padding: 16px 0;
}

.header {
  background: var(--bg-white);
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
  gap: 10px;
}

.brand:hover {
  text-decoration: none;
}

.brand-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.brand-text {
  display: inline-block;
}

.search-bar {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form {
  display: flex;
  gap: 8px;
  width: 100%;
  position: relative;
  align-items: stretch;
}

.search-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-button,
.button,
.button-primary,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  padding: 10px 18px;
  border: none;
  background: var(--primary);
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.search-button:hover,
.button:hover,
.button-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(15, 98, 254, 0.2);
}

.autocomplete-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
}

.autocomplete-panel[hidden] {
  display: none;
}

.autocomplete-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  padding: 10px;
  text-align: left;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: #eff6ff;
  border-color: rgba(15, 98, 254, 0.25);
}

.autocomplete-title {
  font-weight: 700;
  line-height: 1.3;
}

.autocomplete-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.4;
}

mark {
  background: #fef3c7;
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
}

.button-secondary {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border-light);
}

.button-secondary:hover {
  background: var(--bg-light);
  border-color: var(--primary);
  transform: none;
  box-shadow: none;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.card-link:hover {
  text-decoration: none;
}

.cards,
.section,
.detail-card {
  margin-top: 32px;
}

.hero {
  margin-top: 0;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}

.hero h1,
.guide-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4.5vw, 2.25rem);
  line-height: 1.15;
  color: var(--text-primary);
}

.hero p,
.summary,
.section p,
.detail-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.6;
}

.hero .hero-desc {
  margin-bottom: 20px;
  max-width: 600px;
}

.hero .search-form {
  max-width: 560px;
}

.card-grid,
.list-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}

.card,
.summary-card,
.detail-card,
.source-card,
.sidebar-card,
.section-card {
  background: var(--bg-white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.card:hover,
.section-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: rgba(15, 98, 254, 0.2);
}

.card h3,
.summary-card h3,
.section-card h3,
.detail-card h3,
.card h4 {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 1.125rem;
}

.card p,
.summary-card p,
.detail-card p {
  margin: 0 0 12px 0;
  color: var(--text-secondary);
}

.card p:last-child,
.summary-card p:last-child,
.detail-card p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 12px 0;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

li {
  margin-bottom: 8px;
  line-height: 1.6;
}

li:last-child {
  margin-bottom: 0;
}

.breadcrumbs,
.tags,
.meta-row,
.grid-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumbs {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.breadcrumbs a,
.tags span,
.meta-row span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

.breadcrumbs a::after {
  content: "/";
  margin: 0 8px;
  color: #d1d5db;
}

.breadcrumbs a:last-child::after {
  content: "";
}

.tag,
.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge.urgent {
  background: #fed7aa;
  color: #92400e;
}

.badge.high {
  background: #fee2e2;
  color: #7f1d1d;
}

.filter-panel {
  display: grid;
  gap: 12px;
  margin: 24px 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-white);
  color: var(--text-primary);
  cursor: pointer;
  font-weight: 600;
  padding: 8px 12px;
}

.filter-button.active,
.filter-button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

.country-card[hidden],
.country-region[hidden] {
  display: none;
}

.country-card .meta-row {
  margin-bottom: 12px;
}

.compact-grid {
  gap: 12px;
}

.results-note {
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.related-tool-card {
  border-color: #bfdbfe;
  background: #f8fbff;
  margin-top: 20px;
}

.ad-slot {
  margin: 28px 0;
  border: 1px dashed var(--border-light);
  border-radius: 8px;
  padding: 16px;
  color: var(--text-secondary);
  background: var(--bg-white);
  font-size: 0.85rem;
  text-align: center;
}

.quick-answer,
.checklist,
.templates,
.faq,
.sources,
.common-mistakes,
.next-steps {
  margin-top: 28px;
}

.quick-answer .card,
.next-steps .card,
.sources .card,
.who-this-is-for .card {
  padding: 24px;
  border: 2px solid #dbeafe;
  background: #f0f9ff;
}

.checklist ul,
.faq ul,
.common-mistakes ul {
  list-style: disc outside;
  color: var(--text-secondary);
}

.faq li {
  margin-bottom: 16px;
}

.faq strong {
  color: var(--text-primary);
  font-weight: 600;
}

.faq p {
  margin: 8px 0 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.footer {
  border-top: 1px solid var(--border-light);
  padding: 32px 0;
  color: var(--text-secondary);
  background: var(--bg-white);
  margin-top: 64px;
}

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

.footer-inner {
  display: grid;
  gap: 20px;
}

.footer-brand {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.footer-brand p,
.copyright {
  margin: 4px 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.admin-warning {
  border-color: #f59e0b;
  background: #fffbeb;
}

.admin-stat strong {
  display: block;
  font-size: 1.6rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.sticky-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  padding: 8px;
  z-index: 40;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
}

.sticky-nav a {
  border-radius: 8px;
  padding: 12px 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  background: var(--bg-white);
  color: var(--primary);
  transition: all 0.2s ease;
}

.sticky-nav a:hover {
  background: var(--bg-light);
  color: var(--primary-dark);
}

@media (min-width: 768px) {
  .card-grid,
  .list-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .search-bar {
    max-width: 500px;
  }

  .content-with-sidebar {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 28px;
    align-items: start;
  }

  .sidebar-card {
    position: sticky;
    top: 88px;
  }
}

@media (min-width: 1024px) {
  .card-grid,
  .list-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 767px) {
  .page {
    padding: 0 16px 120px;
  }

  .header-inner {
    gap: 12px;
  }

  .brand {
    font-size: 1.1rem;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .brand-text {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search-bar {
    flex: 1;
    max-width: 100%;
  }

  .search-button {
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  .autocomplete-panel {
    max-height: 62vh;
  }

  .card,
  .section-card {
    padding: 16px;
  }

  .content-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sticky-nav {
    grid-template-columns: repeat(4, 1fr);
  }

  .sticky-nav a {
    padding: 10px 0;
    font-size: 0.75rem;
  }
}

pre {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

code {
  font-family: "Monaco", "Courier New", monospace;
  font-size: 0.9rem;
}

strong {
  font-weight: 600;
  color: var(--text-primary);
}

em {
  font-style: italic;
}
