/* ===== Custom Properties ===== */
:root {
  --color-bg: #fafaf8;
  --color-surface: #ffffff;
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-accent: #e05d26;
  --color-accent-hover: #c94d1a;
  --color-border: #e8e8e4;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  --max-width: 1100px;
  --nav-height: 60px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--color-accent-hover);
}

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

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
  background: rgba(250, 250, 248, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 var(--color-border);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.nav.show-logo .nav-logo {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Container ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

/* ===== Section ===== */
.section {
  padding: 6rem 0;
}

.section-title {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  margin-bottom: 1.5rem;
}

.section-heading {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 1.5rem;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.hero-logo {
  width: clamp(140px, 25vw, 280px);
  height: auto;
  margin-bottom: 2rem;
}

.hero-title {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.875rem, 1.5vw, 1.05rem);
  color: var(--color-text-muted);
  max-width: 500px;
  margin-bottom: 3rem;
}

.hero-arrow {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-text-muted);
  animation: bounce 2s infinite;
}

.hero-arrow svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(8px); }
  60% { transform: translateY(4px); }
}

/* ===== About ===== */
.about-content {
  max-width: 640px;
}

.about-content p {
  color: var(--color-text-muted);
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

/* ===== Work / Portfolio ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.filter-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover {
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.filter-btn.active {
  background: var(--color-text);
  color: var(--color-bg);
  border-color: var(--color-text);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.work-card {
  background: var(--color-surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.25s, box-shadow 0.25s;
}

.work-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

a.work-card {
  color: inherit;
  display: block;
}

.work-card[data-category="hardware"] {
  cursor: pointer;
}

.work-card.hidden {
  display: none;
}

.card-thumb {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb.software   { background: linear-gradient(135deg, #667eea, #764ba2); }
.card-thumb.hardware   { background: linear-gradient(135deg, #f093fb, #f5576c); }
.card-thumb.photography { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.card-thumb.music      { background: linear-gradient(135deg, #e05d26, #f4a261); }
.card-thumb.other      { background: linear-gradient(135deg, #a8edea, #fed6e3); }

.card-category {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.3);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Wide Card / Carousel ===== */
.work-card--wide {
  grid-column: 1 / -1;
}

.work-card--wide > .card-body {
  padding: 1.25rem 1.25rem 0.75rem;
}

.carousel {
  position: relative;
  overflow: hidden;
  padding: 0 1.25rem 1.25rem;
}

.carousel-track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.25rem 0;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 280px;
  scroll-snap-align: start;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: none;
  padding: 0;
  background: none;
  transition: transform 0.2s;
}

.carousel-slide:hover {
  transform: scale(1.03);
}

.carousel-placeholder {
  width: 280px;
  height: 200px;
  border-radius: 8px;
}

.carousel-slide img {
  width: 280px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.2s;
}

.carousel-btn:hover {
  background: #fff;
}

.carousel-btn svg {
  width: 18px;
  height: 18px;
}

.carousel-btn--prev {
  left: 1.75rem;
}

.carousel-btn--next {
  right: 1.75rem;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-close:hover {
  opacity: 1;
}

.lightbox-close svg {
  width: 28px;
  height: 28px;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-content .carousel-placeholder {
  width: 70vw;
  height: 70vh;
  max-width: 900px;
  max-height: 600px;
  border-radius: 8px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.lightbox-nav:hover {
  opacity: 1;
}

.lightbox-nav svg {
  width: 32px;
  height: 32px;
}

.lightbox-nav--prev {
  left: 1rem;
}

.lightbox-nav--next {
  right: 1rem;
}

.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.lightbox-caption {
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  margin-top: 1rem;
  font-size: 0.95rem;
  max-width: 600px;
  line-height: 1.5;
}

.lightbox-caption h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: #fff;
}

.lightbox-caption p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
}

/* ===== Contact ===== */
.contact-content {
  max-width: 480px;
}

.contact-content p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.contact-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.contact-links a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.contact-links a:hover {
  color: var(--color-accent);
}

.contact-links svg {
  width: 18px;
  height: 18px;
}

/* ===== Footer ===== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(250, 250, 248, 0.98);
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    gap: 1.5rem;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s, opacity 0.3s;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .section {
    padding: 4rem 0;
  }

  .work-grid {
    grid-template-columns: 1fr;
  }

  .contact-links {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1.25rem;
  }

  .nav {
    padding: 0 1.25rem;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .filter-bar {
    gap: 0.4rem;
  }

  .filter-btn {
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
  }
}
