/* Failure-map globe, DETAIL A on the casebook index (WEB-012). Flag failure_globe.
   Loaded only on pages that render the globe; copied into a build root only when the
   globe is rendered there (scripts/build_site.py FLAG_STATIC). Palette and type from
   DESIGN.md: GeosansLight for the detail title, Jost 400 for text. */

.detail-globe {
  --globe-base: #e8e6e1;     /* sheet-grey: the sea */
  --globe-marker: #914604;   /* rust: case locations */
  --globe-glow: #ffffff;
  margin: 32px 0 8px;
  max-width: 1040px;
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  grid-template-areas: "frame list" "caption list" "hint list";
  gap: 0 40px;
  align-items: start;
}

/* the detail frame: 1 px black box with a khaki rule inside, like a detail on a sheet */
.detail-frame {
  grid-area: frame;
  position: relative;
  border: 1px solid var(--black);
  padding: 10px;
  overflow: clip;
  background: var(--paper);
}
.detail-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--khaki);
  pointer-events: none;
}
/* tick marks at the quarter points, a nod to a drawing grid */
.detail-frame::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    linear-gradient(var(--black), var(--black)) 50% 0 / 1px 8px no-repeat,
    linear-gradient(var(--black), var(--black)) 50% 100% / 1px 8px no-repeat,
    linear-gradient(var(--black), var(--black)) 0 50% / 8px 1px no-repeat,
    linear-gradient(var(--black), var(--black)) 100% 50% / 8px 1px no-repeat;
}

/* square box reserved up front: no layout shift when the canvas arrives */
.globe-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  touch-action: pan-y;
}
.globe-fallback {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 1px solid var(--khaki);
  background:
    linear-gradient(0deg, transparent calc(50% - 0.5px), var(--khaki) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(90deg, transparent calc(50% - 0.5px), var(--khaki) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
  transition: opacity 0.6s;
}
.globe-noscript {
  position: absolute; left: 12%; right: 12%; top: 50%; translate: 0 -50%;
  margin: 0; text-align: center; font-size: 15px; color: var(--ink-soft);
  background: var(--paper); padding: 8px;
}
.globe-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  cursor: grab;
  opacity: 0;
  transition: opacity 0.8s;
}
.is-live .globe-canvas { opacity: 1; }
.is-live .globe-fallback { opacity: 0; }
.is-dragging .globe-canvas { cursor: grabbing; }

/* floating labels (CSS anchor positioning, added by the script where supported) */
.globe-label {
  position: absolute;
  z-index: 1;
  font-family: var(--body);
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 3px 6px;
  opacity: var(--v);
  scale: var(--v);
  transition: opacity 0.3s;
}
.globe-label .n { display: none; }
.globe-label:hover { color: var(--rust); border-color: var(--rust); text-decoration: underline; }
.globe-label--above { bottom: anchor(top); left: anchor(center); translate: -50% -8px; }
.globe-label--below { top: anchor(bottom); left: anchor(center); translate: -50% 8px; }
.globe-label--left  { right: anchor(left); top: anchor(center); translate: -8px -50%; }
.globe-label--right { left: anchor(right); top: anchor(center); translate: 8px -50%; }

/* detail title, drawn the way a detail is titled on a sheet: a split bubble with the
   detail letter over the page ref, then the underlined title and the scale */
.detail-caption {
  grid-area: caption;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 0;
}
.detail-bubble {
  flex: none;
  width: 74px; height: 74px;
  border: 1px solid var(--black);
  border-radius: 50%;
  display: grid;
  grid-template-rows: 1fr 1fr;
  overflow: hidden;
  font-family: var(--geo);
  text-align: center;
}
.detail-bubble span { display: flex; align-items: center; justify-content: center; }
.detail-bubble .bubble-letter { font-size: 22px; border-bottom: 1px solid var(--black); padding-top: 4px; }
.detail-bubble .bubble-ref { font-size: 11px; letter-spacing: 0.02em; padding-bottom: 6px; }
.detail-title { margin: 0; font-family: var(--geo); }
.detail-title .t { display: block; font-size: 19px; letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 2px solid var(--black); padding-bottom: 2px; }
.detail-title .s { display: block; font-size: 13px; letter-spacing: 0.14em; color: var(--ink-soft); margin-top: 4px; text-transform: uppercase; }

.globe-hint { grid-area: hint; font-size: 14px; color: var(--ink-soft); margin: 10px 0 0; visibility: hidden; min-height: 1.6em; }
.is-live .globe-hint { visibility: visible; }

/* the list: always plain HTML, same links as the labels */
.globe-list-wrap { grid-area: list; }
.globe-list-wrap h2 { margin: 0 0 8px; font-size: 22px; }
.globe-list { list-style: none; margin: 0; padding: 0; counter-reset: loc; }
.globe-list li {
  counter-increment: loc;
  border-top: 1px solid var(--black);
  padding: 10px 0 10px 40px;
  position: relative;
}
.globe-list li::before {
  content: counter(loc);
  position: absolute; left: 0; top: 12px;
  width: 26px; height: 26px;
  border: 1px solid var(--rust); border-radius: 50%;
  color: var(--rust);
  font-family: var(--geo); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.globe-list > li > a { display: inline-block; min-height: 28px; font-size: 17px; }
.globe-list .pos { display: block; font-size: 14px; color: var(--ink-soft); }
.globe-list-wrap .note { margin-top: 12px; }

@media (max-width: 860px) {
  .detail-globe {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "frame" "caption" "hint" "list";
    max-width: 560px;
  }
  .globe-list-wrap { margin-top: 24px; }
}
@media (max-width: 480px) {
  .detail-frame { padding: 6px; }
  .detail-bubble { width: 66px; height: 66px; }
  .detail-bubble .bubble-ref { font-size: 10px; }
  .detail-title .t { font-size: 16px; letter-spacing: 0.1em; }
  /* phones: the floating label shrinks to its list number, a callout bubble; the list
     under the globe gives the place and year with the same link */
  .globe-label { width: 24px; height: 24px; padding: 0; border-radius: 50%; border-color: var(--rust);
    color: var(--rust); font-family: var(--geo); font-size: 14px; display: flex; align-items: center; justify-content: center; }
  .globe-label .n { display: inline; }
  .globe-label .t { display: none; }
  .globe-label--above { translate: -50% -6px; }
  .globe-label--below { translate: -50% 6px; }
  .globe-label--left { translate: -6px -50%; }
  .globe-label--right { translate: 6px -50%; }
}
@media (prefers-reduced-motion: reduce) {
  .globe-canvas, .globe-fallback, .globe-label { transition: none; }
}
