{% extends "base.html" %}

{% block title %}{{ article.title }} — {{ collection_title }}{% endblock %}

{% block seo %}
  <meta name="description" content="{{ seo.description }}">
  <link rel="canonical" href="{{ seo.canonical_url }}">
  <meta property="og:type" content="article">
  <meta property="og:title" content="{{ seo.og_title }}">
  <meta property="og:description" content="{{ seo.description }}">
  <meta property="og:url" content="{{ seo.canonical_url }}">
  <meta property="og:site_name" content="{{ collection_title }}">
  {% if seo.og_image %}<meta property="og:image" content="{{ seo.og_image }}">{% endif %}
  <meta property="article:published_time" content="{{ article.published_at }}">
  <link rel="alternate" type="application/atom+xml" title="{{ collection_title }} — RSS" href="{{ base_url }}/feed.xml">
  <script type="application/ld+json">{{ seo.json_ld | safe }}</script>
{% endblock %}

{% block extra_css %}
.article {
  max-width: var(--layout-max-width);
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
}
.article__main { min-width: 0; }
.article__sidebar {
  border-left: 2px solid var(--color-accent);
  padding-left: 1.5rem;
}
.article__title {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  color: var(--color-primary);
}
.article__meta {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-muted);
}
.article__content {
  font-size: 1.05rem;
  line-height: 1.75;
}
.article__content p { margin-bottom: 1em; }
.article__back {
  display: inline-block;
  margin-top: 2rem;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .article { grid-template-columns: 1fr; }
  .article__sidebar {
    border-left: none;
    border-top: 2px solid var(--color-accent);
    padding-left: 0;
    padding-top: 1.5rem;
  }
}
{% endblock %}

{% block content %}
<article class="article">
  <div class="article__main">
    {% if article.og_image %}<img src="/cas/{{ article.og_image }}" alt="{{ article.title }}" style="width:100%;max-height:400px;object-fit:cover;margin-bottom:1.5rem;">{% endif %}
    <h1 class="article__title">{{ article.title }}</h1>
    {% if article.subtitle %}<p style="font-size:1.15rem;color:var(--color-muted);margin-bottom:0.5rem;font-family:var(--font-heading);">{{ article.subtitle }}</p>{% endif %}
    <div class="article__meta">Publisert {{ article.published_at_short }}</div>
    <div class="article__content">{{ article.content | safe }}</div>
    <a class="article__back" href="{{ base_url }}">&larr; Tilbake til forsiden</a>
  </div>
  <aside class="article__sidebar">
  </aside>
</article>
{% endblock %}
