/* The districts' page (src/map/districts-page.mjs), loaded on that page
   alone, after the site's stylesheet, whose colours and type it builds on. */

/* A column of text, sized for reading, the map as wide as it. */
.districts {
  max-width: 68ch;
  margin: 0 auto;
  padding-block: 24px 8px;
  overflow-wrap: break-word;
}

.districts h1 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 1.75rem;
}

.districts h2 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.15rem;
}

/* A part of the page stands above the districts it holds: its title is the
   larger. */
.districts-rest > section:not(.district) > h2 {
  font-size: 1.4rem;
}

.districts p,
.districts li {
  line-height: 1.55;
}

/* Links in the text take its colour; a link styled as its own, such as the
   way back to the top or a district's way to the map, keeps its own. */
:where(.districts) a {
  color: inherit;
}

.districts-intro {
  font-size: 1.05rem;
}

/* On a wide screen the contents stay in view beside the page, as in an
   article; the site's styles keep them there and hide the way to the top. */
@media (min-width: 1100px) {
  main:has(.districts) {
    max-width: 1060px;
  }

  .districts {
    display: grid;
    grid-template-columns: minmax(0, 68ch) 260px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "top contents"
      "rest contents";
    column-gap: 56px;
    max-width: none;
  }

  .districts-top {
    grid-area: top;
  }

  .districts-rest {
    grid-area: rest;
  }
}

/* The map: square on a phone, wider than high on a computer. */
.districts-map {
  aspect-ratio: 1;
  margin: 16px 0 12px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--line);
}

@media (min-width: 700px) {
  .districts-map {
    aspect-ratio: 4 / 3;
  }
}

/* Opened over the whole window by its button. */
.districts-map.is-full {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  aspect-ratio: auto;
  border-radius: 0;
}

/* How the city is divided, between the map and the districts. */
.districts-division {
  margin: 0 0 24px;
}

.districts-division ul {
  margin: 0 0 8px;
  padding-inline-start: 20px;
}

/* How the division changed, closing the page after the districts. */
.districts-history {
  margin: 0 0 24px;
}

/* An old plan of the city, its whole on the page it came from. */
.districts-plan {
  margin: 20px 0;
}

.districts-plan img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--line);
}

.districts-plan figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

/* The quarters people name and the historic part, each on a map of its own. */
.districts-quarters,
.districts-historic {
  margin: 0 0 24px;
}

/* The site's pages a map's part leads to, under the map. */
.districts-part-links {
  margin: 0 0 4px;
}

.districts-part-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* The districts' part: its title, and the districts by name, leading to
   what each is. */
.districts-index {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.districts-list ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.districts-list a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  text-decoration: none;
}

.districts-list a:hover {
  border-color: var(--gold-soft);
}

.district {
  margin: 0 0 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 16px;
}

.district h2:focus {
  outline: none;
}

/* Under the name, what a visitor wants at a glance: where it is, what is
   there, the metro. */
.district-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}

/* The teaser, what draws a visitor in: set apart from the text after it by
   a line beside it, not by weight, so it does not outshout the name. */
.district-teaser {
  margin-inline: 0;
  padding-inline-start: 14px;
  border-inline-start: 3px solid var(--gold-soft);
  color: var(--navy);
  font-size: 1.0625rem;
}

/* A district's story, folded under what it is at a glance. */
.district-more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--gold-text);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.district-more summary::-webkit-details-marker {
  display: none;
}

/* It opens in place, so it shows which way it turns, as the sources do. */
.district-more summary::before {
  content: "▸";
}

.district-more[open] > summary::before {
  content: "▾";
}

/* Where text runs from the right, a closed fold points the way it runs. */
[dir="rtl"] .district-more:not([open]) > summary::before,
[dir="rtl"] .district-sources:not([open]) > summary::before {
  content: "◂";
}

.district-more[open] summary {
  margin-bottom: 4px;
}

/* The ubani a district is divided into, the quarters that lie in it, and
   the site's places in it with videos. */
.district-ubani-title,
.district-quarters-title,
.district-places-title {
  margin: 16px 0 4px;
  color: var(--navy);
  font-size: 1rem;
}

.district-ubani {
  margin: 0 0 8px;
  padding-inline-start: 20px;
}

/* The quarters in a district, as small pills in a row that wraps, each
   leading to the quarters' map. */
.district-quarters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

/* The places, as cards in a row that scrolls, as home shows them. */
.district-places {
  display: flex;
  gap: 12px;
  margin: 0 0 8px;
  padding: 0 0 4px;
  overflow-x: auto;
  list-style: none;
}

.district-places li {
  flex: 0 0 150px;
}

/* Each quarter leads to the quarters' map; room enough for a finger. */
.district-quarters .district-quarter {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.9rem;
  text-decoration: none;
}

.district-quarters .district-quarter:hover {
  border-color: var(--gold-soft);
}

.district-on-map {
  display: inline-block;
  padding-block: 8px;
  color: var(--gold-text);
  font-weight: 600;
}

.district-sources {
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.district-sources summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-height: 44px;
  padding-block: 8px;
  cursor: pointer;
  list-style: none;
}

.district-sources summary::-webkit-details-marker {
  display: none;
}

.district-sources summary::before {
  content: "▸";
}

.district-sources[open] > summary::before {
  content: "▾";
}

.district-sources ul {
  margin: 4px 0 0;
  padding-inline-start: 20px;
}

.district-sources li + li {
  margin-top: 4px;
}

/* What a quarter pressed on its map shows: its name, and its page's link. */
.quarter-popup {
  display: grid;
  gap: 4px;
  color: var(--navy);
}

.quarter-popup a {
  color: var(--gold-text);
  font-weight: 600;
}
