/*
 * The family parts every page of tothelord.com, tsunamiunleashed.com and
 * tsunamiunleashed.org shares (PUBLISH-SPEC.md, "Family parts"; the rules
 * are ministry-plan FAMILY-DESIGN.md). Kept in tu-distro and copied into the
 * build of each site that sets `family: true`. It gives the parts their
 * shape; the colours are each theme's, through these variables:
 *
 *   --family-bg         page background behind the header and its menu
 *   --family-text       names, links and the Menu button
 *   --family-muted      the reader's own site in the strip; quieter links
 *   --family-border     hairlines
 *   --family-accent     the button, and the outline on what has focus
 *   --family-on-accent  the button's words
 *   --family-width      how wide the header's row runs
 *
 * Nothing here needs a script. No web fonts, no images.
 */

/* A link inside the page must not land under the header. */
html {
  scroll-padding-top: 4.5rem;
}

/* The header stays in view: one row, 56px at most on a phone. */
.family-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  box-sizing: border-box;
  background: var(--family-bg, #fff);
  border-bottom: 1px solid var(--family-border, #d9d9d9);
}

.family-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  max-width: var(--family-width, 68rem);
  min-height: 55px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.family-header a,
.family-menu > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--family-text, #222);
  text-decoration: none;
}

.family-brand {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

/* Desktop: the menu in one row. Phones: the Menu button. */
.family-row {
  display: none;
}

.family-row a {
  margin-left: 1.5rem;
  font-size: 0.9375rem;
}

.family-menu > summary {
  box-sizing: border-box;
  padding: 0 0.875rem;
  border: 1px solid var(--family-muted, #595959);
  border-radius: 6px;
  font-size: 0.9375rem;
  cursor: pointer;
  list-style: none;
  -webkit-user-select: none;
  user-select: none;
}

.family-menu > summary::-webkit-details-marker {
  display: none;
}

.family-menu[open] > summary {
  border-color: var(--family-text, #222);
}

.family-menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  box-sizing: border-box;
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  overflow-y: auto;
  padding: 0.5rem 1.25rem 0.75rem;
  background: var(--family-bg, #fff);
  border-top: 1px solid var(--family-border, #d9d9d9);
  border-bottom: 1px solid var(--family-border, #d9d9d9);
}

.family-menu-panel a,
.family-menu-family span {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-size: 1rem;
}

/* The family strip closes the phone menu. */
.family-menu-family {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--family-border, #d9d9d9);
}

.family-menu-family span,
.family-strip span {
  color: var(--family-muted, #595959);
}

@media (min-width: 48rem) {
  .family-row {
    display: flex;
    align-items: center;
  }

  .family-menu {
    display: none;
  }
}

/* The footer: the family strip, then the safety links. */
.family-strip,
.family-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  line-height: 1.3;
}

.family-strip a,
.family-strip span,
.family-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0.625rem;
}

/* A link is underlined; the site the reader is on is plain text. */
.family-strip a,
.family-foot a {
  color: var(--family-text, #222);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* One next step at the end of a page: one sentence, one button. */
.next-step {
  box-sizing: border-box;
  max-width: 42.5rem;
  margin: 3rem auto 0;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--family-border, #d9d9d9);
  text-align: center;
}

.next-step p {
  margin: 0 0 1rem;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--family-text, #222);
}

.family-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  background: var(--family-accent, #222);
  color: var(--family-on-accent, #fff);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

/* Page not found: one plain sentence and the way home. */
.not-found {
  box-sizing: border-box;
  max-width: 42.5rem;
  margin: 0 auto;
  padding: 5rem 1.25rem;
  text-align: center;
}

.not-found h1 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--family-text, #222);
}

.not-found p {
  margin: 0;
}

/* Whatever has focus shows an outline. */
.family-header a:focus-visible,
.family-menu > summary:focus-visible,
.family-strip a:focus-visible,
.family-foot a:focus-visible,
.family-button:focus-visible {
  outline: 2px solid var(--family-accent, #222);
  outline-offset: 2px;
}

/* Paper: the header, the menu and the strip are left off. */
@media print {
  .family-header,
  .family-strip,
  .family-foot {
    display: none !important;
  }
}
