:root {
  --bg: #0f1419;
  --bg-alt: #141a21;
  --bg-card: #1a2230;
  --bg-card-hover: #1f2937;
  --text: #d1d5db;
  --text-muted: #8b95a5;
  --text-bright: #f3f4f6;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.15);
  --accent-secondary: #a78bfa;
  --border: #2a3444;
  --border-hover: #3a4a5e;
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--text-bright); }

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

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

.container-narrow {
  max-width: 760px;
}

.accent { color: var(--accent); }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}
.logo:hover { color: var(--text-bright); }
.logo-bracket { color: var(--accent); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 32px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 4px 0;
  position: relative;
  transition: color var(--transition);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text-bright); }
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: all 0.3s ease;
}

/* ── Hero ── */
.hero {
  padding: 100px 0 80px;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-greeting {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.hero-name {
  font-size: 3.2rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.1;
  margin-bottom: 12px;
  letter-spacing: -1px;
}

.hero-title {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-weight: 400;
}

.hero-desc {
  color: var(--text);
  margin-bottom: 32px;
  max-width: 480px;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  gap: 16px;
}

.hero-cv {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.cv-label {
  color: var(--text-muted);
  font-family: var(--mono);
}

.cv-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cv-link:hover { color: var(--text-bright); }

.cv-sep { color: var(--border); }

/* ── Terminal ── */
.terminal-window {
  background: #1a1e2e;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #161a28;
  border-bottom: 1px solid var(--border);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.terminal-dot.red { background: #ff5f56; }
.terminal-dot.yellow { background: #ffbd2e; }
.terminal-dot.green { background: #27c93f; }
.terminal-title {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 8px;
}

.terminal-body {
  padding: 20px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.9;
}

.terminal-body p { margin-bottom: 2px; }
.prompt { color: #27c93f; }
.cmd { color: var(--text-bright); }
.output { color: var(--text-muted); padding-left: 18px; }
.cursor {
  display: inline-block;
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}
.btn-primary:hover {
  background: #06b6d4;
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.3);
}

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ── Sections ── */
.section {
  padding: 80px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 48px;
  letter-spacing: -0.5px;
}

.section-cta {
  text-align: center;
  margin-top: 40px;
}

/* ── Page Header ── */
.page-header {
  padding: 60px 0 40px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-size: 2.2rem;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}

.page-desc {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 1.05rem;
}

/* ── Post Cards ── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.3s ease;
}
.post-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-tags { display: flex; gap: 8px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 2px 10px;
  background: var(--accent-dim);
  color: var(--accent);
  border-radius: 4px;
  font-weight: 500;
}

.post-card h3 {
  font-size: 1.15rem;
  color: var(--text-bright);
  margin-bottom: 8px;
  line-height: 1.4;
}
.post-card h3 a { color: inherit; }
.post-card h3 a:hover { color: var(--accent); }

.post-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.read-more {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.9rem;
}

/* ── Certifications ── */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}
.cert-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cert-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.cert-card h3 {
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 4px;
  font-weight: 600;
}

.cert-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

a.cert-card-link {
  text-decoration: none;
  cursor: pointer;
}
a.cert-card-link:hover {
  border-color: var(--accent);
}

.cert-link-icon {
  display: inline-block;
  vertical-align: middle;
  color: var(--accent);
  margin-left: 4px;
  opacity: 0.6;
  transition: opacity var(--transition);
}
a.cert-card-link:hover .cert-link-icon { opacity: 1; }

/* ── CTF ── */
.ctf-list {
  display: grid;
  gap: 16px;
  max-width: 600px;
}

.ctf-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
}
.ctf-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.ctf-rank {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 700;
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.rank-gold { background: rgba(255, 189, 46, 0.15); color: #ffbd2e; }
.rank-silver { background: rgba(192, 192, 192, 0.15); color: #c0c0c0; }
.rank-bronze { background: rgba(205, 127, 50, 0.15); color: #cd7f32; }

.ctf-item h4 {
  font-size: 0.95rem;
  color: var(--text-bright);
  margin-bottom: 2px;
}
.ctf-item p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Projects ── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all 0.3s ease;
}
.project-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--accent);
}

.project-link { color: var(--text-muted); }
.project-link:hover { color: var(--accent); }

.project-card h3 {
  font-size: 1.1rem;
  color: var(--text-bright);
  margin-bottom: 8px;
}
.project-card h3 a { color: inherit; }
.project-card h3 a:hover { color: var(--accent); }

.project-card > p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tech-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ── Contact ── */
.contact-content {
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
}
.contact-content p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 1.05rem;
}
.contact-links {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* ── Article ── */
.article-header {
  padding: 60px 0 40px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.article-meta {
  display: flex;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.article-header h1 {
  font-size: 2.2rem;
  color: var(--text-bright);
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.article-tags {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.article-content {
  padding: 48px 0 60px;
}

.article-content h2 {
  font-size: 1.5rem;
  color: var(--text-bright);
  margin-top: 48px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.article-content h3 {
  font-size: 1.2rem;
  color: var(--text-bright);
  margin-top: 32px;
  margin-bottom: 12px;
}

.article-content p {
  margin-bottom: 16px;
}

.article-content ul, .article-content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.article-content li { margin-bottom: 6px; }

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 12px 20px;
  margin: 24px 0;
  background: var(--accent-dim);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
}

.article-content pre {
  background: #1a1e2e;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  margin: 24px 0;
  font-size: 0.85rem;
}

.article-content code {
  font-family: var(--mono);
  font-size: 0.88em;
}

.article-content p code,
.article-content li code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--accent);
}

.article-content img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 24px 0;
}

.article-content a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Article Nav ── */
.article-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.article-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
}
.article-nav-link:hover { color: var(--accent); }
.article-nav-link span:last-child {
  color: var(--text-bright);
  font-weight: 500;
}
.article-nav-link.next { text-align: right; margin-left: auto; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 48px;
  list-style: none;
}

.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.page-item .page-link:hover,
.page-item.active .page-link {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* ── About Page ── */
.about-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

.about-content h2 {
  font-size: 1.3rem;
  color: var(--text-bright);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.about-content h2::before {
  content: '#';
  color: var(--accent);
  font-family: var(--mono);
}

.about-content p {
  margin-bottom: 12px;
  line-height: 1.8;
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}

.skill-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.skill-group h4 {
  font-size: 0.85rem;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.skill-group p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 32px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -33px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline-item h4 {
  font-size: 1rem;
  color: var(--text-bright);
  margin-bottom: 2px;
}

.timeline-item .company {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 500;
}

.timeline-item .period {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--mono);
  margin-bottom: 8px;
}

.timeline-item p:last-child {
  color: var(--text);
  font-size: 0.9rem;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0 24px;
  background: var(--bg-alt);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.footer-logo {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}

.footer-info p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.footer-links {
  display: flex;
  gap: 16px;
}
.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.footer-bottom p {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .hero { padding: 60px 0 40px; min-height: auto; }
  .hero-content { grid-template-columns: 1fr; gap: 40px; }
  .hero-name { font-size: 2.2rem; }
  .hero-title { font-size: 1.1rem; }
  .hero-cta { flex-direction: column; }
  .hero-cta .btn { text-align: center; justify-content: center; }

  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    gap: 0;
    padding: 16px 24px;
  }
  .nav-links.open { display: flex; }
  .nav-links li a { padding: 12px 0; display: block; }

  .section { padding: 48px 0; }
  .section-title { font-size: 1.4rem; margin-bottom: 32px; }

  .posts-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .certs-grid { grid-template-columns: repeat(2, 1fr); }

  .article-header h1 { font-size: 1.6rem; }
  .article-nav { flex-direction: column; }

  .footer-content { flex-direction: column; gap: 16px; text-align: center; }
  .contact-links { flex-direction: column; }
}

@media (max-width: 480px) {
  .certs-grid { grid-template-columns: 1fr; }
  .hero-name { font-size: 1.8rem; }
  .skills-list { grid-template-columns: 1fr; }
}

/* ── Animations ── */
.js-animate .animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js-animate .animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}
.animate-in:nth-child(2) { transition-delay: 0.1s; }
.animate-in:nth-child(3) { transition-delay: 0.2s; }
.animate-in:nth-child(4) { transition-delay: 0.3s; }
.animate-in:nth-child(5) { transition-delay: 0.4s; }
.animate-in:nth-child(6) { transition-delay: 0.5s; }

/* ── Selection ── */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }
