/* Vísindi — Icelandic Science News */
@import url('https://fonts.googleapis.com/css2?family=Lora:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #fafaf8;
  --bg-card: #ffffff;
  --bg-hover: #f5f3f0;
  --border: #e8e6e1;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --accent-longlifi: #2d5016;
  --accent-laekni: #0d47a1;
  --accent-geim: #1a237e;
  --accent-tolvur: #4a3728;
  --accent-gervigreind: #6a1b9a;
  --accent-green: #4a7c59;
  --max-width: 1280px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Lora', 'Crimson Text', Georgia, serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* Header */
.site-header {
  border-bottom: 2px solid var(--border);
  padding: 0 24px;
  position: sticky;
  top: 0;
  background: rgba(250, 250, 248, 0.98);
  backdrop-filter: blur(8px);
  z-index: 100;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
}
.logo span { color: var(--accent-green); }

nav { display: flex; gap: 2px; }
nav a {
  padding: 6px 14px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid transparent;
}
nav a:hover {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
}
nav a.active {
  color: var(--accent-green);
  border-bottom-color: var(--accent-green);
  background: transparent;
}

/* Mobile nav */
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 24px; cursor: pointer; }

/* Hero */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 56px 24px 36px;
  text-align: center;
}
.hero h1 {
  font-family: 'Lora', serif;
  font-size: 44px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.6px;
  color: var(--text);
  line-height: 1.2;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto;
  font-weight: 400;
  line-height: 1.7;
}

/* Category tabs */
.category-tabs {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 7px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all 0.25s ease;
  text-transform: capitalize;
}
.tab:hover { 
  border-color: var(--accent-green);
  color: var(--accent-green);
}
.tab.active { 
  background: var(--accent-green);
  color: white;
  border-color: var(--accent-green);
}
.tab[data-cat="langlifi"].active { background: var(--accent-longlifi); border-color: var(--accent-longlifi); }
.tab[data-cat="laeknivisindi"].active { background: var(--accent-laekni); border-color: var(--accent-laekni); }
.tab[data-cat="geimvisindi"].active { background: var(--accent-geim); border-color: var(--accent-geim); }
.tab[data-cat="tolvur"].active { background: var(--accent-tolvur); border-color: var(--accent-tolvur); }
.tab[data-cat="gervigreind"].active { background: var(--accent-gervigreind); border-color: var(--accent-gervigreind); }

/* Article grid - Featured first article */
.articles-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 60px;
}

.article-card:first-child {
  margin-bottom: 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}

.article-card:first-child .card-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 8px;
  order: 2;
}

.article-card:first-child .card-body {
  padding: 0;
  order: 1;
}

.article-card:first-child h3 {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 16px;
}

.article-card:first-child .card-cat {
  font-size: 12px;
}

/* Regular grid for remaining articles */
.articles-grid::after {
  content: '';
  display: block;
  width: 100%;
  height: 0;
  order: 10;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 28px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-card:first-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
  border: none;
  background: transparent;
  margin-bottom: 12px;
}

.article-card:first-child .card-img {
  width: 100%;
  height: 360px;
  object-fit: cover;
  border-radius: 6px;
  order: 2;
}

.article-card:first-child .card-body {
  padding: 0;
  order: 1;
}

.article-card:first-child h3 {
  font-size: 32px;
  line-height: 1.3;
  margin-bottom: 18px;
}

.article-card:not(:first-child):hover {
  border-color: var(--accent-green);
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(74, 124, 89, 0.08);
}

.article-card .card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.article-card .card-body { 
  padding: 22px; 
  flex: 1;
  display: flex;
  flex-direction: column;
}

.article-card .card-cat {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  width: fit-content;
}

.card-cat.langlifi { background: rgba(45, 80, 22, 0.1); color: var(--accent-longlifi); }
.card-cat.laeknivisindi { background: rgba(13, 71, 161, 0.1); color: var(--accent-laekni); }
.card-cat.geimvisindi { background: rgba(26, 35, 126, 0.1); color: var(--accent-geim); }
.card-cat.tolvur { background: rgba(74, 55, 40, 0.1); color: var(--accent-tolvur); }
.card-cat.gervigreind { background: rgba(106, 27, 154, 0.1); color: var(--accent-gervigreind); }

.article-card h3 {
  font-size: 19px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 10px;
  color: var(--text);
}

.article-card .card-excerpt {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card .card-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 100px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 20px; }
.empty-state h3 { font-size: 22px; margin-bottom: 10px; color: var(--text); font-weight: 600; }

/* Article page */
.article-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}
.article-page .article-cat {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 18px;
}
.article-page h1 {
  font-family: 'Lora', serif;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 18px;
  letter-spacing: -0.4px;
  color: var(--text);
}
.article-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.article-hero-img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 40px;
  max-height: 480px;
  object-fit: cover;
}
.article-content {
  font-size: 17px;
  line-height: 1.85;
  color: var(--text);
}
.article-content p { margin-bottom: 22px; }
.article-content h2 {
  font-family: 'Lora', serif;
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 18px;
  color: var(--text);
}
.article-content strong { color: var(--text); font-weight: 600; }
.article-source {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}
.article-source a { color: var(--accent-green); font-weight: 500; }
.article-source a:hover { text-decoration: underline; }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
  transition: color 0.25s ease;
  font-weight: 500;
}
.back-link:hover { color: var(--accent-green); }

/* Footer */
.site-footer {
  border-top: 2px solid var(--border);
  padding: 40px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-hover);
}

/* Responsive */
@media (max-width: 768px) {
  .nav-toggle { 
    display: block; 
    background: none;
    border: none;
    color: var(--text);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
  }
  
  nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    flex-direction: column;
    padding: 16px;
  }
  nav.open { display: flex; }
  nav a {
    padding: 10px 12px;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  nav a:hover, nav a.active {
    border-left-color: var(--accent-green);
    border-bottom: none;
  }
  
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
  
  .articles-grid { 
    grid-template-columns: 1fr;
  }
  
  .article-card:first-child {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .article-card:first-child .card-img {
    order: 1;
    height: 280px;
  }
  
  .article-card:first-child .card-body {
    order: 2;
  }
  
  .article-card:first-child h3 {
    font-size: 24px;
  }
  
  .article-page h1 { font-size: 28px; }
  .article-content { font-size: 16px; }
  .category-tabs { 
    gap: 8px;
    padding: 20px 24px 32px;
  }
}
