:root {
  --bg: #0f0f10;
  --surface: #1a1a1c;
  --fg: #eee;
  --muted: #9a9aa0;
  --border: #2a2a2d;
  --accent: #e0508a;
  --radius: 14px;
}

html[data-theme="light"] {
  --bg: #fafafa;
  --surface: #fff;
  --fg: #1a1a1c;
  --muted: #6b6b70;
  --border: #e4e4e6;
  --accent: #d43f78;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
.nav-toggle {
  display: none;
  background: var(--surface); border: 1px solid var(--border);
  width: 38px; height: 38px; border-radius: 999px; cursor: pointer;
  color: var(--fg); font-size: 1.05rem; line-height: 1;
  place-items: center;
}
a { color: inherit; text-decoration: none; }
@media (max-width: 600px) {
  .nav-links { position: relative; }
  .nav-links a { display: none; }
  .nav-links.open { flex-direction: column; align-items: flex-end; gap: 2px; }
  .nav-links.open a {
    display: block; width: 100%; padding: 10px 16px;
    border-radius: 8px;
  }
  .nav-links.open { position: absolute; top: 100%; right: 0; margin: 4px 0 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px; min-width: 180px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
  }
  .nav-toggle { display: grid; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ---------- Navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; gap: 24px;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.2rem; letter-spacing: -0.5px;
}
.brand .brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7a4de0);
  display: grid; place-items: center; color: #fff; font-size: 0.95rem;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  padding: 8px 14px; border-radius: 999px;
  font-size: 0.92rem; color: var(--muted);
  transition: background .15s, color .15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--fg); background: var(--surface); }
#theme-toggle {
  border: 1px solid var(--border); background: var(--surface);
  width: 38px; height: 38px; border-radius: 999px; cursor: pointer;
  font-size: 1rem; color: var(--fg);
  display: grid; place-items: center;
}

/* ---------- Hero featured ---------- */
.hero { padding: 48px 0 24px; }
.hero-card {
  display: grid; grid-template-columns: minmax(0, 9fr) minmax(0, 11fr);
  gap: 36px; align-items: center;
}
.hero figure {
  aspect-ratio: 9 / 16; max-height: 70vh;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.hero figure img { width: 100%; height: 100%; object-fit: cover; }
.hero-body .tag {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.hero-body h1 { font-size: clamp(1.6rem, 3.5vw, 2.6rem); line-height: 1.2; letter-spacing: -1px; margin-bottom: 12px; }
.hero-body p { color: var(--muted); margin-bottom: 20px; }
.meta { display: flex; gap: 14px; font-size: 0.85rem; color: var(--muted); }
.meta span::before { content: "•"; margin-right: 6px; color: var(--accent); }
.btn {
  display: inline-block; margin-top: 22px;
  background: var(--accent); color: #fff;
  padding: 11px 26px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem;
}

/* ---------- Section heading ---------- */
.section { padding: 36px 0 12px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
.section-head h2 { font-size: 1.35rem; letter-spacing: -0.5px; }
.section-head a { color: var(--accent); font-size: 0.9rem; font-weight: 600; }

/* ---------- Masonry latest posts ---------- */
.masonry { column-count: 4; column-gap: 16px; }
.masonry .card {
  break-inside: avoid;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: inline-block; width: 100%;
}
.card .thumb {
  aspect-ratio: 9 / 16;
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .thumb img { transform: scale(1.04); }
.card-body { padding: 12px 14px 16px; }
.card-body h3 { font-size: 0.98rem; line-height: 1.35; margin-bottom: 6px; }
.card-body .meta { font-size: 0.78rem; }
.card-body .meta span:not(:first-child)::before { content: "•"; margin: 0 6px 0 0; }
.card-body .meta span:first-child::before { content: none; margin: 0; }

/* ---------- Single post ---------- */
.post-wrap { max-width: 640px; margin: 0 auto; padding: 40px 20px 20px; }
.post-head .tag {
  display: inline-block;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 14px;
}
.post-head h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); line-height: 1.25; letter-spacing: -0.5px; margin-bottom: 12px; }
.post-head .meta { margin-bottom: 26px; }
.post-figure {
  aspect-ratio: 9 / 16; max-height: 80vh;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 22px;
}
.post-figure img { width: 100%; height: 100%; object-fit: cover; }
.post-caption { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 26px; }
.post-body p { margin-bottom: 18px; }
.post-body p:first-of-type::first-letter {
  font-size: 3.2em; float: left; line-height: 0.85;
  padding-right: 10px; color: var(--accent); font-weight: 700;
}

/* related */
.related { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 0; }

/* ---------- Page (about/contact/etc) ---------- */
.page { max-width: 720px; margin: 0 auto; padding: 48px 20px 20px; }
.page h1 { font-size: 2rem; letter-spacing: -0.5px; margin-bottom: 8px; }
.page .updated { color: var(--muted); font-size: 0.85rem; margin-bottom: 28px; }
.page h2 { font-size: 1.15rem; margin: 28px 0 10px; }
.page p { margin-bottom: 14px; color: var(--muted); }
.page ul, .page ol { margin: 0 0 16px 22px; color: var(--muted); }
.page li { margin-bottom: 8px; }

.contact-form { display: grid; gap: 14px; margin-top: 8px; }
.contact-form label { font-size: 0.85rem; font-weight: 600; }
.contact-form input, .contact-form textarea {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--fg); border-radius: 10px;
  padding: 12px 14px; font: inherit; width: 100%;
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.contact-form button {
  justify-self: start;
  background: var(--accent); color: #fff; border: 0;
  padding: 12px 30px; border-radius: 999px;
  font: inherit; font-weight: 600; cursor: pointer;
}
.contact-info { margin-top: 32px; padding: 18px 20px; border: 1px dashed var(--border); border-radius: var(--radius); font-size: 0.9rem; color: var(--muted); }

/* ---------- Footer ---------- */
footer {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 24px;
  justify-content: space-between; align-items: center;
  padding: 32px 20px;
}
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; font-size: 0.88rem; color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { font-size: 0.82rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .masonry { column-count: 3; }
  .hero-card { grid-template-columns: 1fr; }
  .hero figure { max-height: 60vh; }
}
@media (max-width: 600px) {
  .masonry { column-count: 2; }
  .related { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- System additions ---------- */
.brand-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.post-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 8px; }
.post-tags span {
  font-size: 0.8rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px;
}
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.related-grid .card { display: block; }
.home-pager { justify-content: center; margin-top: 28px; }
.pagination .page-info { font-size: 0.85rem; color: var(--muted); }
.form-note.success { color: #2ea56b; font-size: 0.9rem; }

@media (max-width: 600px) {
  .related-grid { grid-template-columns: repeat(2, 1fr); }
}
