/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --border: #334155;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #38bdf8;
  --green: #22c55e;
  --chip-bg: #334155;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: #7dd3fc; }

/* === Top Bar === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.topbar-left { display: flex; align-items: center; gap: .6rem; }
.topbar-name { font-weight: 700; font-size: 1.05rem; }
.topbar-sep { color: var(--text-dim); }
.topbar-title { color: var(--text-dim); font-size: .9rem; }

.status-dot {
  width: 8px; height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
.status-label { font-family: var(--mono); font-size: .75rem; color: var(--green); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

.topbar-links { display: flex; gap: 1rem; align-items: center; }
.topbar-links a { color: var(--text-dim); transition: color .2s; }
.topbar-links a:hover { color: var(--accent); }

/* === Dashboard Grid === */
.dashboard {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-auto-rows: auto;
  gap: 1rem;
  padding: 1rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* === Widget === */
.widget {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.widget-header {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.widget-icon { color: var(--accent); font-size: .5rem; }
.widget-header-link {
  margin-left: auto;
  font-size: .7rem;
  color: var(--text-dim);
}
.widget-header-link:hover { color: var(--accent); }

.widget-body { padding: .75rem; }

/* === Grid placement === */
.widget-status { grid-column: 1; grid-row: 1; }
.widget-skills { grid-column: 1; grid-row: 2; }
.widget-experience { grid-column: 2; grid-row: 1 / 4; }
.widget-projects { grid-column: 3; grid-row: 1; }
.widget-education { grid-column: 3; grid-row: 2; }

/* === Status Widget === */
.kv { display: flex; justify-content: space-between; padding: .35rem 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.kv:last-child { border-bottom: none; }
.kv-key { font-family: var(--mono); font-size: .8rem; color: var(--text-dim); }
.kv-val { font-size: .85rem; font-weight: 500; }
.kv-val a { color: var(--text); }
.kv-val a:hover { color: var(--accent); }

/* === Gauges === */
/* === Metric Sparkline === */
.metric-section {
  padding: .5rem .75rem .4rem;
  border-top: 1px solid var(--border);
}
.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .25rem;
}
.metric-title {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.metric-live {
  font-family: var(--mono);
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
}
.sparkline {
  width: 100%;
  height: 40px;
  display: block;
}
.spark-seg {
  stroke-width: 2;
  stroke-linecap: round;
}
.sparkline-dot {
  fill: var(--accent);
  filter: drop-shadow(0 0 4px var(--accent));
  animation: pulse 2s infinite;
}
.metric-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .5rem;
  color: var(--text-dim);
  opacity: .5;
  margin-top: .1rem;
}
.metric-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .35rem;
  font-family: var(--mono);
  font-size: .5rem;
  color: var(--text-dim);
}
.metric-legend i { font-style: normal; font-size: .45rem; }

/* deprecated gauge styles kept minimal */
.gauge-section {
  display: none;
}
.gauge-container { text-align: center; }
.gauge { width: 80px; height: 80px; }
.gauge-bg {
  fill: none;
  stroke: rgba(255,255,255,.06);
  stroke-width: 8;
}
.gauge-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s ease;
}
.gauge-fill-green { stroke: var(--green); }

/* Learning curve */
.learning-curve { width: 80px; height: 80px; }
.curve-line {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: draw-curve 2s ease forwards;
}
.curve-dot {
  fill: var(--accent);
  opacity: 0;
  animation: dot-appear .3s ease 1.8s forwards;
}
.curve-axis {
  fill: var(--text-dim);
  font-family: var(--mono);
  font-size: .5rem;
}
@keyframes draw-curve {
  to { stroke-dashoffset: 0; }
}
@keyframes dot-appear {
  to { opacity: 1; }
}
.gauge-text {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}
.gauge-label {
  fill: var(--text-dim);
  font-family: var(--mono);
  font-size: .6rem;
  text-anchor: middle;
  letter-spacing: .1em;
}
.gauge-detail {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--text-dim);
  margin-top: .25rem;
}

/* === Timeline === */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
}

.tl-entry { position: relative; margin-bottom: 1.5rem; }
.tl-entry:last-child { margin-bottom: 0; }

.tl-dot {
  position: absolute;
  left: -1.5rem;
  top: .35rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
  z-index: 1;
}
.tl-dot.active { box-shadow: 0 0 8px var(--accent); }
.tl-dot.dim { background: var(--text-dim); }

.tl-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .25rem; }
.tl-company { font-weight: 600; font-size: .95rem; color: var(--text); display: inline-flex; align-items: center; gap: .35rem; }
a.tl-company:hover { color: var(--accent); }
.tl-logo { height: 16px; width: auto; border-radius: 2px; }
.tl-logo-sm { height: 13px; width: auto; border-radius: 2px; vertical-align: middle; margin-right: .15rem; }
.tl-date { font-family: var(--mono); font-size: .75rem; color: var(--text-dim); }
.tl-role { font-size: .8rem; color: var(--accent); margin: .15rem 0 .4rem; }
.tl-role a { color: var(--accent); }
.tl-role a:hover { color: #7dd3fc; }

.tl-desc {
  font-size: .8rem;
  color: var(--text-dim);
  padding-left: 1rem;
  margin-bottom: .5rem;
}
.tl-desc li { margin-bottom: .2rem; }
.tl-desc a { color: var(--text-dim); border-bottom: 1px dotted var(--text-dim); }
.tl-desc a:hover { color: var(--accent); border-color: var(--accent); }

.tl-entry-minor .tl-desc { font-size: .75rem; }

.tl-chips { display: flex; flex-wrap: wrap; gap: .3rem; }

/* === Chips === */
.chip {
  font-family: var(--mono);
  font-size: .65rem;
  padding: .2rem .5rem;
  background: var(--chip-bg);
  border-radius: 4px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: background .2s, color .2s;
}
a.chip:hover { background: rgba(56, 189, 248, .15); color: var(--accent); }
.chip.accent { color: var(--accent); border: 1px solid rgba(56, 189, 248, .25); background: rgba(56, 189, 248, .08); }
a.chip.accent:hover { background: rgba(56, 189, 248, .2); color: #7dd3fc; }

/* Glow on hover from experience */
.chip.glow, a.chip.glow, a.skill-name.glow {
  color: #fbbf24 !important;
  background: rgba(251, 191, 36, .15) !important;
  border-color: rgba(251, 191, 36, .4) !important;
  box-shadow: 0 0 8px rgba(251, 191, 36, .3);
  transition: all .2s ease;
}
a.skill-name.glow { background: none !important; box-shadow: none; text-shadow: 0 0 8px rgba(251, 191, 36, .5); }

/* === Skills Widget === */
.skill-group { margin-bottom: .6rem; }
.skill-group:last-child { margin-bottom: 0; }
.skill-label {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .4rem;
}
.skill-bars { display: flex; flex-direction: column; gap: .35rem; }
.skill-row { display: flex; align-items: center; gap: .5rem; }
.skill-name {
  font-family: var(--mono);
  font-size: .75rem;
  width: 60px;
  color: var(--text);
}
a.skill-name:hover { color: var(--accent); }
.bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
}
.skill-tags { display: flex; flex-wrap: wrap; gap: .3rem; }

/* === Projects Widget === */
.project-item {
  padding: .65rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.project-item:last-child { border-bottom: none; }
.project-item-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .3rem;
}
.project-item-header a {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
}
.project-item-header a:hover { color: var(--accent); }
.project-badge {
  font-family: var(--mono);
  font-size: .65rem;
  padding: .15rem .45rem;
  background: rgba(251, 191, 36, .12);
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 4px;
  color: #fbbf24;
  margin-left: auto;
  white-space: nowrap;
}
.project-item-desc {
  font-size: .8rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.project-item-desc a { color: var(--accent); }
.project-item-desc a:hover { color: #7dd3fc; }

/* === Education Widget === */
.edu-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .1rem;
  padding: .5rem 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.edu-entry:last-child { border-bottom: none; }
.edu-school {
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}
a.edu-school:hover { color: var(--accent); }
.edu-logo {
  height: 18px;
  width: auto;
  opacity: .8;
}
a.edu-school:hover .edu-logo { opacity: 1; }
.edu-detail { font-size: .75rem; color: var(--text-dim); grid-column: 1; }
.edu-date { font-family: var(--mono); font-size: .7rem; color: var(--text-dim); grid-row: 1 / 3; align-self: center; }

/* === Footer === */
.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}
.footer-sep { opacity: .3; }

/* === Responsive === */
@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }
  .widget-status { grid-column: 1; grid-row: auto; }
  .widget-experience { grid-column: 1 / 3; grid-row: auto; }
  .widget-skills { grid-column: 1 / 3; grid-row: auto; }
  .widget-projects { grid-column: 1 / 3; grid-row: auto; }
  .widget-education { grid-column: 1 / 3; grid-row: auto; }
}

@media (max-width: 640px) {
  .dashboard {
    grid-template-columns: 1fr;
    padding: .75rem;
  }
  .topbar { padding: .6rem 1rem; }
  .topbar-left { flex-wrap: wrap; gap: .3rem; }
  .topbar-sep, .topbar-title { display: none; }
}
