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

:root {
  /* Orange gradient palette */
  --bg-deep: #0d0d0d;
  --bg-dark: #1a1410;
  --bg-card: #1e1813;
  --orange-1: #b35c1e;
  --orange-2: #d4722a;
  --orange-3: #e8883a;
  --orange-4: #f0a050;
  --orange-5: #f4b870;
  --accent-glow: rgba(224, 130, 50, 0.3);
  --text-primary: #ffffff;
  --text-secondary: #ddd0c0;
  --text-muted: #a89880;
  --divider: rgba(211, 150, 90, 0.2);
  --font-display: 'Space Mono', monospace;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* ===== BACKGROUND GRADIENT ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(179, 92, 30, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 80% 100%, rgba(212, 114, 42, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 10% 60%, rgba(240, 160, 80, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* Animated grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ===== MAIN CONTAINER ===== */
.portfolio-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 2.5rem;
  background: transparent;
  border: none;
  border-radius: 0;
  animation: cardFadeIn 0.8s ease-out;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== NAME ===== */
.name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: 0.08em;
  text-align: center;
  background: linear-gradient(135deg, var(--orange-4) 0%, var(--orange-2) 50%, var(--orange-5) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 2rem;
  text-shadow: none;
  animation: nameGlow 3s ease-in-out infinite alternate;
}

@keyframes nameGlow {
  from { filter: brightness(1); }
  to { filter: brightness(1.15); }
}

/* ===== PROFILE PHOTO ===== */
.photo-wrapper {
  position: relative;
  width: 180px;
  height: 180px;
  margin-bottom: 1.5rem;
}

.photo-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-2), var(--orange-4), var(--orange-1));
  animation: ringRotate 6s linear infinite;
  z-index: 0;
}

@keyframes ringRotate {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(15deg); }
}

.photo-ring::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--bg-deep);
}

.profile-photo {
  position: relative;
  z-index: 1;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-deep);
  transition: transform var(--transition-smooth);
}

.profile-photo:hover {
  transform: scale(1.05);
}

/* Fallback when no photo is loaded */
.photo-placeholder {
  position: relative;
  z-index: 1;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-1), var(--orange-3));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: var(--bg-deep);
  font-weight: 700;
  border: 3px solid var(--bg-deep);
}

/* ===== SOCIAL ICONS ===== */
.socials {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(179, 92, 30, 0.1);
  border: 1px solid rgba(179, 92, 30, 0.25);
  color: var(--orange-4);
  text-decoration: none;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-2), var(--orange-4));
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.social-link:hover {
  transform: translateY(-3px);
  border-color: var(--orange-3);
  box-shadow: 0 8px 25px rgba(212, 114, 42, 0.3);
}

.social-link:hover::before {
  opacity: 1;
}

.social-link svg {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
  transition: color var(--transition-smooth);
}

.social-link:hover svg {
  color: var(--bg-deep);
}

/* ===== TITLE TAG ===== */
.title-tag {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--orange-3);
  margin-bottom: 0.75rem;
  opacity: 0.8;
}

/* ===== DIVIDER ===== */
.divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--orange-2) 50%, transparent 100%);
  margin: 1.5rem 0;
  opacity: 0.3;
}

/* ===== SUMMARY ===== */
.summary {
  text-align: center;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  max-width: 560px;
  font-style: italic;
  padding: 0 0.5rem;
}

/* ===== NAVIGATION BUTTONS ===== */
.nav-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  margin-top: 0.5rem;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 12px;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: all var(--transition-smooth);
}

.nav-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(179, 92, 30, 0.15), rgba(212, 114, 42, 0.05));
  opacity: 0;
  transition: opacity var(--transition-smooth);
  border-radius: 12px;
}

.nav-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--orange-2), var(--orange-4));
  transition: width var(--transition-smooth);
  border-radius: 2px;
}

.nav-btn:hover {
  border-color: var(--orange-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(179, 92, 30, 0.15);
  color: var(--orange-4);
}

.nav-btn:hover::before {
  opacity: 1;
}

.nav-btn:hover::after {
  width: 60%;
}

.nav-btn:active {
  transform: translateY(0);
}

.nav-btn.active {
  border-color: var(--orange-2);
  color: var(--orange-4);
  box-shadow: 0 4px 16px rgba(179, 92, 30, 0.2);
}

.nav-btn.active::before {
  opacity: 1;
}

.nav-btn.active::after {
  width: 60%;
}

/* ===== SECTION CONTENT AREA ===== */
.section-content {
  width: 100%;
  min-height: 0;
  overflow: hidden;
  transition: min-height 0.4s ease;
}

.section-content:empty {
  display: none;
}

/* ===== CP SECTION ===== */
.cp-section {
  width: 100%;
  animation: sectionSlideIn 0.5s ease-out;
}

@keyframes sectionSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cp-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-3);
  margin: 1.5rem 0 1rem;
  text-align: center;
}

/* Platform cards wrapper */
.cp-platforms {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Individual platform card */
.cp-platform-card {
  background: rgba(26, 20, 16, 0.6);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 1.25rem;
  transition: border-color var(--transition-smooth);
}

.cp-platform-card:hover {
  border-color: rgba(212, 114, 42, 0.35);
}

.cp-platform-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.cp-platform-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cp-platform-name .platform-icon {
  width: 20px;
  height: 20px;
  color: var(--orange-4);
}

/* ===== VIEW PROFILE BUTTON (improved visibility) ===== */
.cp-platform-link {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--orange-4);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid var(--orange-2);
  border-radius: 8px;
  background: rgba(179, 92, 30, 0.15);
  transition: all var(--transition-smooth);
  white-space: nowrap;
  font-weight: 500;
}

.cp-platform-link:hover {
  color: var(--bg-deep);
  background: linear-gradient(135deg, var(--orange-2), var(--orange-4));
  border-color: var(--orange-4);
  box-shadow: 0 4px 16px rgba(212, 114, 42, 0.35);
  transform: translateY(-1px);
}

/* Stats row */
.cp-stats-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.cp-stat-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(179, 92, 30, 0.08);
  border: 1px solid rgba(179, 92, 30, 0.15);
  border-radius: 10px;
  flex: 1;
  min-width: 80px;
}

.cp-stat-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--orange-4);
  font-weight: 700;
}

.cp-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.15rem;
}

/* Heatmap */
.cp-heatmap-container {
  margin-bottom: 1rem;
}

.cp-heatmap-label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}

.cp-heatmap {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 2px;
  width: 100%;
  overflow-x: auto;
}

.cp-heatmap-week {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cp-heatmap-day {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  background: rgba(179, 92, 30, 0.06);
  min-width: 6px;
  min-height: 6px;
  transition: transform 0.15s ease;
  cursor: default;
}

.cp-heatmap-day:hover {
  transform: scale(1.8);
  z-index: 2;
  position: relative;
}

.cp-heatmap-day.level-1 { background: rgba(179, 92, 30, 0.2); }
.cp-heatmap-day.level-2 { background: rgba(212, 114, 42, 0.4); }
.cp-heatmap-day.level-3 { background: rgba(232, 136, 58, 0.65); }
.cp-heatmap-day.level-4 { background: rgba(240, 160, 80, 0.9); }

.cp-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.4rem;
  justify-content: flex-end;
}

.cp-heatmap-legend span {
  font-size: 0.6rem;
  color: var(--text-muted);
}

.cp-heatmap-legend-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* Rating graph */
.cp-rating-graph {
  margin-top: 0.5rem;
}

.cp-rating-graph canvas {
  width: 100%;
  height: 200px;
  border-radius: 8px;
  background: rgba(13, 13, 13, 0.5);
}

/* Loading state */
.cp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--text-muted);
}

.cp-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--divider);
  border-top-color: var(--orange-3);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.cp-loading-text {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

/* Error state */
.cp-error {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Month labels for heatmap */
.cp-heatmap-months {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: 2px;
}

.cp-heatmap-months span {
  font-size: 0.55rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

/* Tooltip for heatmap */
.cp-tooltip {
  position: fixed;
  padding: 0.35rem 0.6rem;
  background: rgba(30, 24, 19, 0.95);
  border: 1px solid var(--divider);
  border-radius: 6px;
  font-family: var(--font-display);
  font-size: 0.65rem;
  color: var(--orange-4);
  pointer-events: none;
  z-index: 100;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.cp-tooltip.visible {
  opacity: 1;
}

/* ===== PROJECTS SECTION ===== */
.projects-section {
  width: 100%;
  animation: sectionSlideIn 0.5s ease-out;
}

.projects-section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-3);
  margin: 1.5rem 0 1rem;
  text-align: center;
}

.projects-section-subtitle {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-style: italic;
}

/* Category buttons (like Education / Work) */
.project-category-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.project-category-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 2rem;
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid var(--divider);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: all var(--transition-smooth);
  min-width: 160px;
}

.project-category-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(179, 92, 30, 0.15), rgba(212, 114, 42, 0.05));
  opacity: 0;
  transition: opacity var(--transition-smooth);
  border-radius: 10px;
}

.project-category-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--orange-2), var(--orange-4));
  transition: width var(--transition-smooth);
  border-radius: 2px;
}

.project-category-btn:hover {
  border-color: var(--orange-2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(179, 92, 30, 0.15);
  color: var(--orange-4);
}

.project-category-btn:hover::before {
  opacity: 1;
}

.project-category-btn:hover::after {
  width: 60%;
}

.project-category-btn.active {
  border-color: var(--orange-2);
  color: var(--orange-4);
  box-shadow: 0 4px 16px rgba(179, 92, 30, 0.2);
}

.project-category-btn.active::before {
  opacity: 1;
}

.project-category-btn.active::after {
  width: 60%;
}

/* Divider between categories and circles */
.projects-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--orange-2) 50%, transparent 100%);
  margin: 0.5rem 0 1.5rem;
  opacity: 0.2;
}

/* Project circles row */
.project-circles {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  animation: sectionSlideIn 0.4s ease-out;
}

.project-circle {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}

.project-circle-ring {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--divider);
  transition: all var(--transition-smooth);
}

.project-circle-ring::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--bg-deep);
}

.project-circle:hover .project-circle-ring {
  background: linear-gradient(135deg, var(--orange-2), var(--orange-4));
  box-shadow: 0 0 16px rgba(212, 114, 42, 0.3);
}

.project-circle:hover {
  transform: translateY(-4px) scale(1.08);
}

.project-circle.selected .project-circle-ring {
  background: linear-gradient(135deg, var(--orange-3), var(--orange-5));
  box-shadow: 0 0 20px rgba(240, 160, 80, 0.4), 0 0 40px rgba(240, 160, 80, 0.15);
}

.project-circle.selected {
  transform: translateY(-2px) scale(1.05);
}

.project-circle-img {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-deep);
}

/* Fallback circle with initials */
.project-circle-placeholder {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(179, 92, 30, 0.3), rgba(212, 114, 42, 0.15));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--orange-4);
  letter-spacing: 0.04em;
  border: 2px solid var(--bg-deep);
  text-align: center;
  line-height: 1.1;
  padding: 0.25rem;
}

/* Project circle label */
.project-circle-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 0.55rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.03em;
  transition: color var(--transition-smooth);
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-circle:hover .project-circle-label,
.project-circle.selected .project-circle-label {
  color: var(--orange-4);
}

/* Project detail panel */
.project-detail-panel {
  background: rgba(26, 20, 16, 0.6);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 1.5rem;
  margin-top: 1rem;
  animation: sectionSlideIn 0.4s ease-out;
  transition: border-color var(--transition-smooth);
}

.project-detail-panel:hover {
  border-color: rgba(212, 114, 42, 0.35);
}

.project-detail-name {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-4);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.project-detail-name::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange-3);
  box-shadow: 0 0 8px rgba(232, 136, 58, 0.5);
}

.project-detail-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
}

.project-detail-tag {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.3rem 0.75rem;
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid rgba(179, 92, 30, 0.2);
  border-radius: 6px;
  background: rgba(179, 92, 30, 0.06);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .portfolio-card {
    padding: 2rem 1.5rem;
    border-radius: 18px;
  }

  .nav-buttons {
    grid-template-columns: repeat(3, 1fr);
  }

  .photo-wrapper {
    width: 140px;
    height: 140px;
  }

  .profile-photo,
  .photo-placeholder {
    width: 140px;
    height: 140px;
  }

  .name {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
  }

  .cp-stats-row {
    gap: 0.5rem;
  }

  .cp-stat-chip {
    min-width: 65px;
    padding: 0.4rem 0.5rem;
  }

  .cp-heatmap-day {
    min-width: 4px;
    min-height: 4px;
  }

  .cp-rating-graph canvas {
    height: 160px;
  }

  .project-category-btn {
    min-width: 130px;
    padding: 0.7rem 1.25rem;
    font-size: 0.7rem;
  }

  .project-circle {
    width: 58px;
    height: 58px;
  }

  .project-circle-img,
  .project-circle-placeholder {
    width: 58px;
    height: 58px;
  }

  .project-circles {
    gap: 1rem;
  }
}

@media (max-width: 380px) {
  .portfolio-card {
    padding: 1.5rem 1rem;
  }

  .nav-buttons {
    grid-template-columns: 1fr;
  }

  .project-category-buttons {
    flex-direction: column;
    align-items: center;
  }
}
