/* PassioneUncinetto - Design System */

:root {
  --bg: #faf8f5;
  --bg2: #f3efe8;
  --bg3: #ffffff;
  --primary: #c2185b;
  --primary-lt: #f48fb1;
  --primary-dk: #880e4f;
  --secondary: #7c4dff;
  --accent: #ff6f00;
  --text: #3e2723;
  --text-light: #5d4037;
  --muted: #8d6e63;
  --border: #d7ccc8;
  --success: #2e7d32;
  --warning: #f9a825;
  --danger: #c62828;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(62, 39, 35, 0.08);
  --shadow-lg: 0 8px 32px rgba(62, 39, 35, 0.12);
  --transition: 0.2s ease;
  --max-width: 1200px;
  --nav-height: 64px;
}

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

/* Typography */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 600; }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); font-weight: 600; }

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dk); }

img { max-width: 100%; height: auto; display: block; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-logo svg { width: 32px; height: 32px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition);
}

.nav-links a:hover { color: var(--primary); }

.nav-links a.active { color: var(--primary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

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

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-light);
}
.btn-ghost:hover { background: var(--bg2); }

/* Hero */
.hero {
  position: relative;
  padding: 5rem 1.5rem;
  text-align: center;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 50%, #fce4ec 100%);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c2185b' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}

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

.hero h1 {
  margin-bottom: 1rem;
  color: var(--text);
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 1.15rem;
  color: var(--text-light);
  margin-bottom: 2rem;
  max-width: 550px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Section */
.section {
  padding: 4rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title p {
  color: var(--muted);
  margin-top: 0.5rem;
  font-size: 1.05rem;
}

/* Categories Grid */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.category-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.category-card:hover {
  border-color: var(--primary-lt);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.category-card .icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.category-card .name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.category-card .count {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Pattern Cards Grid */
.patterns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.pattern-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}

.pattern-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.pattern-card-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg2);
  overflow: hidden;
}

.pattern-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pattern-card:hover .pattern-card-img img { transform: scale(1.05); }

.pattern-card-img .badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
}

.badge-easy { background: var(--success); }
.badge-medium { background: var(--warning); color: var(--text); }
.badge-hard { background: var(--danger); }

.pattern-card-img .favorite-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--muted);
}

.favorite-btn:hover { color: var(--primary); transform: scale(1.1); }
.favorite-btn.active { color: var(--primary); }

.pattern-card-body {
  padding: 1rem;
}

.pattern-card-body h3 {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pattern-card-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

.pattern-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* How it works */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  text-align: center;
}

.step {
  padding: 1.5rem;
}

.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.step h3 { margin-bottom: 0.5rem; }
.step p { color: var(--muted); font-size: 0.95rem; }

/* Footer */
.footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

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

/* Catalog Page */
.catalog-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.filters {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: calc(var(--nav-height) + 1rem);
  height: fit-content;
}

.filter-group {
  margin-bottom: 1.5rem;
}

.filter-group h4 {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0;
  cursor: pointer;
  font-size: 0.95rem;
}

.filter-option input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition);
}

.search-bar:focus-within { border-color: var(--primary-lt); }

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: none;
  font-size: 1rem;
  color: var(--text);
  padding: 0.3rem;
}

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

.search-bar svg { color: var(--muted); flex-shrink: 0; }

/* Results info */
.results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 768px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 50;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    transform: translateY(calc(100% - 48px));
    transition: transform 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
  }

  .filters.open { transform: translateY(0); }

  .filters-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
  }

  .patterns-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }

  .hero { padding: 3rem 1rem; }

  .nav-links { gap: 1rem; }

  .categories-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 769px) {
  .filters-toggle { display: none; }
}

/* Pattern detail */
.pattern-detail {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.pattern-detail-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.pattern-detail-img {
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--bg2);
}

.pattern-detail-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pattern-detail-info h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.pattern-detail-info .author {
  color: var(--muted);
  margin-bottom: 1rem;
}

.pattern-meta-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pattern-meta-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.pattern-meta-list li strong {
  color: var(--text-light);
  min-width: 100px;
}

@media (max-width: 768px) {
  .pattern-detail-header {
    grid-template-columns: 1fr;
  }
}
