/* ==========================================================================
   Cardsite Showcase — Styles
   Mobile-first responsive design with proper viewport handling
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--surface-page);
  min-height: 100vh;
  min-height: 100svh;
  overscroll-behavior-y: contain;
}

/* Prevent iOS input zoom */
input,
select,
textarea,
[contenteditable] {
  font-size: max(16px, 1rem);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ========== Navigation ========== */
.nav-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-fixed);
  padding: var(--space-3);
  padding-top: calc(var(--space-3) + var(--safe-top));
  pointer-events: none;
}

.nav {
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--surface-overlay);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-2) var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  pointer-events: auto;
  box-shadow: var(--shadow-md);
  transition: 
    padding var(--duration-normal) var(--ease-out),
    border-radius var(--duration-normal) var(--ease-out);
}

.nav.is-scrolled {
  border-radius: var(--radius-lg);
}

/* Nav Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--text-primary);
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--text-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: var(--text-sm);
}

[data-theme="dark"] .nav-logo-icon {
  background: var(--text-primary);
  color: var(--text-inverse);
}

.nav-logo-text {
  font-weight: 600;
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-tight);
  display: none;
}

/* Nav Search */
.nav-search-container {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  max-width: 320px;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-out);
  cursor: text;
}

.nav-search:focus-within {
  background: var(--surface-raised);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--interactive-muted);
}

.nav-search-icon {
  color: var(--text-muted);
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.nav-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
}

.nav-search-input::placeholder {
  color: var(--text-muted);
}

.nav-search-shortcut {
  display: none;
  padding: 2px 6px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-btn:hover {
  color: var(--text-primary);
  background: var(--surface-sunken);
}

.nav-btn i {
  font-size: var(--text-lg);
}

.nav-cta {
  display: none;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: inherit;
  color: var(--text-inverse);
  background: var(--interactive-default);
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-cta:hover {
  background: var(--interactive-hover);
}

/* Nav Responsive */
@media (min-width: 640px) {
  .nav-wrapper {
    padding: var(--space-4);
    padding-top: calc(var(--space-4) + var(--safe-top));
  }
  
  .nav {
    padding: var(--space-3) var(--space-4);
  }
  
  .nav-logo-text {
    display: block;
  }
  
  .nav-search-shortcut {
    display: block;
  }
  
  .nav-cta {
    display: inline-flex;
  }
}

@media (min-width: 1024px) {
  .nav-search {
    max-width: 400px;
  }
}

/* ========== Hero ========== */
.hero {
  padding: calc(var(--space-24) + var(--nav-height) + var(--safe-top)) var(--space-4) var(--space-12);
  text-align: center;
  background: var(--surface-sunken);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(ellipse 100% 60% at 50% -10%, oklch(from var(--brand-300) l c h / 0.2), transparent 60%),
    radial-gradient(ellipse 80% 50% at 85% 90%, oklch(from var(--brand-200) l c h / 0.1), transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 680px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-xs);
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--interactive-default);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 8vw, var(--text-5xl));
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.hero-title em {
  font-style: italic;
  color: var(--text-brand);
}

.hero-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto var(--space-8);
  line-height: var(--leading-relaxed);
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
  min-width: 80px;
}

.hero-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

@media (min-width: 640px) {
  .hero {
    padding: calc(var(--space-24) + var(--nav-height) + var(--safe-top)) var(--space-6) var(--space-16);
  }
  
  .hero-subtitle {
    font-size: var(--text-lg);
  }
  
  .hero-stats {
    gap: var(--space-10);
  }
  
  .hero-stat-value {
    font-size: var(--text-3xl);
  }
}

/* ========== Filter Section ========== */
.filter-section {
  position: sticky;
  top: calc(var(--nav-height-compact) + var(--safe-top) + var(--space-3));
  z-index: var(--z-sticky);
  background: var(--surface-page);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-3) 0;
  margin: 0 var(--space-4);
  transition: opacity var(--duration-normal) var(--ease-out);
}

.filter-container {
  max-width: var(--container-max);
  margin: 0 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  touch-action: pan-x;
}

.filter-container::-webkit-scrollbar {
  display: none;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-1);
  min-width: max-content;
}

.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--surface-sunken);
}

.filter-tab.is-active {
  color: var(--text-brand);
  background: var(--interactive-muted);
  border-color: oklch(from var(--brand-200) l c h / 0.5);
}

.filter-tab-count {
  font-size: var(--text-xs);
  padding: 2px 6px;
  background: var(--surface-sunken);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 600;
}

.filter-tab.is-active .filter-tab-count {
  background: oklch(from var(--brand-200) l c h / 0.5);
  color: var(--text-brand);
}

@media (min-width: 640px) {
  .filter-section {
    margin: 0;
    padding: var(--space-4) var(--space-6);
    top: calc(var(--nav-height) + var(--safe-top) + var(--space-4));
  }
}

/* ========== Showcase Grid ========== */
.showcase-section {
  padding: var(--space-8) var(--space-4);
  max-width: var(--container-max);
  margin: 0 auto;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .showcase-section {
    padding: var(--space-10) var(--space-6);
  }
  
  .showcase-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }
}

@media (min-width: 1024px) {
  .showcase-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

/* ========== Showcase Card ========== */
.showcase-card {
  position: relative;
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: 
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}

.showcase-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

@media (hover: hover) {
  .showcase-card:hover {
    transform: translateY(-4px);
  }
}

.showcase-card-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-sunken);
  overflow: hidden;
}

.showcase-card-preview-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--surface-sunken) 0%, var(--surface-page) 100%);
}

.showcase-card-preview-placeholder i {
  font-size: 2rem;
  color: var(--text-muted);
}

.showcase-card-overlay {
  position: absolute;
  inset: 0;
  background: oklch(from var(--neutral-900) l c h / 0);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all var(--duration-normal) var(--ease-out);
}

.showcase-card:hover .showcase-card-overlay {
  background: oklch(from var(--neutral-900) l c h / 0.65);
  opacity: 1;
}

.showcase-card-overlay-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--surface-raised);
  color: var(--text-brand);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-md);
  transform: translateY(8px);
  transition: transform var(--duration-normal) var(--ease-spring);
}

[data-theme="dark"] .showcase-card-overlay-btn {
  background: var(--interactive-default);
  color: var(--text-inverse);
}

.showcase-card:hover .showcase-card-overlay-btn {
  transform: translateY(0);
}

.showcase-card-content {
  padding: var(--space-4);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.showcase-card-category {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-brand);
}

.showcase-card-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

.showcase-card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.showcase-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.showcase-card-type {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.showcase-card-type i {
  font-size: var(--text-sm);
}

.showcase-card-arrow {
  color: var(--text-muted);
  font-size: var(--text-base);
  transition: all var(--duration-fast) var(--ease-out);
}

.showcase-card:hover .showcase-card-arrow {
  transform: translateX(4px);
  color: var(--text-brand);
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-4);
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ========== Footer ========== */
.footer {
  background: var(--neutral-950);
  color: var(--neutral-400);
  padding: var(--space-10) var(--space-4);
  padding-bottom: calc(var(--space-10) + var(--safe-bottom));
  margin-top: var(--space-12);
}

[data-theme="dark"] .footer {
  background: oklch(6% 0.015 270);
  border-top: 1px solid var(--border-subtle);
}

.footer-content {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.footer-brand {
  max-width: 260px;
}

.footer-brand-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.footer-brand-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: oklch(85% 0.01 270);
  color: var(--neutral-950);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: var(--text-xs);
}

.footer-brand-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: oklch(85% 0.01 270);
}

.footer-brand p {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: oklch(50% 0.01 270);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.footer-column h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: oklch(65% 0.01 270);
  margin-bottom: var(--space-3);
}

.footer-column ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-column a {
  font-size: var(--text-sm);
  color: oklch(50% 0.01 270);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-column a:hover {
  color: oklch(80% 0.01 270);
}

.footer-bottom {
  padding-top: var(--space-6);
  border-top: 1px solid oklch(18% 0.015 270);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.footer-copyright {
  font-size: var(--text-xs);
  color: oklch(40% 0.01 270);
}

.footer-social {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.footer-social a {
  color: oklch(45% 0.01 270);
  font-size: var(--text-lg);
  transition: color var(--duration-fast) var(--ease-out);
}

.footer-social a:hover {
  color: var(--brand-400);
}

@media (min-width: 640px) {
  .footer {
    padding: var(--space-12) var(--space-6);
    padding-bottom: calc(var(--space-12) + var(--safe-bottom));
  }
  
  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .footer-links {
    grid-template-columns: repeat(3, auto);
    gap: var(--space-10);
  }
  
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* ========== Animations ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.showcase-card {
  animation: fadeInUp var(--duration-slow) var(--ease-out) backwards;
}

.showcase-card:nth-child(1) { animation-delay: 0ms; }
.showcase-card:nth-child(2) { animation-delay: 40ms; }
.showcase-card:nth-child(3) { animation-delay: 80ms; }
.showcase-card:nth-child(4) { animation-delay: 120ms; }
.showcase-card:nth-child(5) { animation-delay: 160ms; }
.showcase-card:nth-child(6) { animation-delay: 200ms; }
.showcase-card:nth-child(7) { animation-delay: 240ms; }
.showcase-card:nth-child(8) { animation-delay: 280ms; }
.showcase-card:nth-child(9) { animation-delay: 320ms; }

/* ========== Utilities ========== */
.hidden {
  display: none !important;
}

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