:root {
  --hero-font-family: Luckiest Guy;
  --header-font-family: Oswald;
  --color-page: #000;
  --color-paper: #fff;
  --color-deselected: #ccc;
  --color-primary: rebeccapurple;
  --color-secondary: #84a;
  --color-tertiary: #a5b;
  --color-accent: #ff0;
  --color-candylike: #f00;
  --color-link: #4f4;
  --color-button-red: #a1282f;
  --color-button-teal: #007d8c;
  --color-button-brown: #856e22;
  --color-button-blue: #46709a;
  --color-button-gray: #6c7477;
  --color-button-white: #f5f7f6;
  --color-button-purple: #59308c;
  --color-button-gravy: #B65C30;
  --color-light-gray: #eaeaea;
  --body-max-width: 67dvh;
  --body-font-size: 2dvh;
  --body-font-color: var(--color-page);
  --body-background-color: var(--color-page);
  --main-background-color: var(--color-paper);
  --header-background-color: var(--color-primary);
  --header-nav-background-color: var(--color-secondary);
  --footer-background-color: var(--color-primary);
  --footer-nav-background-color: var(--color-primary);
  --footer-search-background-color: var(--color-secondary);
  --button-header-nav-link-color: var(--color-link);
  --button-header-nav-active-color: var(--color-accent);
  --button-mahele-link-background-color: var(--color-deselected);
  --button-mahele-active-background-color: var(--color-paper);
  --height-huge: 8dvh;
  --height-big: 8dvh;
  --height-medium: 6dvh;
  --height-small: 5dvh;
  --border-radius-small: 3px;
  --border-radius-large: 5px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
}

html {
  height: 100%;
  font-synthesis: none; /* no fake bold or italic: a font shows only the weights it loaded */
}

/* The header font (settings.presentation.root) needs the macron vowels and the okina. */
h2,
h3,
h4,
dt,
header nav[data-view],
header nav.filter > nav.moku,
#calendar-grid .weekday {
  font-family: var(--header-font-family);
}

/* Every h4 (a listing's name): the rules above that reset the font set these again. */
h4 {
  font-size: 1.2em;
  font-weight: 700;
}

select,
textarea {
  appearance: none; /* drop the native look: arrow, bevel, rounded corners */
  font: inherit; /* otherwise they use the system font and size */
  color: inherit;
  background: transparent; /* or your own background */
  border: 0; /* or your own border */
  border-radius: 0; /* iOS rounds them */
  margin-bottom: 1dvh;
  padding: 0;
  outline-offset: 0; /* keep the focus outline; don't remove it */
}

body {
  --mahele-size: calc(
    var(--height-small) - 1dvh
  ); /* 0.5dvh of room above and below */
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: var(--body-max-width);
  margin: 0 auto;
  touch-action: manipulation;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  font-size: var(--body-font-size);
  color: var(--body-font-color);

  header {
    div.title {
      display: flex;
      align-items: center;
      justify-content: center;
      height: var(--height-big);
    }

    /* The hero picture, left of the title: a bit taller than the letters, and centered in the
       bar like them. It goes home when tapped, as the title does. */
    img.hero {
      flex: none;
      height: 2.4em;
      max-height: 90%;
      width: auto;
      margin-right: 0.4em;
      cursor: pointer;
    }

    /* Luckiest Guy has capitals only, and the page loads just the letters of the
       title (see the head's font link), so the title is set in capitals. */
    h1 {
      font-family: var(--hero-font-family);
      /* The capitals of Luckiest Guy sit a little above the middle of its line, so the
         line is nudged down for the letters to look centered in the bar. */
      position: relative;
      top: 0.07em;
      text-transform: uppercase;
      color: var(--color-paper);
      font-size: 2em;
      padding: 0;
      cursor: pointer;
    }

    nav button {
      padding: 0.25em 0.5em;
      color: var(--color-paper);
      text-transform: uppercase;
    }

    /* The moku and article buttons are a little larger than the rest. */
    nav.filter > nav.moku button,
    nav[data-view]:not(.calendar-header) button {
      font-size: 1.1em;
    }

    /* The article navs; each shows on its own view. */
    nav[data-view] {
      display: none;
      align-items: center;
      height: var(--height-medium);
    }

    /* The filter shows on the views that show the search box. Its one nav holds
       every mahele button; only the selected moku's show, by body's data-moku. */
    nav.filter {
      display: none;
      flex-direction: column;

      > nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
      }

      > nav.moku {
        align-items: center;
        gap: 0 1em;
        height: var(--height-medium);

        button {
          display: flex;
          align-items: center;
          padding: 0;
        }
      }

      > nav:not(.moku) {
        align-items: center;
        gap: calc(var(--mahele-size) / 2); /* half a button's width */
        height: var(--height-small);
        background-color: var(--color-tertiary);
      }
    }
  }

  /* Hidden things use visibility, not display, so they keep their scroll
     positions. Sections and articles are stacked so hidden ones take no room. */
  main {
    flex: 1;
    position: relative;
    z-index: 0; /* keeps the map's high z-indexes inside the map pane */

    section {
      position: absolute;
      inset: 0;
      visibility: hidden;

      > div,
      > ul,
      > article {
        position: absolute;
        inset: 0;
        overflow-y: auto;
        padding: 0.5em;
        visibility: hidden;
      }

      > div,
      > ul {
        visibility: inherit;
      }

      /* The calendar's container has no padding; its DDs carry it instead, so the
         group headings can reach the edges. */
      &[data-view="calendar"] > div {
        padding: 0;
      }

      > ul {
        list-style: none;

        li {
          padding: 0.25em 0.5em;
          background-color: var(--color-light-gray);
          margin-bottom: 0.5em;
          border-radius: var(--border-radius-large);
        }

        h4 {
          font: inherit;
          font-family: var(--header-font-family);
          font-size: 1.2em;
          font-weight: 700;
        }
      }

      > article form#homeContact {
        textarea,
        select {
          display: block;
          width: 100%;
          border: 2px solid #000;
          border-radius: var(--border-radius-large);
          padding: 0.5dvh;
        }
        textarea {
          min-height: 5em;
        }

        /* A black down arrow at the select's right end; the padding keeps the text clear of it. */
        select {
          padding-right: 2em;
          background-image: url("assets/ui/nav/down_black.svg?v=203c9ce270");
          background-repeat: no-repeat;
          background-position: right 0.4em center;
          background-size: 1.2em;
        }
      }

      > article p {
        margin-bottom: 1dvh;
        &:last-child {
          margin-bottom: none;
        }
      }
      /* A story's youtube button: the video's thumbnail, with a play button centered over
         it. The thumbnail is 16:9 and cropped to fit (YouTube's own is letterboxed). The
         play button is 3em wide and 2em high, deselected until the thumbnail is hovered.
         The image and the play button let a tap through to the button, which is what
         carries the action. */
      > article button[data-act="youtube"] {
        position: relative;
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;

        img {
          display: block;
          width: 100%;
          height: 100%;
          object-fit: cover;
          pointer-events: none;
        }

        .youtube-play-btn {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          display: flex;
          align-items: center;
          justify-content: center;
          width: 3em;
          height: 2em;
          border-radius: 0.5em;
          background-color: var(--color-deselected);
          color: var(--color-paper);
          pointer-events: none;
        }

        /* The title, if the button has one: along the bottom, on a stripe of the page
           color at half strength (the color is mixed, not the element faded, so the
           words stay solid). */
        .youtube-title {
          position: absolute;
          left: 0;
          right: 0;
          bottom: 0;
          height: 2em;
          line-height: 2em;
          padding: 0 0.5em;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          text-align: left;
          font-size: 1em;
          color: var(--color-paper);
          background-color: color-mix(
            in srgb,
            var(--color-page) 50%,
            transparent
          );
          pointer-events: none;
        }

        .youtube-play-btn::before {
          content: "►";
        }

        &:hover .youtube-play-btn {
          background-color: var(--color-candylike);
        }
      }

      /* The video that replaces a youtube button when it is tapped. */
      > article iframe.videoplayer {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        border: 0;
      }

      /* wide buttons in articles */

      > article button.wide {
        font-family: var(--header-font-family);
        font-size: 1.2em;
        font-weight: 400;
        text-transform: uppercase;
        display: block;
        text-align: center;
        width: 100%;
        padding: 0.5em 0;
        border-radius: var(--border-radius-large);
        color: #fff;
        margin: 1dvh 0;
        &.red {
          background-color: var(--color-button-red);
        }

        &.teal {
          background-color: var(--color-button-teal);
        }

        &.brown {
          background-color: var(--color-button-brown);
        }

        &.blue {
          background-color: var(--color-button-blue);
        }

        &.gray {
          background-color: var(--color-button-gray);
        }

        &.white {
          background-color: var(--color-button-white);
        }

        &.purple {
          background-color: var(--color-button-purple);
        }

        &.gravy {
          background-color: var(--color-button-gravy);
        }
      }

      /* The map fills its section. position is set here, with the id, because a
         map library's own class (MapLibre's is position: relative) would
         otherwise win and collapse it to nothing. */
      > div#map {
        position: absolute;
        inset: 0;
        padding: 0;
        overflow: hidden;

        /* The map's canvas is a whole number of pixels, and the section can be a
           fraction of one taller (heights are in dvh), so a hairline of what is
           behind it shows along the edge. Make that the search box's color, not main's. */
        background-color: var(--footer-search-background-color);

        /* MapLibre gives its map its own font, which everything inside, a pop-up's
           listings included, would inherit. Listings take theirs from the body, so
           the map takes the body's too, and the controls keep MapLibre's. */
        font: inherit;

        /* MapLibre sets visibility: visible on its credit line, so it would stay
           on screen after the section is hidden. Controls follow the section. */
        .maplibregl-ctrl {
          visibility: inherit;
          font:
            12px/20px "Helvetica Neue",
            Arial,
            Helvetica,
            sans-serif;
        }
      }
    }
  }

  footer {
    /* The search box and its hints show only on views that turn them on. */
    search {
      display: none;

      /* One row, never taller: hints that don't fit scroll sideways. A finger drags
         it natively; the mouse drags it by script (see the hints' pointer handlers). */
      nav.hints {
        display: none;
        position: relative;
        flex-wrap: nowrap;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        touch-action: pan-x;
        cursor: grab;
        user-select: none;
        /* The last 2em fade out, a clue that more hints are out there. */
        mask-image: linear-gradient(
          to right,
          black calc(100% - 2em),
          transparent
        );
        height: var(--height-small);
        background-color: var(--color-tertiary);
        font-family: var(--header-font-family);
        font-weight: 400;
        color: var(--color-paper);
        padding-left: 0.25em; /* with the first button's own 0.25em, the 0.5em it had */

        span {
          padding: 0.25em 0.5em;
        }

        /* The "nothing found" message, one line. Its links are accent; the hints stay paper. */
        .nada {
          flex: none;
          white-space: nowrap;
          padding-left: 0.25em; /* the same 0.5em in all, with the nav's */

          > span {
            padding-left: 0;
            padding-right: 0;
          }

          /* The sentence, then the mahele buttons, side by side, nothing between them. */
          > span.buttons {
            display: flex;
            align-items: center;
            gap: calc(var(--mahele-size) / 4);
          }

          button {
            color: var(--color-accent);
          }
        }

        /* The map's own message: results exist, but none has a marker. */
        .nomap {
          flex: none;
          white-space: nowrap;
          padding-left: 0.25em;

          /* The word "search" is a link to the search view. */
          button {
            display: inline;
            padding: 0;
            color: var(--color-accent);
          }
        }

        .nada[hidden],
        .nomap[hidden] {
          display: none;
        }

        /* Moku names in the message look like inline text of the sentence. */
        .nada button[data-act="moku"] {
          display: inline;
          margin: 0;
          padding: 0;
        }

        button {
          flex: none;
          padding: 0.25em;
          color: var(--color-paper);
          white-space: nowrap;
        }

        &::-webkit-scrollbar {
          display: none;
        }
      }

      /* The padding lets the search's background show around
         the box; the box takes whatever height is left of --height-medium. */
      .query {
        position: relative;
        height: var(--height-medium);
        padding: 0.5em;

        input {
          display: block;
          width: 100%;
          height: 100%;
          padding: 0 2em 0 0.5em;
          border: 0;
          outline: 0;
          font: inherit;
          font-family: var(--header-font-family);
          color: var(--body-font-color);
          background-color: var(--main-background-color);
          cursor: text;
        }

        /* Sits over the right end of the box, so it looks like it is inside. */
        button {
          display: none;
          position: absolute;
          top: 0.5em;
          right: 0.5em;
          bottom: 0.5em;
          width: 2em;
          align-items: center;
          justify-content: center;
          background-color: transparent;
          background-image: url("assets/ui/nav/close_black.svg?v=a0723f91fd");
          background-repeat: no-repeat;
          background-position: center;
          background-size: 100%;
        }
      }

      /* Set on <search> while the box has text in it. */
      &.has-query {
        nav.hints {
          display: flex;
        }

        .query button {
          display: flex;
        }
      }
    }

    nav.views {
      display: flex;
      justify-content: center;
      align-items: center;
      height: var(--height-huge);
      gap: 2dvh;
      --icon-size: calc(var(--height-huge) - 3dvh);

      button {
        width: var(--icon-size);
        height: var(--icon-size);
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
      }

      button[data-view="home"] {
        background-image: url("assets/ui/main/home.svg?v=38d765980b");
      }

      button[data-view="map"] {
        background-image: url("assets/ui/main/map.svg?v=ad4b9b86d9");
      }

      button[data-view="search"] {
        background-image: url("assets/ui/main/search.svg?v=6046a7ca67");
      }

      button[data-view="calendar"] {
        background-image: url("assets/ui/main/calendar.svg?v=9a8e30a745");
      }

      button[data-view="news"] {
        background-image: url("assets/ui/main/news.svg?v=73f2304c2e");
      }
    }
  }
}

/* The map's location button: a square, in the pop-up's border, with a picture for each state. */
.map-locate {
  border: 2px solid var(--color-page);
  border-radius: var(--border-radius-small);
  background-color: var(--color-paper);

  button {
    display: block;
    width: 3em;
    height: 3em;
    background-repeat: no-repeat;
    background-position: center;
    /* The picture's drawing fills about two thirds of its box, so the box is half again an
       emoji's (the mahele buttons'), to make the drawing the size of an emoji. */
    background-size: --body-font-size;
  }

  button[data-state="off"] {
    background-image: url("assets/ui/nav/loc_off_black.svg?v=92cb8264ec");
  }

  button[data-state="on"] {
    background-image: url("assets/ui/nav/loc_on_black.svg?v=27eeaccb04");
  }

  button[data-state="nope"] {
    background-image: url("assets/ui/nav/loc_denied_black.svg?v=4e211c5ad6");
  }
}

/* The map's legend: a button, and above it, when open, the markers of the selected moku
   with the names of its mahele, in the pop-up's border. */
.map-legend {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border: 2px solid var(--color-page); /* the pop-up's */
  border-radius: var(--border-radius-small);
  background-color: var(--color-paper);
  color: var(--body-font-color);

  button {
    padding: 0.25em 0.5em;
  }

  ul {
    list-style: none;
    padding: 0.25em 0.5em;
    border-bottom: 1px solid var(--color-deselected);
  }

  ul[hidden] {
    display: none;
  }

  li {
    display: flex;
    align-items: center;
    gap: 0.5em;
    padding: 0.125em 0;
    white-space: nowrap;
  }

  img {
    flex: none;
  }
}

/* The pop-up has no fang; it sits under its marker, which is drawn over it at 1.5x
   (see openPopup), with a 2px border. */
.maplibregl-popup {
  z-index: 1;
}
.maplibregl-marker {
  z-index: 2;
  pointer-events: none;
}
.maplibregl-popup-tip {
  display: none;
}
.maplibregl-popup-content {
  border: 2px solid var(--color-page);
  padding: 0 10px;
}
.maplibregl-popup-content .listings {
  overflow-y: auto;

  .listing {
    padding: 0.25em 0 0.5em;
  }

  h4 {
    margin: 0;
    font: inherit;
    font-family: var(--header-font-family);
    font-size: 1.2em;
    font-weight: 700;
  }

  /* A pop-up is as wide as its widest line, so a long note on one line would make it
     wider than the map has room for; the note wraps instead. */
  p.note {
    max-width: 22em;
    overflow-wrap: anywhere;
  }

  /* A long note scrolls, but the chiclets stay put at the bottom of the pop-up. */
  nav.chiclets {
    position: sticky;
    bottom: 0;
    margin: 0;
    padding: 0.25em 0;
    background-color: #fff;
  }
}

/* A listing's chiclets: square buttons, each with its picture. */
nav.chiclets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  margin: 0.25em 0;

  button,
  a {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 1.75em;
    height: 1.75em;
    border: 0;
    border-radius: var(--border-radius-large);
    background-color: var(--color-primary);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.5em;
    font: inherit;
    color: inherit;
    text-decoration: none;
    cursor: default;
  }

  a {
    cursor: pointer;
  }
}

nav.chiclets button[data-icon="directions"] {
  background-image: url("assets/ui/chiclet/directions.svg?v=52b3b55227");
}

nav.chiclets button[data-icon="calendar_add"] {
  background-image: url("assets/ui/chiclet/calendar_add.svg?v=caf054463e");
}

nav.chiclets button[data-icon="map"] {
  background-image: url("assets/ui/chiclet/map.svg?v=adaeb832d7");
}

nav.chiclets button[data-icon="calendar"] {
  background-image: url("assets/ui/chiclet/calendar.svg?v=1c9509d205");
}

nav.chiclets button[data-icon="goog"] {
  background-image: url("assets/ui/chiclet/goog.svg?v=41fa58ce3a");
}

nav.chiclets button[data-icon="insta"] {
  background-image: url("assets/ui/chiclet/insta.svg?v=1c0fde1bdd");
}

nav.chiclets button[data-icon="web"] {
  background-image: url("assets/ui/chiclet/web.svg?v=1007568618");
}

nav.chiclets button[data-icon="venmo"] {
  background-image: url("assets/ui/chiclet/venmo.svg?v=4e49141456");
}

nav.chiclets button[data-icon="phone"] {
  background-image: url("assets/ui/chiclet/phone.svg?v=9e23f92633");
}

/* A listing's name opens its close-up. */
h4[data-act="closeup"] {
  cursor: pointer;
}

/* A mahele button, in the filter and in the "nothing found" message: round, a black
   border for selected (see the mahele rules) and a gray one for deselected. */
header nav.filter > nav:not(.moku) button,
nav.hints .nada button[data-act="mahele"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--mahele-size);
  height: var(--mahele-size);
  padding: 0;
  border: 1px solid var(--color-deselected);
  border-radius: 50%;
  background-color: var(--color-paper);
}

/* In the filter, a deselected button is washed out: its emoji goes gray, and a see-
   through white veil, over the emoji only, fades it. The circle itself stays white. */
header nav.filter > nav:not(.moku) button {
  position: relative;
  filter: grayscale(1);

  &::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background-color: rgb(255 255 255 / 0.6);
    pointer-events: none;
  }
}

/* A pili's text, in the hints and in the close-up, is in capitals. */
button[data-act="hint"] {
  text-transform: uppercase;
}

/* A listing's pili: tag buttons that fill the search box. */
nav.pili {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
  margin: 0.25em 0;

  /* Dressed like the hints under the search box. */
  button {
    padding: 0.25em;
    background-color: var(--color-tertiary);
    color: var(--color-paper);
    font: inherit;
    font-family: var(--header-font-family);
    font-weight: 400;
    white-space: nowrap;
    cursor: pointer;
  }
}

/* A listing's manawa, a paragraph under its H4, wherever the listing is. */
p.manawa {
  margin: 0;
}

/* A listing's note. */
p.note {
  font-size: 0.9em;
}

/* The calendar: its header steps and its grid of days. */
header nav.calendar-header {
  font-size: 1.1em;
  align-items: center;
  justify-content: space-between;

  .date {
    flex: 1;
    text-align: center;
    color: var(--color-paper);
    text-transform: uppercase;
  }

  /* The step buttons are squares with an arrow picture, on no background of their own. */
  .prev-day,
  .next-day {
    width: var(--height-medium);
    height: var(--height-medium);
    padding: 0;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1.1em;
  }

  .prev-day {
    background-image: url("assets/ui/nav/back_white.svg?v=49661e0812");
  }

  .next-day {
    background-image: url("assets/ui/nav/forward_white.svg?v=1c3780c9ee");
  }

  button:disabled {
    opacity: 0.35;
    cursor: default;
  }
}

#calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background-color: var(--header-nav-background-color);
  color: var(--color-paper);
  font-family: var(--header-font-family);

  .weekday {
    padding: 0.25em 0;
    text-align: center;
    font-size: 0.8em;
    font-weight: 400;
    text-transform: uppercase;
  }

  button {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--height-small);
    border: 2px solid transparent;
    cursor: pointer;

    /* Days from the neighboring months that fill out the rows look like the rest. */
    &:disabled {
      opacity: 0.35;
      cursor: default;
    }

    &.today {
      border-color: var(--color-paper);
    }

    /* Reversed out: the text color becomes the background, and the other way round. */
    &.focused {
      border-color: var(--color-paper);
      background-color: var(--color-paper);
      color: var(--header-nav-background-color);
    }
  }
}

/* The events of the focused day, under the grid; and a close-up's hours, appearances and
   guests, under the listing. Both are a DL with a sticky heading for each part. */
#calendar-day,
#closeup-sections {
  margin-top: 0;

  dt {
    /* Sticky: as the list scrolls, the heading of the group at the top stays there. */
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--height-small);
    margin-top: 0.75em;
    background-color: var(--color-tertiary);

    &:first-of-type {
      margin-top: 0;
    }

    color: var(--color-paper);

    h3 {
      flex: 1;
      margin: 0;
      padding: 0.25em 0.5em;
      font-size: 1em;
      font-weight: 400;
      text-transform: uppercase;
    }

    /* The up-arrow at the right end: out of sight (and out of reach) until this
       heading is the one stuck at the top. */
    button {
      visibility: hidden;
      width: var(--height-small);
      height: var(--height-small);
      padding: 0;
      background-color: transparent;
      background-image: url("assets/ui/nav/top_white.svg?v=14714fbf23");
      background-repeat: no-repeat;
      background-position: center;
      background-size: 1.5em;
    }

    /* Not "visible": that would show it when the calendar itself is hidden (a hidden
       section's children inherit hidden, unless one says visible). */
    &.stuck button {
      visibility: inherit;
    }
  }

  dd {
    margin: 0;
    padding: 0.5em;
  }

  ul {
    list-style: none;
  }

  li {
    padding: 0.25em 0;

    h4 {
      font: inherit;
      font-family: var(--header-font-family);
      font-size: 1.2em;
      font-weight: 700;
    }
  }
}

/* The close-up's Close button: a square X at the top right of the box, with the
   search box's close picture. It scrolls away with the listing, so it
   never covers the up-arrow in a stuck heading; the name leaves room for it. */
section[data-view="closeup"] > div {
  > button[data-act="closeCloseup"] {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    width: 2em;
    height: 2em;
    padding: 0;
    border: 0;
    background-color: transparent;
    background-image: url("assets/ui/nav/close_black.svg?v=a0723f91fd");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
  }

  /* Opened from another close-up: Back instead. */
  > button[data-act="closeCloseup"].back {
    background-image: url("assets/ui/nav/back_black.svg?v=319e119e59");
  }

  > h4 {
    padding-right: 2.5em;
  }
}

/* The close-up's box has half an em of padding, so the headings reach out over it to
   run the full width, as the calendar's do. */
#closeup-sections {
  margin: 0.75em -0.5em 0;

  /* A heading sticks at the edge inside the box's padding, so it reaches out over it to
     stick flush with the top (and to be seen as stuck, see markStuck). */
  dt {
    top: -0.5em;
  }
}

/* A close-up's Appearances and Guests are listed as the main list is: each listing on its own
   rounded, shaded card. (The last card needs no room under it, the DD has its own padding.) */
#closeup-sections li {
  margin-bottom: 0.5em;
  padding: 0.25em 0.5em;
  border-radius: var(--border-radius-large);
  background-color: var(--color-light-gray);

  &:last-child {
    margin-bottom: 0;
  }
}

/* A link in a story that does something on the page (data-act) has no href, so it is
   dressed as the browser's own links. */
a[data-act] {
  color: LinkText;
  text-decoration: underline;
  cursor: pointer;
}

/* The hours: a table with the map pop-up's border (2px, rounded 3px at the corners only),
   the same weight inside, all in the header font and never bold. */
#closeup-sections table.hours {
  width: 100%;
  border: 2px solid var(--color-page);
  border-radius: var(--border-radius-small);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-family: var(--header-font-family);
  font-weight: 400;

  th,
  td {
    padding: 0.25em 0.5em;
    border: 0 solid var(--color-page);
    border-width: 0 2px 2px 0;
    font-family: var(--header-font-family);
    font-weight: 400;
    text-align: center;
  }

  thead th {
    width: 25%; /* the four times share what the days leave, equally */
    text-align: center;
  }

  /* The days' column is no wider than its longest name. */
  thead th:first-child {
    width: 1%;
    white-space: nowrap;
  }

  /* The days, down the left column. */
  tbody th {
    text-align: right;
  }

  th:last-child,
  td:last-child {
    border-right-width: 0;
  }

  tbody tr:last-child > * {
    border-bottom-width: 0;
  }
}

body {
  background-color: var(--body-background-color);
}

main {
  background-color: var(--main-background-color);
}

header {
  background-color: var(--header-background-color);
}

header nav {
  background-color: var(--header-nav-background-color);
}

footer {
  background-color: var(--footer-background-color);
}

footer nav {
  background-color: var(--footer-nav-background-color);
}

footer search {
  background-color: var(--footer-search-background-color);
}

body[data-view="home"] {
  main section[data-view="home"] {
    visibility: visible;
  }
  header nav[data-view="home"] {
    display: flex;
  }
  footer nav.views button[data-view="home"] {
    background-image: url("assets/ui/main/home_selected.svg?v=adeb734198");
  }
  main section[data-view="home"][data-article="welcome"] > article[data-article="welcome"] {
    visibility: inherit;
  }
  &:has(main section[data-view="home"][data-article="welcome"]) header nav[data-view="home"] button[data-article="welcome"] {
    color: var(--button-header-nav-active-color);
  }
  main section[data-view="home"][data-article="help"] > article[data-article="help"] {
    visibility: inherit;
  }
  &:has(main section[data-view="home"][data-article="help"]) header nav[data-view="home"] button[data-article="help"] {
    color: var(--button-header-nav-active-color);
  }
  main section[data-view="home"][data-article="share"] > article[data-article="share"] {
    visibility: inherit;
  }
  &:has(main section[data-view="home"][data-article="share"]) header nav[data-view="home"] button[data-article="share"] {
    color: var(--button-header-nav-active-color);
  }
  main section[data-view="home"][data-article="contact"] > article[data-article="contact"] {
    visibility: inherit;
  }
  &:has(main section[data-view="home"][data-article="contact"]) header nav[data-view="home"] button[data-article="contact"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-view="map"] {
  main section[data-view="map"] {
    visibility: visible;
  }
  header nav[data-view="map"] {
    display: flex;
  }
  footer nav.views button[data-view="map"] {
    background-image: url("assets/ui/main/map_selected.svg?v=42e14bedb7");
  }
  footer search {
    display: block;
  }
  header nav.filter {
    display: flex;
  }
}

body[data-view="search"] {
  main section[data-view="search"] {
    visibility: visible;
  }
  header nav[data-view="search"] {
    display: flex;
  }
  footer nav.views button[data-view="search"] {
    background-image: url("assets/ui/main/search_selected.svg?v=c4ed08fdbb");
  }
  footer search {
    display: block;
  }
  header nav.filter {
    display: flex;
  }
}

body[data-view="calendar"] {
  main section[data-view="calendar"] {
    visibility: visible;
  }
  header nav[data-view="calendar"] {
    display: flex;
  }
  footer nav.views button[data-view="calendar"] {
    background-image: url("assets/ui/main/calendar_selected.svg?v=97927ab954");
  }
}

body[data-view="news"] {
  main section[data-view="news"] {
    visibility: visible;
  }
  header nav[data-view="news"] {
    display: flex;
  }
  footer nav.views button[data-view="news"] {
    background-image: url("assets/ui/main/news_selected.svg?v=ad55544abb");
  }
  main section[data-view="news"][data-article="respect"] > article[data-article="respect"] {
    visibility: inherit;
  }
  &:has(main section[data-view="news"][data-article="respect"]) header nav[data-view="news"] button[data-article="respect"] {
    color: var(--button-header-nav-active-color);
  }
  main section[data-view="news"][data-article="beach"] > article[data-article="beach"] {
    visibility: inherit;
  }
  &:has(main section[data-view="news"][data-article="beach"]) header nav[data-view="news"] button[data-article="beach"] {
    color: var(--button-header-nav-active-color);
  }
  main section[data-view="news"][data-article="camping"] > article[data-article="camping"] {
    visibility: inherit;
  }
  &:has(main section[data-view="news"][data-article="camping"]) header nav[data-view="news"] button[data-article="camping"] {
    color: var(--button-header-nav-active-color);
  }
}

/* Close-up is a view with no button in the nav: it opens from a listing's name. Its
   section shows when it is the view. The header's other navs, the filter, and the
   search box belong to other views, so none of them show. */
body[data-view="closeup"] main section[data-view="closeup"] {
  visibility: visible;
}

body[data-moku="food"] {
  header nav.filter > nav.moku > button[data-moku="food"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-moku="food"] header nav.filter > nav:not(.moku) button[data-moku]:not([data-moku="food"]) {
  display: none;
}

body[data-moku="activities"] {
  header nav.filter > nav.moku > button[data-moku="activities"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-moku="activities"] header nav.filter > nav:not(.moku) button[data-moku]:not([data-moku="activities"]) {
  display: none;
}

body[data-moku="events"] {
  header nav.filter > nav.moku > button[data-moku="events"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-moku="events"] header nav.filter > nav:not(.moku) button[data-moku]:not([data-moku="events"]) {
  display: none;
}

body[data-moku="essential"] {
  header nav.filter > nav.moku > button[data-moku="essential"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-moku="essential"] header nav.filter > nav:not(.moku) button[data-moku]:not([data-moku="essential"]) {
  display: none;
}

body[data-moku="provider"] {
  header nav.filter > nav.moku > button[data-moku="provider"] {
    color: var(--button-header-nav-active-color);
  }
}

body[data-moku="provider"] header nav.filter > nav:not(.moku) button[data-moku]:not([data-moku="provider"]) {
  display: none;
}

body[data-mahele~="truck"] header nav.filter > nav button[data-mahele="truck"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="truck"] header nav.filter > nav button[data-mahele="truck"]::after {
  display: none;
}

body[data-mahele~="grinds"] header nav.filter > nav button[data-mahele="grinds"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="grinds"] header nav.filter > nav button[data-mahele="grinds"]::after {
  display: none;
}

body[data-mahele~="grocer"] header nav.filter > nav button[data-mahele="grocer"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="grocer"] header nav.filter > nav button[data-mahele="grocer"]::after {
  display: none;
}

body[data-mahele~="farmstand"] header nav.filter > nav button[data-mahele="farmstand"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="farmstand"] header nav.filter > nav button[data-mahele="farmstand"]::after {
  display: none;
}

body[data-mahele~="fish"] header nav.filter > nav button[data-mahele="fish"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="fish"] header nav.filter > nav button[data-mahele="fish"]::after {
  display: none;
}

body[data-mahele~="adventure"] header nav.filter > nav button[data-mahele="adventure"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="adventure"] header nav.filter > nav button[data-mahele="adventure"]::after {
  display: none;
}

body[data-mahele~="beach"] header nav.filter > nav button[data-mahele="beach"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="beach"] header nav.filter > nav button[data-mahele="beach"]::after {
  display: none;
}

body[data-mahele~="fun"] header nav.filter > nav button[data-mahele="fun"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="fun"] header nav.filter > nav button[data-mahele="fun"]::after {
  display: none;
}

body[data-mahele~="good"] header nav.filter > nav button[data-mahele="good"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="good"] header nav.filter > nav button[data-mahele="good"]::after {
  display: none;
}

body[data-mahele~="luau"] header nav.filter > nav button[data-mahele="luau"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="luau"] header nav.filter > nav button[data-mahele="luau"]::after {
  display: none;
}

body[data-mahele~="thrifting"] header nav.filter > nav button[data-mahele="thrifting"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="thrifting"] header nav.filter > nav button[data-mahele="thrifting"]::after {
  display: none;
}

body[data-mahele~="tour"] header nav.filter > nav button[data-mahele="tour"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="tour"] header nav.filter > nav button[data-mahele="tour"]::after {
  display: none;
}

body[data-mahele~="farmers-market"] header nav.filter > nav button[data-mahele="farmers-market"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="farmers-market"] header nav.filter > nav button[data-mahele="farmers-market"]::after {
  display: none;
}

body[data-mahele~="craft-fair"] header nav.filter > nav button[data-mahele="craft-fair"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="craft-fair"] header nav.filter > nav button[data-mahele="craft-fair"]::after {
  display: none;
}

body[data-mahele~="featured-event"] header nav.filter > nav button[data-mahele="featured-event"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="featured-event"] header nav.filter > nav button[data-mahele="featured-event"]::after {
  display: none;
}

body[data-mahele~="featured-show"] header nav.filter > nav button[data-mahele="featured-show"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="featured-show"] header nav.filter > nav button[data-mahele="featured-show"]::after {
  display: none;
}

body[data-mahele~="local-event"] header nav.filter > nav button[data-mahele="local-event"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="local-event"] header nav.filter > nav button[data-mahele="local-event"]::after {
  display: none;
}

body[data-mahele~="local-show"] header nav.filter > nav button[data-mahele="local-show"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="local-show"] header nav.filter > nav button[data-mahele="local-show"]::after {
  display: none;
}

body[data-mahele~="for-good"] header nav.filter > nav button[data-mahele="for-good"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="for-good"] header nav.filter > nav button[data-mahele="for-good"]::after {
  display: none;
}

body[data-mahele~="atm"] header nav.filter > nav button[data-mahele="atm"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="atm"] header nav.filter > nav button[data-mahele="atm"]::after {
  display: none;
}

body[data-mahele~="bathroom"] header nav.filter > nav button[data-mahele="bathroom"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="bathroom"] header nav.filter > nav button[data-mahele="bathroom"]::after {
  display: none;
}

body[data-mahele~="lodging"] header nav.filter > nav button[data-mahele="lodging"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="lodging"] header nav.filter > nav button[data-mahele="lodging"]::after {
  display: none;
}

body[data-mahele~="medical"] header nav.filter > nav button[data-mahele="medical"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="medical"] header nav.filter > nav button[data-mahele="medical"]::after {
  display: none;
}

body[data-mahele~="water"] header nav.filter > nav button[data-mahele="water"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="water"] header nav.filter > nav button[data-mahele="water"]::after {
  display: none;
}

body[data-mahele~="caterer"] header nav.filter > nav button[data-mahele="caterer"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="caterer"] header nav.filter > nav button[data-mahele="caterer"]::after {
  display: none;
}

body[data-mahele~="grower"] header nav.filter > nav button[data-mahele="grower"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="grower"] header nav.filter > nav button[data-mahele="grower"]::after {
  display: none;
}

body[data-mahele~="maker"] header nav.filter > nav button[data-mahele="maker"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="maker"] header nav.filter > nav button[data-mahele="maker"]::after {
  display: none;
}

body[data-mahele~="player"] header nav.filter > nav button[data-mahele="player"] {
  border-color: var(--color-page);
  filter: none;
}

body[data-mahele~="player"] header nav.filter > nav button[data-mahele="player"]::after {
  display: none;
}

body[data-moku="food"] section[data-view="search"] li:not([data-moku="food"]) {
  display: none;
}

body[data-moku="activities"] section[data-view="search"] li:not([data-moku="activities"]) {
  display: none;
}

body[data-moku="events"] section[data-view="search"] li:not([data-moku="events"]) {
  display: none;
}

body[data-moku="essential"] section[data-view="search"] li:not([data-moku="essential"]) {
  display: none;
}

body[data-moku="provider"] section[data-view="search"] li:not([data-moku="provider"]) {
  display: none;
}

body:not([data-mahele~="atm"]) section[data-view="search"] li[data-mahele="atm"] {
  display: none;
}

body:not([data-mahele~="bathroom"]) section[data-view="search"] li[data-mahele="bathroom"] {
  display: none;
}

body:not([data-mahele~="beach"]) section[data-view="search"] li[data-mahele="beach"] {
  display: none;
}

body:not([data-mahele~="grinds"]) section[data-view="search"] li[data-mahele="grinds"] {
  display: none;
}

body:not([data-mahele~="farmstand"]) section[data-view="search"] li[data-mahele="farmstand"] {
  display: none;
}

body:not([data-mahele~="fish"]) section[data-view="search"] li[data-mahele="fish"] {
  display: none;
}

body:not([data-mahele~="good"]) section[data-view="search"] li[data-mahele="good"] {
  display: none;
}

body:not([data-mahele~="luau"]) section[data-view="search"] li[data-mahele="luau"] {
  display: none;
}

body:not([data-mahele~="grocer"]) section[data-view="search"] li[data-mahele="grocer"] {
  display: none;
}

body:not([data-mahele~="fun"]) section[data-view="search"] li[data-mahele="fun"] {
  display: none;
}

body:not([data-mahele~="medical"]) section[data-view="search"] li[data-mahele="medical"] {
  display: none;
}

body:not([data-mahele~="truck"]) section[data-view="search"] li[data-mahele="truck"] {
  display: none;
}

body:not([data-mahele~="thrifting"]) section[data-view="search"] li[data-mahele="thrifting"] {
  display: none;
}

body:not([data-mahele~="tour"]) section[data-view="search"] li[data-mahele="tour"] {
  display: none;
}

body:not([data-mahele~="water"]) section[data-view="search"] li[data-mahele="water"] {
  display: none;
}

body:not([data-mahele~="farmers-market"]) section[data-view="search"] li[data-mahele="farmers-market"] {
  display: none;
}

body:not([data-mahele~="craft-fair"]) section[data-view="search"] li[data-mahele="craft-fair"] {
  display: none;
}

body:not([data-mahele~="featured-event"]) section[data-view="search"] li[data-mahele="featured-event"] {
  display: none;
}

body:not([data-mahele~="featured-show"]) section[data-view="search"] li[data-mahele="featured-show"] {
  display: none;
}

body:not([data-mahele~="local-event"]) section[data-view="search"] li[data-mahele="local-event"] {
  display: none;
}

body:not([data-mahele~="local-show"]) section[data-view="search"] li[data-mahele="local-show"] {
  display: none;
}

body:not([data-mahele~="for-good"]) section[data-view="search"] li[data-mahele="for-good"] {
  display: none;
}

body:not([data-mahele~="caterer"]) section[data-view="search"] li[data-mahele="caterer"] {
  display: none;
}

body:not([data-mahele~="grower"]) section[data-view="search"] li[data-mahele="grower"] {
  display: none;
}

body:not([data-mahele~="maker"]) section[data-view="search"] li[data-mahele="maker"] {
  display: none;
}

body:not([data-mahele~="player"]) section[data-view="search"] li[data-mahele="player"] {
  display: none;
}

body:not([data-mahele~="lodging"]) section[data-view="search"] li[data-mahele="lodging"] {
  display: none;
}

body:not([data-mahele~="adventure"]) section[data-view="search"] li[data-mahele="adventure"] {
  display: none;
}

/* The loading screen: covers the page, with the hero picture swaying, until the builder's
   script has the data and has drawn it, and sets data-loaded on body. It is in the page's
   own HTML, so it is the first thing painted. */
#loading {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary);
  opacity: 1;
  transition:
    opacity 0.4s ease,
    visibility 0s linear 0.4s;

  img {
    width: 50vw;
    max-height: 60dvh;
    object-fit: contain;
    transform-origin: center;
    animation: loading-sway 0.6s ease-in-out infinite alternate;
  }
}

body[data-loaded] #loading {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes loading-sway {
  from {
    transform: rotate(-5deg);
  }
  to {
    transform: rotate(5deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  #loading img {
    animation: none;
  }
}

/* A mahele's picture is the background of whatever carries data-picture="<slug>" (the rule
   that sets the image for each slug is made by the builder, at the marker below). In a
   listing's name it is an IMG (below); in the filter's round buttons it fills about three quarters of the circle. */
[data-picture] {
  background-repeat: no-repeat;
}

/* In a listing's name the picture is an IMG at the start of the h4, in the line with the letters.
   It lets taps through to the name, which carries the action. A name that wraps hangs: the h4 is
   indented by the room the picture takes (its width and margin) and the first line is pulled
   back out by the same, so the picture fills it and the lines after the first start under the
   name, not under the picture. If the picture's size or margin changes, change both numbers. */
h4:has(> img.mahele-picture) {
  padding-left: 1.9em;
  text-indent: -1.9em;
}

h4 > img.mahele-picture {
  width: 1.9em;
  height: 1.9em;
  margin-right: 0;
  vertical-align: middle;
  pointer-events: none;
}

header nav.filter > nav:not(.moku) button[data-picture],
nav.hints .nada button[data-act="mahele"][data-picture] {
  background-position: center;
  background-size: 85%;
}

[data-picture="adventure"] {
  background-image: url("assets/ui/mahele/adventure.png?v=4d3966ba29");
}

[data-picture="atm"] {
  background-image: url("assets/ui/mahele/atm.png?v=5b011cb2f2");
}

[data-picture="bathroom"] {
  background-image: url("assets/ui/mahele/bathroom.png?v=48b3ec9991");
}

[data-picture="beach"] {
  background-image: url("assets/ui/mahele/beach.png?v=d21839fdf4");
}

[data-picture="caterer"] {
  background-image: url("assets/ui/mahele/caterer.png?v=324100665d");
}

[data-picture="craft-fair"] {
  background-image: url("assets/ui/mahele/craft-fair.png?v=2da65c064e");
}

[data-picture="farmers-market"] {
  background-image: url("assets/ui/mahele/farmers-market.png?v=bef79dd01a");
}

[data-picture="farmstand"] {
  background-image: url("assets/ui/mahele/farmstand.png?v=6c21013f28");
}

[data-picture="featured-event"] {
  background-image: url("assets/ui/mahele/featured-event.png?v=0d3988464c");
}

[data-picture="featured-show"] {
  background-image: url("assets/ui/mahele/featured-show.png?v=9a4bb28501");
}

[data-picture="fish"] {
  background-image: url("assets/ui/mahele/fish.png?v=cfc2a50bf4");
}

[data-picture="for-good"] {
  background-image: url("assets/ui/mahele/for-good.png?v=58de035258");
}

[data-picture="fun"] {
  background-image: url("assets/ui/mahele/fun.png?v=70e1537381");
}

[data-picture="good"] {
  background-image: url("assets/ui/mahele/good.png?v=58de035258");
}

[data-picture="grinds"] {
  background-image: url("assets/ui/mahele/grinds.png?v=66d2791804");
}

[data-picture="grocer"] {
  background-image: url("assets/ui/mahele/grocer.png?v=e8e5628251");
}

[data-picture="grower"] {
  background-image: url("assets/ui/mahele/grower.png?v=623c9f7f7b");
}

[data-picture="local-event"] {
  background-image: url("assets/ui/mahele/local-event.png?v=887e5c7e29");
}

[data-picture="local-show"] {
  background-image: url("assets/ui/mahele/local-show.png?v=670a2892d4");
}

[data-picture="lodging"] {
  background-image: url("assets/ui/mahele/lodging.png?v=47c26deee5");
}

[data-picture="luau"] {
  background-image: url("assets/ui/mahele/luau.png?v=c6ca78df14");
}

[data-picture="maker"] {
  background-image: url("assets/ui/mahele/maker.png?v=4c2ef570fd");
}

[data-picture="medical"] {
  background-image: url("assets/ui/mahele/medical.png?v=2257fbda0c");
}

[data-picture="player"] {
  background-image: url("assets/ui/mahele/player.png?v=02db721c22");
}

[data-picture="thrifting"] {
  background-image: url("assets/ui/mahele/thrifting.png?v=747028ef57");
}

[data-picture="tour"] {
  background-image: url("assets/ui/mahele/tour.png?v=233fb9a2c3");
}

[data-picture="truck"] {
  background-image: url("assets/ui/mahele/truck.png?v=4a0482efd9");
}

[data-picture="water"] {
  background-image: url("assets/ui/mahele/water.png?v=6780a1ed92");
}
