{% load static %}
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>{{ title|default:"Sites · Card" }}</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  {% if main_preview_url %}
  <meta property="og:image" content="{{ main_preview_url }}">
  {% endif %}
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
  <style>
    body { background:#0b1220; color:#e5e7eb; }
    .card { background:#111827; border-color:#1f2937; }
    .thumb { max-width:100%; border-radius:.5rem; box-shadow:0 0.5rem 1.25rem rgba(0,0,0,.35); }
    .muted { color:#9ca3af; }
    a.btn { text-transform: none; }
  </style>
</head>
<body class="py-4">
  <div class="container">
    <div class="card shadow-lg">
      <div class="card-body">
        <h3 class="mb-1">{{ business }} <span class="muted">@ {{ city }}</span></h3>
        <div class="muted mb-3">Sites · {{ created_at }}</div>

        {% if main_preview_url %}
          <img class="thumb mb-3" src="{{ main_preview_url }}" alt="Sites preview">
        {% endif %}

        <div class="row g-2 mb-3">
          {% if download.main %}<div class="col-auto"><a class="btn btn-outline-light btn-sm" href="{{ download.main }}" target="_blank">Download main PNG</a></div>{% endif %}
          {% if download.demand %}<div class="col-auto"><a class="btn btn-outline-light btn-sm" href="{{ download.demand }}" target="_blank">Download demand PNG</a></div>{% endif %}
          {% if download.competition %}<div class="col-auto"><a class="btn btn-outline-light btn-sm" href="{{ download.competition }}" target="_blank">Download competition PNG</a></div>{% endif %}
        </div>

        <div class="row g-2">
          {% if geojson.isochrones %}<div class="col-auto"><a class="btn btn-secondary btn-sm" href="{{ geojson.isochrones }}" target="_blank">Isochrones GeoJSON</a></div>{% endif %}
          {% if geojson.candidates %}<div class="col-auto"><a class="btn btn-secondary btn-sm" href="{{ geojson.candidates }}" target="_blank">Candidates GeoJSON</a></div>{% endif %}
          {% if geojson.pois_competition %}<div class="col-auto"><a class="btn btn-secondary btn-sm" href="{{ geojson.pois_competition }}" target="_blank">POIs GeoJSON</a></div>{% endif %}
          {% if geojson.popgrid %}<div class="col-auto"><a class="btn btn-secondary btn-sm" href="{{ geojson.popgrid }}" target="_blank">PopGrid GeoJSON</a></div>{% endif %}
        </div>
      </div>
    </div>
  </div>
</body>
</html>
