/* === Tokens === */
:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --border: #E5E7EB;
  --primary: #0E7490;
  --primary-light: #ECFEFF;
  --accent: #D97706;
  --warm: #B45309;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
}

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

/* === Base === */
body {
  font-family: 'Noto Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

h1 { font-family: 'Literata', 'Georgia', serif; font-size: 1.8rem; margin-bottom: 1rem; line-height: 1.2; color: var(--text) }
h2 { font-family: 'Literata', 'Georgia', serif; font-size: 1.35rem; margin: 2rem 0 .75rem; color: var(--primary); line-height: 1.25 }
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; color: var(--text) }
p { margin-bottom: .8rem }

/* === Layout === */
.container { max-width: 860px; margin: 0 auto; padding: 0 1.25rem }

/* === Header === */
header {
  background: linear-gradient(135deg, #065F6B 0%, var(--primary) 50%, #0891B2 100%);
  padding: 1rem 0;
  margin-bottom: 2rem;
  box-shadow: 0 2px 8px rgba(14,116,144,.2);
}
header nav {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
.site-title {
  font-family: 'Literata', 'Georgia', serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff;
  letter-spacing: .01em;
}
.site-title:hover { text-decoration: none; color: var(--accent) }
.nav-links { display: flex; gap: .5rem }
.nav-links a {
  color: #fff;
  padding: .35rem .9rem;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 20px;
  font-size: .9rem;
  transition: all .2s;
}
.nav-links a:hover {
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  border-color: #fff;
}

/* === Categories Grid === */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
  margin: 1rem 0 2rem;
}
.category-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
  color: var(--text);
  font-weight: 500;
}
.category-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
  border-color: var(--primary);
}
.category-count {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: .85rem;
  font-weight: 600;
}

/* === FAQ Single Page === */
.faq-page { max-width: 72ch }

.faq-meta {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
.faq-meta .updated { color: var(--primary); font-weight: 500 }
.faq-meta .updated::before { content: "·"; margin-right: .75rem; color: var(--muted) }
.faq-meta .views::before { content: "·"; margin-right: .75rem }

.faq-content {
  margin-bottom: 1.5rem;
}
.faq-content h2 {
  font-family: 'Literata', 'Georgia', serif;
  font-size: 1.15rem;
  margin: 1.5rem 0 .5rem;
  padding-bottom: .4rem;
}
.faq-content h2:first-child {
  color: var(--primary);
  border-left: 4px solid var(--accent);
  padding-left: .75rem;
  margin-top: 0;
}
.faq-content h2:last-of-type,
.faq-content h2:nth-of-type(2) {
  color: var(--warm);
  border-left: 4px solid var(--primary);
  padding-left: .75rem;
}

.faq-content h2 ~ p,
.faq-content h2 ~ ul,
.faq-content h2 ~ ol {
  padding-left: .75rem;
}

/* === Tags === */
.faq-tags, .faq-categories { margin: 1.5rem 0 }
.faq-tags strong, .faq-categories strong { color: var(--muted); font-weight: 500; font-size: .9rem }

.tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: .85rem;
  margin: 3px 2px;
  transition: all .15s;
}
.tag:hover { background: var(--primary); color: #fff; text-decoration: none }

.tag-sm {
  display: inline-block;
  font-size: .78rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 12px;
  padding: 1px 8px;
  margin: 1px 2px;
  transition: all .15s;
}
.tag-sm:hover { background: var(--primary); color: #fff; text-decoration: none }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; margin-top: .5rem }

/* === Questions List === */
.questions-list {
  list-style: none;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.questions-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.questions-list li:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}
.questions-list li a {
  font-weight: 500;
  font-size: 1rem;
  color: var(--text);
}
.questions-list li a:hover { color: var(--primary); text-decoration: none }
.tags-inline { margin-left: .5rem }

/* === Section Description === */
.section-desc { color: var(--muted); margin-bottom: 1.5rem; font-size: 1.05rem }

/* === Related === */
.related {
  margin-top: 2.5rem;
  padding: 1.25rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.related h3 {
  color: var(--primary);
  margin-top: 0;
  margin-bottom: .6rem;
  font-size: 1rem;
}
.related ul { list-style: none }
.related li { padding: .3rem 0 }
.related li a { color: var(--primary) }
.related li a:hover { color: var(--accent) }

/* === Search === */
.search-box { margin-bottom: 1.5rem }
#search-input {
  width: 100%;
  padding: .75rem 1rem;
  font-size: 1.05rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color .2s;
}
#search-input:focus {
  outline: none;
  border-color: var(--primary);
}
.search-empty { color: var(--muted); font-style: italic; margin: 1rem 0 }
.search-desc { color: var(--muted); font-size: .88rem; margin: .25rem 0 0; line-height: 1.4 }

/* === Footer === */
footer {
  max-width: 860px;
  margin: 3rem auto 0;
  padding: 1.25rem;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* === Pagination === */
.pagination { margin: 2rem 0; text-align: center }
.pagination li { display: inline-block; margin: 0 .15rem }
.pagination a, .pagination .active a {
  display: inline-block;
  padding: .4rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  transition: all .15s;
}
.pagination a:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  text-decoration: none;
}
.pagination .active a {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* === Breadcrumb === */
.breadcrumb {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
  padding: .5rem 0;
}
.breadcrumb a { color: var(--primary) }
.breadcrumb a:hover { text-decoration: underline }
.breadcrumb span { color: var(--text) }

/* === 404 === */
.helpful-links {
  list-style: none;
  margin: 1rem 0 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.helpful-links li a {
  display: inline-block;
  padding: .5rem 1.2rem;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  transition: background .15s;
}
.helpful-links li a:hover {
  background: var(--accent);
  text-decoration: none;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem .8rem;
  margin-bottom: .75rem;
  font-size: .85rem;
}
.footer-nav a { color: var(--primary) }
.footer-nav a:hover { color: var(--accent) }

/* === Tables === */
.faq-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .95rem;
}
.faq-content th, .faq-content td {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  text-align: left;
}
.faq-content th {
  background: var(--primary-light);
  font-weight: 600;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}

/* === Mobile === */
@media (max-width: 640px) {
  body { font-size: 16px; -webkit-text-size-adjust: 100% }
  h1 { font-size: 1.35rem; word-wrap: break-word; overflow-wrap: break-word }
  h2 { font-size: 1.15rem }
  header nav { gap: .5rem }
  .site-title { font-size: 1.05rem }
  .nav-links a { padding: .4rem .8rem; font-size: .85rem; min-height: 44px; display: inline-flex; align-items: center }
  .questions-list li { padding: .85rem }
  .questions-list li a { font-size: 1.05rem; line-height: 1.4; display: block; min-height: 44px }
  .tags-inline { display: block; margin-left: 0; margin-top: .4rem }
  .faq-page { max-width: 100% }
  .container { padding: 0 1rem }
  .tag { padding: 6px 14px; font-size: .88rem; min-height: 36px; display: inline-flex; align-items: center }
  .faq-meta { flex-wrap: wrap }
  .pagination a, .pagination .active a { padding: .5rem 1rem; min-height: 44px; display: inline-flex; align-items: center }
  .breadcrumb { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
  .related li { padding: .5rem 0 }
  .related li a { display: inline-block; min-height: 44px; line-height: 1.4 }
  .faq-content table { font-size: .85rem }
  .faq-content th, .faq-content td { padding: .4rem .5rem }
  .categories-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) }
}
