/* ==========================================================
   StartNode — Apps Listing Page Styles
   apps.css: Grid, cards, filters for /apps/index.html
   ========================================================== */

/* ========== PAGE HEADER ========== */
.apps-hero {
  padding-top: 140px;
  padding-bottom: 80px;
  position: relative;
  overflow: hidden;
}

.apps-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.apps-hero-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, var(--accent-dim) 0%, transparent 70%);
  filter: blur(100px);
}

.apps-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.apps-hero h1 {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.apps-hero p {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.7;
}

/* ========== FILTER TABS ========== */
.apps-filters {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 32px;
  margin-bottom: 48px;
}

.filter-btn {
  padding: 8px 20px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(255,255,255,0.03);
}

.filter-btn.active {
  background: var(--accent-dim);
  border-color: rgba(57, 255, 20, 0.3);
  color: var(--accent);
}

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

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.app-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.app-card-visual {
  height: 200px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-card-visual .app-icon {
  font-size: 56px;
  position: relative;
  z-index: 1;
}

.app-card-visual .app-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.4;
}

.app-card-body {
  padding: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.app-card-category {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.app-card-body h3 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.app-card-body p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.app-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.app-tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 100px;
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.app-card-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  transition: var(--transition);
}

.app-card-link:hover {
  gap: 10px;
}

/* ========== APP DETAIL PAGE — Shared Structure ========== */
.app-detail-hero {
  min-height: 70vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: 100px;
}

.app-detail-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.app-detail-hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.app-detail-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  margin-bottom: 24px;
}

.app-detail-hero h1 {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -2px;
  margin-bottom: 20px;
}

.app-detail-hero p {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 560px;
  margin-bottom: 32px;
}

.app-detail-hero .hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* App detail sections */
.app-section {
  padding: 100px 0;
  border-top: 1px solid var(--border);
}

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

.app-feature-card {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}

.app-feature-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.app-feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.app-feature-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.app-feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* App tech stack */
.app-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.app-stack-tag {
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

/* ========== SCREENSHOT PREVIEW — Card (web apps) ========== */
.app-card-visual--web {
  position: relative;
  overflow: hidden;
  background: #0a0a0b;
  height: 200px;
}

.app-card-screenshot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  min-height: 200%;
  object-fit: cover;
  object-position: top center;
  transition: transform 3s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}

/* On card hover: slow scroll down to reveal more of the page */
.app-card:hover .app-card-screenshot {
  transform: translateY(calc(-100% + 200px));
}

.app-card-screenshot-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, transparent 40%, rgba(10, 10, 11, 0.7) 100%);
  pointer-events: none;
}

/* ========== PHONE FRAME — Shared ========== */
.phone-frame {
  position: relative;
  background: #1c1c1e;
  border-radius: 36px;
  padding: 10px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 20px 60px rgba(0, 0, 0, 0.5);
}

.phone-frame-notch {
  width: 36%;
  height: 5px;
  background: #0a0a0b;
  border-radius: 100px;
  margin: 2px auto 6px;
}

.phone-frame-screen {
  border-radius: 26px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 9 / 19.5;
  position: relative;
}

.phone-frame-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.phone-frame-screen video.loaded {
  opacity: 1;
}

.phone-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

/* Phone — card variant */
.phone-frame--card {
  width: 110px;
  border-radius: 22px;
  padding: 6px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 30px rgba(0, 0, 0, 0.4);
}

.phone-frame--card .phone-frame-notch {
  height: 3px;
  margin: 1px auto 4px;
}

.phone-frame--card .phone-frame-screen {
  border-radius: 16px;
}

.phone-frame--card .phone-placeholder {
  font-size: 22px;
}

/* Phone — detail page variant */
.phone-frame--detail {
  width: 280px;
}

/* ========== CARD VISUAL — Mobile variant ========== */
.app-card-visual--mobile {
  position: relative;
  overflow: hidden;
  height: 200px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16px;
}

.app-card-visual--mobile .phone-frame--card {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

/* ========== PREVIEW SECTIONS — Detail Pages ========== */
.app-preview-section .container {
  max-width: 900px;
}

/* Mobile preview — phone mockup */
.app-preview-device {
  display: flex;
  justify-content: center;
  padding: 40px 0;
  position: relative;
}

.app-preview-device::before {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--app-accent-dim, rgba(255, 255, 255, 0.05)) 0%, transparent 70%);
  filter: blur(60px);
  pointer-events: none;
}

/* Web preview — browser mockup */
.app-preview-browser {
  padding: 40px 0;
}

.browser-frame {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0a0b;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.browser-frame-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}

.browser-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.browser-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.browser-dots span:first-child { background: #ff5f57; }
.browser-dots span:nth-child(2) { background: #febc2e; }
.browser-dots span:last-child { background: #28c840; }

.browser-url {
  flex: 1;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-frame-content {
  position: relative;
  height: 500px;
  overflow: hidden;
}

.browser-frame-screenshot {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
  object-fit: cover;
  object-position: top center;
  transition: transform 6s cubic-bezier(0.25, 0.1, 0.25, 1);
  will-change: transform;
}

.browser-frame:hover .browser-frame-screenshot {
  transform: translateY(calc(-100% + 500px));
}

.browser-frame-visit {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 3;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--app-accent, var(--accent));
  color: #0a0a0b;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.browser-frame:hover .browser-frame-visit {
  opacity: 1;
}

.browser-frame-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  z-index: 2;
  background: linear-gradient(transparent, rgba(10, 10, 11, 0.8));
  pointer-events: none;
}

/* ========== APPS RESPONSIVE ========== */
@media (max-width: 768px) {
  .apps-grid { grid-template-columns: 1fr; }
  .app-card-visual,
  .app-card-visual--web,
  .app-card-visual--mobile { height: 180px; }
  .app-features-grid { grid-template-columns: 1fr; }
  .phone-frame--detail { width: 220px; }
  .browser-frame-content { height: 300px; }
  .browser-frame:hover .browser-frame-screenshot {
    transform: translateY(calc(-100% + 300px));
  }
  .app-card:hover .app-card-screenshot {
    transform: translateY(calc(-100% + 180px));
  }
}
