* { box-sizing: border-box; }
:root {
  --bg: #ffffff;
  --text: #0b0b0b;
  --border-color: #e6e6e6;
  --text-muted: #6b6b6b;
  --accent-color: #006fe6;
  --shadow: 0 2px 6px rgba(0,0,0,0.12);
  --border-radius: 6px;
  --container-padding: 1.25rem;
  --transition-fast: 180ms;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f10;
    --text: #e6e6e6;
    --border-color: #2b2b2b;
    --text-muted: #a8a8a8;
    --accent-color: #2a84ff;
    --shadow: 0 2px 6px rgba(0,0,0,0.18);
  }
}
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.site-main {
  flex: 1;
}
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--container-padding);
}
@media (max-width: 768px) {
  .container {
    padding: max(0.5rem, 5vw);
  }
}
a {
  color: var(--accent-color);
  text-decoration: none;
}
a:hover {
  opacity: 0.9;
  text-decoration: underline;
}

/* Header */
header {
  background: var(--bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
}
.logo img {
  width: 44px;
  height: 44px;
  border-radius: calc(var(--border-radius) - 2px);
}
.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-menu a {
  color: var(--text);
  text-decoration: none;
  padding: 0.35rem 0.45rem;
  border-radius: calc(var(--border-radius) - 2px);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-menu a:hover {
  color: var(--accent-color);
  background: rgba(0,0,0,0.02);
}
#nav-toggle {
  display: none;
}
.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: 0.25rem;
}
.hamburger span {
  display: block;
  width: 26px;
  height: 3px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

/* Articles Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}
@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .articles-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Cards */
.card {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
  transition: transform 220ms ease, box-shadow 220ms ease;
}
.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}
.card-image {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: calc(var(--border-radius) - 2px);
  margin-bottom: 0.85rem;
}

/* Featured Image */
.featured-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
}

/* Article Meta */
.article-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0 1.5rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.92rem;
}
.article-meta .author {
  font-weight: 600;
}

/* Article Content Images */
[itemprop="articleBody"] img {
  max-width: 45%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  margin: 0.5rem 1.5rem 1rem 0;
}
[itemprop="articleBody"] img:nth-of-type(odd) {
  float: left;
  margin: 0.5rem 1.5rem 1rem 0;
}
[itemprop="articleBody"] img:nth-of-type(even) {
  float: right;
  margin: 0.5rem 0 1rem 1.5rem;
}
[itemprop="articleBody"]::after {
  content: "";
  display: table;
  clear: both;
}

/* Article Tables */
[itemprop="articleBody"] table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: collapse;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}
[itemprop="articleBody"] table thead,
[itemprop="articleBody"] table tbody,
[itemprop="articleBody"] table tfoot {
  display: table;
  width: 100%;
  table-layout: fixed;
}
[itemprop="articleBody"] table thead {
  background: var(--accent-color);
  color: #fff;
}
[itemprop="articleBody"] table th,
[itemprop="articleBody"] table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid var(--border-color);
  white-space: normal;
  word-break: break-word;
}
[itemprop="articleBody"] table th {
  font-weight: 700;
  text-align: center;
}
[itemprop="articleBody"] table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}
@media (prefers-color-scheme: dark) {
  [itemprop="articleBody"] table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
  }
}
[itemprop="articleBody"] table tbody tr:hover {
  background: rgba(0, 111, 230, 0.06);
}
@media (max-width: 768px) {
  [itemprop="articleBody"] table {
    font-size: 0.85rem;
  }
  [itemprop="articleBody"] table th,
  [itemprop="articleBody"] table td {
    padding: 0.5rem;
  }
}

/* Breadcrumb */
.breadcrumb {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  padding: 0;
  margin: 0 0 1rem;
}
.breadcrumb li:last-child {
  font-weight: 700;
}

/* Search Form */
.search-form {
  max-width: 600px;
  margin: 0 auto 2rem;
  display: flex;
  gap: 0.5rem;
}
.search-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--bg);
  color: var(--text);
}
.search-form input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0,111,230,0.08);
}
.search-form button {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.18s ease;
}
.search-form button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 30;
  }
  .nav-menu ul {
    flex-direction: column;
    padding: 1rem;
  }
  #nav-toggle:checked ~ .nav-menu {
    display: block;
  }
  [itemprop="articleBody"] img {
    float: none !important;
    max-width: 100%;
    margin: 1rem 0 !important;
  }
  .search-form {
    flex-direction: column;
  }
  .search-form button {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .article-meta {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
}