/* ═══════════════════════════════════════════════
   RESET & CUSTOM PROPERTIES
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font: 'Courier New', Courier, monospace;
  --color-bg:     #000000;
  --color-text:   #e8e8e8;
  --color-muted:  #555555;
  --color-accent: #ffffff;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-backdrop: rgba(0, 0, 0, 0.78);
  --color-donut:  rgba(255, 255, 255, 0.38);

  --section-pad:  6rem 2rem;
  --inner-pad:    2.5rem;
  --inner-max:    860px;
  --radius:       4px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  overflow-x: hidden;
}


/* ═══════════════════════════════════════════════
   TOP NAV
═══════════════════════════════════════════════ */
#topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  padding: 0 2rem;
  background: rgba(0, 0, 0, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-brand {
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: bold;
  color: var(--color-accent);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
}

.nav-brand:hover { opacity: 0.7; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.nav-link {
  font-family: var(--font);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--color-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-link:hover { color: var(--color-accent); }
.nav-link:hover::after { transform: scaleX(1); }

.nav-link.active {
  color: var(--color-text);
}

.nav-link.active::after {
  transform: scaleX(1);
  opacity: 0.4;
}


/* ═══════════════════════════════════════════════
   LAYER 0: DONUT BACKGROUND
═══════════════════════════════════════════════ */
#donut {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: clamp(8px, 1.4vw, 14px);
  line-height: 1;
  color: var(--color-donut);
  pointer-events: none;
  user-select: none;
  white-space: pre;
  overflow: hidden;
}


/* ═══════════════════════════════════════════════
   LAYER 1: CONTENT WRAPPER
═══════════════════════════════════════════════ */
#content {
  position: relative;
  z-index: 1;
}


/* ═══════════════════════════════════════════════
   SHARED SECTION PATTERNS
═══════════════════════════════════════════════ */
section {
  padding: var(--section-pad);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

section.visible {
  opacity: 1;
  transform: translateY(0);
}

.section-inner {
  background: var(--color-backdrop);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--inner-pad);
  max-width: var(--inner-max);
  margin: 0 auto;
}

.section-label {
  font-size: 0.7rem;
  font-weight: normal;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  color: var(--color-muted);
  margin-bottom: 2rem;
}


/* ═══════════════════════════════════════════════
   HERO SECTION
═══════════════════════════════════════════════ */
#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem 2rem; /* top accounts for fixed nav */
  /* Hero is immediately visible — no fade-in delay */
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

#hero.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  background: var(--color-backdrop);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 3rem 3.5rem;
  max-width: var(--inner-max);
  width: 100%;
}

/* Photo */
.hero-photo {
  flex-shrink: 0;
  position: relative;
  width: clamp(100px, 16vw, 160px);
  height: clamp(100px, 16vw, 160px);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent);
  display: block;
  filter: grayscale(20%);
}

/* Fallback when photo.jpg is missing */
.photo-fallback {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  letter-spacing: 0.05em;
  color: var(--color-muted);
  background: rgba(255,255,255,0.02);
}

.hero-photo.photo-missing img { display: none; }
.hero-photo.photo-missing .photo-fallback { display: flex; }

/* Text */
.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-prompt {
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
  letter-spacing: 0.05em;
}

.cursor {
  animation: blink 1.2s step-end infinite;
  color: var(--color-accent);
}

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

h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: bold;
  letter-spacing: -0.02em;
  color: var(--color-accent);
  line-height: 1.05;
}

.job-title {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-divider {
  width: 2rem;
  height: 1px;
  background: var(--color-border);
  margin: 1.25rem 0;
}

.hero-tagline {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.6;
  max-width: 40ch;
  margin-bottom: 1.5rem;
}

.hero-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.hero-nav a {
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.2s;
  letter-spacing: 0.05em;
}

.hero-nav a:hover { color: var(--color-accent); }

.nav-sep {
  color: rgba(255,255,255,0.15);
}


/* ═══════════════════════════════════════════════
   ABOUT SECTION
═══════════════════════════════════════════════ */
.bio {
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--color-text);
}

.bio + .bio {
  margin-top: 1.1rem;
}


/* ═══════════════════════════════════════════════
   TIMELINE SECTION
═══════════════════════════════════════════════ */
.timeline-list {
  list-style: none;
  position: relative;
  padding-left: 0;
}

/* Vertical connecting line */
.timeline-list::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.timeline-node {
  display: flex;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
  position: relative;
}

.timeline-node:last-child {
  margin-bottom: 0;
}

/* Node dot */
.tl-dot {
  width: 15px;
  height: 15px;
  min-width: 15px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1.5px solid rgba(255,255,255,0.35);
  margin-top: 3px;
  position: relative;
  z-index: 1;
  transition: border-color 0.2s;
}

/* Current role — pulsing dot */
.tl-dot.tl-current {
  border-color: var(--color-accent);
}

.tl-dot.tl-current::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  animation: pulse-ring 2.5s ease-out infinite;
}

@keyframes pulse-ring {
  0%   { transform: scale(0.9); opacity: 0.6; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.tl-content { flex: 1; }

.tl-date {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.tl-role {
  font-size: 0.92rem;
  font-weight: bold;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}

.tl-org {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}

.tl-desc {
  font-size: 0.8rem;
  line-height: 1.65;
  color: rgba(232, 232, 232, 0.55);
}


/* ═══════════════════════════════════════════════
   PROJECTS SECTION
═══════════════════════════════════════════════ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.project-card {
  display: block;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.2s;
}

.project-card:hover {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255, 255, 255, 0.04);
  transform: translateY(-2px);
}

.project-card:hover::before {
  opacity: 1;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-icon {
  width: 18px;
  height: 18px;
  color: var(--color-muted);
}

.card-arrow {
  font-size: 0.9rem;
  color: var(--color-muted);
  transition: color 0.2s, transform 0.2s;
}

.project-card:hover .card-arrow {
  color: var(--color-accent);
  transform: translate(2px, -2px);
}

.card-title {
  font-size: 0.92rem;
  font-weight: bold;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.78rem;
  line-height: 1.65;
  color: rgba(232, 232, 232, 0.55);
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-muted);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 2px 7px;
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.project-card:hover .tag {
  color: var(--color-text);
  border-color: rgba(255,255,255,0.25);
}


/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
#footer {
  padding: 4rem 2rem 5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

#footer.visible {
  opacity: 1;
  transform: translateY(0);
}

.footer-inner {
  max-width: var(--inner-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.footer-icon {
  color: var(--color-muted);
  text-decoration: none;
  transition: color 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
}

.footer-icon:hover {
  color: var(--color-accent);
  transform: translateY(-2px);
}

.footer-copy {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.15);
}


/* ═══════════════════════════════════════════════
   SKILLS SECTION
═══════════════════════════════════════════════ */
.skills-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.skills-group-title {
  font-size: 0.65rem;
  font-weight: normal;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 1.1rem;
}

/* Language dot rows */
.skills-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.skill-name {
  font-size: 0.82rem;
  color: var(--color-text);
  width: 7rem;
  flex-shrink: 0;
}

.skill-dots {
  display: flex;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.dot.on  { background: var(--color-accent); }
.dot.off { background: rgba(255, 255, 255, 0.12); }

.skill-level {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Tools tags */
.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--color-text);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px 10px;
  border-radius: 2px;
}

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


/* ═══════════════════════════════════════════════
   MOBILE RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 640px) {
  :root {
    --section-pad: 4rem 1rem;
    --inner-pad:   1.5rem;
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
    padding: 2rem 1.5rem;
    gap: 1.5rem;
  }

  .hero-photo {
    width: 100px;
    height: 100px;
  }

  .hero-tagline { max-width: 100%; }

  .hero-nav { justify-content: center; }

  h1 { font-size: clamp(1.8rem, 8vw, 2.5rem); }

  #donut { font-size: 6px; }

  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  #donut { font-size: 4px; }
}


/* ═══════════════════════════════════════════════
   PROJECTS PAGE
═══════════════════════════════════════════════ */
.page-header {
  padding: 8rem 2rem 3rem;
  max-width: var(--inner-max);
  margin: 0 auto;
}

.page-title {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--color-accent);
  font-weight: bold;
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 0.4rem;
  letter-spacing: 0.06em;
}

/* Toolbar: sort + filter controls */
.repo-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0 2rem 2rem;
  max-width: var(--inner-max);
  margin: 0 auto;
}

.repo-toolbar select {
  font-family: var(--font);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 2px;
  color: var(--color-muted);
  padding: 5px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.2s, color 0.2s;
}

.repo-toolbar select:hover,
.repo-toolbar select:focus {
  border-color: rgba(255,255,255,0.3);
  color: var(--color-text);
}

.repo-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  color: var(--color-muted);
  letter-spacing: 0.08em;
  cursor: pointer;
  user-select: none;
}

.repo-toolbar input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 12px;
  height: 12px;
  cursor: pointer;
}

.repo-count {
  margin-left: auto;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.06em;
}

/* Repo grid */
.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  padding: 0 2rem 6rem;
  max-width: var(--inner-max);
  margin: 0 auto;
}

.repo-card {
  display: flex;
  flex-direction: column;
  background: rgba(0,0,0,0.82);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  min-height: 140px;
}

.repo-card:hover {
  border-color: rgba(255,255,255,0.3);
  background: rgba(0,0,0,0.88);
  transform: translateY(-2px);
}

.repo-name {
  font-size: 0.88rem;
  font-weight: bold;
  color: var(--color-text);
  margin-bottom: 0.45rem;
  word-break: break-word;
}

.repo-desc {
  font-size: 0.76rem;
  line-height: 1.6;
  color: rgba(232,232,232,0.5);
  flex: 1;
  margin-bottom: 1rem;
}

.repo-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.repo-lang {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.66rem;
  color: var(--color-muted);
  letter-spacing: 0.05em;
}

.lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255,255,255,0.3);
}

.repo-stat {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.66rem;
  color: var(--color-muted);
}

.repo-updated {
  margin-left: auto;
  font-size: 0.62rem;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.04em;
}

/* Loading state */
.repo-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  letter-spacing: 0.1em;
}

.loading-dots span {
  display: inline-block;
  animation: dot-blink 1.4s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40%            { opacity: 1; }
}

/* Error state */
.repo-error {
  grid-column: 1 / -1;
  padding: 2rem;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.7;
  background: rgba(0,0,0,0.5);
}

.repo-error code {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.3);
}

/* Forked badge */
.fork-badge {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 1px 5px;
  border-radius: 2px;
}

@media (max-width: 640px) {
  .page-header { padding: 6rem 1rem 2rem; }
  .repo-toolbar { padding: 0 1rem 1.5rem; }
  .repo-grid { padding: 0 1rem 4rem; grid-template-columns: 1fr; }
  #topnav { padding: 0 1rem; }
}
