/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  z-index: 1;
  padding: 160px 48px 80px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(48px, 7vw, 80px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  margin-bottom: 24px;
}

.hero h1 span { color: var(--text-dim); }

.hero-desc {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 480px;
  line-height: 1.7;
}

/* ============================================
   SECTION
   ============================================ */
.section {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px 120px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.section-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================
   PROJECT GRID
   ============================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ============================================
   PROJECT CARD
   ============================================ */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

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

.project-card:hover .card-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}

.project-card:hover .placeholder-img::after {
  opacity: 0.6;
}

/* Placeholder image */
.placeholder-img {
  width: 100%;
  height: 200px;
  background: var(--surface2);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.placeholder-img::before {
  display: none;
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.placeholder-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.03));
  opacity: 0;
  transition: opacity 0.3s;
}

.placeholder-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  opacity: 0.15;
  user-select: none;
}

.placeholder-tag {
  display: none;
  position: absolute;
  top: 14px;
  left: 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(0,0,0,0.5);
  padding: 4px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* Card body */
.card-body { padding: 20px 24px 24px; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-arrow {
  font-size: 16px;
  color: var(--text-dim);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  flex-shrink: 0;
  margin-top: 2px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 16px;
}

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

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
}

.status-wip {
  color: #f0883e;
  background: rgba(240,136,62,0.08);
  border: 1px solid rgba(240,136,62,0.2);
}

.status-done {
  color: #56d364;
  background: rgba(86,211,100,0.08);
  border: 1px solid rgba(86,211,100,0.2);
}

/* ============================================
   SUB-PANEL (modal)
   ============================================ */
.sub-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.sub-panel.open { display: flex; }

.sub-panel-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 40px;
  max-width: 560px;
  width: 100%;
  position: relative;
  animation: panelIn 0.2s ease;
}

@keyframes panelIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.sub-panel-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.sub-panel-close:hover { color: var(--text); }

.sub-panel-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.sub-panel h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.sub-panel p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
  font-weight: 300;
}

.sub-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sub-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, background 0.15s;
}

.sub-card:hover {
  border-color: #555;
  background: #252525;
}

.sub-card-icon {
  font-size: 24px;
  margin-bottom: 10px;
  opacity: 0.7;
}

.sub-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.sub-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 300;
  line-height: 1.5;
}

.placeholder-img img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #000000;
}

.img-unitree img {
  object-fit: cover;
  object-position: center 27%;
}

.img-isaac img {
  object-fit: cover;
  object-position: center;
}

.img-imitation img {
  object-fit: cover;
  object-position: center;
}

.img-rl img {
  object-fit: cover;
  object-position: center;
}


/* Staggered animation delays */
.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.10s; }
.project-card:nth-child(3) { animation-delay: 0.15s; }
.project-card:nth-child(4) { animation-delay: 0.20s; }
.project-card:nth-child(5) { animation-delay: 0.25s; }

/* ============================================
   RESPONSIVE DESIGN (cards.css)
   ============================================ */
@media (max-width: 768px) {
  .hero {
    padding: 120px 24px 60px; /* ลด Padding บนมือถือ */
  }

  .section {
    padding: 0 24px 80px; /* ลด Padding บนมือถือ */
  }

  /* ปรับ Grid การ์ดให้เป็น 1 คอลัมน์ */
  .projects-grid {
    grid-template-columns: 1fr;
  }

  /* ลดช่องว่างของการ์ดในมือถือ (แทนที่ inline style) */
  .projects-grid[style*="margin-bottom: 64px;"] {
      margin-bottom: 32px !important; 
  }

  /* ปรับขนาด Modal Panel บนมือถือ */
  .sub-panel-inner {
    padding: 24px;
    margin: 16px; /* กันขอบจอมือถือ */
  }

  /* ปรับ Grid ของการ์ดใน Modal ให้เป็น 1 คอลัมน์ */
  .sub-cards {
    grid-template-columns: 1fr;
  }
}