/* ============================================
   Factictionary Portfolio - Shared Styles
   ============================================ */

:root {
  --bg: #0a0e1a;
  --bg-soft: #111827;
  --bg-card: #1a2236;
  --bg-card-hover: #232d47;
  --border: #2a3548;
  --text: #e8ecf4;
  --text-dim: #9aa3b8;
  --text-muted: #6b7591;
  --primary: #4f8cff;
  --primary-hover: #6ba0ff;
  --accent: #7c5cff;
  --gradient: linear-gradient(135deg, #4f8cff 0%, #7c5cff 100%);
  --gradient-soft: linear-gradient(135deg, rgba(79,140,255,0.15) 0%, rgba(124,92,255,0.15) 100%);
  --shadow: 0 10px 40px rgba(0,0,0,0.3);
  --shadow-card: 0 4px 20px rgba(0,0,0,0.25);
  --radius: 16px;
  --radius-sm: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 30%, rgba(79,140,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(124,92,255,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   Header / Navigation
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: white;
}

.brand-name {
  font-weight: 800;
}

.brand-name span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-link.primary {
  background: var(--gradient);
  color: white;
  padding: 9px 18px;
}

.nav-link.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79,140,255,0.4);
}

/* ============================================
   Hero (main page)
   ============================================ */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--gradient-soft);
  border: 1px solid rgba(79,140,255,0.3);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero h1 .gradient {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-dim);
  max-width: 680px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  margin-top: 48px;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   App Grid (main page)
   ============================================ */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px;
}

.section-header {
  margin-bottom: 36px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.section-subtitle {
  color: var(--text-dim);
  font-size: 1rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 24px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.app-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: rgba(79,140,255,0.4);
  box-shadow: var(--shadow);
}

.app-card:hover::before {
  opacity: 1;
}

.app-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg-soft);
}

.app-meta {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.app-developer {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.app-card-body {
  flex: 1;
}

.app-desc {
  font-size: 0.92rem;
  color: var(--text-dim);
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.app-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-soft);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 500;
}

.app-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.app-cta-arrow {
  transition: transform 0.2s;
}

.app-card:hover .app-cta-arrow {
  transform: translateX(3px);
}

/* ============================================
   App Detail Page
   ============================================ */
.app-hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 24px 30px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 32px;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--primary);
}

.app-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}

.app-detail-icon {
  width: 140px;
  height: 140px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.app-detail-info {
  flex: 1;
  min-width: 280px;
}

.app-developer-tag {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.app-detail-name {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  line-height: 1.1;
}

.app-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--gradient);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(79,140,255,0.4);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(79,140,255,0.4);
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* About section */
.about-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 24px;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}

@media (min-width: 880px) {
  .about-grid {
    grid-template-columns: 1.3fr 1fr;
  }
}

.about-content h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.about-content p {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.about-content ul {
  list-style: none;
  margin-top: 16px;
}

.about-content ul li {
  padding: 10px 0;
  padding-left: 28px;
  position: relative;
  color: var(--text-dim);
  line-height: 1.6;
}

.about-content ul li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: 10px;
  width: 18px;
  height: 18px;
  background: var(--gradient);
  color: white;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  align-self: start;
}

.info-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.info-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}

/* Screenshots gallery */
.screenshots-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.screenshots-grid {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 10px 0 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.screenshots-grid::-webkit-scrollbar {
  height: 8px;
}

.screenshots-grid::-webkit-scrollbar-track {
  background: var(--bg-soft);
  border-radius: 4px;
}

.screenshots-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.screenshot {
  flex-shrink: 0;
  width: 280px;
  scroll-snap-align: start;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: transform 0.3s;
}

.screenshot:hover {
  transform: translateY(-4px);
}

.screenshot img {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.footer-text strong {
  color: var(--text);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--primary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 640px) {
  .nav {
    padding: 14px 16px;
  }
  
  .hero {
    padding: 50px 16px 40px;
  }
  
  .hero-stats {
    gap: 24px;
  }
  
  .section {
    padding: 40px 16px;
  }
  
  .app-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .app-detail-info {
    text-align: center;
  }
  
  .app-actions {
    justify-content: center;
  }
  
  .screenshot {
    width: 240px;
  }
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90vh;
  border-radius: 12px;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
