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

:root {
  --ink: #0F1B2D;
  --ink-soft: #16273F;
  --paper: #F6F7F9;
  --paper-raised: #FFFFFF;
  --steel: #245A8D;
  --steel-dark: #1B4266;
  --signal: #1F9D6C;
  --slate: #5B6672;
  --line: #DDE2E8;
  --line-dark: rgba(255,255,255,0.12);

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

a { color: inherit; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--steel);
  font-weight: 500;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Header ---------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 247, 249, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}
.logo span { color: var(--signal); }
nav.links { display: flex; gap: 28px; }
nav.links a {
  font-size: 14px;
  text-decoration: none;
  color: var(--slate);
  font-weight: 500;
  transition: color 0.15s ease;
}
nav.links a:hover, nav.links a:focus-visible { color: var(--steel); }

/* ---------- Hero ---------- */
.hero {
  padding: 88px 0 64px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 56px;
  align-items: start;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: -20px; right: -8%;
  width: 480px; height: 480px;
  background-image: radial-gradient(var(--line) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(circle, black, transparent 72%);
  mask-image: radial-gradient(circle, black, transparent 72%);
  pointer-events: none;
  z-index: -1;
}
.hero-identity { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--steel), var(--ink));
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; object-fit: cover; overflow: hidden;
  box-shadow: 0 8px 20px -8px rgba(36,90,141,0.5);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero h1 {
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.05;
  margin: 0;
}
.hero .tagline {
  font-size: 18px;
  color: var(--slate);
  max-width: 46ch;
  margin: 18px 0 32px;
}
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  font-family: var(--font-body);
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--steel-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--steel); color: var(--steel); }

/* Status panel — the signature element */
.status-panel {
  background: var(--ink);
  color: #E7ECF2;
  border-radius: 10px;
  padding: 22px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  box-shadow: 0 20px 40px -20px rgba(15, 27, 45, 0.45);
}
.status-panel .dot-row {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.status-panel .dot { width: 10px; height: 10px; border-radius: 50%; background: #384A61; }
.status-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-dark);
  color: #B7C2D0;
}
.status-line:last-child { border-bottom: none; }
.status-line b { color: #fff; font-weight: 500; text-align: right; max-width: 60%; }
.status-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--signal);
}
.status-live .blip {
  width: 7px; height: 7px; border-radius: 50%; background: var(--signal);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(31,157,108,0.5); }
  50% { opacity: 0.6; }
}

/* Metrics strip */
.metrics-strip { background: var(--ink); padding: 0; border-top: none; }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 34px 28px;
}
.metric { text-align: left; padding: 0 20px; border-left: 1px solid var(--line-dark); }
.metric:first-child { border-left: none; padding-left: 0; }
.metric .num {
  font-family: var(--font-display); font-weight: 700; font-size: 34px;
  color: #fff; letter-spacing: -0.01em;
}
.metric .lbl {
  font-family: var(--font-mono); font-size: 11.5px; color: #9AACC1;
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; display: block;
}

/* ---------- Sections ---------- */
section { padding: 72px 0; border-top: 1px solid var(--line); }
section:first-of-type { border-top: none; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 40px; }
.section-head h2 { font-size: 28px; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.5s ease, transform 0.5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* About / skills */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; }
.about-grid p { color: var(--slate); font-size: 16px; }
.skill-group { margin-bottom: 18px; }
.skill-group .cat {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--slate); margin-bottom: 8px; display: block;
}
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--paper-raised); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 5px; color: var(--ink);
}

/* Experience — commit-log timeline */
.log { position: relative; padding-left: 2px; }
.log-entry {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding-bottom: 36px;
  position: relative;
}
.log-entry::before {
  content: '';
  position: absolute;
  left: 129px;
  top: 6px;
  bottom: -6px;
  width: 1px;
  background: var(--line);
}
.log-entry:last-child::before { display: none; }
.log-rail { font-family: var(--font-mono); font-size: 12px; color: var(--slate); position: relative; padding-top: 2px; }
.log-dot {
  position: absolute; left: 126px; top: 3px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--slate); border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--line);
}
.log-dot.current { background: var(--signal); box-shadow: 0 0 0 3px rgba(31,157,108,0.18); }
.log-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px 22px;
}
.log-card h3 { font-size: 18px; }
.log-card .company { font-size: 13px; color: var(--steel); font-weight: 600; margin-top: 2px; }
.log-card .loc { font-family: var(--font-mono); font-size: 11.5px; color: var(--slate); margin-top: 2px; }
.log-card p { margin: 12px 0 0; color: var(--slate); font-size: 14.5px; white-space: pre-line; }
.tag-current {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--signal);
  border: 1px solid rgba(31,157,108,0.35); padding: 2px 8px; border-radius: 999px;
  margin-left: 8px;
}

/* Projects */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.project-card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 8px;
  padding: 22px; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.project-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px -18px rgba(15,27,45,0.3); }
.project-card h3 { font-size: 17px; margin-bottom: 8px; }
.project-card p { color: var(--slate); font-size: 14px; margin: 0 0 14px; }
.project-links { display: flex; gap: 14px; margin-top: 14px; font-size: 13px; }
.project-links a { color: var(--steel); text-decoration: none; font-weight: 600; }
.project-links a:hover { text-decoration: underline; }

/* Education */
.edu-item { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.edu-item:last-child { border-bottom: none; }
.edu-item .when { font-family: var(--font-mono); font-size: 12px; color: var(--slate); white-space: nowrap; }

/* Contact / footer */
.contact-section { text-align: left; }
.contact-links { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 20px; }
.contact-links a { text-decoration: none; font-weight: 600; color: var(--steel); font-size: 15px; }
.contact-links a:hover { text-decoration: underline; }
footer {
  padding: 28px 0 40px; color: var(--slate); font-size: 13px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
footer a { color: var(--slate); text-decoration: none; }
footer a:hover { color: var(--steel); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  nav.links { display: none; }
  .log-entry { grid-template-columns: 90px 1fr; gap: 14px; }
  .log-entry::before { left: 89px; }
  .log-dot { left: 86px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 0; }
  .metric:nth-child(2n+1) { border-left: none; padding-left: 0; }
  .metric:nth-child(n+3) { padding-top: 12px; }
}

/* ---------- Admin ---------- */
.admin-shell { min-height: 100vh; }
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--ink);
}
.login-card {
  background: var(--paper-raised); border-radius: 10px; padding: 40px 36px;
  width: 100%; max-width: 380px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4);
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p.sub { color: var(--slate); font-size: 14px; margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink);
}
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px;
  font-family: var(--font-body); font-size: 14px; background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid var(--steel); outline-offset: 1px; border-color: var(--steel);
}
.error-msg { color: #B3261E; font-size: 13px; margin: -6px 0 14px; min-height: 16px; }
.admin-header {
  background: var(--ink); color: #fff; padding: 18px 0; position: sticky; top: 0; z-index: 20;
}
.admin-header .wrap { display: flex; justify-content: space-between; align-items: center; }
.admin-header h1 { font-size: 16px; font-family: var(--font-mono); font-weight: 500; }
.tab-row { display: flex; gap: 8px; margin: 28px 0; flex-wrap: wrap; }
.tab-btn {
  padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line); background: #fff;
  font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--slate);
}
.tab-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.item-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; margin-bottom: 14px;
}
.item-card .row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.item-card h4 { margin: 0; font-size: 15px; }
.item-card .meta { font-size: 12.5px; color: var(--slate); font-family: var(--font-mono); margin-top: 2px; }
.item-actions { display: flex; gap: 8px; }
.icon-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 10px;
  font-size: 12.5px; cursor: pointer; font-weight: 600;
}
.icon-btn.danger { color: #B3261E; border-color: #F0C6C2; }
.icon-btn:hover { border-color: var(--steel); color: var(--steel); }
.icon-btn.danger:hover { border-color: #B3261E; color: #B3261E; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.add-form {
  background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 20px; margin-top: 8px;
}
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 6px; font-size: 13.5px; opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.checkbox-row input { width: auto; }

/* ---------- Photo upload ---------- */
.photo-upload-box {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}
.photo-preview-wrap {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink-soft);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.photo-preview { width: 100%; height: 100%; object-fit: cover; }
.photo-preview-placeholder {
  color: #fff;
  font-family: var(--font-mono);
  font-size: 12px;
  opacity: .75;
}
.photo-upload-actions { flex: 1; min-width: 0; }
.photo-buttons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-file-btn { cursor: pointer; }
.photo-file-btn input { display: none; }
.photo-status { margin-top: 9px; color: var(--slate); font-size: 12px; }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 13px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--steel); color: var(--steel); }
@media (max-width: 680px) {
  .photo-upload-box { align-items: flex-start; flex-direction: column; }
}
