/* ── Reset & Base ─────────────────────────────────────────────────────────── */

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

:root {
  --bg:        #f8f6f2;
  --bg-alt:    #f0ece5;
  --card:      #ffffff;
  --card-hover:#faf9f7;
  --border:    #e2d9ce;
  --border-hi: #c9bdb0;
  --text:      #111827;
  --muted:     #6b7280;
  --accent:    #2563eb;
  --accent-hi: #1d4ed8;
  --gold:      #d97706;
  --green:     #16a34a;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,0.09);
  --glow:      0 0 28px rgba(37,99,235,0.18);
  --font:      'Inter', system-ui, sans-serif;
  --mono:      'JetBrains Mono', 'Courier New', monospace;
}

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ── Layout ──────────────────────────────────────────────────────────────── */

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

.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }

.section-title {
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.section-title::after {
  content: '';
  display: block;
  width: 36px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  margin-top: 10px;
  border-radius: 2px;
}

.section-sub {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 48px;
  max-width: 600px;
  margin-top: 16px;
}

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 246, 242, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Logo ────────────────────────────────────────────────────────────────── */

.nav-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.logo-mark {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1e3a8a, #2563eb);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.3), 0 0 20px rgba(37,99,235,0.25);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  flex-shrink: 0;
  z-index: 1;
}

.logo-mark::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(37,99,235,0.3);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.logo-mark::after {
  content: '';
  position: absolute;
  inset: -13px;
  border-radius: 50%;
  border: 1px solid rgba(37,99,235,0.13);
  transition: border-color 0.3s ease, opacity 0.3s ease;
}

.logo-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-logo:hover .logo-mark {
  box-shadow: 0 0 0 2px rgba(37,99,235,0.55), 0 0 32px rgba(37,99,235,0.5);
  transform: scale(1.06);
}

.nav-logo:hover .logo-mark::before {
  border-color: rgba(37,99,235,0.55);
  transform: scale(1.04);
}

.nav-logo:hover .logo-mark::after {
  border-color: rgba(37,99,235,0.3);
}

.nav-logo:hover .logo-name {
  color: var(--accent-hi);
}

/* ── Nav Links ───────────────────────────────────────────────────────────── */

.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
  letter-spacing: 0.01em;
}

.nav-links a:hover { color: var(--text); }

.nav-cta {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 7px 18px;
  border-radius: 6px;
  font-weight: 600 !important;
  transition: background 0.2s, box-shadow 0.2s !important;
}

.nav-cta:hover {
  background: #1e40af !important;
  box-shadow: 0 0 16px rgba(37,99,235,0.35) !important;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero {
  padding: 100px 0 88px;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -80px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(37,99,235,0.07) 0%, transparent 65%);
  pointer-events: none;
}

.hero-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 72px;
  align-items: center;
  position: relative;
}

.hero-name {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 1.1rem;
  color: var(--accent-hi);
  font-weight: 500;
  margin-bottom: 22px;
  letter-spacing: 0.01em;
}

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.8;
  margin-bottom: 34px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 0 rgba(37,99,235,0);
}

.btn-primary:hover {
  background: #1e40af;
  box-shadow: 0 0 20px rgba(37,99,235,0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-hi);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-hi);
}

.hero-certs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.cert-badge img {
  height: 76px;
  width: 76px;
  display: block;
  mix-blend-mode: multiply;
  transition: transform 0.2s, opacity 0.2s;
}

.cert-badge:hover img {
  transform: scale(1.08);
  opacity: 0.85;
}

.cert-tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: rgba(37,99,235,0.07);
  border: 1px solid rgba(37,99,235,0.22);
  color: var(--accent-hi);
  padding: 4px 10px;
  border-radius: 4px;
  font-weight: 500;
}

.cert-tag--progress {
  background: rgba(245,158,11,0.07);
  border-color: rgba(245,158,11,0.22);
  color: var(--gold);
}

.cert-tag--progress em { font-style: normal; opacity: 0.75; }

/* ── Hero Photo ──────────────────────────────────────────────────────────── */

.hero-photo {
  display: flex;
  justify-content: center;
}

.photo-frame {
  width: 350px;
  height: 350px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--border-hi);
  box-shadow: 0 0 0 8px rgba(37,99,235,0.08), var(--shadow);
  flex-shrink: 0;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* ── About ───────────────────────────────────────────────────────────────── */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 64px;
  align-items: start;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 18px;
  font-size: 1rem;
  line-height: 1.8;
}

.about-text p:last-child { margin-bottom: 0; }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.stat:hover {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(37,99,235,0.12);
}

.stat-num {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-hi);
  font-family: var(--mono);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Skills ──────────────────────────────────────────────────────────────── */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 18px;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.skill-card:hover {
  border-color: var(--accent);
  background: var(--card-hover);
  box-shadow: 0 0 14px rgba(37,99,235,0.1);
}

.skill-icon {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.skill-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text);
}

.skill-card li {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 2px 0 2px 12px;
  position: relative;
}

.skill-card li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ── Projects ────────────────────────────────────────────────────────────── */

.projects-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 20px rgba(37,99,235,0.1);
}

.project-card--featured:hover {
  box-shadow: 0 8px 40px rgba(0,0,0,0.45), 0 0 28px rgba(37,99,235,0.15);
}

.project-diagram {
  background: rgba(37,99,235,0.04);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px;
}

.diagram-placeholder { text-align: center; padding: 8px 0; }
.diagram-placeholder--sm { padding: 4px 0; }

.diagram-label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 7px;
}

.diagram-ascii {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-hi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-content {
  padding: 22px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-content h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(37,99,235,0.1);
  border: 1px solid rgba(37,99,235,0.3);
  color: var(--accent-hi);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.project-content p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 4px;
}

.project-link {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-hi);
  align-self: flex-start;
  margin-top: 2px;
  transition: color 0.2s;
}

.project-link:hover { color: #fff; }

/* ── Blog ────────────────────────────────────────────────────────────────── */

.writing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.writing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.writing-card:hover { border-color: var(--border-hi); }
.writing-card--soon { opacity: 0.72; }

.writing-meta { display: flex; gap: 8px; align-items: center; }

.writing-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.22);
  padding: 3px 9px;
  border-radius: 4px;
}

.writing-card h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--text);
}

.writing-card p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
  flex: 1;
}

.writing-cta {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-hi);
  align-self: flex-start;
}

.writing-cta:hover { text-decoration: underline; }

.writing-cta-disabled {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

.writing-card--published {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  border-color: rgba(22,163,74,0.35);
  text-decoration: none;
  cursor: pointer;
}

.writing-card--published:hover {
  border-color: var(--green);
  box-shadow: 0 4px 20px rgba(22,163,74,0.1);
}

.writing-card--published .writing-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.writing-card--published h3 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.writing-card--published p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
}

.writing-tag--published {
  color: var(--green);
  background: rgba(22,163,74,0.08);
  border-color: rgba(22,163,74,0.22);
}

.writing-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.writing-card--published .writing-arrow {
  font-size: 1.4rem;
  color: var(--border-hi);
  flex-shrink: 0;
  transition: color 0.2s, transform 0.2s;
}

.writing-card--published:hover .writing-arrow {
  color: var(--green);
  transform: translateX(4px);
}

@media (max-width: 600px) {
  .writing-card--published {
    grid-template-columns: 1fr;
  }
  .writing-card--published .writing-arrow { display: none; }
}

/* ── Contact ─────────────────────────────────────────────────────────────── */

.contact-container { text-align: center; }
.contact-container .section-sub { margin: 16px auto 48px; }

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
  padding: 14px 28px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  transition: all 0.2s;
  font-weight: 500;
}

.contact-link:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--card-hover);
  box-shadow: 0 0 16px rgba(37,99,235,0.12);
}

.contact-icon {
  font-style: normal;
  font-weight: 700;
  color: var(--accent-hi);
  font-family: var(--mono);
  width: 22px;
  text-align: center;
  font-size: 0.95rem;
}

/* ── Flagship Project Card ───────────────────────────────────────────────── */

.project-card--flagship {
  grid-column: 1 / -1;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(37,99,235,0.12), var(--shadow);
  overflow: visible;
}

.flagship-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
}

.flagship-terminal {
  background: #0d1117;
  border-radius: var(--radius) 0 0 var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #161b22;
  border-bottom: 1px solid #30363d;
  flex-shrink: 0;
}

.terminal-dots { display: flex; gap: 5px; }
.terminal-dots span { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dots span:nth-child(1) { background: #ff5f57; }
.terminal-dots span:nth-child(2) { background: #febc2e; }
.terminal-dots span:nth-child(3) { background: #28c840; }

.terminal-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #8b949e;
  flex: 1;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #8b949e;
  letter-spacing: 0.06em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.live-dot--up {
  background: #28c840;
  box-shadow: 0 0 6px #28c840;
  animation: bgp-pulse 2s ease-in-out infinite;
}

.live-dot--down { background: #ff5f57; }

@keyframes bgp-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

.terminal-router-select {
  display: flex;
  gap: 2px;
  padding: 6px 12px 2px;
  background: #161b22;
}

.router-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #6e7681;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 8px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.router-btn:hover  { color: #e6edf3; border-color: #30363d; }
.router-btn.active { color: #3fb950; border-color: #2ea043; background: rgba(46,160,67,0.1); }

.terminal-cmds {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}

.cmd-btn {
  font-family: var(--mono);
  font-size: 0.71rem;
  color: #8b949e;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.cmd-btn:hover  { color: #e6edf3; border-color: #30363d; }
.cmd-btn.active { color: #79c0ff; border-color: #388bfd; background: rgba(56,139,253,0.1); }

.terminal-body {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}

.terminal-prompt-line {
  font-family: var(--mono);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.terminal-prompt     { color: #28c840; }
.terminal-cmd-text   { color: #e6edf3; }

.terminal-output {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: #c9d1d9;
  line-height: 1.65;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto;
  flex: 1;
  margin: 0;
}

.terminal-output.loading::after {
  content: '▋';
  color: #28c840;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.terminal-ts {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: #484f58;
  text-align: right;
  flex-shrink: 0;
}

.flagship-info {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 1px solid var(--border);
}

.flagship-arch {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
}

.flagship-arch code {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.project-badge--live {
  background: rgba(40,200,64,0.1);
  border: 1px solid rgba(40,200,64,0.3);
  color: #16a34a;
}

@media (max-width: 900px) {
  .flagship-layout { grid-template-columns: 1fr; }
  .flagship-terminal { border-radius: var(--radius) var(--radius) 0 0; min-height: 260px; }
  .flagship-info { border-left: none; border-top: 1px solid var(--border); }
  .terminal-cmds { flex-wrap: wrap; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}

.footer p { font-size: 0.8rem; color: var(--muted); }
.footer a { color: var(--accent-hi); }
.footer a:hover { text-decoration: underline; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero-container {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .hero-photo { order: -1; }
  .photo-frame { width: 240px; height: 240px; }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 768px) {
  .nav-links { gap: 16px; }
  .nav-links li:not(:last-child) { display: none; }
  .logo-name { display: none; }
  .section { padding: 72px 0; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .writing-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 1.6rem; }
}

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