/* ============================================
   CSS Variables (from design tokens)
   ============================================ */
:root {
  --bg-white: #ffffff;
  --bg-black: #000000;
  --accent-gray: #F5F5F5;
  --border-hairline: #E0E0E0;
  --text-primary: #000000;
  --text-secondary: #666666;
  --text-white: #ffffff;
  --dark-text: #4a4a4a;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 24px;
  --font-size-xl: 48px;
  --font-size-xxl: 72px;
  --spacing-xs: 8px;
  --spacing-sm: 16px;
  --spacing-md: 24px;
  --spacing-lg: 48px;
  --spacing-xl: 80px;
  --font-heading: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-white);
  color: var(--dark-text);
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

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

/* ============================================
   Navigation
   ============================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-white);
  border-bottom: 0.5px solid var(--border-hairline);
}

.nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 60px;
}

.wordmark {
  display: flex;
  align-items: center;
  flex: 1;
}

.wordmark-logo {
  height: 44px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 35px;
}

.nav-btn-wrap {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.nav-links a {
  font-family: var(--font-body);
  font-size: 15.75px;
  color: var(--dark-text);
  transition: opacity 0.2s;
}

.nav-links a:hover {
  opacity: 0.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn-primary {
  background: var(--dark-text);
  color: var(--text-white);
  padding: 12px 24px;
  border-radius: 24px;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.33), 0 4px 8px rgba(60, 64, 67, 0.17);
}

.btn-primary:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.4), 0 6px 16px rgba(60, 64, 67, 0.25);
}

.btn-arrow {
  font-family: var(--font-body);
  font-size: 16px;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 60px 110px;
  overflow: hidden;
  border-bottom: 0.5px solid var(--border-hairline);
}

.grid-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: #D0D0D0;
  opacity: 0.864;
}

.grid-pattern-dark {
  color: #ffffff;
  opacity: 0.173;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
}

.logo-interactive {
  position: relative;
  display: inline-block;
  line-height: 0;
  width: clamp(300px, 68vw, 620px);
  cursor: pointer;
}

#hero-logo {
  width: 100%;
  height: auto;
  display: block;
  fill: currentColor;
}

.pupil-shape {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.2s ease;
}

.pupil-shape.active {
  opacity: 1;
  transform: scale(1);
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: 30px;
  color: var(--text-secondary);
}

/* ============================================
   About Section
   ============================================ */
.about {
  position: relative;
  background: #1A1A1A;
  overflow: hidden;
  scroll-margin-top: 80px;
}

.about-inner {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  gap: 60px;
  padding: 100px 80px;
}

.about-left,
.about-right {
  flex: 1;
}

.about-quote {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: #EEEEEE;
  margin-bottom: 24px;
}

.about-body {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: #888888;
}

.about-body + .about-body {
  margin-top: 1em;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.stat-row {
  display: flex;
  width: 100%;
}

.stat-cell {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-num {
  font-family: var(--font-heading);
  font-size: 56px;
  font-weight: 500;
  color: #EEEEEE;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
}

/* ============================================
   Projects Section
   ============================================ */
.projects {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 100px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow: hidden;
}

.projects-headline {
  position: relative;
  font-family: var(--font-heading);
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -2px;
  color: var(--dark-text);
}

.projects-grid {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.projects-row {
  display: flex;
  gap: 40px;
  justify-content: center;
}

/* --- Project Card (Polaroid style) --- */
.projects-row {
  perspective: 1200px;
}

.project-card {
  width: 380px;
  flex-shrink: 0;
  background: #ffffff;
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 8px 24px rgba(0,0,0,0.06);
  transform-style: preserve-3d;
  transform: rotate(var(--rotation, 0deg));
  cursor: pointer;
  will-change: transform, box-shadow;
  position: relative;
  z-index: 1;
}

.project-card.is-hovered {
  z-index: 10;
}

.card-image {
  border-radius: 14px;
  overflow: hidden;
  height: 340px;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-card.is-hovered .card-image img {
  transform: scale(1.04);
}

.card-info {
  display: flex;
  justify-content: space-between;
  padding: 8px 4px 4px;
}

.card-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 600;
  color: #1A1A1A;
}

.card-desc {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 400;
  color: #999999;
}

.card-tag-row {
  display: flex;
  justify-content: center;
  padding-bottom: 4px;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-gray);
  border-radius: 20px;
  padding: 6px 16px;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 500;
  color: var(--dark-text);
}

.tag-check {
  color: #4CAF50;
  font-size: 12px;
  font-weight: 600;
}

.view-all-row {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 24px;
}

/* ============================================
   Contact Section
   ============================================ */
.contact {
  position: relative;
  background: #1A1A1A;
  overflow: hidden;
}

.contact-inner {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
  padding: 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: #888888;
}

.contact-headline {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 600;
  letter-spacing: -1px;
  line-height: 1.1;
  color: #EEEEEE;
}

.contact-desc {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: #888888;
  max-width: 600px;
}

.contact-links {
  display: flex;
  gap: 48px;
  margin-top: 8px;
}

.contact-email {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-email-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: #888888;
}

.contact-email-value {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
  color: #EEEEEE;
  transition: opacity 0.2s;
}

.contact-email-value:hover {
  opacity: 0.6;
}

.cta-row {
  display: flex;
  margin-top: 16px;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  overflow: hidden;
}

.footer-dark {
  background: #1A1A1A;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.footer-divider {
  height: 1px;
  background: #333333;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: #666666;
}

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

.footer-links a {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: #666666;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #999999;
}

/* ============================================
   My Work Page
   ============================================ */
.mywork-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 80px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.back-link {
  font-family: var(--font-heading);
  font-size: 14px;
  color: #999999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--dark-text);
}

.mywork-grid {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.mywork-row {
  display: flex;
  gap: 40px;
  justify-content: center;
  perspective: 1200px;
}

.mywork-row .project-card {
  width: auto;
  flex: 1;
}

.card-image-tall {
  height: 420px;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: contents;
}

/* ============================================
   Individual Project Page
   ============================================ */
.project-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 80px 80px;
}

.project-header {
  margin-bottom: 48px;
}

.project-back {
  font-family: var(--font-heading);
  font-size: 14px;
  color: #999999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 0.2s;
  margin-bottom: 32px;
}

.project-back:hover {
  color: var(--dark-text);
}

.project-title {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: var(--dark-text);
  margin-bottom: 16px;
}

.project-desc {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  color: #666666;
  max-width: 720px;
}

.project-tags {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.project-gallery {
  columns: 2;
  column-gap: 20px;
}

.project-gallery-single {
  columns: 1;
}

.project-gallery img {
  width: 100%;
  margin-bottom: 20px;
  border-radius: 12px;
  display: block;
  break-inside: avoid;
}

@media (max-width: 900px) {
  .project-page {
    padding: 24px 30px 60px;
  }

  .project-title {
    font-size: 32px;
  }

  .project-gallery {
    columns: 1;
  }
}

@media (max-width: 600px) {
  .project-title {
    font-size: 28px;
  }
}

@media (max-width: 900px) {
  .mywork-page {
    padding: 24px 30px 60px;
  }

  .mywork-row {
    flex-direction: column;
    align-items: center;
  }

  .mywork-row .project-card {
    width: 100%;
    max-width: 500px;
  }

  .mywork-row:last-child {
    display: flex;
  }
}

/* ============================================
   Scroll Animations
   ============================================ */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* Cards use JS-driven transforms, so only animate opacity for fade-in */
.project-card.fade-up {
  transform: none;
  transition: opacity 0.7s ease;
}

.project-card.fade-up.is-visible {
  transform: none;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1100px) {
  .projects-row {
    flex-wrap: wrap;
  }

  .project-card {
    width: calc(50% - 20px);
    min-width: 300px;
  }
}

@media (max-width: 900px) {
  .nav-inner {
    padding: 0 30px;
  }

  .nav-links {
    display: none;
  }

  .hero {
    padding: 40px 30px 80px;
    height: auto;
    min-height: 440px;
  }

  .hero-subtitle {
    font-size: 20px;
  }

  .about-inner {
    flex-direction: column;
    padding: 60px 30px;
  }

  .stat-cell {
    text-align: center;
    align-items: center;
  }

  .stat-num {
    font-size: 48px;
  }

  .stat-label {
    font-size: 12px;
  }

  .projects {
    padding: 60px 30px;
  }

  .projects-headline {
    font-size: 48px;
  }

  .projects-row {
    flex-direction: column;
    align-items: center;
  }

  /* Show only 4 cards on mobile homepage: hide 5th and 6th */
  .projects-grid > .projects-row:nth-child(2) .card-link:nth-child(n+2) {
    display: none;
  }

  .project-card {
    width: 100%;
    max-width: 380px;
  }

  .contact-inner {
    padding: 60px 30px;
  }

  .contact-headline {
    font-size: 32px;
  }

  .contact-links {
    flex-direction: column;
    gap: 24px;
  }

  .footer-inner {
    padding: 24px 30px;
  }
}

@media (max-width: 600px) {
  .hero-headline {
    font-size: 72px;
  }

  .project-card {
    width: 100%;
  }
}
