*, *::before, *::after {
  box-sizing: border-box;
}

*:not(dialog) {
  margin: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

p {
  text-wrap: pretty;
}
h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

#root, #__next {
  isolation: isolate;
}


/* Storefront CSS */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #020617;
    --foreground: #f8fafc;
    --card: #0f172a;
    --card-foreground: #f8fafc;
    --primary: #3b82f6;
    --primary-foreground: #ffffff;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #1e293b;
  }
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  margin: 0;
  line-height: 1.5;
}

header {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

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

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--foreground);
}

main {
  padding: 2rem 0;
}

/* --- Infinite Scroll Blocks --- */
.news-block {
    margin-bottom: 2rem;
}

/* --- Main Page Grids --- */

.news-block-type-1 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}

/* Grid 1: Top Row (3 items) */
.news-block-type-1 .news-card:nth-child(1),
.news-block-type-1 .news-card:nth-child(2),
.news-block-type-1 .news-card:nth-child(3) {
    grid-column: span 2; 
}

/* Grid 1: Subsequent items (2 per row -> span 3) */
.news-block-type-1 .news-card:nth-child(n+4) {
    grid-column: span 3;
}


.news-block-type-2 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Type 5: 4 items in a row */
.news-block-type-5 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

/* --- Detail Page Grids --- */

/* Top Teasers (2 items side-by-side) */
.detail-top-teasers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Detail Feed: 1/3 Left, 2/3 Right */
.news-block-type-3 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
}

/* Detail Feed: 1/2 Left, 1/2 Right */
.news-block-type-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}


/* Styles for News Cards */
.news-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.news-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background-color: var(--muted);
}

.news-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Combined H2 title styling per user request (hiding category/date) */
.news-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.news-title a {
  text-decoration: none;
  color: inherit;
}

/* --- News Detail Page Structure --- */
.news-detail-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.news-detail-main {
    background: var(--card);
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
}

.news-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sidebar-widget {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
}

.loading-indicator {
  text-align: center;
  padding: 2rem;
  color: var(--muted-foreground);
}

footer {
  background-color: var(--card);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 4rem;
  text-align: center;
  color: var(--muted-foreground);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .news-block-type-1,
    .news-block-type-2,
    .news-block-type-3,
    .news-block-type-4,
    .news-block-type-5,
    .detail-top-teasers {
        display: flex;
        flex-direction: column;
        grid-template-columns: 1fr;
    }
    
    .news-block-type-1 .news-card {
        grid-column: auto !important;
    }
    
    .news-detail-container {
        grid-template-columns: 1fr;
    }
}
