/* The mark is the only home link. Home and place pages show place navigation;
   content pages show a single link back to their place. */
.site-masthead {
  --masthead-ink: var(--ink, #203b32);
  --masthead-muted: var(--ink-soft, #66726c);
  --masthead-active: #e2e8dd;
  color: var(--masthead-ink);
  font-family: var(--sans, "Avenir Next", Avenir, system-ui, sans-serif);
  font-size: 0.875rem;
  line-height: 1.5;
}

.site-masthead,
.site-masthead * {
  box-sizing: border-box;
}

.site-masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  width: min(100% - (2 * var(--page-gutter, 1.5rem)), var(--content-width, 68rem));
  min-height: 7.5rem;
  margin-inline: auto;
  padding-block: 1.5rem;
}

.site-masthead:has(+ .page-shell .playlist) {
  --content-width: 70rem;
}

.site-masthead--contained .site-masthead__inner {
  width: 100%;
}

.site-masthead .site-masthead__brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.7rem;
  min-height: 3.5rem;
  color: var(--masthead-ink);
  text-decoration: none;
}

.site-masthead__mark {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  flex: 0 0 3.5rem;
}

.site-masthead__mark--dark {
  display: none;
}

.site-masthead__wordmark {
  font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
  font-size: 1.875rem;
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 1;
  white-space: nowrap;
}

.site-masthead__wordmark > span {
  padding-inline: 0.04em;
  color: var(--vermilion, #ba644b);
}

.site-masthead__nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 2rem;
  background: rgba(255, 253, 248, 0.6);
}

.site-masthead__nav .site-masthead__destination {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1.2rem;
  border-radius: 2rem;
  color: var(--masthead-muted);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}

.site-masthead__nav .site-masthead__destination:hover {
  color: var(--masthead-ink);
  background: rgba(32, 59, 50, 0.055);
}

.site-masthead__nav .site-masthead__destination[aria-current] {
  color: var(--masthead-ink);
  background: var(--masthead-active);
  font-weight: 650;
}

.site-masthead .site-masthead__back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.2rem;
  border-radius: 2rem;
  color: var(--masthead-muted);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}

.site-masthead__back > span {
  color: var(--vermilion, #ba644b);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.site-masthead .site-masthead__back:hover {
  color: var(--masthead-ink);
  background: rgba(32, 59, 50, 0.055);
}

.site-masthead__back:hover > span {
  transform: translateX(-0.15rem);
}

.site-masthead a:focus-visible {
  outline: 3px solid var(--theme-focus, #984632);
  outline-offset: 4px;
  border-radius: 1.5rem;
}

.site-masthead__skip {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: var(--masthead-ink);
  background: var(--paper-light, #fffdf8);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(calc(-100% - 2rem));
}

.site-masthead__skip:focus {
  transform: translateY(0);
}

/* Place identity belongs to the content, rather than a second navigation row.
   It sits directly under the masthead and flush on the first content panel. */
main:has(> .place-intro:first-child) {
  padding-top: 0;
}

.place-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 0.5rem 0.75rem;
}

.place-intro .place-intro__title {
  margin: 0;
  color: var(--ink, #203b32);
  font-family: var(--serif, Georgia, serif);
  font-size: clamp(2.75rem, 5.4vw, 4.75rem);
  font-weight: 400;
  letter-spacing: -0.05em;
  line-height: 1.1;
}

.place-intro__description {
  max-width: 36rem;
  margin: 1rem 0 0;
  color: var(--ink-soft, #66726c);
  font-size: 1rem;
  line-height: 1.7;
  text-wrap: pretty;
}

.place-intro__japanese {
  flex: 0 0 auto;
  padding-inline: 1rem;
  color: var(--vermilion-deep, #984632);
  opacity: 0.3;
  font-family: var(--serif, "Yu Mincho", Georgia, serif);
  font-size: clamp(3rem, 6vw, 5.5rem);
  letter-spacing: 0.05em;
  line-height: 1.3;
}

:root[data-theme="dark"] .site-masthead {
  --masthead-active: #293d32;
}

:root[data-theme="dark"] .site-masthead__nav {
  background: #1b231e;
}

:root[data-theme="dark"] .site-masthead__destination:hover,
:root[data-theme="dark"] .site-masthead .site-masthead__back:hover {
  background: #26352c;
}

:root[data-theme="dark"] .site-masthead__mark {
  display: none;
}

:root[data-theme="dark"] .site-masthead__mark--dark {
  display: block;
}

/* Match theme.css when scripts are unavailable and the system prefers dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead {
    --masthead-active: #293d32;
  }

  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead__nav {
    background: #1b231e;
  }

  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead__destination:hover,
  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead .site-masthead__back:hover {
    background: #26352c;
  }

  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead__mark {
    display: none;
  }

  :root:not([data-theme]):has(link[href*="theme.css"]) .site-masthead__mark--dark {
    display: block;
  }
}

@media (max-width: 48rem) {
  .site-masthead__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding-block: 1.25rem 0.75rem;
  }

  /* Place pages center the logo above the full-width navigation. */
  .site-masthead--place .site-masthead__brand {
    align-self: center;
  }

  .site-masthead__inner:has(> .site-masthead__back) {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    min-height: 0;
  }

  .site-masthead .site-masthead__back {
    margin-right: -0.75rem;
    padding-inline: 0.75rem;
    font-size: 0.8125rem;
  }

  .site-masthead__nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 0;
  }

  .site-masthead__nav .site-masthead__destination {
    padding-inline: 0.35rem;
    font-size: 0.8125rem;
  }

  .site-masthead__mark {
    width: 3rem;
    height: 3rem;
    flex-basis: 3rem;
  }

  .site-masthead__wordmark {
    font-size: 1.75rem;
  }

  .place-intro {
    align-items: flex-start;
    gap: 1rem;
  }

  .place-intro__japanese {
    padding: 1.9rem 0 0;
    font-size: 2.5rem;
    writing-mode: vertical-rl;
  }
}

@media (max-width: 23rem) {
  .site-masthead__nav .site-masthead__destination {
    font-size: 0.75rem;
  }

  .place-intro__japanese {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-masthead__destination,
  .site-masthead__back,
  .site-masthead__back > span {
    transition: none;
  }
}

@media print {
  .site-masthead__skip,
  .site-masthead__nav,
  .site-masthead__back {
    display: none;
  }
}
