{% extends "base.html" %}

{% block title %}{{ index.title }}{% endblock %}

{% block extra_css %}
.mag-layout {
  max-width: var(--layout-max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

/* Hero — fullbredde */
.mag-hero {
  padding: 3rem 0;
  text-align: center;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 2rem;
}
.mag-hero__title {
  font-family: var(--font-heading);
  font-size: 3rem;
  line-height: 1.1;
  color: var(--color-primary);
  margin-bottom: 0.75rem;
}
.mag-hero__summary {
  font-size: 1.15rem;
  color: var(--color-muted);
  max-width: 50ch;
  margin: 0 auto;
}
.mag-hero__meta {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}

/* Featured cards */
.mag-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}
.mag-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  transition: box-shadow 0.2s;
}
.mag-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.mag-card__title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}
.mag-card__summary {
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.5;
}
.mag-card__meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-top: 0.75rem;
}

/* Kronologisk strøm */
.mag-stream { border-top: 2px solid var(--color-primary); padding-top: 1.5rem; }
.mag-stream__heading {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 1rem;
}
.mag-stream-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.mag-stream-item__title { font-size: 1rem; }
.mag-stream-item__date { font-size: 0.8rem; color: var(--color-muted); white-space: nowrap; margin-left: 1rem; }

@media (max-width: 768px) {
  .mag-hero__title { font-size: 2rem; }
  .mag-hero { padding: 2rem 0; }
}
{% endblock %}

{% block content %}
<div class="mag-layout">
  {% if index.hero %}
  <div class="mag-hero">
    <h2 class="mag-hero__title"><a href="{{ base_url }}/{{ index.hero.short_id }}">{{ index.hero.title }}</a></h2>
    {% if index.hero.summary %}
    <p class="mag-hero__summary">{{ index.hero.summary }}</p>
    {% endif %}
    <div class="mag-hero__meta">{{ index.hero.published_at_short }}</div>
  </div>
  {% endif %}

  {% if index.featured | length > 0 %}
  <div class="mag-cards">
    {% for item in index.featured %}
    <div class="mag-card">
      <h3 class="mag-card__title"><a href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a></h3>
      {% if item.summary %}
      <p class="mag-card__summary">{{ item.summary }}</p>
      {% endif %}
      <div class="mag-card__meta">{{ item.published_at_short }}</div>
    </div>
    {% endfor %}
  </div>
  {% endif %}

  {% if index.stream | length > 0 %}
  <section class="mag-stream">
    <h3 class="mag-stream__heading">Alle artikler</h3>
    {% for item in index.stream %}
    <div class="mag-stream-item">
      <a class="mag-stream-item__title" href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a>
      <span class="mag-stream-item__date">{{ item.published_at_short }}</span>
    </div>
    {% endfor %}
  </section>
  {% endif %}
</div>
{% endblock %}
