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

:root {
  --color-bg: #0c0c0e;
  --color-surface: #141416;
  --color-surface-2: #1c1c20;
  --color-border: #2a2a30;
  --color-text: #e8e6e1;
  --color-text-muted: #8a877f;
  --color-accent: #c8a46e;
  --color-accent-soft: rgba(200, 164, 110, 0.12);
  --font-display: 'Instrument Serif', serif;
  --font-body: 'DM Sans', sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --max-w: 1240px;
  --gap: clamp(1rem, 3vw, 2rem);
}

html { scroll-behavior: smooth; }

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

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* ── Nav ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 1.25rem 2rem;
  transition: background 0.4s var(--ease-out), backdrop-filter 0.4s var(--ease-out);
}
.nav.scrolled {
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-accent);
  letter-spacing: 0.02em;
}
.nav-links { display: flex; gap: 2rem; }
.nav-link {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.3s;
  position: relative;
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1px;
  background: var(--color-accent);
  transition: width 0.3s var(--ease-out);
}
.nav-link:hover { color: var(--color-text); }
.nav-link:hover::after { width: 100%; }

.nav-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 28px; height: 20px;
  position: relative;
}
.nav-toggle span {
  display: block; width: 100%; height: 2px;
  background: var(--color-text);
  position: absolute; left: 0;
  transition: 0.3s var(--ease-out);
}
.nav-toggle span:first-child { top: 0; }
.nav-toggle span:last-child { bottom: 0; }
.nav-toggle.active span:first-child { top: 50%; transform: translateY(-50%) rotate(45deg); }
.nav-toggle.active span:last-child { bottom: 50%; transform: translateY(50%) rotate(-45deg); }

/* ── Hero ── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 8rem 2rem 4rem;
}
.hero-content { flex: 1; max-width: 720px; }
.hero-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent);
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1.05;
  font-weight: 400;
  margin-bottom: 1.5rem;
}
.hero-name { display: block; }
.hero-name--italic { font-style: italic; color: var(--color-accent); }
.hero-desc {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-muted);
  max-width: 540px;
  margin-bottom: 2.5rem;
}
.hero-desc em {
  font-style: italic;
  color: var(--color-text);
}
.hero-links { display: flex; gap: 1rem; flex-wrap: wrap; }

.hero-aside {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2.5rem;
  border-left: 1px solid var(--color-border);
}
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 3rem;
  display: block;
  color: var(--color-accent);
  line-height: 1;
}
.hero-stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  display: block;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  font-size: 0.875rem;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 2px;
  transition: all 0.3s var(--ease-out);
  cursor: pointer;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--color-accent);
  color: var(--color-bg);
}
.btn--primary:hover { background: #d4b07a; }
.btn--outline {
  border-color: var(--color-border);
  color: var(--color-text-muted);
}
.btn--outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ── Section ── */
.section-header {
  max-width: var(--max-w);
  margin: 0 auto 3rem;
  padding: 0 2rem;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  margin-bottom: 0.5rem;
}
.section-desc {
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* ── Work Grid (Home) ── */
.work {
  padding: 6rem 0;
  border-top: 1px solid var(--color-border);
}
.work-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--gap);
}
.work-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease-out);
  display: block;
}
.work-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-4px);
}
.work-card--featured {
  grid-column: 1 / -1;
}
.work-card--featured .work-card-img { max-height: 420px; }
.work-card-img {
  overflow: hidden;
  background: var(--color-surface-2);
  max-height: 280px;
}
.work-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.6s var(--ease-out);
}
.work-card:hover .work-card-img img { transform: scale(1.03); }
.work-card-info { padding: 1.25rem 1.5rem; }
.work-card-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  font-weight: 500;
}
.work-card-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 400;
  margin-top: 0.35rem;
}
.work-card-tech {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.35rem;
}

.work-cta {
  max-width: var(--max-w);
  margin: 3rem auto 0;
  padding: 0 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Project Detail Page Layout ── */
.page-header {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 8rem 2rem 3rem;
}
.page-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
}
.page-header p {
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  font-size: 1.05rem;
}

.projects {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 2rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 5rem;
}

.project {
  border-top: 1px solid var(--color-border);
  padding-top: 3rem;
  scroll-margin-top: 6rem;
}
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.project-meta { flex: 1; min-width: 240px; }
.project-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: 0.5rem;
}
.project-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.15;
}
.project-desc {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-top: 0.75rem;
  max-width: 560px;
}
.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}
.project-tech span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.65rem;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  border-radius: 2px;
}
.project-link {
  align-self: flex-start;
  margin-top: 0.5rem;
}
.project-link a {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 2px;
  transition: color 0.3s, border-color 0.3s;
}
.project-link a:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.project-hero {
  border-radius: 4px;
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}
.project-hero img {
  width: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Light hero background for UI/UX page (transparent PNGs) */
.project-hero--light {
  background: linear-gradient(145deg, #d4d4d4, #ebebeb);
}

/* Side-by-side layout for UI/UX projects */
.project-layout-side {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
  align-items: start;
}
.project-layout-side .project-hero--light {
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  padding: 1rem;
}
.project-layout-side .project-hero--light img {
  width: 100%;
  object-fit: contain;
}
.project-layout-side .project-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

@media (max-width: 700px) {
  .project-layout-side {
    grid-template-columns: 1fr;
  }
  .project-layout-side .project-hero--light {
    max-width: 260px;
  }
}

.project-screenshots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.project-screenshots img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.3s, transform 0.3s var(--ease-out);
}
.project-screenshots img:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

/* Light background for transparent PNG screenshots */
.project-screenshots--light img {
  background: linear-gradient(145deg, #d4d4d4, #ebebeb);
  padding: 0.5rem;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 2rem;
  animation: lbFadeIn 0.3s var(--ease-out);
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  cursor: default;
}
.lightbox-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: none; border: none;
  color: var(--color-text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s;
}
.lightbox-close:hover { color: var(--color-text); }

@keyframes lbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem;
}
.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.footer-copy {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  transition: color 0.3s;
}
.footer-links a:hover { color: var(--color-accent); }

/* ── Animations ── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .hero { flex-direction: column; gap: 2rem; min-height: auto; padding-top: 7rem; }
  .hero-aside {
    flex-direction: row;
    border-left: none;
    border-top: 1px solid var(--color-border);
    padding: 2rem 0 0;
  }
  .work-grid { grid-template-columns: 1fr; }
  .work-card--featured { grid-column: auto; }
  .project-screenshots { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 640px) {
  .nav { padding: 1rem 1.25rem; }
  .nav-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--color-bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .nav-links.open {
    opacity: 1;
    pointer-events: auto;
  }
  .nav-link { font-size: 1.25rem; }
  .hero { padding: 6rem 1.25rem 3rem; }
  .hero-title { font-size: 2.75rem; }
  .hero-aside { gap: 1.5rem; }
  .section-header, .page-header, .projects, .work-grid, .work-cta { padding-left: 1.25rem; padding-right: 1.25rem; }
  .project-screenshots { grid-template-columns: 1fr 1fr; }
  .work-cta { flex-direction: column; }
  .work-cta .btn { text-align: center; justify-content: center; }
}
