/**
 * The DOM half of the holographic display: the buttons that sit over the
 * canvas, and the project detail panel.
 *
 * The canvas handles the map itself, so everything here is chrome. It shares
 * the map's visual language -- hairline rules, corner brackets, letter-spaced
 * display type, and a faint scanline wash over anything solid.
 */

/* ------------------------------------------------------------- buttons --- */

.holo-button {
  position: fixed;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.75em 1.15em;
  border: 1px solid rgba(var(--holo), 0.3);
  background: linear-gradient(
    135deg,
    rgba(var(--panel), 0.72),
    rgba(var(--panel), 0.45)
  );
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgb(var(--holo-bright));
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease,
    border-color 0.25s ease,
    background-color 0.25s ease;
}

.holo-button::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(var(--holo), 0.1);
  pointer-events: none;
}

.holo-button:hover,
.holo-button:focus-visible {
  border-color: rgba(var(--holo), 0.75);
  background-color: rgba(var(--holo), 0.08);
  outline: none;
}

.holo-button__mark {
  position: relative;
  width: 11px;
  height: 11px;
  flex: none;
}

.holo-button__mark::before,
.holo-button__mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
}

/* A cross for close */
.holo-button--close .holo-button__mark::before {
  clip-path: polygon(0 42%, 100% 42%, 100% 58%, 0 58%);
  transform: rotate(45deg);
}

.holo-button--close .holo-button__mark::after {
  clip-path: polygon(0 42%, 100% 42%, 100% 58%, 0 58%);
  transform: rotate(-45deg);
}

/* An arrow for back */
.holo-button--back .holo-button__mark::before {
  clip-path: polygon(0 50%, 55% 0, 55% 100%);
}

.holo-button--back .holo-button__mark::after {
  clip-path: polygon(45% 42%, 100% 42%, 100% 58%, 45% 58%);
}

.holo-button--close {
  top: calc(18px + var(--safe-top));
  right: calc(18px + var(--safe-right));
}

/* The back button rides inside the panel: `.detail` is transformed, which
   would make a fixed child position against it anyway */
.holo-button--back {
  position: static;
  align-self: flex-start;
  flex: none;
  margin: clamp(14px, 2.2vw, 20px) 0 0 clamp(14px, 2.2vw, 20px);
}

.is-open:not(.is-project) .holo-button--close {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0.65s;
}

.is-project .holo-button--back {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0.75s;
}

@media (max-width: 600px) {
  .holo-button {
    font-size: 0.6rem;
    padding: 0.7em 0.95em;
  }

  .holo-button--close {
    top: calc(12px + var(--safe-top));
    right: calc(12px + var(--safe-right));
  }

  .holo-button--back {
    margin: 12px 0 0 12px;
  }
}

/* -------------------------------------------------------------- detail --- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) calc(24px + var(--safe-right))
    calc(28px + var(--safe-bottom)) calc(24px + var(--safe-left));
  pointer-events: none;

  /* The panel comes up as the display dims behind it */
  opacity: 0;
  transform: scale(1.06);
  transition: opacity 0.4s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.is-project .detail {
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

.detail__frame {
  position: relative;
  width: min(760px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(var(--holo), 0.22);
  background:
    linear-gradient(
      180deg,
      rgba(var(--panel), 0.88),
      rgba(var(--panel), 0.94)
    );
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow:
    0 0 0 1px rgba(var(--holo), 0.06),
    0 24px 90px rgba(0, 0, 0, 0.55),
    inset 0 0 70px rgba(var(--holo), 0.05);
}

/* Scanline wash over the panel, which ties it to the projected map */
.detail__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(var(--holo), 0.045) 0px,
    rgba(var(--holo), 0.045) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
  opacity: 0.6;
}

.detail__corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(var(--holo), 0.7);
  pointer-events: none;
}

.detail__corner--tl {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.detail__corner--tr {
  top: -1px;
  right: -1px;
  border-left: 0;
  border-bottom: 0;
}

.detail__corner--bl {
  bottom: -1px;
  left: -1px;
  border-right: 0;
  border-top: 0;
}

.detail__corner--br {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
}

.detail__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(18px, 2.8vw, 30px) clamp(26px, 4.4vw, 48px)
    clamp(26px, 4.4vw, 48px);
  user-select: text;
}

.detail.is-loading .detail__scroll::before {
  content: 'Retrieving record…';
  display: block;
  font-family: var(--display);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(var(--holo-dim), 0.9);
}

/* ------------------------------------------------------- detail: text --- */

.detail__eyebrow {
  font-family: var(--display);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(var(--accent), 0.85);
  margin-bottom: 1.1em;
}

.detail__title {
  font-family: var(--display);
  font-size: clamp(1.5rem, 4.6vw, 2.35rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.02em;
  color: rgb(var(--holo-bright));
  text-shadow:
    -1px 0 rgba(255, 70, 120, 0.22),
    1px 0 rgba(70, 160, 255, 0.22);
}

.detail__subtitle {
  margin-top: 0.7em;
  font-size: clamp(0.95rem, 2.4vw, 1.08rem);
  line-height: 1.5;
  color: rgba(var(--holo), 0.78);
}

.detail__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 1.4em;
}

.detail__meta-item {
  font-family: var(--display);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 0.5em 0.8em;
  border: 1px solid rgba(var(--holo), 0.22);
  color: rgba(var(--holo), 0.85);
}

.detail__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45em;
  list-style: none;
  margin-top: 1.5em;
}

.detail__tech li {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  padding: 0.35em 0.7em;
  border-left: 2px solid rgba(var(--accent), 0.55);
  background: rgba(var(--holo), 0.05);
  color: rgba(var(--holo), 0.8);
}

.detail__head {
  padding-bottom: 1.6em;
  border-bottom: 1px solid rgba(var(--holo), 0.14);
}

.detail__body {
  margin-top: 1.8em;
  font-size: clamp(0.95rem, 2.3vw, 1rem);
  line-height: 1.72;
  color: rgba(var(--holo), 0.82);
}

.detail__body > * + * {
  margin-top: 1.1em;
}

.detail__body h1,
.detail__body h2,
.detail__body h3,
.detail__body h4 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: rgb(var(--holo-bright));
  margin-top: 1.9em;
}

.detail__body h1 {
  font-size: 1.3rem;
}

.detail__body h2 {
  font-size: 1.05rem;
}

.detail__body h3 {
  font-size: 0.92rem;
}

.detail__body strong {
  color: rgb(var(--holo-bright));
  font-weight: 600;
}

.detail__body em {
  color: rgba(var(--accent), 0.95);
  font-style: italic;
}

.detail__body a {
  color: rgb(var(--accent));
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--accent), 0.4);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.detail__body a:hover {
  color: rgb(var(--holo-bright));
  border-bottom-color: rgb(var(--holo-bright));
}

.detail__body ul,
.detail__body ol {
  padding-left: 1.3em;
}

.detail__body li + li {
  margin-top: 0.5em;
}

.detail__body li::marker {
  color: rgba(var(--accent), 0.7);
}

.detail__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.12em 0.4em;
  background: rgba(var(--holo), 0.08);
  border: 1px solid rgba(var(--holo), 0.12);
  color: rgb(var(--holo-bright));
}

.detail__body pre {
  padding: 1em 1.1em;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.35);
  border-left: 2px solid rgba(var(--accent), 0.5);
}

.detail__body pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.6;
}

.detail__body blockquote {
  padding-left: 1.1em;
  border-left: 2px solid rgba(var(--holo), 0.3);
  color: rgba(var(--holo), 0.7);
  font-style: italic;
}

.detail__body hr {
  border: 0;
  border-top: 1px solid rgba(var(--holo), 0.14);
  margin: 2em 0;
}

.detail__body img,
.detail__body video {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid rgba(var(--holo), 0.18);
}

.detail__images {
  margin-top: 1.9em;
  display: grid;
  gap: 1em;
}

.detail__figure img,
.detail__figure video {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(var(--holo), 0.2);
  filter: saturate(0.9) contrast(1.05);
}

.detail__figure figcaption {
  margin-top: 0.6em;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: rgba(var(--holo-dim), 0.9);
}

.detail__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  margin-top: 2.2em;
  padding-top: 1.8em;
  border-top: 1px solid rgba(var(--holo), 0.14);
}

.detail__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.8em 1.15em;
  border: 1px solid rgba(var(--holo), 0.3);
  background: rgba(var(--holo), 0.04);
  font-family: var(--display);
  font-size: 0.64rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(var(--holo-bright));
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.detail__link::before {
  content: '';
  width: 5px;
  height: 5px;
  background: rgb(var(--accent));
  transform: rotate(45deg);
  flex: none;
}

.detail__link:hover,
.detail__link:focus-visible {
  border-color: rgba(var(--holo), 0.8);
  background: rgba(var(--holo), 0.11);
  outline: none;
}

.detail__error {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: rgba(255, 150, 170, 0.85);
}

@media (max-width: 600px) {
  .detail {
    padding: calc(14px + var(--safe-top)) 10px calc(14px + var(--safe-bottom))
      10px;
  }

  .detail__frame {
    width: 100%;
    max-height: 100%;
  }
}

/* ----------------------------------------------------------------- nav --- */

/**
 * The project list is hidden until something in it takes focus, at which
 * point it becomes a visible skip-list in the corner so keyboard users can
 * see where they are.
 */
.sr-nav {
  position: fixed;
  z-index: 7;
  left: calc(14px + var(--safe-left));
  bottom: calc(14px + var(--safe-bottom));
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.sr-nav:focus-within {
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  padding: 14px 16px;
  border: 1px solid rgba(var(--holo), 0.35);
  background: rgba(var(--panel), 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sr-nav h2 {
  font-family: var(--display);
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(var(--holo-dim), 0.9);
  margin-bottom: 0.8em;
}

.sr-nav ul {
  list-style: none;
  display: grid;
  gap: 2px;
}

.sr-nav button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4em 0.6em;
  border: 1px solid transparent;
  background: none;
  font-family: var(--text);
  font-size: 0.8rem;
  color: rgba(var(--holo), 0.85);
  cursor: pointer;
}

.sr-nav button:hover,
.sr-nav button:focus-visible {
  border-color: rgba(var(--holo), 0.5);
  background: rgba(var(--holo), 0.08);
  color: rgb(var(--holo-bright));
  outline: none;
}

.sr-nav button[aria-current='true'] {
  color: rgb(var(--accent));
}

/* Without a canvas the page becomes the logo and a plain list of projects */
body.no-webgl {
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: 10vh 20px 6rem;
}

.no-webgl .logo-fallback {
  position: static;
  transform: none;
  margin-bottom: 3rem;
}

.no-webgl .sr-nav {
  position: static;
  width: min(420px, 100%);
  height: auto;
  overflow: visible;
  clip: auto;
  padding: 18px 20px;
  border: 1px solid rgba(var(--holo), 0.22);
  background: rgba(var(--panel), 0.6);
}

.no-webgl .holo-button--close {
  display: none;
}

/* The list sits behind the panel, and gets out of the way while one of its
   projects is open */
.no-webgl .sr-nav {
  z-index: 1;
}

.no-webgl.is-project .sr-nav,
.no-webgl.is-project .logo-fallback {
  visibility: hidden;
}

.no-webgl .detail {
  position: fixed;
}

@media (prefers-reduced-motion: reduce) {
  .holo-button,
  .detail {
    transition-duration: 0.01ms;
  }
}
