/*
 * Krona Mag - Cards Stylesheet
 * Version: 0.1.0
 * Description: All card styles used across the theme.
 *
 * Sections:
 *   1. Generic Card
 *   2. Featured Grid Cards
 *   3. Category Row Cards
 *   4. Premium Section Cards
 *   5. Standard Section Cards
 *   6. Insights Grid
 *   7. Related Posts Grid
 *   8. Responsive
 */

/* =============================================
   1. GENERIC CARD
   Base card used in archive, search, related posts
   Used in: template-parts/post/card.php
   ============================================= */

.km-card {
  background: var(--km-surface);
  border-radius: var(--km-radius-lg);
  border: 1px solid var(--km-border);
  overflow: hidden;
  box-shadow: var(--km-shadow);
  transition: box-shadow 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

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

/* Card image */
.km-card-img-wrap {
  display: block;
  overflow: hidden;
}

.km-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.km-card:hover .km-card-img {
  transform: scale( 1.04 );
}

/* Card body */
.km-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Category badge */
.km-card-cat {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--km-accent);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.km-card-cat:hover {
  color: var(--km-accent-dark);
}

/* Card title */
.km-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  flex: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.km-card-title a {
  color: inherit;
  transition: color 0.2s;
}

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

/* Card excerpt */
.km-card-excerpt {
  font-size: 13px;
  color: var(--km-text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Card meta - date and author */
.km-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--km-text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--km-border);
}

.km-card-author {
  font-weight: 500;
}

.km-card-sep {
  opacity: 0.5;
}

/* =============================================
   2. FEATURED GRID CARDS
   Text-only cards without image
   Used in: template-parts/home/grid-featured.php
   ============================================= */

/* Section wrapper */
.km-featured {
  margin: 48px auto;
  max-width: 1100px;
}

/* 3 equal columns */
.km-featured-grid {
  display: grid;
  grid-template-columns: repeat( 3, 1fr );
  gap: 24px;
}

/* Featured card */
.km-featured-card {
  background: var(--km-surface);
  border-radius: var(--km-radius-lg);
  border: 1px solid var(--km-border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.km-featured-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.km-featured-card .km-card-cat {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--km-accent);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-bottom: 8px;
  display: inline-block;
  transition: color 0.2s;
}

.km-featured-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.km-featured-card-title a {
  color: inherit;
  transition: color 0.2s;
}

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

.km-featured-card-excerpt {
  font-size: 13px;
  color: var(--km-text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  flex: 1;
}

.km-featured-card .km-card-meta {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--km-border);
  font-size: 11px;
  color: var(--km-text-muted);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =============================================
   3. CATEGORY ROW CARDS
   Cards with image for category rows
   Used in: template-parts/home/section-standard.php
   ============================================= */

/* Category row wrapper */
.km-cat-row {
  margin-bottom: 56px;
  margin-top: 80px;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}

/* 4 equal columns */
.km-cat-grid {
  display: grid;
  grid-template-columns: repeat( 4, 1fr );
  gap: 20px;
}

/* Category card with image */
.km-cat-card {
  background: var(--km-surface);
  border-radius: var(--km-radius-lg);
  border: 1px solid var(--km-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

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

.km-cat-card-img-wrap {
  display: block;
  overflow: hidden;
}

.km-cat-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.km-cat-card:hover .km-cat-card-img {
  transform: scale( 1.04 );
}

.km-cat-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.km-cat-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 8px 0 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  flex: 1;
}

.km-cat-card-title a {
  color: inherit;
  transition: color 0.2s;
}

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

/* =============================================
   4. PREMIUM SECTION CARDS
   White semi-transparent cards below premium hero
   Used in: template-parts/home/section-premium.php
   ============================================= */

/* Premium section wrapper */
.km-premium-section {
  background: linear-gradient(
    to bottom,
    #3b6fa0 0%,
    #5a8bbf 60%,
    #ffffff 100%
  );
  margin-bottom: 6px;
  padding-bottom: 40px;
  width: 100%;
}

.km-premium-grid-wrap {
  width: 100%;
  padding: 60px 0;
}

/* 4 equal columns */
.km-premium-grid {
  display: grid;
  grid-template-columns: repeat( 4, 1fr );
  gap: 16px;
}

/* Premium card */
.km-premium-card {
  background: rgba(255,255,255,0.95);
  border-radius: var(--km-radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

.km-premium-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  transform: translateY( -2px );
}

.km-premium-card-img-wrap {
  display: block;
  overflow: hidden;
}

.km-premium-card-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.km-premium-card:hover .km-premium-card-img {
  transform: scale( 1.04 );
}

.km-premium-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.km-premium-card-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 10px;
  flex: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.km-premium-card-title a {
  color: inherit;
  transition: color 0.2s;
}

.km-premium-card-title a:hover {
  color: #3b6fa0;
}

.km-premium-card .km-card-meta {
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* =============================================
   5. STANDARD SECTION CARDS
   2-column top row + 4-column grid below
   Used in: template-parts/home/section-standard.php
   ============================================= */

/* Top row: 2 columns - 2/3 left + 1/3 right */
.km-cat-top {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* Main article left */
.km-cat-main {
  background: var(--km-surface);
  border-radius: var(--km-radius-lg);
  border: 1px solid var(--km-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}

.km-cat-main:hover {
  box-shadow: var(--km-shadow-md);
  transform: translateY( -2px );
}

.km-cat-main-img-wrap {
  display: block;
  overflow: hidden;
}

.km-cat-main-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.km-cat-main:hover .km-cat-main-img {
  transform: scale( 1.03 );
}

.km-cat-main-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.km-cat-main-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin: 8px 0 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.km-cat-main-title a {
  color: inherit;
  transition: color 0.2s;
}

.km-cat-main-title a:hover {
  color: var(--km-accent);
}

.km-cat-main-excerpt {
  font-size: 14px;
  color: var(--km-text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  flex: 1;
}

/* Sidebar right - 3 cards stacked */
.km-cat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.km-cat-side-card {
  background: var(--km-surface);
  border-radius: var(--km-radius-lg);
  border: 1px solid var(--km-border);
  transition: box-shadow 0.2s, transform 0.2s;
  flex: 1;
}

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

.km-cat-side-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.km-cat-side-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  margin: 6px 0 10px;
  flex: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.km-cat-side-title a {
  color: inherit;
  transition: color 0.2s;
}

.km-cat-side-title a:hover {
  color: inherit;
}

.km-cat-side-excerpt {
  font-size: 13px;
  color: var(--km-text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =============================================
   6. INSIGHTS GRID
   4-column grid with load more button
   Used in: template-parts/home/section-insights.php
   ============================================= */

.km-insights {
  padding: 80px 0 64px;
  background: var(--km-bg);
}

/* Centered section header with lines on both sides */
.km-insights .km-section-header {
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
}

.km-insights .km-section-title {
  font-size: 32px;
  letter-spacing: 0.2em;
}

.km-insights .km-section-header::before {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--km-border);
}

.km-insights .km-section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--km-border);
}

/* 4-column grid */
.km-insights-grid {
  display: grid;
  grid-template-columns: repeat( 4, 1fr );
  gap: 20px;
  margin-bottom: 40px;
}

/* Load more button wrapper */
.km-insights-more {
  text-align: center;
  margin-top: 40px;
}

/* =============================================
   7. RELATED POSTS GRID
   4-column grid below single post
   Used in: single.php
   ============================================= */

.km-related {
  padding: 48px 0 64px;
  border-top: 1px solid var(--km-border);
}

.km-related-grid {
  display: grid;
  grid-template-columns: repeat( 4, 1fr );
  gap: 20px;
  margin-top: 24px;
}

/* =============================================
   8. RESPONSIVE
   ============================================= */

@media ( max-width: 1024px ) {
  .km-featured-grid       { grid-template-columns: repeat( 2, 1fr ); }
  .km-cat-grid            { grid-template-columns: repeat( 2, 1fr ); }
  .km-premium-grid        { grid-template-columns: repeat( 2, 1fr ); }
  .km-insights-grid       { grid-template-columns: repeat( 2, 1fr ); }
  .km-related-grid        { grid-template-columns: repeat( 2, 1fr ); }
  .km-cat-top             { grid-template-columns: 1fr; }
}

@media ( max-width: 640px ) {
  .km-featured-grid       { grid-template-columns: 1fr; }
  .km-cat-grid            { grid-template-columns: 1fr; }
  .km-premium-grid        { grid-template-columns: 1fr; }
  .km-insights-grid       { grid-template-columns: 1fr; }
  .km-related-grid        { grid-template-columns: 1fr; }
}