{% extends "base.html" %}

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

{% block extra_css %}
.blog-layout {
  max-width: var(--layout-max-width);
  margin: 2rem auto;
  padding: 0 1rem;
}
.blog-list { list-style: none; }
.blog-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.blog-item:first-child { padding-top: 0; }
.blog-item__title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}
.blog-item__meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 0.5rem;
}
.blog-item__summary {
  font-size: 0.95rem;
  color: var(--color-text);
  line-height: 1.5;
}

/* Pinned hero-artikkel */
.blog-pinned {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--color-accent);
}
.blog-pinned__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .blog-item__title { font-size: 1.25rem; }
}
{% endblock %}

{% block content %}
<div class="blog-layout">
  {% if index.hero %}
  <div class="blog-pinned">
    <div class="blog-pinned__label">Fremhevet</div>
    <h2 class="blog-item__title"><a href="{{ base_url }}/{{ index.hero.short_id }}">{{ index.hero.title }}</a></h2>
    {% if index.hero.summary %}
    <p class="blog-item__summary">{{ index.hero.summary }}</p>
    {% endif %}
    <div class="blog-item__meta">{{ index.hero.published_at_short }}</div>
  </div>
  {% endif %}

  {% if index.featured | length > 0 %}
  {% for item in index.featured %}
  <div class="blog-item" style="border-left: 3px solid var(--color-accent); padding-left: 1rem; margin-bottom: 1rem;">
    <h3 class="blog-item__title"><a href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a></h3>
    {% if item.summary %}
    <p class="blog-item__summary">{{ item.summary }}</p>
    {% endif %}
    <div class="blog-item__meta">{{ item.published_at_short }}</div>
  </div>
  {% endfor %}
  {% endif %}

  <ul class="blog-list">
    {% for item in index.stream %}
    <li class="blog-item">
      <h3 class="blog-item__title"><a href="{{ base_url }}/{{ item.short_id }}">{{ item.title }}</a></h3>
      <div class="blog-item__meta">{{ item.published_at_short }}</div>
      {% if item.summary %}
      <p class="blog-item__summary">{{ item.summary }}</p>
      {% endif %}
    </li>
    {% endfor %}
  </ul>
</div>
{% endblock %}
