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

:root {
  --bg: #f6f4f0;
  --bg-elevated: #edeae4;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --text-primary: #1a1a1f;
  --text-secondary: #5c5c66;
  --text-tertiary: #9495a0;
  --accent: #e85d26;
  --accent-dim: rgba(232, 93, 38, 0.1);
  --accent-glow: rgba(232, 93, 38, 0.06);
  --border: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ========== NOISE TEXTURE OVERLAY ========== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.018;
  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)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ========== AMBIENT GLOW ========== */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(180px);
  opacity: 0.12;
  pointer-events: none;
  z-index: 0;
}
.ambient-glow--1 {
  top: -200px; left: -100px;
  background: var(--accent);
}
.ambient-glow--2 {
  bottom: -300px; right: -200px;
  background: #818cf8;
  opacity: 0.08;
}

/* ========== LAYOUT ========== */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 60px);
}

/* ========== NAVIGATION ========== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 clamp(20px, 4vw, 60px);
  transition: background var(--transition), box-shadow var(--transition);
}
.nav.scrolled {
  background: rgba(246, 244, 240, 0.85);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: 0 1px 0 var(--border);
}
.nav__inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.nav__logo {
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav__logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px var(--accent); }
  50% { opacity: 0.5; box-shadow: 0 0 4px var(--accent); }
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}
.nav__links a {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  transition: color var(--transition);
  letter-spacing: 0.01em;
}
.nav__links a:hover { color: var(--text-primary); }
.nav__count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 100px;
  letter-spacing: 0.04em;
}

/* ========== HERO ========== */
.hero {
  padding: clamp(140px, 18vh, 220px) 0 clamp(60px, 10vh, 120px);
  text-align: center;
}
.hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 28px;
  opacity: 0;
  animation: fade-up 0.8s ease forwards 0.2s;
}
.hero__tag-line {
  width: 24px;
  height: 1px;
  background: var(--text-tertiary);
}
.hero__title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 7.5rem);
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.03em;
  margin-bottom: 28px;
  opacity: 0;
  animation: fade-up 0.8s ease forwards 0.35s;
}
.hero__title em {
  font-style: italic;
  color: var(--accent);
}
.hero__subtitle {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 300;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 44px;
  line-height: 1.7;
  opacity: 0;
  animation: fade-up 0.8s ease forwards 0.5s;
}
.hero__divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-tertiary), transparent);
  margin: 0 auto;
  opacity: 0;
  animation: fade-up 0.8s ease forwards 0.6s;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== SECTION HEADER ========== */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 48px;
  flex-wrap: wrap;
  gap: 16px;
}
.section-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.section-header__count {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ========== FILTER TABS ========== */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 400;
  padding: 8px 18px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}
.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(0,0,0,0.03);
}
.filter-btn.active {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
  font-weight: 500;
}

/* ========== PROJECT GRID ========== */
.projects {
  padding-bottom: 120px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 24px;
}

/* ========== PROJECT CARD ========== */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(30px);
  box-shadow: 0 2px 12px -4px rgba(0,0,0,0.06);
}
.project-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease, background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: 0 24px 64px -16px rgba(0,0,0,0.12), 0 0 0 1px var(--border-hover);
  transform: translateY(-4px);
}

.project-card__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-elevated);
}
.project-card__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.project-card:hover .project-card__preview img {
  transform: scale(1.04);
}
.project-card__preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated) 0%, #f0ede7 100%);
  position: relative;
  overflow: hidden;
}
.project-card__preview-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.4;
}
.project-card__preview-icon {
  font-size: 2.6rem;
  opacity: 0.25;
  z-index: 1;
}

/* Unique pattern backgrounds */
.pattern-grid { background-image:
  linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
  linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}
.pattern-dots { background-image: radial-gradient(rgba(0,0,0,0.07) 1px, transparent 1px);
  background-size: 20px 20px;
}
.pattern-diagonal {
  background-image: repeating-linear-gradient(
    -45deg, transparent, transparent 10px, rgba(0,0,0,0.03) 10px, rgba(0,0,0,0.03) 11px
  );
}
.pattern-circles {
  background-image: radial-gradient(circle at 25% 25%, rgba(232,93,38,0.06) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(129,140,248,0.06) 0%, transparent 50%);
}

.project-card__body {
  padding: 24px 28px 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.project-card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.project-card__tag {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 10px;
  border-radius: 6px;
}
.project-card__type {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
}
.project-card__type--static {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.08);
}
.project-card__type--dynamic {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.08);
}
.project-card__pages {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.project-card__title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  line-height: 1.25;
}
.project-card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-weight: 300;
  flex: 1;
}
.project-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.project-card__tech {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.project-card__tech-tag {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  background: rgba(0,0,0,0.04);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 400;
}
.project-card__arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.project-card:hover .project-card__arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  transform: rotate(-45deg);
}
.project-card__arrow svg {
  width: 16px;
  height: 16px;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-tertiary);
}
.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state__desc {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ========== FOOTER ========== */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
}
.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer__brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-secondary);
}
.footer__copy {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 860px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  .nav__links { display: none; }
}
@media (max-width: 480px) {
  .project-card__body { padding: 18px 20px 22px; }
}

/* ========== SCROLL REVEAL ========== */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
