/* ===== Design System ===== */
/* GeistSans loaded via CDN <link> in HTML */

@font-face {
  font-family: 'GeistPixelSquare';
  src: url('assets/fonts/GeistPixelSquare.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Light mode (default) */
  --bg: #ffffff;
  --bg-card: #ffffff;
  --bg-nav: rgba(255, 255, 255, 0.85);
  --text: #09090b;
  --text-muted: #71717b;
  --text-light: #9f9fa9;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: #eff6ff;
  --border: #e4e4e7;
  --border-hover: #d4d4d8;
  --tag-bg: #fafafa;
  --tag-text: #71717b;
  --tag-border: #e4e4e7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --dot-color: #d4d4d8;
  --section-heading: #9f9fa9;
  --expand-bg: #fafafa;
}

[data-theme="dark"] {
  --bg: #060607;
  --bg-card: #111114;
  --bg-nav: rgba(6, 6, 7, 0.85);
  --text: #fafafa;
  --text-muted: #9f9fa9;
  --text-light: #52525c;
  --accent: #60a5fa;
  --accent-hover: #93bbfd;
  --accent-subtle: #1e293b;
  --border: #323238;
  --border-hover: #3f3f46;
  --tag-bg: #18181b;
  --tag-text: #9f9fa9;
  --tag-border: #323238;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --dot-color: #27272a;
  --section-heading: #52525c;
  --expand-bg: #111114;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'GeistPixelSquare', ui-monospace, SFMono-Regular, 'Roboto Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.71429;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  text-rendering: optimizelegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ===== Layout ===== */
.container {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

.section {
  padding: clamp(1.5rem, 3vw, 2rem) 0;
}

/* ===== Navigation ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.nav.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .nav.scrolled {
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.3);
}

.nav-inner {
  max-width: 768px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
}

.nav-logo {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

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

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

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

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  margin-left: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
  transition: color 0.2s ease, transform 0.15s ease, border-color 0.3s ease;
}

.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

/* ===== Dot Grid Pattern ===== */
.dot-pattern {
  width: 100%;
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  margin: 0 calc(-1 * clamp(1.25rem, 5vw, 2rem));
  width: calc(100% + 2 * clamp(1.25rem, 5vw, 2rem));
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 1px solid var(--border);
  transition: background-image 0.3s ease, border-color 0.3s ease;
}

.dot-pattern-bottom {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

/* ===== Profile Card ===== */
.profile-card {
  padding: clamp(1.5rem, 4vw, 2rem) 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-muted);
  overflow: hidden;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-name {
  font-size: clamp(1.5rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: color 0.3s ease;
}

.profile-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  min-height: 1.4em;
}

.subtitle-rotate {
  display: inline-block;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.subtitle-rotate.fade-out {
  opacity: 0;
  transform: translateY(-4px);
}

.profile-status {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

/* ===== Section Headings ===== */
.section-heading {
  font-family: 'GeistPixelSquare', 'Silkscreen', monospace;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 400;
  color: var(--section-heading);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* ===== About Section ===== */
.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.about-item {
  display: flex;
  gap: 0.75rem;
  line-height: 1.6;
  color: var(--text);
}

.about-bullet {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-hover);
  flex-shrink: 0;
  margin-top: 0.55rem;
}

/* ===== Connect Section ===== */
.connect-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.connect-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-card);
  text-decoration: none;
}

.connect-pill:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
  color: var(--text);
}

.connect-pill svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

/* ===== Experience Timeline ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  padding: 1.25rem 0.75rem;
  margin: 0 -0.75rem;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.timeline-item:hover {
  background: var(--expand-bg);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-hover);
  flex-shrink: 0;
  margin-top: 0.5rem;
}

.timeline-content {
  flex: 1;
  min-width: 0;
}

.timeline-company {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.125rem;
}

.timeline-role-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.timeline-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.timeline-role {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.timeline-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.625rem;
}

.tag {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--tag-text);
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  border-radius: 8px;
  white-space: nowrap;
}

/* Expand/Collapse */
.timeline-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.2s ease;
  margin-top: 0.25rem;
}

.timeline-toggle:hover {
  background: var(--tag-bg);
  color: var(--text);
}

.timeline-toggle svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.timeline-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.timeline-details {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-top: 0;
}

.timeline-details.open {
  max-height: 300px;
  opacity: 1;
  margin-top: 0.75rem;
}

.timeline-details-inner {
  padding: 1rem;
  background: var(--expand-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.timeline-details-inner ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-details-inner li {
  color: var(--text-muted);
  line-height: 1.6;
  padding-left: 1rem;
  position: relative;
}

.timeline-details-inner li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--text-light);
}

/* ===== Education ===== */
.education-item {
  padding: 1rem 0.75rem;
  margin: 0 -0.75rem;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.education-item:hover {
  background: var(--expand-bg);
}

.education-item:last-child {
  border-bottom: none;
}

.education-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.education-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.education-content {
  flex: 1;
}

.education-school {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.education-degree {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.education-year {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ===== Additional Section ===== */
.additional-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.additional-item {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  transition: border-color 0.3s ease;
}

.additional-item:last-child {
  border-bottom: none;
}

.additional-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.additional-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===== Projects Page ===== */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'GeistPixelSquare', 'Silkscreen', monospace;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  font-weight: 400;
  color: var(--section-heading);
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  line-height: 1.6;
  transition: color 0.3s ease;
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

.project-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--tag-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.85rem;
  overflow: hidden;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-body {
  padding: 1.25rem;
}

.project-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.project-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.project-date {
  font-size: 0.8rem;
  color: var(--text-light);
  white-space: nowrap;
}

.project-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.875rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.project-links {
  display: flex;
  border-top: 1px solid var(--border);
  margin: 0 -1.25rem -1.25rem;
}

.project-link {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.75rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s ease;
}

.project-link:hover {
  color: var(--text);
  background: var(--tag-bg);
}

.project-link + .project-link {
  border-left: 1px solid var(--border);
}

.project-link svg {
  width: 16px;
  height: 16px;
}

/* ===== Footer ===== */
.footer {
  padding: 2rem 0;
  text-align: center;
  transition: color 0.3s ease;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-light);
}

.footer-tagline {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  opacity: 0.7;
}

/* ===== Panel Side Borders ===== */
.panel {
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ===== Press Feedback ===== */
.connect-pill:active,
.theme-toggle:active,
.timeline-toggle:active,
.project-link:active,
.back-to-top:active {
  transform: scale(0.98);
}

/* ===== Text Selection ===== */
::selection {
  background: var(--accent);
  color: #ffffff;
}

::-moz-selection {
  background: var(--accent);
  color: #ffffff;
}

/* ===== Smooth Theme Transitions ===== */
.now-card,
.timeline-details-inner,
.resume-embed,
.resume-download {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.project-card {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.connect-pill {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.tag {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.section-heading,
.panel {
  transition: border-color 0.3s ease, color 0.3s ease;
}

/* ===== Now Card ===== */
.now-card {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 280px;
}

.now-card:hover {
  border-color: var(--border-hover);
}

.now-label {
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.now-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.now-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  pointer-events: none;
  z-index: 50;
  cursor: pointer;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--tag-bg);
  color: var(--text);
  border-color: var(--border-hover);
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

/* ===== Animations ===== */
[data-animate] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-animate].visible {
  opacity: 1;
  transform: translateY(0);
}

[data-animate-delay="1"] { transition-delay: 0.1s; }
[data-animate-delay="2"] { transition-delay: 0.2s; }
[data-animate-delay="3"] { transition-delay: 0.3s; }
[data-animate-delay="4"] { transition-delay: 0.4s; }
[data-animate-delay="5"] { transition-delay: 0.5s; }

/* Hero entrance */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-animate {
  opacity: 0;
  animation: fadeUp 0.7s ease forwards;
}

.hero-animate-1 { animation-delay: 0s; }
.hero-animate-2 { animation-delay: 0.15s; }
.hero-animate-3 { animation-delay: 0.3s; }
.hero-animate-4 { animation-delay: 0.45s; }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  [data-animate] {
    opacity: 1;
    transform: none;
  }

  .hero-animate {
    opacity: 1;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ===== Responsive ===== */
@media (max-width: 639px) {
  .profile-card {
    flex-direction: column;
    text-align: center;
  }

  .profile-status {
    justify-content: center;
  }

  .connect-links {
    justify-content: center;
  }

  .timeline-header {
    flex-wrap: wrap;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-link {
    font-size: 0.85rem;
  }

  .additional-item {
    flex-direction: column;
    gap: 0.125rem;
  }

  .panel {
    border-left: none;
    border-right: none;
  }

  .theme-toggle {
    margin-left: 0.25rem;
    padding-left: 0.75rem;
  }
}

@media (min-width: 1024px) {
  .projects-grid {
    gap: 1.75rem;
  }
}
