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

/* ===== Theme: Dark Cozy (default) ===== */
:root {
  /* Dark Cozy palette */
  --bg: #1c1822;
  --bg-soft: #262030;
  --bg-card: #2a2334;
  --text: #f3ece4;
  --muted: #b3a8bd;
  --accent: #ff9e6d;          /* warm peach */
  --accent-2: #c9a6ff;        /* soft lilac */
  --accent-hover: #ffb589;
  --border: #3a3247;
  --shadow: rgba(0, 0, 0, 0.35);
  --tag-bg: #352c44;

  --max-width: 860px;
  --radius: 16px;
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-head: "Baloo 2", "Nunito", system-ui, sans-serif;
}

:root[data-theme="light"] {
  /* Warm light variant */
  --bg: #fbf6f0;
  --bg-soft: #f4ece3;
  --bg-card: #ffffff;
  --text: #2c2536;
  --muted: #7a6f86;
  --accent: #e8743b;
  --accent-2: #8b5cf6;
  --accent-hover: #d8612a;
  --border: #ecdfd2;
  --shadow: rgba(120, 90, 60, 0.12);
  --tag-bg: #f0e6da;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 1.05rem;
  /* subtle cozy texture: soft radial glows */
  background-image:
    radial-gradient(circle at 12% -5%, rgba(255, 158, 109, 0.10), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(201, 166, 255, 0.10), transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, .nav-brand { font-family: var(--font-head); letter-spacing: 0.2px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== Header / Nav ===== */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
  flex-wrap: wrap;
}

.nav-brand {
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-brand:hover { color: var(--accent); }
.nav-brand .paw { font-size: 1.1rem; }

.nav-right { display: flex; align-items: center; gap: 1.25rem; }

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.97rem;
  font-weight: 700;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.nav-links a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, border-color 0.2s;
}
.theme-toggle:hover { transform: rotate(-15deg) scale(1.08); border-color: var(--accent); }

/* ===== Main ===== */
.main {
  max-width: var(--max-width);
  margin: 3rem auto;
  padding: 0 1.5rem;
}

/* ===== Hero ===== */
.hero {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "🐾";
  position: absolute;
  right: 1.2rem;
  bottom: 0.4rem;
  font-size: 5rem;
  opacity: 0.07;
  transform: rotate(-12deg);
  pointer-events: none;
}
.hero h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero .content { color: var(--muted); font-size: 1.12rem; }
.hero .content p { margin-bottom: 0.9rem; }
.hero .content strong { color: var(--text); }

/* ===== Sections ===== */
.section-cards, .recent-posts, .home-block { margin-top: 3rem; }
.section-cards h2, .recent-posts h2, .home-block h2 {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.section-sub { color: var(--muted); margin-bottom: 1.25rem; font-size: 1rem; }

/* ===== Cards ===== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px var(--shadow);
}
.card h3 { font-size: 1.12rem; margin-bottom: 0.5rem; }
.card p { font-size: 0.92rem; color: var(--muted); margin: 0 0 0.9rem; flex: 1; }
.card-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--tag-bg);
  color: var(--accent-2);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.card-tag.soon { color: var(--muted); }

/* Big feature cards (community-first homepage) */
.feature-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.feature-card { font-size: 1.05rem; }
.feature-card .emoji { font-size: 2rem; display: block; margin-bottom: 0.6rem; }

/* ===== Post List ===== */
.post-list { list-style: none; margin-top: 1.25rem; }
.post-item {
  padding: 1.1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.9rem;
  transition: border-color 0.15s, transform 0.15s;
}
.post-item:hover { border-color: var(--accent); transform: translateX(3px); }
.post-title { font-size: 1.18rem; font-weight: 800; color: var(--text); }
.post-title:hover { color: var(--accent); }
.post-item time { display: block; color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
.post-desc { color: var(--muted); font-size: 0.95rem; margin-top: 0.5rem; }

/* ===== Article ===== */
.article-header { margin-bottom: 2rem; }
.article-header h1 { font-size: 2.2rem; font-weight: 800; }
.article-meta { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.875rem; flex-wrap: wrap; }
.tags { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }
.tag {
  background: var(--tag-bg);
  color: var(--accent-2);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}
.tag:hover { background: var(--accent); color: #1c1822; }

.content h2 { margin: 2rem 0 0.75rem; font-size: 1.5rem; }
.content h3 { margin: 1.5rem 0 0.5rem; font-size: 1.2rem; }
.content p { margin-bottom: 1.25rem; }
.content ul, .content ol { margin: 0 0 1.25rem 1.5rem; }
.content li { margin-bottom: 0.4rem; }
.content a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.content code { background: var(--bg-soft); padding: 0.2rem 0.45rem; border-radius: 6px; font-size: 0.9em; }
.content pre { background: #15121b; color: #e2e8f0; padding: 1.25rem; border-radius: 12px; overflow-x: auto; margin-bottom: 1.25rem; border: 1px solid var(--border); }
.content pre code { background: none; padding: 0; }
.content blockquote { border-left: 3px solid var(--accent); padding-left: 1rem; color: var(--muted); margin-bottom: 1.25rem; }

/* ===== List page ===== */
.list-page > h1 { font-size: 2.2rem; margin-bottom: 0.5rem; }
.list-page > .content { color: var(--muted); margin-bottom: 1.5rem; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: var(--accent);
  color: #1c1822;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
  transition: transform 0.15s, background 0.15s;
}
.btn:hover { background: var(--accent-hover); color: #1c1822; transform: translateY(-2px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 2px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card); color: var(--text); border-color: var(--accent); }

/* ===== Notice / disclaimer banner ===== */
.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.notice .notice-icon { font-size: 1.3rem; line-height: 1; }

/* ===== Gallery ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-top: 1.5rem;
}
.gallery-item {
  display: block;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  aspect-ratio: 1 / 1;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s;
  margin: 0;
}
.gallery-item:hover { transform: scale(1.02); box-shadow: 0 8px 20px var(--shadow); }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item figcaption {
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.82rem;
  padding: 1.5rem 0.7rem 0.6rem;
  opacity: 0;
  transition: opacity 0.18s;
}
.gallery-item:hover figcaption { opacity: 1; }

/* empty gallery placeholder */
.gallery-empty {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
  margin-top: 1.5rem;
}
.gallery-empty .big { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; opacity: 0.6; }

/* Lightbox (CSS + tiny JS) */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 2rem;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.lightbox .lb-close {
  position: absolute;
  top: 1.2rem;
  right: 1.6rem;
  font-size: 2.2rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.lightbox .lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  padding: 0 1rem;
  user-select: none;
}
.lightbox .lb-prev { left: 0.5rem; }
.lightbox .lb-next { right: 0.5rem; }
.lightbox .lb-caption { position: absolute; bottom: 1rem; left: 0; right: 0; text-align: center; color: #eee; font-size: 0.9rem; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}
.footer .footer-links { margin-bottom: 0.6rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.footer .footer-links a { color: var(--muted); font-weight: 700; }
.footer .footer-links a:hover { color: var(--accent); }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .nav { padding: 0.8rem 1rem; }
  .nav-right { gap: 0.8rem; width: 100%; justify-content: space-between; }
  .nav-links { gap: 0.9rem; font-size: 0.9rem; }
  .main { padding: 0 1rem; margin: 2rem auto; }
  .hero { padding: 1.8rem 1.3rem; }
  .hero h1 { font-size: 2rem; }
}
