/* app-shell.css — Uniflection App chrome. Uses existing CSS custom
   properties from textbook.css and map.css. No hard-coded colors. */

.uf-shell-fixed {
  position: fixed;
  top: 8px;
  z-index: 1050; /* above site-header (z:1000) */
  font-family: "Manrope", "Segoe UI", sans-serif;
}
.uf-shell-right { right: 8px; }
.uf-shell-left  { left: 8px; }

.uf-shell-inline {
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
}

/* T-1.4 / T-6.2 — continue-reading strip on the homepage (#uf-continue-mount).
   Populated by app-continuation.js when the user has reading history; hidden
   for anonymous / fresh visitors. Single-line strip; long titles truncate
   with ellipsis at narrow widths so the strip stays one row at 390px. */
#uf-continue-mount {
  align-items: center;
  gap: 12px;
  padding: 10px 32px;
  border-bottom: 1px solid var(--color-rule, rgba(168, 40, 40, 0.22));
  font-family: 'Newsreader', serif;
  font-size: 13px;
  background: var(--color-page, #fcfbf8);
}
#uf-continue-mount .kind {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--color-accent, #a82828);
  flex-shrink: 0;
}
#uf-continue-mount .title {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-ink, #0a0a08);
  text-decoration: none;
}
#uf-continue-mount .title:hover { text-decoration: underline; }
#uf-continue-mount .percent {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--color-ink-secondary, #2a2a26);
  font-variant-numeric: tabular-nums;
}
#uf-continue-mount .resume {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-accent, #a82828);
  text-decoration: none;
  white-space: nowrap;
}
@media (max-width: 768px) {
  #uf-continue-mount { padding: 8px 16px; gap: 8px; font-size: 12px; }
  #uf-continue-mount .kind { font-size: 9.5px; letter-spacing: 0.14em; }
}

/* Signin / account buttons render as icon-buttons (person SVG) — visual
   styling lives in topnav.css's .icon-btn rules so the chrome matches the
   sibling theme + lang icons. The rules below are state-only (disabled
   opacity) and an authenticated-state accent for the filled-person look. */
.uf-signin-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.uf-account-btn.is-authed {
  color: var(--color-accent, #a82828);
}

.uf-account { position: relative; display: inline-block; }
.uf-account-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-bg, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  min-width: 160px;
  overflow: hidden;
  z-index: 61;
}
.uf-account-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--color-text, #1a1a2e);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.uf-account-item:hover {
  background: var(--color-bg-alt, #f1f5f9);
}

.uf-bookmark {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 55;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border, #e2e8f0);
  background: var(--color-bg, #ffffff);
  color: var(--color-text, #1a1a2e);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.uf-bookmark.active {
  color: var(--color-accent, #2563eb);
}
.uf-bookmark-anon {
  opacity: 0.55;
}
.uf-bookmark-anon:hover {
  opacity: 0.85;
}

.uf-share {
  position: fixed;
  bottom: 16px;
  right: 68px; /* sits to the left of .uf-bookmark */
  z-index: 55;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--color-border, #e2e8f0);
  background: var(--color-bg, #ffffff);
  color: var(--color-text, #1a1a2e);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

@media (max-width: 900px) {
  .uf-bookmark { bottom: 8px; right: 8px; width: 36px; height: 36px; font-size: 1.1rem; }
  .uf-share    { bottom: 8px; right: 54px; width: 36px; height: 36px; font-size: 1rem; }
}

/* On map pages the default bottom-right position collides with the timeline
   slider and legend. Float the buttons at the top-right instead, just below
   the site-header (which is 48px tall, z-index above the map surface). */
body:has(.lm-map-container) .uf-bookmark,
body:has(.gdp-map) .uf-bookmark {
  top: 58px;
  bottom: auto;
  right: 16px;
}
body:has(.lm-map-container) .uf-share,
body:has(.gdp-map) .uf-share {
  top: 58px;
  bottom: auto;
  right: 68px;
}
@media (max-width: 900px) {
  body:has(.lm-map-container) .uf-bookmark,
  body:has(.gdp-map) .uf-bookmark { top: 54px; bottom: auto; right: 8px; }
  body:has(.lm-map-container) .uf-share,
  body:has(.gdp-map) .uf-share { top: 54px; bottom: auto; right: 54px; }
}

/* Mobile-native touch targets: enlarge when inside the native app + pointer coarse. */
@media (max-width: 767px) and (pointer: coarse) {
  .uf-bookmark, .uf-share {
    width: 48px;
    height: 48px;
    font-size: 1.35rem;
  }
}
