:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --surface-2: #e9ecef;
  --text: #1a1a1a;
  --muted: #6c757d;
  --accent: #0066cc;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #ffffff;
  color: var(--text);
  line-height: 1.6;
  position: relative;
}

/* Subtle knight background watermark */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('/assets/background.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  opacity: 0.04;
  z-index: -1;
  pointer-events: none;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1120px, 92vw); margin: 0 auto; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  background: #111;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 1000;
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 10px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #1d4ed8;
  outline-offset: 2px;
}


/* Header */
header.sticky {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid #dee2e6;
}
.nav { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.nav-links { display: flex; gap: 14px; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: clamp(1.6rem, 2.8vw, 2.2rem); letter-spacing: 0.2px; color: var(--text); }
.brand a { color: inherit; text-decoration: none; }
.brand a:hover { text-decoration: none; }
.nav-links a,
.nav-links a:visited,
.nav-links a:hover,
.nav-links a:active {
  color: #000;
  font-weight: 500;
  text-decoration: none;
}

/* News Hub hero carousel */
.news-hero {
  margin: 18px 0 24px;
}
.news-hero-slide {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #dee2e6;
  background: #fff;
}
.news-hero-slide:hover {
  text-decoration: none;
}
.news-hero-image-wrap {
  position: relative;
  height: clamp(220px, 35vw, 360px);
  background: #f3f4f6;
}
.news-hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.news-hero-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 6px 10px;
  border-radius: 999px;
}

/* Trending Hero Section */
.trending-hero {
  margin: 24px 0 32px;
}
.trending-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
  letter-spacing: 0.5px;
}
.trending-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: rgba(255,255,255,0.95);
  border: 1px solid #dee2e6;
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.1s;
}
.trending-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  transform: translateY(-2px);
  text-decoration: none;
}
.trending-image-wrap {
  position: relative;
  min-height: 320px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.trending-image-wrap::before {
  content: '🔥';
  font-size: 4rem;
  opacity: 0.3;
}
.trending-image-wrap img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.trending-content {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.trending-content h1 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.3;
  color: var(--text);
}
.trending-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.trending-summary {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .trending-card {
    grid-template-columns: 1fr;
  }
  .trending-image-wrap {
    min-height: 200px;
  }
  .trending-content {
    padding: 20px;
  }
}

/* News Sections */
.news-sections {
  display: flex;
  flex-direction: column;
  gap: 48px;
  margin-bottom: 48px;
}
.news-category {
  scroll-margin-top: 80px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #dee2e6;
}
.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--text);
  background: rgba(255,255,255,0.95);
  padding: 4px 8px;
  border-radius: 8px;
}
.view-all {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
}

/* Grid Layouts */
.grid { display: grid; gap: 16px; }

/* News image wrapper styles - for ALL cards */
.news-image-wrap {
  position: relative;
  height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.news-image-wrap-large {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px 8px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.news-image-wrap-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

/* Image loading placeholder */
.image-loading-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  font-size: 2.5rem;
  opacity: 0.6;
  z-index: 1;
}

/* Large news cards (Trending) */
.grid.news-large {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid.news-large .card {
  padding: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.98);
}

.grid.news-large .card .news-content {
  padding: 16px;
}
.grid.news-large .card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--text);
}
.grid.news-large .card .meta {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.grid.news-large .card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.5;
}

/* Medium news cards */
.grid.news-medium {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid.news-medium .card {
  padding: 0;
  overflow: hidden;
  background: rgba(255,255,255,0.98);
  display: flex;
  flex-direction: column;
}

.grid.news-medium .card .news-content {
  padding: 16px;
  flex: 1;
}

.grid.news-medium .card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
}
.grid.news-medium .card .meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 8px;
}
.grid.news-medium .card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}

/* Card styles */
.card {
  background: rgba(255,255,255,0.98);
  border: 1px solid #dee2e6;
  border-radius: var(--radius);
  transition: box-shadow 0.2s, transform 0.1s;
}
.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Tools Section - Compact */
.tools-section {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 2px solid #dee2e6;
}
.tools-section h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
  color: var(--muted);
}
.tools-compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  text-align: center;
  gap: 8px;
}
.tool-card:hover {
  text-decoration: none;
}
.tool-icon {
  font-size: 1.8rem;
}
.tool-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

/* Legacy styles */
.hero, .panel, .ad-slot {
  background: rgba(248,249,250,0.98);
  border: 1px solid #dee2e6;
  border-radius: var(--radius);
}
.hero { padding: 26px; margin: 20px 0; }
.hero h1 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2.2rem); color: var(--text); }
.hero p { margin: 0; color: var(--muted); }

.ad-slot {
  min-height: 100px;
  padding: 10px;
  display: grid;
  place-items: center;
  color: #adb5bd;
  background: rgba(248,249,250,0.98);
  margin: 16px 0;
}
.ad-slot::before { content: 'Ad Slot'; opacity: .8; }

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 980px) {
  .layout.news-page { grid-template-columns: 1fr 320px; }
}

input, select, button {
  border-radius: 10px;
  border: 1px solid #ced4da;
  background: #ffffff;
  color: var(--text);
  padding: 10px;
}
button { 
  cursor: pointer; 
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 500;
}
button:hover { background: #0052a3; }
.tool-box { padding: 16px; }
.tool-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 10px; }
.tool-row.single { grid-template-columns: 1fr; }
.result { font-weight: 700; margin-top: 10px; color: var(--text); }
footer { margin: 30px 0; color: var(--muted); font-size: .92rem; }
.badge { 
  font-size: .75rem; 
  padding: 3px 8px; 
  border: 1px solid #dee2e6; 
  border-radius: 999px; 
  background: rgba(248,249,250,0.98);
  color: var(--muted);
}
.breadcrumbs { margin: 10px 0; color: var(--muted); font-size: .9rem; }
.small { font-size: .88rem; color: var(--muted); }
.share { margin-top: 8px; }

.news-item { 
  display: flex; 
  flex-direction: column;
  background: rgba(255,255,255,0.98);
}

/* News item image wrapper */
.news-item .news-image-wrapper {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  border-radius: 10px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.news-item .news-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.news-item .news-image-wrapper .image-loading-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  font-size: 2rem;
  z-index: 1;
}

h1, h2, h3, h4, h5, h6 { color: var(--text); }

/* Category pages (View all) redesign */
.grid.news {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

/* News hub category cards */
.news-hub-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.category-card {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.category-card .category-image-wrap {
  position: relative;
  height: 160px;
  background: #f3f4f6;
}
.category-card .category-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.category-card h3 {
  margin: 0;
  padding: 14px 16px;
  color: var(--text);
}

.layout.news-page {
  grid-template-columns: 1fr;
}

.layout.news-page aside {
  display: none;
}

.grid.news .news-item {
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.grid.news .news-item .news-image-wrapper {
  width: 100%;
  height: 220px;
  margin-bottom: 0;
  border-radius: 0;
}

.grid.news .news-item h3,
.grid.news .news-item .meta,
.grid.news .news-item p,
.grid.news .news-item .share {
  padding-left: 16px;
  padding-right: 16px;
}

.grid.news .news-item h3 {
  margin: 14px 0 8px;
  font-size: 1.08rem;
}

.grid.news .news-item .meta {
  margin-bottom: 8px;
}

.grid.news .news-item p {
  margin: 0 0 14px;
  color: #222;
  line-height: 1.65;
}

.grid.news .news-item .share {
  margin: 0 0 16px;
}

@media (max-width: 1100px) {
  .grid.news {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* Ensure all text remains readable */
.card, .trending-card, .hero, .panel, .ad-slot {
  background: rgba(255,255,255,0.98);
}

.card:hover, .trending-card:hover {
  background: rgba(255,255,255,0.99);
}


/* AdSense placements */
.ad-banner-top {
  width: 100%;
  background: rgba(255,255,255,0.98);
  border-bottom: 1px solid #dee2e6;
  padding: 8px 10px;
  display: block;
}
.ad-banner-top ins { min-height: 90px; }

.ad-inline-break {
  margin: 8px 0 4px;
  padding: 8px;
  border: 1px dashed #ced4da;
  border-radius: 12px;
  background: rgba(248,249,250,0.98);
}
.ad-inline-break ins { min-height: 100px; }

.ad-native-card {
  padding: 12px !important;
  border-style: dashed;
  border-color: #d0d7de;
  background: rgba(255,255,255,0.98);
}
.ad-native-label {
  display: inline-block;
  font-size: 0.75rem;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}

.ad-footer-sticky {
  width: 100%;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid #dee2e6;
  padding: 8px 44px 8px 8px;
  position: static;
  z-index: 30;
}
.ad-footer-sticky ins { min-height: 90px; }
.ad-close {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #ced4da;
  background: #fff;
  color: #111;
  cursor: pointer;
  line-height: 1;
}

@media (max-width: 900px) {
  .ad-footer-sticky {
    position: fixed;
    left: 0;
    bottom: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.12);
  }
  body { padding-bottom: 124px; }
}
