@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --text: #14171C;
  --muted: #6B7280;
  --accent: #2F6FED;
  --accent-ink: #16305E;
  --accent-soft: #EAF0FF;
  --border: #E4E7EC;
  --radius: 10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--text); background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(245,246,248,0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-top { display: flex; align-items: center; gap: 20px; padding: 14px 20px; position: relative; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 20px; text-decoration: none; color: var(--text); letter-spacing: -0.02em; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav > a, .dropdown-toggle { font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; background: none; border: none; cursor: pointer; font-family: var(--font-body); }
.main-nav > a:hover, .dropdown-toggle:hover { background: var(--accent-soft); color: var(--accent-ink); }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: 110%; left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 180px; box-shadow: 0 12px 28px rgba(20,23,28,0.12); }
.dropdown-menu a { display: block; padding: 8px 10px; font-size: 13.5px; text-decoration: none; color: var(--text); border-radius: 6px; }
.dropdown-menu a:hover { background: var(--accent-soft); color: var(--accent-ink); }
.dropdown:hover .dropdown-menu, .dropdown.open .dropdown-menu { display: block; }
.head-social { display: flex; gap: 6px; }
.head-social a { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 10.5px; font-family: var(--font-mono); text-decoration: none; }
.head-social a:hover { background: var(--accent); color: #fff; }
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

/* ---------- card grid (Phantom-style overlay tiles) ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px; padding: 24px 0 40px; }
.grid-small { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.card { position: relative; text-decoration: none; color: #fff; display: block; background: #10131a; overflow: hidden; }
.card .thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s ease, filter 0.4s ease; }
.card:hover .thumb img { transform: scale(1.08); filter: brightness(0.55); }
.card .overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px; background: linear-gradient(180deg, rgba(16,19,26,0) 40%, rgba(16,19,26,0.92) 100%);
  opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s;
}
.card:hover .overlay { opacity: 1; transform: translateY(0); }
.card .overlay .title { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; line-height: 1.3; margin-bottom: 6px; }
.card .overlay .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .overlay .cat { font-size: 11px; color: #cfd6e4; }
.card .overlay .ext { font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.03em; color: #10131a; background: #fff; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; white-space: nowrap; }
@media (hover: none) {
  .card .overlay { opacity: 1; transform: none; background: linear-gradient(180deg, rgba(16,19,26,0) 55%, rgba(16,19,26,0.9) 100%); }
  .card .thumb img { filter: brightness(0.85); }
}

/* ---------- pagination ---------- */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 8px 0 32px; }
.pagination a { min-width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; text-decoration: none; color: var(--text); font-family: var(--font-mono); font-size: 13px; border: 1px solid var(--border); }
.pagination a.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination a:hover:not(.active) { border-color: var(--accent); color: var(--accent-ink); }
.pagination .dots { display: flex; align-items: center; justify-content: center; min-width: 24px; color: var(--muted); font-family: var(--font-mono); }

/* ---------- single post layout ---------- */
.post-layout { display: grid; grid-template-columns: 1fr 300px; gap: 40px; padding: 32px 0 56px; align-items: start; }
.single-post { min-width: 0; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.single-post h1 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 30px); font-weight: 700; letter-spacing: -0.015em; margin: 0 0 14px; }
.post-meta a { display: inline-block; font-size: 12.5px; color: var(--muted); text-decoration: none; margin-right: 8px; background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.post-meta a:hover { color: var(--accent-ink); }
.featured-image { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); margin: 18px 0; border: 1px solid var(--border); }
.post-content { margin: 20px 0; font-size: 15px; }
.post-content p { margin: 0 0 1em; }

.download-card { background: var(--surface); border-radius: var(--radius); padding: 18px; margin: 24px 0; border: 1.5px dashed var(--border); }
.download-card h3 { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; font-weight: 600; }
.download-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dl-btn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-decoration: none; color: var(--text); background: var(--bg); border: 1.5px solid var(--border); border-radius: 8px; padding: 12px 14px; font-size: 13.5px; font-weight: 500; transition: border-color 0.15s, background 0.15s; }
.dl-btn:hover { border-color: var(--accent); background: var(--accent-soft); border-style: dashed; animation: marchAnts 0.6s linear infinite; }
.dl-btn .size { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }

.post-tags { margin: 18px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.post-tags a { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-decoration: none; border: 1px solid var(--border); padding: 3px 9px; border-radius: 999px; }
.post-tags a:hover { border-color: var(--accent); color: var(--accent-ink); }

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 24px; }
.related h3 { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.related .grid { grid-template-columns: 1fr; gap: 10px; padding: 0; }
.related .card .thumb { aspect-ratio: 16/9; }

/* ---------- ad slot ---------- */
.ad-slot { margin: 24px 0; text-align: center; }
.ad-slot .ad-label { font-family: var(--font-mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; display: block; }

/* ---------- archive ---------- */
.archive-header { padding: 36px 0 4px; }
.archive-header h1 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 28px); margin: 0; }

/* ---------- static page ---------- */
.static-page { padding: 36px 0 56px; max-width: 720px; margin: 0 auto; }
.static-page h1 { font-family: var(--font-display); font-size: 26px; }

/* ---------- footer ---------- */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 28px 20px; color: var(--muted); font-size: 12.5px; border-top: 1px solid var(--border); margin-top: 24px; }
.footer-left a { color: var(--muted); }
.footer-social { display: flex; gap: 14px; }
.footer-social a { text-decoration: none; color: var(--muted); }
.footer-social a:hover { color: var(--accent); }

@keyframes marchAnts { from { background-position: 0 0; border-color: var(--accent); } to { background-position: 8px 0; border-color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}
@media (max-width: 720px) {
  .main-nav, .head-social { display: none; }
  .main-nav.open { display: flex; flex-direction: column; align-items: flex-start; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; gap: 0; }
  .main-nav.open .dropdown-menu { position: static; display: block; box-shadow: none; border: none; padding-left: 12px; }
  .nav-toggle { display: flex; margin-left: auto; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
