/* ============================================================
   PHONEBOOK v3.6 — dense index layout + grid view toggle
   Features: category/year/client filters, back-to-top, empty state,
   touch preview, pagination, list/grid view toggle, dark mode,
   sticky filter bar, subtle admin year hover
   ============================================================ */

/* Apply theme to page */
[data-theme="dark"] body {
  background-color: var(--tt-bg);
  color: var(--tt-text);
}

/* Apply font to entire phonebook */
main.template-phonebook {
  font-family: var(--pb-font);
}

[data-theme="dark"] #container {
  background-color: var(--tt-bg);
}

[data-theme="dark"] main.template-phonebook {
  background-color: var(--tt-bg);
}

[data-theme="dark"] header,
[data-theme="dark"] footer {
  background-color: var(--tt-bg);
}

/* Header logo invert in dark mode */
[data-theme="dark"] header .website-title a img,
[data-theme="dark"] header .title-container img {
  filter: invert(1);
}

/* Nav links in dark mode */
[data-theme="dark"] header nav a {
  color: var(--tt-text);
}

/* ----------------------------
   Main Site Header - Sticky (desktop only)
   ---------------------------- */

@media (min-width: 769px) {
  header.js-nav {
    position: sticky !important;
    top: 0 !important;
    z-index: 200;
    background-color: var(--tt-bg, #fff);
  }
}

/* Tighter header on tablet — save vertical space */
@media (min-width: 769px) and (max-width: 1366px) {
  header.js-nav {
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
  }
}

/* ----------------------------
   Sticky Header for Filter Bar
   ---------------------------- */

#stickyHeader {
  position: sticky;
  top: var(--header-height, 60px);
  z-index: 100;
  background: var(--tt-bg, #fff);
  margin: 0 calc(-1 * var(--pb-pad-x, 20px));
  padding: 12px var(--pb-pad-x, 20px) 0;
}

/* On mobile, main header scrolls away, so sticky filter sticks to top */
@media (max-width: 768px) {
  #stickyHeader {
    top: 0;
  }
}

/* Full-width line + shadow on scroll */
#stickyHeader::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: transparent;
  box-shadow: none;
  transition: background 100ms ease, box-shadow 100ms ease;
  pointer-events: none;
}

#stickyHeader.is-scrolled::after {
  background: var(--tt-border, rgba(0,0,0,0.1));
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="dark"] #stickyHeader.is-scrolled::after {
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

/* ----------------------------
   Scroll to Top Button
   ---------------------------- */

.tt-scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  
  width: 40px;
  height: 40px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  background: var(--tt-bg, #fff);
  border: 1px solid var(--tt-border, rgba(0,0,0,0.18));
  border-radius: 50%;
  
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 100ms ease, visibility 100ms ease, transform 100ms ease, background-color 100ms ease;
}

.tt-scroll-top:hover {
  background: var(--tt-bg-secondary, #f5f5f4);
}

.tt-scroll-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tt-scroll-top svg {
  width: 20px;
  height: 20px;
  color: var(--tt-text, #000);
}

/* ----------------------------
   Nav Theme Toggle (Desktop)
   ---------------------------- */

.tt-nav-theme-item {
  display: flex;
  align-items: center;
}

.tt-nav-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 150ms ease;
}

.tt-nav-theme-toggle:hover {
  opacity: 1;
}

.tt-nav-theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Show moon in light mode, sun in dark mode */
.tt-icon-sun { display: none; }
.tt-icon-moon { display: block; }

[data-theme="dark"] .tt-icon-sun { display: block; }
[data-theme="dark"] .tt-icon-moon { display: none; }

/* Hide on mobile (use filter bar toggle instead) */
@media (max-width: 768px) {
  .tt-nav-theme-item {
    display: none;
  }
}

/* ----------------------------
   Mobile Theme Toggle (in filter bar)
   ---------------------------- */

.toggle-separator {
  width: 1px;
  height: 20px;
  background: var(--tt-border, rgba(0,0,0,0.18));
  margin: 0 4px;
}

.tt-mobile-theme-toggle .theme-icon {
  width: 16px;
  height: 16px;
}

.tt-mobile-theme-toggle .theme-icon--sun { display: none; }
.tt-mobile-theme-toggle .theme-icon--moon { display: block; }

[data-theme="dark"] .tt-mobile-theme-toggle .theme-icon--sun { display: block; }
[data-theme="dark"] .tt-mobile-theme-toggle .theme-icon--moon { display: none; }

/* Hide mobile toggle on desktop */
@media (min-width: 769px) {
  .toggle-separator,
  .tt-mobile-theme-toggle {
    display: none;
  }
}

/* ----------------------------
   Top bar (filters only)
   ---------------------------- */

#topBar {
  padding: 0 10px;
  margin: 6px 0 0 0;
}

/* ----------------------------
   Filter bar (left side)
   ---------------------------- */

#filterWrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.filter-select {
  height: 28px;
  min-width: 80px;
  max-width: 220px;
  padding: 0 28px 0 10px;
  box-sizing: border-box;

  border: 1px solid var(--tt-border);
  border-radius: 2px;
  background: var(--tt-bg);

  font: inherit;
  font-size: 13px;
  color: var(--tt-text);

  cursor: pointer;
  outline: none;

  appearance: none;
  -webkit-appearance: none;
  
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23000' stroke-opacity='0.5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  
  transition: border-color 120ms ease, background-color 120ms ease;
}

[data-theme="dark"] .filter-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23fff' stroke-opacity='0.5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

.filter-select:hover {
  border-color: var(--tt-text-muted);
}

.filter-select:focus {
  border-color: var(--tt-text-muted);
}

.filter-select.is-active {
  background-color: var(--tt-bg-secondary);
  border-color: var(--tt-text-muted);
}

/* Search bar in filter row */
#filterWrapper #searchBar {
  flex: 1;
  min-width: 120px;
  max-width: 200px;
  height: 28px;
  box-sizing: border-box;

  border: 1px solid var(--tt-border);
  border-radius: 2px;
  background: var(--tt-bg);

  padding: 0 12px;

  outline: none;
  box-shadow: none !important;

  font: inherit;
  font-size: 13px;
  line-height: 1.3;

  color: var(--tt-text);

  transition: border-color 120ms ease, background-color 120ms ease;
}

#filterWrapper #searchBar:focus {
  border-color: var(--tt-text-muted);
}

#filterWrapper #searchBar::placeholder {
  color: var(--tt-text-faint);
}

/* remove native search x */
#searchBar::-webkit-search-decoration,
#searchBar::-webkit-search-cancel-button,
#searchBar::-webkit-search-results-button,
#searchBar::-webkit-search-results-decoration {
  display: none;
}
#searchBar[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

/* Clear button - appears after search when filters active */
#searchClear {
  display: flex;
  align-items: center;
  height: 28px; /* Match filter-select height */
  padding: 0 10px;
  margin-left: 4px;
  box-sizing: border-box;

  border: 1px solid var(--tt-border);
  border-radius: 2px;
  background: var(--tt-bg);

  font: inherit;
  font-size: 13px; /* Match filter-select font-size */
  color: var(--tt-text-muted);

  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, opacity 120ms ease;

  /* Hidden by default but reserve space to prevent layout shift */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

#searchClear:hover {
  border-color: rgba(200, 80, 70, 0.6);
  background: rgba(200, 80, 70, 0.06);
  color: rgb(170, 50, 40);
  box-shadow: 0 0 8px rgba(200, 80, 70, 0.2);
}

[data-theme="dark"] #searchClear:hover {
  border-color: rgba(240, 110, 100, 0.55);
  background: rgba(240, 110, 100, 0.08);
  color: rgb(250, 150, 140);
  box-shadow: 0 0 8px rgba(240, 110, 100, 0.18);
}

#searchClear.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  border-color: rgba(200, 80, 70, 0.45);
  color: rgb(180, 60, 50);
  box-shadow: 0 0 6px rgba(200, 80, 70, 0.15);
}

[data-theme="dark"] #searchClear.is-visible {
  border-color: rgba(240, 110, 100, 0.4);
  color: rgb(240, 130, 120);
  box-shadow: 0 0 6px rgba(240, 110, 100, 0.12);
}

/* ----------------------------
   Stats + View toggle row
   ---------------------------- */

#statsRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 12px 10px;
}

#statsSummary {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--tt-text-faint);
}

#statsSummary .stats-separator {
  padding: 0 10px;
  font-weight: 400;
}

/* ----------------------------
   View toggle - icon buttons
   ---------------------------- */

#viewToggle {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#viewToggle .view-toggle-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  
  border: none;
  background: transparent;
  
  cursor: pointer;
  outline: none;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  border-radius: 4px;
  transition: background-color 120ms ease;
}

#viewToggle .view-toggle-btn:hover {
  background: var(--tt-bg-secondary);
}

#viewToggle .view-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--tt-text);
  opacity: 0.35;
  transition: opacity 120ms ease;
}

#viewToggle .view-toggle-btn:hover svg {
  opacity: 0.55;
}

#viewToggle .view-toggle-btn.is-active svg {
  opacity: 0.9;
}


/* ----------------------------
   Loading state (before JS initializes)
   Show skeleton shimmer on the source list
   ---------------------------- */

#pb_list:not([style*="display: none"]) {
  opacity: 0.4;
  pointer-events: none;
}

#pb_list:not([style*="display: none"]) .album-item {
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

/* Loading state during AJAX fetch */
#pb_container.is-loading {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 100ms;
}

/* ----------------------------
   Grid container (list view - default)
   ---------------------------- */

#pb_container {
  --pb-col: 340px;
  --pb-gap: 10px;
  --pb-pad-x: 10px;

  width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: var(--pb-col);
  column-gap: var(--pb-gap);

  padding: 4px var(--pb-pad-x) 12px var(--pb-pad-x);
  padding-right: max(var(--pb-pad-x), env(safe-area-inset-right));
  box-sizing: border-box;

  overflow-x: clip;
  font-family: var(--pb-font);
  font-size: 14px;
  line-height: 1.35;
  
  opacity: 1;
  transition: opacity 150ms ease;
}

#pb_container.is-fading {
  opacity: 0;
}

/* FLIP animation for view transitions */
#pb_container .album-item {
  transition: transform 150ms ease;
}

#pb_container.is-animating .album-item {
  transition: none;
}

/* ----------------------------
   Grid view (thumbnail cards)
   ---------------------------- */

#pb_container.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  grid-auto-flow: row;
  grid-auto-columns: unset;
  gap: 32px 24px;
  
  padding: 4px var(--pb-pad-x) 60px var(--pb-pad-x);
  
  /* Cap width on ultrawide screens and center */
  max-width: var(--website-maxwidth, 1800px);
  margin-left: auto;
  margin-right: auto;
}

/* Grid card */
#pb_container.view-grid .album-item {
  display: block;
}

#pb_container.view-grid a.sitelink {
  display: block;
  text-decoration: none;
  color: inherit;
}

#pb_container.view-grid a.sitelink:hover .card-info {
  color: rgba(0,0,0,0.5);
}

#pb_container.view-grid a.sitelink:hover .card-thumb img {
  opacity: 0.85;
}

#pb_container.view-grid .card-thumb {
  --shimmer-base: #e0e0e0;
  --shimmer-pulse: #d4d4d4;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--shimmer-base);
  margin-bottom: 12px;
  position: relative;
  animation: shimmer 2.4s ease-in-out infinite;
}

[data-theme="dark"] #pb_container.view-grid .card-thumb {
  --shimmer-base: #2a2a2a;
  --shimmer-pulse: #313131;
}

/* Stop shimmer when loaded */
#pb_container.view-grid .card-thumb.is-loaded {
  animation: none;
  background: transparent;
}

@keyframes shimmer {
  0%, 100% { background-color: var(--shimmer-base); }
  50% { background-color: var(--shimmer-pulse); }
}

#pb_container.view-grid .card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 300ms ease;
}

#pb_container.view-grid .card-thumb.is-loaded img {
  opacity: 1;
}

#pb_container.view-grid .card-info {
  display: block;
  font-family: var(--pb-font);
  font-size: 13px;
  line-height: 1.4;
  transition: color 140ms ease;
}

/* Title on first line */
#pb_container.view-grid .card-info .info-title {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Year + Client on second line */
#pb_container.view-grid .card-info .info-meta {
  display: block;
  color: var(--tt-text-muted);
  font-weight: 400;
}

#pb_container.view-grid .card-info .info-year {
  font-weight: 400;
  display: inline;
}

#pb_container.view-grid .card-info .info-year.info-year-admin {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: color 140ms ease, text-shadow 140ms ease;
}

#pb_container.view-grid .card-info .info-year.info-year-admin:hover {
  color: #dc2626;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* Prevent card hover from affecting admin year */
#pb_container.view-grid a.sitelink:hover .info-year.info-year-admin {
  color: inherit;
}

#pb_container.view-grid a.sitelink:hover .info-year.info-year-admin:hover {
  color: #dc2626;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

#pb_container.view-grid .card-info .info-client {
  display: inline;
  font-weight: 400;
  margin-left: 8px;
}

/* Hide list-specific elements in grid view */
#pb_container.view-grid .pb_main,
#pb_container.view-grid .thumbnail {
  display: none;
}

/* Responsive grid columns - one less than before */
@media (min-width: 1600px) {
  #pb_container.view-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1200px) and (max-width: 1599px) {
  #pb_container.view-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 900px) and (max-width: 1199px) {
  #pb_container.view-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 600px) and (max-width: 899px) {
  #pb_container.view-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px 20px;
  }
}

/* Mobile phones - single column */
@media (max-width: 599px) {
  #pb_container.view-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 4px 16px 60px 16px;
  }
  
  #pb_container.view-grid .card-info {
    font-size: 13px;
  }
  
  #pb_container.view-grid .card-thumb {
    margin-bottom: 8px;
  }
}

/* Larger phones / small tablets - two columns */
@media (min-width: 600px) and (max-width: 899px) {
  #pb_container.view-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 16px;
  }
}

.pb_column {
  list-style: none;
  margin: 0;
  padding: 0;
}

#pb_container li.album-item {
  margin: 0;
  padding: 0;
}


/* ----------------------------
   Empty state
   ---------------------------- */

#pb_empty {
  display: none;
  padding: 20px 20px 60px 20px;
  text-align: left;
}

#pb_empty.is-visible {
  display: block;
}

.pb_empty-icon {
  display: none;
}

.pb_empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--tt-text);
  margin: 0 0 8px 0;
}

.pb_empty-query {
  font-style: italic;
}

.pb_empty-subtitle {
  font-size: 14px;
  color: var(--tt-text-muted);
  margin: 0;
}

.pb_empty-link {
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.pb_empty-link:hover {
  color: var(--tt-text);
}


/* ----------------------------
   Rows
   ---------------------------- */

#pb_container a.sitelink {
  display: grid;
  grid-template-columns: max-content 1fr;
  align-items: baseline;

  padding: 0;
  margin-top: -0.25px;
  margin-bottom: -0.25px;

  text-decoration: none;
  color: inherit;
  transition: color 140ms ease;
}

#pb_container a.sitelink:hover {
  color: var(--tt-text-faint);
}

#pb_container a.sitelink:hover .info-year,
#pb_container a.sitelink:hover .info-title,
#pb_container a.sitelink:hover .info-client {
  color: var(--tt-text-faint);
}

.info-year {
  font-weight: 400;
  white-space: nowrap;
  padding-right: 18px;
  line-height: 1.3;
}

/* Admin year - clickable link to edit in admin panel */
.info-year.info-year-admin {
  color: inherit;
  text-decoration: none !important;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: color 140ms ease, text-shadow 140ms ease;
}

.info-year.info-year-admin:hover {
  color: #dc2626;
  text-decoration: none !important;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

/* Prevent parent hover from fading admin year */
#pb_container a.sitelink:hover .info-year.info-year-admin {
  color: inherit;
  text-decoration: none !important;
}

#pb_container a.sitelink:hover .info-year.info-year-admin:hover {
  color: #dc2626;
  text-decoration: none !important;
  text-shadow: 0 0 8px rgba(220, 38, 38, 0.5);
}

.pb_main {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;

  column-gap: 10px;
  row-gap: 0;

  min-width: 0;
  max-width: 100%;
}

.info-title {
  font-weight: 600;
  min-width: 0;

  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;

  line-height: 1.3;
  transition: color 140ms ease;
}

.info-client {
  font-weight: 400;
  min-width: 0;
  color: var(--tt-text-muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;

  line-height: 1.3;
  transition: color 140ms ease;
}

.thumbnail {
  display: none;
}


/* ----------------------------
   Hover thumbnail
   ---------------------------- */

#hoverThumbnail {
  z-index: 9999;
  position: fixed;
  left: -9999px;
  top: -9999px;

  border: 0;
  border-radius: 2px;
  box-shadow: 0 14px 40px rgba(0,0,0,.10);

  width: auto;
  max-width: 380px;
  height: auto;
  max-height: 380px;

  object-fit: contain;

  opacity: 1;
  transition: none;
}

@media (hover:none), (pointer:coarse) {
  #hoverThumbnail {
    display: none !important;
  }
}


/* ----------------------------
   Mobile touch preview modal
   ---------------------------- */

#touchPreview {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  
  opacity: 0;
  transition: opacity 200ms ease;
}

#touchPreview.is-visible {
  display: flex;
  opacity: 1;
}

#touchPreview.is-hiding {
  opacity: 0;
}

#touchPreviewImage {
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

#touchPreviewTitle {
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#touchPreviewHint {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  position: absolute;
  bottom: 30px;
}

@media (hover:hover) and (pointer:fine) {
  #touchPreview {
    display: none !important;
  }
}


/* ----------------------------
   Back to top button
   ---------------------------- */

#backToTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  
  width: 44px;
  height: 44px;
  
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.75);
  color: #fff;
  
  cursor: pointer;
  
  display: flex;
  align-items: center;
  justify-content: center;
  
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  
  transition: opacity 100ms ease, visibility 100ms ease, transform 100ms ease, background-color 100ms ease;
  
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

#backToTop:hover {
  background: rgba(0,0,0,0.9);
}

#backToTop.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#backToTop svg {
  width: 20px;
  height: 20px;
}


/* ----------------------------
   Scroll sentinel (grid infinite scroll)
   ---------------------------- */

#scrollSentinel {
  pointer-events: none;
}


/* ----------------------------
   Responsive
   ---------------------------- */

@media (max-width: 768px) {
  #topBar {
    padding: 0 8px;
  }
  
  #filterWrapper {
    width: 100%;
  }
  
  #statsRow {
    padding: 8px 8px 12px 8px;
  }
  
  .filter-select {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
    max-width: none;
  }
  
  #filterWrapper #searchBar {
    flex: 1 1 100%;
    max-width: none;
    order: 10;
    margin-top: 4px;
  }
  
  #searchClear {
    order: 11;
  }
}

@media (max-width: 520px) {
  #pb_container {
    --pb-gap: 10px;
    --pb-pad-x: 8px;
    font-size: 15px;
    line-height: 1.3;
  }
  
  #backToTop {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  
  #backToTop svg {
    width: 18px;
    height: 18px;
  }
}


/* ----------------------------
   Map view
   ---------------------------- */

/* Hidden by default */
.pb-map {
  display: none;
  position: relative;
}

/* Map view: hide album list, show map full-height */
.view-map #pb_container { display: none; }
.view-map.template-phonebook { display: flex; flex-direction: column; height: calc(100dvh - var(--header-height, 84px)); }
.view-map #stickyHeader { flex-shrink: 0; }

.view-map .pb-map {
  display: block;
  flex: 1;
  min-height: 300px;
}

.view-map #scrollSentinel { display: none; }

.map-admin-link {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tt-text-muted);
  background: var(--tt-bg, #fff);
  border: 1px solid var(--tt-border-strong, rgba(0,0,0,0.15));
  border-radius: 2px;
  text-decoration: none;
  opacity: 0.6;
  transition: opacity 150ms ease;
}

.map-admin-link:hover {
  opacity: 1;
  color: var(--tt-text);
}


/* Admin edit: now uses year as link, no pencil icon */

/* ============================================================
   Footnote asterisk — red * after project count
   ============================================================ */

.pb-asterisk {
  color: #c44;
  font-size: 1.15em;
  line-height: 0;
  vertical-align: super;
  margin-left: 1px;
}

#statsSummary .pb-footnote {
  font-size: 0.75em;
  color: var(--tt-text-faint, #bbb);
}

