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

:root {
  --sidebar-bg:   #1B2A4A;
  --sidebar-text: #E8EFF8;
  --sidebar-sub:  #9AADBE;
  --bg:           #F4F5F7;
  --bg-card:      #FFFFFF;
  --border:       #E8E5DF;
  --text-1:       #1B2A4A;
  --text-2:       #4A5568;
  --text-3:       #9AA5B4;
  --accent:       #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft:  #EFF6FF;
  --font:         'Inter', system-ui, sans-serif;
  --mono:         'JetBrains Mono', monospace;
  --radius:       12px;
  --shadow:       0 2px 12px rgba(27,42,74,0.08);
  --shadow-lg:    0 8px 32px rgba(27,42,74,0.12);
}

[data-theme="dark"] {
  --sidebar-bg:   #0F1923;
  --sidebar-text: #FFFFFF;
  --sidebar-sub:  #B0C8D8;
  --bg:           #16202E;
  --bg-card:      #1E2B3C;
  --border:       #2A3A4F;
  --text-1:       #FFFFFF;
  --text-2:       #D8E8F4;
  --text-3:       #A0BCCF;
  --accent:       #60A5FA;
  --accent-hover: #93C5FD;
  --accent-soft:  #1A2F4A;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2.5rem 1.5rem 1.5rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
  transition: background .25s;
}

.avatar-wrap {
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  overflow: hidden;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; object-position: top; }

.sidebar-name {
  font-size: 1.15rem; font-weight: 700;
  color: var(--sidebar-text);
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 0.3rem;
}

.sidebar-title {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #93C5FD;
  text-align: center;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.sidebar-loc {
  font-size: 0.75rem;
  color: var(--sidebar-sub);
  text-align: center;
  margin-bottom: 1.75rem;
}

.sidebar-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.875rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--sidebar-sub);
  transition: all 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.08);
  color: var(--sidebar-text);
}

.sidebar-nav a.active { color: #fff; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-socials {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  width: 100%;
  justify-content: center;
}

.sidebar-socials a {
  color: var(--sidebar-sub);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color 0.15s;
}

.sidebar-socials a:hover { color: var(--sidebar-text); }

.sidebar-copy {
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--sidebar-sub);
  opacity: 0.8;
  text-align: center;
}

/* ── Main ── */
.main {
  margin-left: 260px;
  flex: 1;
  padding: 2.5rem;
  min-height: 100vh;
}

/* ── Theme toggle ── */
.theme-btn {
  position: fixed;
  top: 1.25rem; right: 1.25rem;
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.theme-btn:hover { transform: scale(1.05); }

/* ── Sections ── */
.section { display: block; max-width: 860px; }


.page-title {
  font-size: 1.75rem; font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-1);
  margin-bottom: 0.3rem;
}

.page-line {
  width: 36px; height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-bottom: 2rem;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--accent);
}

/* ── About ── */
.about-bio { margin-bottom: 1.25rem; }
.about-bio p { font-size: 0.9rem; color: var(--text-2); line-height: 1.75; margin-bottom: 0.75rem; }
.about-bio p:last-child { margin-bottom: 0; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.info-card h4 { font-size: 0.75rem; font-family: var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.75rem; }
.info-list { display: flex; flex-direction: column; gap: 0.4rem; }
.info-item { font-size: 0.85rem; color: var(--text-2); display: flex; align-items: center; gap: 0.5rem; }
.info-item::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ── Skills ── */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 1rem; }
.skill-group h4 { font-size: 0.72rem; font-family: var(--mono); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 0.6rem; padding-bottom: 0.4rem; border-bottom: 1px solid var(--border); }
.skill-list { display: flex; flex-direction: column; gap: 0.35rem; }
.skill-item { font-size: 0.85rem; color: var(--text-2); display: flex; align-items: center; gap: 0.5rem; }
.skill-item::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ── Projects ── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.25rem; }
.proj-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.6rem; }
.proj-head h3 { font-size: 0.975rem; font-weight: 600; color: var(--text-1); }
.proj-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.65; margin-bottom: 1rem; }
.proj-links { display: flex; gap: 1rem; }
.proj-links a { font-size: 0.8rem; font-weight: 500; color: var(--accent); }

/* ── Badges ── */
.badge { font-family: var(--mono); font-size: 0.65rem; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
.badge-live { background: #DCFCE7; color: #166534; }
.badge-wip  { background: #FEF9C3; color: #854D0E; }
.badge-paused { background: var(--accent-soft); color: var(--accent); }
[data-theme="dark"] .badge-live { background: #14532D; color: #86EFAC; }
[data-theme="dark"] .badge-wip  { background: #422006; color: #FDE047; }

/* ── Pills ── */
.pill-row { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.pill { font-family: var(--mono); font-size: 0.68rem; padding: 3px 8px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); }
[data-theme="dark"] .pill { background: rgba(74,144,226,0.15); }

/* ── Certs ── */
.cert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.cert-card { display: flex; gap: 1rem; align-items: flex-start; }
.cert-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.cert-card h3 { font-size: 0.875rem; font-weight: 600; color: var(--text-1); margin-bottom: 0.2rem; line-height: 1.35; }
.cert-issuer { font-family: var(--mono); font-size: 0.7rem; color: var(--text-3); margin-bottom: 0.35rem; }

/* ── Contact ── */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.contact-form input, .contact-form textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-family: var(--font);
  font-size: 0.875rem; color: var(--text-1); margin-bottom: 0.75rem;
  outline: none; transition: border-color 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); }
.contact-form textarea { min-height: 120px; resize: vertical; }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; padding: 10px 20px; border-radius: 8px; font-size: 0.875rem; font-weight: 500; cursor: pointer; border: none; transition: all 0.18s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.contact-links { display: flex; flex-direction: column; gap: 0.75rem; }
.contact-link { display: flex; align-items: center; gap: 0.875rem; padding: 0.875rem 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); font-size: 0.875rem; transition: all 0.2s; }
.contact-link:hover { border-color: var(--accent); color: var(--text-1); background: var(--accent-soft); }
.cl-icon { font-size: 1.1rem; width: 28px; text-align: center; }
.cl-label { font-weight: 500; font-size: 0.8rem; color: var(--text-1); }
.cl-val { font-size: 0.75rem; color: var(--text-3); }

/* ── Blog ── */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 1.25rem; }
.blog-card h3 { font-size: 0.975rem; font-weight: 600; color: var(--text-1); margin-bottom: 0.4rem; line-height: 1.4; }
.blog-card h3 a { color: var(--text-1); }
.blog-card h3 a:hover { color: var(--accent); }
.blog-meta { font-family: var(--mono); font-size: 0.72rem; color: var(--text-3); margin-bottom: 0.6rem; }
.blog-card p { font-size: 0.875rem; color: var(--text-2); line-height: 1.65; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { width: 100%; min-height: auto; position: relative; flex-direction: row; flex-wrap: wrap; padding: 1rem; justify-content: center; }
  .main { margin-left: 0; padding: 1.5rem; }
  .info-grid, .contact-grid { grid-template-columns: 1fr; }
}

/* ── Sidebar home link ── */
.sidebar-home-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s;
}
.sidebar-home-link:hover { opacity: 0.85; }
.sidebar-home-link .sidebar-name { color: var(--sidebar-text); }

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-3);
  margin-bottom: 2rem;
  transition: color .15s;
}
.back-link:hover { color: var(--text-1); }

/* ── Post content ── */
.post-content { font-size: .925rem; line-height: 1.8; color: var(--text-2); }
.post-content h2, .post-content h3 { color: var(--text-1); margin: 1.5rem 0 .5rem; }
.post-content p { margin-bottom: 1rem; }
.post-content ul, .post-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.post-content code { font-family: var(--mono); font-size: .85em; background: var(--bg-code, var(--bg-subtle, #f0f0ed)); padding: 2px 6px; border-radius: 4px; }
.post-content pre { background: var(--bg-code, #f0f0ed); padding: 1rem; border-radius: 8px; overflow-x: auto; margin-bottom: 1rem; }

/* ── Prevent flash of wrong theme ── */
html[data-theme="dark"] body { background: #16202E; }

/* ── Post / Page layout ── */
.post-wrap {
  max-width: 860px;
}

.post-date {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--text-3);
  margin-bottom: 2rem;
}

/* Override post-content to remove card box */
.post-content {
  font-size: .925rem;
  line-height: 1.8;
  color: var(--text-2);
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

.post-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 2rem 0 .75rem;
  letter-spacing: -.02em;
}

.post-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 1.5rem 0 .5rem;
}

.post-content p { margin-bottom: 1.1rem; }

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-content li { margin-bottom: .35rem; }

.post-content strong { color: var(--text-1); font-weight: 600; }

.post-content code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--bg-subtle, #f0f0ed);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent);
}

.post-content pre {
  background: var(--bg-subtle, #f0f0ed);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-family: var(--mono);
  font-size: .85rem;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding: .75rem 1.25rem;
  margin: 1.25rem 0;
  color: var(--text-3);
  font-style: italic;
}

/* ── Cert dates ── */
.cert-dates {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 4px 0 6px;
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--mono);
}

.cert-expires { color: var(--text-3); }
.cert-expired { color: #dc2626; }
[data-theme="dark"] .cert-expired { color: #f87171; }

/* ── Cert card improvements ── */
.cert-card {
  align-items: center;
  min-height: 100px;
}

.cert-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1) !important;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.cert-card h3 a {
  color: var(--text-1) !important;
  text-decoration: none;
}

.cert-card h3 a:hover {
  color: var(--accent) !important;
}

.cert-card .cert-issuer {
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  color: var(--text-3);
}

.cert-icon {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.cert-icon img {
  width: 44px !important;
  height: 44px !important;
  object-fit: contain;
}

@media (max-width: 600px) {
  .cert-grid { grid-template-columns: 1fr; }
}

/* ── Force cert title color in both modes ── */
.cert-card h3,
.cert-card h3 a {
  color: var(--text-1) !important;
}
.cert-card h3 a:hover {
  color: var(--accent) !important;
}

/* ── Dark mode cert text fix ── */
[data-theme="dark"] .cert-card h3,
[data-theme="dark"] .cert-card h3 a {
  color: #E8EFF8 !important;
}

[data-theme="dark"] .cert-card .cert-issuer {
  color: #9AADBE !important;
}

[data-theme="dark"] .cert-dates {
  color: #7A94A8 !important;
}

/* ── Bigger cert icon ── */
.cert-icon {
  width: 70px !important;
  height: 70px !important;
  min-width: 70px;
  font-size: 1.75rem !important;
}

.cert-icon img {
  width: 56px !important;
  height: 56px !important;
  object-fit: contain;
}

/* ── Nuclear cert title fix ── */
.cert-card h3 a,
.cert-card h3 a:link,
.cert-card h3 a:visited,
[data-theme="dark"] .cert-card h3 a,
[data-theme="dark"] .cert-card h3 a:link,
[data-theme="dark"] .cert-card h3 a:visited {
  color: var(--text-1) !important;
  text-decoration: none !important;
}

.cert-card h3 a:hover,
[data-theme="dark"] .cert-card h3 a:hover {
  color: var(--accent) !important;
}

/* ── Contact links grid ── */
.contact-links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  max-width: 600px;
}

@media (max-width: 600px) {
  .contact-links-grid { grid-template-columns: 1fr; }
}

/* ── Contact links brighter ── */
.cl-label { font-weight: 600; font-size: 0.875rem; color: var(--text-1); }
.cl-val { font-size: 0.8rem; color: var(--text-2); }

/* ── Contact grid 2 cols ── */
.contact-links-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  max-width: 100% !important;
}


/* ── Single page scroll sections ── */
.main > div {
  padding-bottom: 4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.main > div:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.section { display: block !important; max-width: 860px; }

/* Offset anchor scroll for fixed sidebar header on mobile */
div[id] { scroll-margin-top: 1rem; }
