/* Page chrome (header, card, embed body) mirrors hiking-map's assets/css/map.css so the two subdomains match;
   the canvas palette is the main site's dark skin. */
:root {
  color-scheme: dark;
  --surface-1: #252a34;
  /* what the frame composites to over --surface-1; hollow stars fill with it to hide dots behind them */
  --canvas-bg: #21252d;
  --text-primary: #eaeaea;
  --text-secondary: #b9bcc2;
  --text-muted: #868b94;
  --field: #8a8f98;
  --series-1: #3987e5; /* papers I cite */
  --series-2: #d95926; /* papers citing me */
  --mine: #f4f1e8;
  --glow: rgba(255, 210, 110, 0.9); /* first-author halo */
  /* hiking-map's control tokens */
  --action-btn-bg: rgba(10, 12, 16, 0.81);
  --action-btn-border: rgba(232, 238, 245, 0.18);
  --action-btn-text: rgba(232, 238, 245, 0.95);
  --action-btn-hover-border: rgba(111, 220, 121, 0.55);
  --action-btn-hover-fill: rgba(111, 220, 121, 0.14);
  --focus-ring: 0 0 0 2px rgba(111, 220, 121, 0.35);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--surface-1);
  color: #e6edf3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

/* full page: header + a card that fills the rest of the viewport */
body:not(.embed-body) {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page {
  width: 100%;
  margin: 0;
  padding: 14px 16px 16px;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background: rgba(8, 12, 20, 0.8);
  color: #e8eef5;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(232, 238, 245, 0.12);
}
.site-header .wrap {
  width: 100%;
  margin: 0;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}
.brand-pfp {
  position: relative;
  display: block;
  height: 2.6875rem;
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(232, 238, 245, 0.18);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.brand-pfp:hover,
.brand-pfp:focus-visible {
  border-color: rgba(111, 220, 121, 0.55);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}
.brand-pfp:focus-visible {
  outline: 2px solid #0292ca;
  outline-offset: 3px;
}
.brand-pfp img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}
.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.brand-title {
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: 0.2px;
}
.brand-sub {
  color: rgba(232, 238, 245, 0.7);
  font-size: 0.9rem;
  margin-top: 2px;
}
.brand-title__link,
.brand-title__link:visited,
.brand-title__link:focus {
  color: inherit;
  text-decoration: none;
}
.brand-title__link:hover {
  color: inherit;
  text-decoration: none;
  opacity: 0.82;
}
.brand-title__link:focus-visible {
  outline: 2px solid #0292ca;
  outline-offset: 3px;
  border-radius: 6px;
}
@media (max-width: 500px) {
  .brand-title { font-size: 1rem; }
  .brand-sub { font-size: 0.75rem; }
  .brand-pfp { height: 2.25rem; }
}

/* card around the frame: hiking-map's .embed-card + .pct-shell */
.embed-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(232, 238, 245, 0.12);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

/* embed: the card is the whole iframe, unframed, with one control row above the map */
.embed-body {
  height: 100dvh;
  overflow: hidden;
}
.embed-body .embed-card {
  height: 100dvh;
  border: 0;
  border-radius: 0;
}
.embed-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 40px;
  margin-bottom: 10px;
  gap: 12px;
}
.embed-external {
  height: 36px;
  width: 36px;
  border-radius: 12px;
  border: 1px solid var(--action-btn-border);
  background: var(--action-btn-bg);
  color: var(--action-btn-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  -webkit-tap-highlight-color: transparent;
}
.embed-external:hover {
  border-color: var(--action-btn-hover-border);
  box-shadow: inset 0 0 0 999px var(--action-btn-hover-fill);
}
.embed-external:focus { outline: none; }
.embed-external:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.embed-external__icon {
  display: block;
  width: 16px;
  height: 16px;
  background: url("../icons/arrow-up-right-box-outline.svg") no-repeat center / contain;
}

/* the map frame: hiking-map's .pct-frame; the canvas is absolutely filled so it never depends on % heights */
.topic-map {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(232, 238, 245, 0.12);
  background: var(--canvas-bg);
}
.topic-map__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; cursor: grab; }
.topic-map__canvas:active { cursor: grabbing; }

/* legend + hint overlay; pointer-events off so papers under it stay hoverable */
.topic-map__overlay {
  position: absolute;
  left: 12px;
  bottom: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--action-btn-border);
  background: rgba(10, 12, 16, 0.62);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.topic-map__legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-secondary); }
.topic-map__key { display: inline-flex; align-items: center; gap: 6px; }
.topic-map__swatch { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.topic-map__star { width: 14px; height: 14px; overflow: visible; }
.topic-map__star--first { fill: var(--mine); filter: drop-shadow(0 0 2.5px var(--glow)); }
.topic-map__star--coauthor { fill: none; stroke: var(--mine); stroke-width: 1.3; stroke-linejoin: round; }
.topic-map__hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
@media (max-width: 500px) {
  .topic-map__legend { font-size: 12px; gap: 4px 12px; }
  .topic-map__hint { display: none; }
}

.topic-map__tip { position: absolute; pointer-events: none; max-width: 340px; background: #1b1f27; border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,.4); display: none; }
.topic-map__tip-title { color: var(--text-primary); font-weight: 600; margin-bottom: 4px; }
.topic-map__tip-meta { color: var(--text-secondary); }
.topic-map__tip-kind { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--text-secondary); }
.topic-map__tip-action { margin-top: 6px; color: var(--text-muted); font-size: 12px; }
