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

:root {
  --bg: #0d0d0d;
  --bg-alt: #111111;
  --surface: #1a1a1a;
  --border: #222222;
  --text: #e8e8e8;
  --text-muted: #888888;
  --accent: #4f8ef7;
  --accent-hover: #6fa3ff;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --max-w: 820px;
}

html {
  scroll-behavior: smooth;
}

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

/* Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 28px;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}

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

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

.hero-content {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.hero h1 {
  font-size: clamp(42px, 8vw, 72px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 16px;
}

.hero-tagline {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 300;
  margin-bottom: 8px;
  min-height: 1.6em;
}

.hero-location {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 36px;
  min-height: 1.6em;
}

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

.hero-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--accent);
  padding: 8px 18px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.hero-links a:hover {
  background: var(--accent);
  color: #fff;
}

/* Sections */
.section {
  padding: 96px 24px;
}

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

.container {
  max-width: var(--max-w);
  margin: 0 auto;
}

h2 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 40px;
  color: var(--text);
}

/* About */
.about-body p {
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.75;
  max-width: 640px;
  margin-bottom: 48px;
}

.experience h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

.exp-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-areas:
    "role company date"
    "detail detail detail";
  gap: 4px 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}

.exp-item:last-child {
  border-bottom: 1px solid var(--border);
}

.exp-role {
  grid-area: role;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
}

.exp-company {
  grid-area: company;
  font-size: 14px;
  color: var(--text-muted);
}

.exp-date {
  grid-area: date;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
}

.exp-detail {
  grid-area: detail;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 2px;
}

.education {
  margin-top: 48px;
}

.education h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}

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

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, transform 0.15s;
}

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

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

.project-header h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.project-url {
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
}

.project-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
  flex: 1;
}

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

.project-tags span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  letter-spacing: 0.02em;
}

/* Reading */
.reading-toggle {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
  margin-bottom: 40px;
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 20px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.reading-shelf.hidden {
  display: none;
}

.book-queue {
  display: flex;
  flex-direction: column;
}

.book-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.book-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3px;
  width: 16px;
  flex-shrink: 0;
}

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

.node-dot.pulse {
  background: var(--accent);
  animation: pulse-ring 2s ease-out infinite;
}

.node-dot.done {
  background: transparent;
  border: 2px solid var(--border);
}

.node-dot.queued {
  background: transparent;
  border: 2px dashed var(--border);
}

.node-line {
  width: 1px;
  flex: 1;
  min-height: 32px;
  background: var(--border);
  margin-top: 6px;
}

.book-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-bottom: 28px;
}

.book-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.book-row.book-active .book-label {
  color: var(--accent);
}

.book-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.15s;
}

.book-title:hover {
  color: var(--accent);
}

.book-title.strikethrough {
  text-decoration: line-through;
  color: var(--text-muted);
}

.book-title.strikethrough:hover {
  color: var(--text-muted);
}

.book-author {
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0.7;
}

.book-row.book-active .book-author {
  opacity: 1;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(79, 142, 247, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(79, 142, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 142, 247, 0); }
}

/* Writing Card */
.writing-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  max-width: 480px;
  transition: border-color 0.2s, transform 0.2s;
}

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

.writing-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: rgba(255, 255, 255, 0.025);
  border-bottom: 1px solid var(--border);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.writing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  animation: pulse-ring 2s ease-out infinite;
}

.writing-path {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.writing-path strong {
  color: var(--text);
  font-weight: 600;
}

.writing-arrow {
  color: var(--accent);
  font-size: 14px;
  font-family: var(--font);
}

.writing-card-body {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.writing-card-body p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.writing-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-ring 2s ease-out infinite;
}

/* Contact */
.contact-sub {
  color: var(--text-muted);
  font-size: 17px;
  margin-bottom: 32px;
  min-height: 1.6em;
}

.contact-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-email {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 400;
}

.contact-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  padding: 10px 22px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
}

.contact-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
}

footer p {
  font-size: 13px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
  .exp-item {
    grid-template-columns: 1fr;
  }
  .exp-date {
    text-align: left;
  }
  nav ul {
    gap: 16px;
  }
}

/* Fade-in on scroll */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
