/* ============================================
   Shadow's Reptiles — Care Guides
   ============================================ */

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

:root {
  --red-dark: #8B0000;
  --red-mid: #A50000;
  --red-accent: #CC0000;
  --red-bright: #E60000;
  --gold: #FFD700;
  --bg-black: #111111;
  --bg-dark: #1a1a1a;
  --bg-card: #222222;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --border-color: #333333;
  --font-heading: 'Oswald', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --max-width: 1200px;
  --radius: 8px;
  --nav-height: 74px;
}

html { scroll-behavior: smooth; }

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

a { color: var(--text-primary); text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.2;
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--red-accent);
  color: white;
  padding: 8px 16px;
  z-index: 10000;
  border-radius: var(--radius);
  font-family: var(--font-body);
}
.skip-link:focus { top: 16px; }

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 16px 32px;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  border-radius: 4px;
}
.btn-primary {
  background: var(--red-accent);
  color: white;
  border-color: var(--red-accent);
}
.btn-primary:hover {
  background: var(--red-bright);
  border-color: var(--red-bright);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(204, 0, 0, 0.4);
}
.btn-outline {
  background: transparent;
  color: white;
  border-color: white;
}
.btn-outline:hover {
  background: white;
  color: var(--bg-black);
  transform: translateY(-2px);
}

.hero {
  position: relative;
  padding: 160px 24px 80px;
  text-align: center;
  background: linear-gradient(135deg, var(--bg-black) 0%, var(--red-dark) 100%);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect width="4" height="4" fill="%23000" opacity="0.15"/><rect width="1" height="1" fill="%23000" opacity="0.1"/></svg>');
  opacity: 0.3;
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
}
.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  margin-bottom: 16px;
}
.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-secondary);
  line-height: 1.6;
  text-transform: none;
  font-weight: 400;
}

/* --- Filter Bar --- */
.filter-bar {
  position: sticky;
  top: var(--nav-height);
  z-index: 100;
  background: var(--bg-black);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-bar-inner {
  display: flex;
  gap: 10px;
  max-width: var(--max-width);
  margin: 0 auto;
  justify-content: center;
}
.filter-btn {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 20px;
  border: 2px solid var(--border-color);
  border-radius: 50px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}
.filter-btn:hover {
  border-color: var(--red-accent);
  color: var(--text-primary);
}
.filter-btn.active {
  background: var(--red-accent);
  border-color: var(--red-accent);
  color: white;
}
.filter-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.filter-lang-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}
.filter-lang-group .filter-btn {
  font-size: 0.78rem;
  padding: 6px 16px;
}

/* --- Guide Grid --- */
.guides-section {
  padding: 60px 24px 80px;
}
.guides-container {
  max-width: var(--max-width);
  margin: 0 auto;
}
.guides-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}
.guides-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0 20px;
  margin-top: 8px;
}
.guides-sentinel[hidden] { display: none; }
.guides-sentinel-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--red-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Loading state */
.guides-loading {
  display: contents;
}

/* Error state */
.guides-error {
  text-align: center;
  padding: 60px 24px;
  grid-column: 1 / -1;
}
.guides-error p {
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Empty state */
.guides-empty {
  text-align: center;
  padding: 60px 24px;
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* --- Guide Card --- */
.guide-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
  display: flex;
  flex-direction: column;
}
.guide-card:hover {
  border-color: var(--red-accent);
}
.guide-card a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
}
.guide-card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
}
.guide-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.guide-card:hover .guide-card-image img {
  transform: scale(1.05);
}
.guide-card-image .category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--red-accent);
  color: white;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
}
.guide-card-image .featured-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gold);
  color: var(--bg-black);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
}
.guide-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.guide-card-title {
  font-size: 1.15rem;
  margin-bottom: 8px;
  line-height: 1.3;
}
.guide-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.guide-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.guide-card-meta .lang-badge {
  background: var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
}

/* --- Skeleton Loading Cards --- */
.skeleton-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.skeleton-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(90deg, var(--bg-dark) 25%, var(--border-color) 50%, var(--bg-dark) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-body { padding: 20px; }
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-dark) 25%, var(--border-color) 50%, var(--bg-dark) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 10px;
}
.skeleton-line.title { height: 20px; width: 70%; }
.skeleton-line.short { width: 40%; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Meet the Author --- */
.meet-author {
  background: var(--bg-dark);
  padding: 100px 24px;
  overflow: hidden;
}
.author-inner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 60px;
  max-width: 900px;
  margin: 0 auto;
  align-items: center;
}
.author-photo {
  position: relative;
}
.author-photo img {
  width: 280px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.5));
}
.author-label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--red-bright);
  margin-bottom: 8px;
}
.author-text h2 {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.8rem);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 20px;
}
.author-bio {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 16px;
}
.author-bio:last-of-type {
  margin-bottom: 28px;
}
.author-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .author-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 32px;
  }
  .author-photo {
    display: flex;
    justify-content: center;
  }
  .author-photo img {
    width: 200px;
  }
  .author-links {
    justify-content: center;
  }
}

/* --- CTA Section --- */
.cta {
  padding: 80px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-black) 0%, var(--red-dark) 100%);
}
.cta-inner {
  max-width: 600px;
  margin: 0 auto;
}
.cta h2 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 16px;
}
.cta p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* --- Guide Page: Header --- */
.guide-header {
  padding-top: 0;
}
.guide-banner {
  width: 100%;
  max-height: 400px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
}
.guide-banner img {
  width: 100%;
  height: 400px;
  object-fit: cover;
}
.guide-header-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 0;
}
.guide-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 24px;
  transition: color 0.3s ease;
}
.guide-back:hover { color: var(--text-primary); }
.guide-page-title {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 16px;
}
.guide-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.guide-meta .category-badge {
  background: var(--red-accent);
  color: white;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
}
.guide-meta span {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.guide-meta .lang-badge {
  background: var(--border-color);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
}

/* --- Guide Page: Body --- */
.guide-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.guide-body h2 {
  font-size: 1.5rem;
  margin: 40px 0 16px;
  text-transform: uppercase;
}
.guide-body p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.guide-body em {
  color: var(--text-muted);
  font-style: italic;
}

/* --- Guide Page: Related Guides --- */
.related-guides {
  padding: 60px 24px 80px;
  background: var(--bg-dark);
}
.related-guides-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.related-guides h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 32px;
  text-align: center;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}
.related-guides .back-link {
  text-align: center;
  margin-top: 40px;
}
.related-guides .back-link a {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--red-accent);
  transition: color 0.3s ease;
}
.related-guides .back-link a:hover { color: var(--red-bright); }

/* --- Guide Not Found --- */
.guide-not-found {
  text-align: center;
  padding: 200px 24px 100px;
}
.guide-not-found h1 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.guide-not-found p {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1.1rem;
}

/* --- Footer --- */
/* --- Animation Initial States --- */
.hero-subtitle { opacity: 0; }
.filter-bar { opacity: 0; }
.guide-card { opacity: 0; transform: translateY(20px); }
.cta h2, .cta p, .cta .btn { opacity: 0; }
@media (max-width: 992px) {
  .guides-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .guides-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .filter-bar-inner {
    justify-content: flex-start;
  }

  .guide-banner img { height: 250px; }
}

@media (max-width: 480px) {
  .guides-grid {
    grid-template-columns: 1fr;
  }
  .related-grid {
    grid-template-columns: 1fr;
  }
  .hero { padding: 140px 24px 60px; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .hero-subtitle,
  .filter-bar,
  .guide-card,
  .cta h2, .cta p, .cta .btn,
  .stagger-text .char,
  .guide-meta,
  .guide-body,
  .related-guides h2 {
    opacity: 1 !important;
    transform: none !important;
  }
  .skeleton-image,
  .skeleton-line {
    animation: none;
    background: var(--bg-dark);
  }
  .guide-card-image img {
    transition: none;
  }
  .guides-sentinel-spinner {
    animation: none;
  }
}
