/* ===== Design Tokens ===== */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-tertiary: #242836;
  --text-primary: #e2e4ea;
  --text-secondary: #8b8fa3;
  --accent: #6c63ff;
  --accent-hover: #7f78ff;
  --fade-duration: 300ms;
}

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

/* ===== Base ===== */
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
}

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

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

/* ===== Hero ===== */
#hero {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 32px;
}

.hero-content {
  display: flex;
  align-items: center;
  gap: 32px;
}

.hero-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
  flex-shrink: 0;
}

.hero-info h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-info p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 16px;
}

.hero-socials {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

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

.social-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ===== Tab Bar ===== */
#tab-bar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.tab-bar-inner {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--bg-tertiary);
}

.tab-btn {
  position: relative;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

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

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

/* ===== Filter Bar ===== */
#filter-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: 12px 24px;
}

.filter-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
}

/* --- Type button row --- */
.filter-type-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-type-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.filter-type-btn:hover {
  color: var(--text-primary);
  border-color: var(--type-color, var(--accent));
}

.filter-type-btn.open {
  background: var(--type-color, var(--accent));
  color: #fff;
  border-color: transparent;
}

.filter-type-btn.has-filters:not(.open) {
  border-color: var(--type-color, var(--accent));
  color: var(--text-primary);
}

.filter-arrow {
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.filter-type-btn.open .filter-arrow {
  transform: rotate(180deg);
}

.filter-badge {
  font-size: 0.7rem;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  background: var(--type-color, var(--accent));
  color: #fff;
}

.filter-badge:empty {
  display: none;
}

.filter-type-btn.open .filter-badge {
  background: rgba(255, 255, 255, 0.25);
}

/* --- Dropdown panel --- */
.filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease;
  padding: 0;
}

.filter-panel.open {
  max-height: 200px;
  padding-top: 12px;
}

/* --- Chips --- */
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.825rem;
  font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  color: var(--text-primary);
}

.filter-chip:hover {
  border-color: var(--chip-color, var(--accent));
}

.filter-chip.active {
  background: var(--chip-color, var(--accent));
  color: #fff;
}

/* --- Clear button --- */
.clear-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: color 0.2s;
}

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

/* ===== Projects Grid ===== */
#projects-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 1023px) {
  #projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 599px) {
  #projects-grid {
    grid-template-columns: 1fr;
  }

  .hero-content {
    flex-direction: column;
    text-align: center;
  }

  .hero-socials {
    justify-content: center;
  }
}

/* ===== Project Card ===== */
.project-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: opacity var(--fade-duration) ease, transform var(--fade-duration) ease;
}

.project-card:hover {
  z-index: 5;
}

.project-card h2 {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 16px 16px 4px;
}

.desc-slot {
  position: relative;
  height: 8em;
  padding: 0 16px;
  font-size: 0.8rem;
}

.project-desc {
  position: absolute;
  inset: 0 16px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background: var(--bg-secondary);
  border-radius: 0 0 8px 8px;
  max-height: 8em;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              padding-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s ease;
}

.project-card:hover .project-desc.is-overflowing {
  -webkit-line-clamp: 999;
  max-height: 24em;
  padding-bottom: 12px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  z-index: 5;
}

.project-desc::-webkit-scrollbar {
  width: 6px;
}

.project-desc::-webkit-scrollbar-track {
  background: transparent;
}

.project-desc::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.project-desc > *:first-child {
  margin-top: 0;
}

.project-desc > *:last-child {
  margin-bottom: 0;
}

.project-desc p {
  margin: 0 0 0.6em;
}

.project-desc ul,
.project-desc ol {
  margin: 0 0 0.6em;
  padding-left: 1.4em;
}

.project-desc li {
  margin-bottom: 0.2em;
}

.project-desc strong {
  color: var(--text-primary);
}

.project-desc a {
  color: var(--accent);
  text-decoration: underline;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 0;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  background: color-mix(in srgb, var(--tag-color, var(--accent)) 20%, transparent);
  color: var(--tag-color, var(--accent));
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px 16px;
  margin-top: auto;
}

.platform-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s;
}

.platform-link:hover {
  background: var(--accent);
}

.platform-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

/* ===== Status Badge ===== */
.media-wrapper {
  position: relative;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.status-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  z-index: 3;
  pointer-events: none;
}

.status-published {
  background: rgba(80, 200, 120, 0.9);
  color: #fff;
}

.status-cancelled {
  background: rgba(220, 60, 60, 0.9);
  color: #fff;
}

.status-prototype {
  background: rgba(232, 160, 67, 0.9);
  color: #fff;
}

.status-in-development {
  background: rgba(74, 158, 255, 0.9);
  color: #fff;
}

/* ===== Slideshow ===== */
.slideshow {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.slides-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.slide {
  min-width: 100%;
  height: 100%;
}

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

.slide iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}

.slideshow:hover .slideshow-arrow {
  opacity: 1;
}

.slideshow-arrow.prev {
  left: 8px;
}

.slideshow-arrow.next {
  right: 8px;
}

.slideshow-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 2;
}

.slideshow-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s;
}

.slideshow-dot.active {
  background: var(--accent);
}

/* ===== Card Animations ===== */
.project-card.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

/* ===== Load Error ===== */
.load-error {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 12px;
}

.load-error code {
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}
