/* ===== base.css ===== */
/*
 * The site shell: the ground everything stands on, and the corridor between
 * the acts. Deliberately plain. The aquarium brings its own glass, its own
 * light and its own brass; none of that is duplicated here.
 */

/* ------------------------------------------------- the page, hoisted */
/*
 * These rules came out of the aquarium's stylesheet when the aquarium was the
 * whole page. They belong to the page now: the ground tone, the clipping, the
 * control reset, and the one rule that makes the entire site stop moving when
 * the visitor asks it to. The values are the first screen's, unchanged.
 */

html {
  background: #03080a;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body.sw-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  /* The page ground of the first screen, kept exactly: the aquarium covers
     the viewport edge to edge, and the corridor sits on the same ink. */
  background: #03080a;
  color: var(--sw-pale);
  font-family: var(--sw-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* A visitor who cannot see the corridor should not have to hunt for it. */
.sw-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.7rem 1.1rem;
  background: var(--sw-ink-deep);
  color: var(--sw-pale);
  font-family: var(--sw-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid var(--sw-brass);
  z-index: 50;
}

.sw-skip:focus {
  left: 1rem;
  top: 1rem;
}

/* One visible focus ring, everywhere, for keyboard visitors only. */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--sw-brass-lit);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ head */
.sw-masthead {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--sw-hair);
  font-family: var(--sw-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--sw-pale-faint);
}

.sw-masthead__mark,
.sw-masthead__state {
  margin: 0;
}

/* ----------------------------------------------------------------- stage */
.sw-stage {
  display: block;
  max-width: var(--sw-stage-max);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem);
  min-height: 60vh;
}

/*
 * Some acts are rooms, not panels. The aquarium is the whole main hall: it
 * was the whole page once, and it still draws itself edge to edge.
 *
 * When such an act is mounted the stage gives up its column and its padding,
 * and the shell steps out of the way - the room has its own header and its
 * own controls, and a second set of chrome on top of it would be a scar.
 */
.sw-stage--bleed {
  max-width: none;
  padding: 0;
  min-height: 0;
}

/*
 * Only the masthead steps aside. The collection index stays reachable: the
 * room that fills the page has its own header, and the door out of that
 * header is the EXIT lamp, which opens the index.
 */
.sw-body--immersive .sw-masthead {
  display: none;
}

/* An act that is not on screen is not in the document at all: the router
   removes its host element, so a hidden act cannot be read by a screen
   reader or reached by the keyboard. */
.act:focus {
  outline: none;
}

/* ------------------------------------------------------------------- nav */
/*
 * The collection index.
 *
 * The whole museum, named all at once. It is opened from the masthead, and
 * from the EXIT lamp in the main hall - a room that fills the page has its
 * own header, so the shell's own door is not on the screen while it is
 * there.
 *
 * It is an overlay and not a strip at the foot of the page: eleven rooms in
 * a strip at the foot of the page is a list, and a list is not a museum.
 */
.sw-nav {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  overflow-y: auto;
  padding: clamp(1.5rem, 6vh, 4rem) clamp(1rem, 5vw, 3rem);
  /*
   * Opaque on purpose.
   *
   * This overlay was rgba(3, 8, 10, .97), which sounds close enough to solid
   * to be safe. It is not: three percent of a bright title is enough to leave
   * a readable ghost of the room behind it, and on a phone that ghost was
   * clearly there - the previous room's own heading showing through the
   * museum's index. Measured, the leak was 8 of 255 levels, which a person
   * with the screen in a dark room can see.
   *
   * So the index is a real surface now. The gradient gives it a light above
   * it - the hall, lit from the front - and both of its stops are opaque.
   */
  background:
    radial-gradient(140% 90% at 50% 0%, #071316 0%, #03080a 62%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity var(--sw-dur) var(--sw-ease),
    transform var(--sw-dur) var(--sw-ease),
    visibility 0s linear var(--sw-dur);
}

.sw-body--directory .sw-nav {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.sw-nav__inner {
  width: 100%;
  max-width: 54rem;
}

.sw-nav__head {
  margin: 0 0 clamp(1.4rem, 3vw, 2.2rem);
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--sw-hair);
}

.sw-nav__title {
  margin: 0 0 .6rem;
  font-family: var(--sw-mono);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--sw-pale-faint);
}

.sw-nav__lead {
  margin: 0;
  max-width: var(--sw-measure);
  font-family: var(--sw-display);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--sw-pale-soft);
}

.sw-nav__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sw-nav__group {
  margin: 0 0 clamp(1.2rem, 2.4vw, 1.8rem);
}

.sw-nav__chapter {
  display: block;
  margin: 0 0 .55rem;
  font-family: var(--sw-mono);
  font-size: .6rem;
  letter-spacing: .26em;
  color: var(--sw-brass);
}

.sw-nav__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .8rem;
  margin: 0 0 .3rem;
}

.sw-nav__row--sub {
  margin-left: 1.1rem;
}

/*
 * The collection, opened on top of a room that fills the page.
 *
 * The aquarium has its own header and its own controls, so the site's own
 * masthead steps out of the way while it is on screen. The EXIT lamp in the
 * room's header opens the index instead.
 */
.sw-nav__item {
  appearance: none;
  background: transparent;
  border: 1px solid var(--sw-hair);
  color: var(--sw-pale-soft);
  font-family: var(--sw-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  transition: border-color var(--sw-dur) var(--sw-ease), color var(--sw-dur) var(--sw-ease), background-color var(--sw-dur) var(--sw-ease);
}

.sw-nav__item:hover {
  border-color: var(--sw-brass);
  color: var(--sw-pale);
}

.sw-nav__item.is-current {
  border-color: var(--sw-brass-lit);
  color: var(--sw-brass-lit);
}

.sw-nav__item.is-visited {
  border-left: 3px solid var(--sw-brass);
}

.sw-nav__item--sub {
  font-size: 0.68rem;
  padding: 0.42rem 0.8rem;
}

.sw-nav__note {
  font-family: var(--sw-mono);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  color: var(--sw-pale-faint);
}

.sw-nav__optional {
  font-family: var(--sw-mono);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: rgba(217, 210, 180, 0.24);
}

.sw-nav__foot {
  margin: clamp(1.6rem, 3vw, 2.4rem) 0 0;
  padding-top: 1.2rem;
  border-top: 1px solid var(--sw-hair);
}

.sw-nav__close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--sw-hair-strong);
  color: var(--sw-pale-faint);
  font-family: var(--sw-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
}

.sw-nav__close:hover {
  color: var(--sw-pale);
  border-color: var(--sw-brass);
}

/* The masthead's own door into the collection. */
.sw-masthead__door {
  appearance: none;
  background: transparent;
  border: 1px solid var(--sw-hair);
  color: var(--sw-pale-faint);
  font-family: var(--sw-mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
  transition: border-color var(--sw-dur) var(--sw-ease), color var(--sw-dur) var(--sw-ease);
}

.sw-masthead__door:hover {
  color: var(--sw-brass-lit);
  border-color: var(--sw-brass);
}

.sw-noscript {
  margin: 0;
  padding: 2rem clamp(1rem, 4vw, 3rem);
  color: var(--sw-pale-soft);
  font-family: var(--sw-mono);
  font-size: 0.78rem;
  max-width: var(--sw-measure);
}

/* ----------------------------------------------------------- narrow */
/*
 * The collection index on a phone. The overlay is a full screen of small
 * monospaced type, and on a phone in daylight that type has to be a step
 * larger and a step brighter than it is on a desk.
 *
 * The index is closed - opacity 0, visibility hidden - while the
 * aquarium is on the screen, so nothing here can change the first screen.
 */
@media (max-width: 640px) {
  .sw-nav__title {
    font-size: 0.74rem;
  }

  .sw-nav__lead {
    font-size: 1.04rem;
    color: var(--sw-pale);
  }

  .sw-nav__item {
    font-size: 0.8rem;
    padding: 0.8rem 1rem;
    color: var(--sw-pale);
  }

  .sw-nav__item--sub {
    font-size: 0.76rem;
    padding: 0.68rem 0.95rem;
  }

  .sw-nav__chapter,
  .sw-nav__note {
    font-size: 0.7rem;
    color: var(--sw-pale-soft);
  }

  .sw-nav__close {
    font-size: 0.74rem;
    padding: 0.8rem 1.2rem;
  }

  .sw-masthead {
    font-size: 0.74rem;
  }

  .sw-masthead__door {
    font-size: 0.72rem;
    padding: 0.62rem 0.95rem;
  }
}
