/* The page to read before the trip (src/pages/checklist.mjs), loaded on that page
   alone, after the site's stylesheet, whose colours and type it builds on. */

/* The page to read before the trip opens on a step per section: a picture,
   its title and one line, leading down to the section. */
.checklist-intro {
  font-size: 1.05rem;
}

.checklist-steps {
  margin: 20px 0 8px;
  scroll-margin-top: 16px;
}

.checklist-steps h2 {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.checklist-steps ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist-steps li + li {
  margin: 0;
}

/* A last card left alone in its row takes the whole row. */
.checklist-steps li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.checklist-steps a {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  line-height: 1.35;
}

.checklist-steps a:hover {
  border-color: var(--gold-soft);
}

.checklist-steps a:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 2px;
}

.checklist-steps strong {
  display: block;
  margin-bottom: 2px;
  color: var(--navy);
}

.checklist-steps span span {
  color: var(--muted);
  font-size: 0.9rem;
}

.checklist-icon {
  flex: none;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* A section: its heading with its picture, the text, then what is folded
   away: the details, and the sources with the day they hold as of. */
/* The site's sections draw a line above them; here the cards, the
   warning's frame and the space between say where one ends. */
.checklist-section {
  margin-top: 36px;
  padding-top: 0;
  border-top: 0;
  scroll-margin-top: 16px;
}

.checklist-section time {
  white-space: nowrap;
}

/* One button in the corner leads back up to the steps. It fades in as the
   page scrolls past them, where the browser can tie that to the scroll;
   elsewhere it simply stays. */
.checklist .checklist-top {
  position: fixed;
  inset-inline-end: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgb(37 44 53 / 12%);
  color: var(--gold-text);
}

.checklist .checklist-top:hover {
  border-color: var(--gold-soft);
}

.checklist .checklist-top:focus-visible {
  outline: 2px solid var(--gold-text);
  outline-offset: 2px;
}

.checklist-top svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Room under the footer, so the button covers none of its links. */
body:has(.checklist-top) footer {
  padding-bottom: 76px;
}

/* On a wide screen the steps stand beside the sections and stay in view
   as they scroll, as an article's contents do; the corner button is then
   not needed. */
@media (min-width: 1100px) {
  main:has(.checklist) {
    max-width: 1060px;
  }

  .checklist {
    display: grid;
    grid-template-columns: minmax(0, 68ch) 260px;
    column-gap: 56px;
    align-items: start;
    max-width: none;
  }

  .checklist > * {
    grid-column: 1;
  }

  .checklist > .checklist-steps {
    grid-column: 2;
    grid-row: 1 / span 20;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: 0;
  }

  .checklist-steps ol {
    grid-template-columns: 1fr;
  }

  .checklist-steps li:last-child:nth-child(odd) {
    grid-column: auto;
  }

  .checklist .checklist-top {
    display: none;
  }

  body:has(.checklist-top) footer {
    padding-bottom: 0;
  }
}

@supports (animation-timeline: scroll()) {
  .checklist .checklist-top {
    animation: checklist-top-in linear both;
    animation-timeline: scroll();
    animation-range: 0 480px;
  }
}

@keyframes checklist-top-in {
  0%,
  60% {
    opacity: 0;
    visibility: hidden;
  }

  100% {
    opacity: 1;
    visibility: visible;
  }
}

.checklist-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 1.3rem;
}

.checklist-steps .checklist-warning a {
  border-color: var(--gold-soft);
  background: #fdf3e4;
}

.checklist-section.checklist-warning {
  padding: 16px 18px 12px;
  border: 1px solid var(--gold-soft);
  border-inline-start-width: 4px;
  border-radius: 12px;
  background: #fdf3e4;
}

/* Figures read at a glance: a tile per allowance, two to a row, and a
   last one left alone takes the row. */
.checklist ul.checklist-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.checklist ul.checklist-tiles li {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.checklist-tiles li:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-content: start;
}

/* Across the row, its picture stands beside it. */
.checklist-tiles li:last-child:nth-child(odd) > * {
  grid-column: 2;
}

.checklist-tiles li:last-child:nth-child(odd) > .checklist-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0;
}

.checklist-tiles .checklist-icon {
  display: block;
  margin-bottom: 6px;
}

.checklist-tile-value {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.3;
}

/* A rule the reader must not miss, set apart with its picture. */
.checklist .checklist-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--gold-soft);
  border-inline-start-width: 4px;
  border-radius: 12px;
  background: #fdf3e4;
}

.checklist-line {
  display: block;
}

.checklist-line ~ .checklist-line {
  margin-top: 6px;
}

.checklist-pause {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The questions the page settles, each a line that opens on its answer. */
.checklist-faq {
  margin-top: 40px;
}

.checklist-question {
  border-top: 1px solid var(--line);
}

.checklist-question:last-of-type {
  border-bottom: 1px solid var(--line);
}

.checklist-question summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 44px;
  padding-block: 12px;
  color: var(--navy);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.checklist-question summary::-webkit-details-marker {
  display: none;
}

.checklist-question summary::before {
  content: "▸";
  color: var(--gold-text);
}

.checklist-question[open] > summary::before {
  content: "▾";
}

.checklist-question p {
  margin: 0 0 14px;
  padding-inline-start: 18px;
}

.checklist-more,
.checklist-sources {
  margin: 4px 0;
}

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

.checklist-more summary::-webkit-details-marker,
.checklist-sources summary::-webkit-details-marker {
  display: none;
}

.checklist-more summary::before,
.checklist-sources summary::before {
  content: "▸";
}

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

.checklist-more summary {
  color: var(--gold-text);
  font-weight: 600;
}

/* What opens under "more" is set off from the text that was already there. */
.checklist-more-text {
  margin-inline-start: 4px;
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--gold-soft);
}

.checklist-more-text > :first-child {
  margin-top: 0;
}

.checklist-more-text > :last-child {
  margin-bottom: 0;
}

.checklist-sources {
  color: var(--muted);
  font-size: 0.85rem;
}

.checklist-sources ul {
  margin: 4px 0 0;
}

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