/* ========================================
   探洞 - 洞穴探险综合平台
   杂志风格 CSS
   ======================================== */

/* CSS 变量 */
:root {
  --accent-color: #e91e63;
  --accent-dark: #c2185b;
  --primary-dark: #1a1a2e;
  --secondary-dark: #16213e;
  --text-primary: #333;
  --text-secondary: #666;
  --text-light: #999;
  --bg-light: #f8f9fa;
  --bg-white: #fff;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
  --radius: 4px;
  --radius-lg: 8px;
  --max-width: 1200px;
  --header-height: 60px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-light);
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s;
}

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

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

ul {
  list-style: none;
}

/* ========================================
   布局
   ======================================== */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ========================================
   Header
   ======================================== */

.header {
  background: var(--primary-dark);
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.logo span {
  color: var(--accent-color);
}

.nav {
  display: flex;
  gap: 2rem;
}

.nav a {
  color: rgba(255,255,255,0.85);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav a:hover {
  color: #fff;
}

/* ========================================
   Breadcrumb
   ======================================== */

.breadcrumb {
  background: var(--bg-white);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb ol {
  display: flex;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.breadcrumb li:not(:last-child)::after {
  content: ">";
  margin-left: 8px;
  color: var(--text-light);
}

.breadcrumb a:hover {
  color: var(--accent-color);
}

/* ========================================
   Main Layout Grid
   ======================================== */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  padding: 24px 0;
}

.main-content {
  min-width: 0;
}

.sidebar {
  width: 320px;
}

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s, transform 0.3s;
}

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

.card-image {
  position: relative;
  overflow: hidden;
}

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

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

.card-body {
  padding: 16px;
}

.card-category {
  font-size: 0.75rem;
  color: var(--accent-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-title a:hover {
  color: var(--accent-color);
}

.card-excerpt {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ========================================
   Hero Section
   ======================================== */

.hero-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.hero-main {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 400px;
}

.hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 24px 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
}

.hero-overlay .card-category {
  color: var(--accent-color);
}

.hero-overlay .card-title {
  font-size: 1.5rem;
  color: #fff;
  margin: 8px 0;
}

.hero-overlay .card-title a {
  color: #fff;
}

.hero-overlay .card-title a:hover {
  color: var(--accent-color);
}

.hero-overlay .card-excerpt {
  color: rgba(255,255,255,0.8);
}

.hero-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-sidebar .card {
  flex: 1;
}

.hero-sidebar .card-image {
  height: 120px;
}

/* ========================================
   Featured Grid
   ======================================== */

.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.featured-large {
  grid-row: span 2;
}

.featured-large .card-image {
  height: 300px;
}

.featured-grid .card-image {
  height: 160px;
}

/* ========================================
   Section Title
   ======================================== */

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
  display: inline-block;
}

/* ========================================
   Article List
   ======================================== */

.article-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.article-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

.article-item:hover {
  box-shadow: var(--shadow-hover);
}

.article-thumb {
  width: 120px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-info {
  flex: 1;
  min-width: 0;
}

.article-info .card-title {
  font-size: 1rem;
  margin-bottom: 6px;
}

.article-info .card-excerpt {
  font-size: 0.8rem;
  -webkit-line-clamp: 1;
}

/* ========================================
   Sidebar Widgets
   ======================================== */

.widget {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.widget-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-color);
}

.widget-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
}

.widget-list li:last-child {
  border-bottom: none;
}

.widget-list a {
  font-size: 0.9rem;
  color: var(--text-primary);
  display: block;
}

.widget-list a:hover {
  color: var(--accent-color);
}

.widget-list .meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}

/* Tags */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-light);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.tag:hover {
  background: var(--accent-color);
  color: #fff;
}

/* Subscribe */
.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.subscribe-form input {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.subscribe-form input:focus {
  outline: none;
  border-color: var(--accent-color);
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  text-align: center;
}

.btn:hover {
  background: var(--accent-dark);
  color: #fff;
}

.btn-block {
  width: 100%;
}

/* ========================================
   Three Column Section
   ======================================== */

.three-col-section {
  background: var(--bg-white);
  padding: 32px 0;
  margin-top: 32px;
}

.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.col-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.col-list li:last-child {
  border-bottom: none;
}

.col-list a {
  font-size: 0.9rem;
  display: block;
}

.col-list .num {
  display: inline-block;
  width: 20px;
  height: 20px;
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
  border-radius: 50%;
  margin-right: 8px;
}

/* ========================================
   Category Page
   ======================================== */

.category-hero {
  position: relative;
  height: 280px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.category-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 24px 24px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: #fff;
}

.category-hero-overlay h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.category-hero-overlay p {
  color: rgba(255,255,255,0.8);
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.content-grid .card-image {
  height: 180px;
}

/* ========================================
   Article Page
   ======================================== */

.article-header {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.article-header-image {
  width: 100%;
  height: 400px;
}

.article-header-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-header-content {
  padding: 24px;
}

.article-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}

.article-meta {
  display: flex;
  gap: 20px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.article-body {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  font-size: 1rem;
  line-height: 1.8;
}

.article-body h2 {
  font-size: 1.5rem;
  margin: 32px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

.article-body h3 {
  font-size: 1.25rem;
  margin: 24px 0 12px;
}

.article-body p {
  margin-bottom: 16px;
}

.article-body img {
  border-radius: var(--radius-lg);
  margin: 24px 0;
}

.article-body blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}

.article-body ul,
.article-body ol {
  margin: 16px 0;
  padding-left: 24px;
}

.article-body ul {
  list-style: disc;
}

.article-body ol {
  list-style: decimal;
}

.article-body li {
  margin-bottom: 8px;
}

/* Author Widget */
.author-widget {
  text-align: center;
}

.author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 12px;
  overflow: hidden;
}

.author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.author-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Related Articles */
.related-inline {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 24px 0;
}

.related-inline h4 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.related-inline ul {
  list-style: none;
  padding: 0;
}

.related-inline li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.related-inline li:last-child {
  border-bottom: none;
}

.related-inline a {
  color: var(--accent-color);
}

/* ========================================
   404 Page
   ======================================== */

.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.error-content {
  max-width: 500px;
}

.error-code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--accent-color);
  line-height: 1;
  margin-bottom: 16px;
}

.error-title {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.error-desc {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* ========================================
   Footer
   ======================================== */

.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.8);
  padding: 48px 0 24px;
  margin-top: 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 32px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.7);
}

.footer-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.875rem;
  color: rgba(255,255,255,0.5);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .widget {
    margin-bottom: 0;
  }

  .three-col-grid {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .nav {
    display: none;
  }

  .hero-section {
    grid-template-columns: 1fr;
  }

  .hero-main {
    height: 280px;
  }

  .hero-sidebar {
    flex-direction: row;
  }

  .hero-sidebar .card {
    flex: 1;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-large {
    grid-row: auto;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .article-header-image {
    height: 200px;
  }

  .article-title {
    font-size: 1.25rem;
  }

  .article-body {
    padding: 20px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .error-code {
    font-size: 5rem;
  }
}

@media (max-width: 480px) {
  .hero-sidebar {
    flex-direction: column;
  }

  .article-item {
    flex-direction: column;
  }

  .article-thumb {
    width: 100%;
    height: 160px;
  }

  .article-meta {
    flex-wrap: wrap;
    gap: 12px;
  }
}
