/* =========================================
   Design tokens (from Pencil file)
   ========================================= */
:root {
  --bg-page:       #0A0A0A;
  --bg-elevated:   #0F0F0F;
  --bg-active:     #1F1F1F;
  --border:        #2a2a2a;
  --text-primary:  #FAFAFA;
  --text-secondary:#6B7280;
  --text-tertiary: #4B5563;
  --accent:        #047857;
  --accent-dim:    rgba(4, 120, 87, 0.1);
  --green-mid:     #059669;
  --green-light:   #34D399;
  --divider:       #040806;
  --transition:    0.2s ease;
}

/* =========================================
   Background canvas
   ========================================= */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  display: block;
}

/* Lift all page content above the canvas */
header, main, footer {
  position: relative;
  z-index: 1;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; transition: color var(--transition); }
img { max-width: 100%; height: auto; display: block; }

/* =========================================
   Layout
   ========================================= */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 80px;
}

.divider {
  width: 100%;
  height: 1px;
  background: var(--divider);
}

/* =========================================
   Header
   ========================================= */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 72px;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-letter {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

.logo-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

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

nav ul a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
}

nav ul a:hover,
nav ul a.active { color: var(--text-primary); }

.btn-outline {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 8px 20px;
  transition: background var(--transition), color var(--transition);
}

.btn-outline:hover {
  background: var(--accent-dim);
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 24px; height: 2px;
  background: var(--text-primary);
  margin: 0;
  transition: var(--transition);
}

/* =========================================
   Hero
   ========================================= */
main { padding-top: 72px; }

.hero {
  padding: 100px 0 120px;
}

.hero .container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.hero-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 1px;
}

.hero-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.hero-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-title h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(48px, 5vw, 68px);
  font-weight: 500;
  letter-spacing: -1px;
  line-height: 1.05;
  color: var(--text-primary);
}

.hero-title h1.muted {
  color: var(--text-tertiary);
}

.hero-desc {
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 680px;
}

.hero-ctas {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #FAF5F8;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 14px 32px;
  transition: opacity var(--transition);
}

.btn-primary:hover { opacity: 0.88; color: #fff; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 14px 32px;
  transition: border-color var(--transition), color var(--transition);
}

.btn-secondary:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* =========================================
   Section blocks (Featured + Repos)
   ========================================= */
.section-block {
  padding: 80px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 48px;
}

.section-heading {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-sub {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
}

.link-accent {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.link-accent:hover { text-decoration: underline; }

/* =========================================
   App cards (Featured Work)
   ========================================= */
.app-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.app-card {
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition);
  cursor: pointer;
}

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

.app-card-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  background: var(--bg-elevated);
}

video.app-card-img {
  object-fit: cover;
}

.app-card-img-placeholder {
  width: 100%;
  height: 240px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 2rem;
}

.app-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.app-card-num {
  font-family: 'Fraunces', serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--blue);
}

.app-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.app-card-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
}

.app-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.app-card-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* =========================================
   Repo grid (Open Source)
   ========================================= */
.repo-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.repo-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.repo-card {
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: border-color var(--transition);
  text-decoration: none;
  color: inherit;
}

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

.repo-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.repo-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.repo-desc {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.repo-footer {
  display: flex;
  align-items: center;
  gap: 16px;
}

.repo-lang {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.repo-stars {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

/* =========================================
   Footer
   ========================================= */
footer {
  padding: 64px 0;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 48px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.footer-tagline {
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.footer-col a {
  font-size: 13px;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--text-primary); }

.footer-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 24px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* =========================================
   Legacy page styles (CV, Contact)
   ========================================= */
.page-section { padding: 80px 0; }

.cv-header { margin-bottom: 60px; }
.cv-name {
  font-family: 'Fraunces', serif;
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.cv-title { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 24px; }
.cv-bio { max-width: 700px; color: var(--text-secondary); line-height: 1.8; }
.cv-section { margin-bottom: 60px; }
.cv-section-title {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.timeline { display: flex; flex-direction: column; gap: 32px; }
.timeline-item { display: grid; grid-template-columns: 140px 1fr; gap: 24px; }
.timeline-date { font-size: 0.875rem; color: var(--text-secondary); }
.timeline-content h3 { font-size: 1rem; font-weight: 500; margin-bottom: 4px; }
.timeline-content h4 { font-size: 0.875rem; font-weight: 400; color: var(--text-secondary); margin-bottom: 8px; }
.timeline-content p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.7; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.skill-category h3 { font-size: 0.875rem; font-weight: 500; margin-bottom: 12px; }
.skill-category ul { list-style: none; }
.skill-category li { font-size: 0.875rem; color: var(--text-secondary); padding: 4px 0; }

.contact-content { max-width: 600px; }
.contact-intro { font-size: 1.5rem; font-weight: 300; line-height: 1.6; margin-bottom: 48px; }
.contact-links { display: flex; flex-direction: column; gap: 16px; margin-bottom: 60px; }
.contact-link {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 1rem; color: var(--text-secondary);
  transition: color var(--transition);
}
.contact-link:hover { color: var(--text-primary); }
.contact-link svg { width: 20px; height: 20px; }

.contact-form { display: flex; flex-direction: column; gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label {
  font-size: 0.75rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.form-group input,
.form-group textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 14px 16px;
  font-family: inherit; font-size: 1rem;
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: var(--text-secondary); }
.form-group textarea { min-height: 150px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 28px; font-family: inherit; font-size: 0.875rem; font-weight: 500;
  border: none; cursor: pointer; transition: all var(--transition);
}
.btn-form {
  background: var(--text-primary);
  color: var(--bg-page);
}
.btn-form:hover { opacity: 0.88; }

/* Projects grid (legacy — used by CV or other pages if needed) */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.project-card {
  position: relative; aspect-ratio: 16/10;
  background: var(--bg-elevated);
  overflow: hidden; cursor: pointer;
  transition: transform var(--transition);
}
.project-card:hover { transform: translateY(-4px); }
.project-image { width: 100%; height: 100%; object-fit: cover; opacity: 0.7; transition: opacity var(--transition); }
.project-card:hover .project-image { opacity: 1; }
.project-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, #1a1a1a 100%);
  font-size: 3rem; color: var(--text-secondary); opacity: 0.5;
}
.project-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.9));
}
.project-title { font-size: 1.25rem; font-weight: 500; margin-bottom: 8px; }
.project-description {
  font-size: 0.875rem; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.project-tags { display: flex; gap: 8px; margin-top: 12px; }
.tag {
  font-size: 0.75rem; color: var(--text-secondary);
  background: rgba(255,255,255,0.1); padding: 4px 10px;
}
.quote {
  font-style: italic;
}
/* =========================================
   Instagram grid
   ========================================= */
.ig-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}

.ig-post {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-elevated);
  display: block;
  text-decoration: none;
}

.ig-post img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.ig-post:hover img {
  transform: scale(1.05);
}

.ig-post-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 120, 87, 0.88);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity var(--transition);
}

.ig-post:hover .ig-post-overlay {
  opacity: 1;
}

.ig-caption {
  font-size: 11px;
  line-height: 1.4;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Skeleton / loading state */
.ig-skeleton {
  aspect-ratio: 1;
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.ig-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 100%
  );
  animation: ig-shimmer 1.8s ease-in-out infinite;
}

@keyframes ig-shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* No-token / error CTA */
.ig-cta {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 0 8px;
  text-align: center;
}

.ig-cta-handle {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 1024px) {
  .container { padding: 0 40px; }
  .app-cards { grid-template-columns: repeat(2, 1fr); }
  .repo-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .container { padding: 0 24px; }

  header { height: 64px; }
  main { padding-top: 64px; }

  .menu-toggle { display: block; }

  nav {
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    padding: 24px;
    gap: 24px;
    transform: translateY(-110%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
  }

  nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  nav ul { flex-direction: column; gap: 16px; }

  .hero { padding: 60px 0 80px; }
  .hero-title h1 { font-size: 40px; }

  .app-cards { grid-template-columns: 1fr; }
  .repo-row { grid-template-columns: 1fr; }

  .ig-grid { grid-template-columns: repeat(3, 1fr); }
  .section-header { flex-direction: column; align-items: flex-start; gap: 12px; }

  .footer-top { flex-direction: column; gap: 40px; }
  .footer-links { gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  .timeline-item { grid-template-columns: 1fr; gap: 8px; }
  .projects-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero-ctas { flex-direction: column; align-items: flex-start; }
  .footer-links { flex-direction: column; }
}
