/* HUD styles: fixed toolbar with flexible buttons and overlay */
#hud {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  align-items: center;
  gap: 12px;
  background: var(--hud-shell-bg);
  backdrop-filter: blur(6px);
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(18,18,18,0.06);
  transition: transform 240ms cubic-bezier(.2,.9,.3,1), opacity 180ms ease;
}

#hud.hud-hidden {
  transform: translateX(-50%) translateY(120%);
  opacity: 0;
  pointer-events: none;
}

.hud-left, .hud-right { display:flex; gap:8px; align-items:center }
.hud-center { flex: 1 }

.project-close {
  text-decoration: none;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}
.project-header-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
}

:root {
  --hud-overlay-blur: 8px;
  --hud-panel-blur: 24px;
  /* Shared pill metrics (match project header/close) */
  --hud-pill-height: 40px;
  --hud-pill-radius: 999px;
  --hud-pill-bg: rgba(0,0,0,0.04);
  --hud-shell-bg: rgba(0,0,0,0.04); /* HUD shell background */
  --hud-pill-blur: 6px;
  --hud-search-height: var(--hud-pill-height); /* search input + close height */
  --hud-search-padding-x: 20px;
  --hud-pill-gap: 12px;
  /* Icon colour control */
  --hud-icon-color: #505050;
  --hud-icon-hover-color: #111111;
  --hud-font-size: 1.2rem;
  --hud-padding-top: 18px;
}

/* Dark mode link-up: inherit site dark mode via prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root {
    /* darker, slightly more opaque surface in dark mode */
    --hud-shell-bg: rgba(0,0,0,0.35);
    --hud-pill-bg: var(--hud-shell-bg);
    --hud-icon-color: #eaeaea;
    --hud-icon-hover-color: #ffffff;
  }
  .project-header-title { color: #eee; background: var(--hud-shell-bg); }
  .hud-search-input { color: #eee; }
  /* Dark mode: slightly darker backgrounds for overlay panels */
  .hud-overlay .panel.panel--search { background: rgba(0,0,0,0.55); }
  .hud-overlay .panel.panel--about { background: rgba(0,0,0,0.42); }
}

/* Match project title typography from the projects table (home) while keeping a separate class
   This mirrors `.col-project` / `.project-row-inner` typography but can be customized independently. */
.project-header-title {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: #222222;
  letter-spacing: 0;
}
.hud-btn { 
 background: transparent; 
 border: none; 
 cursor: pointer; 
 padding: 6px 10px; 
 border-radius: 6px; }
.hud-btn-pill { 
  background: var(--hud-shell-bg); 
  padding: 6px 10px; 
  font-size: 13px; }
.hud-btn-pill[aria-pressed="true"] { 
  background: var(--hud-shell-bg); 
}

/* plain toggle style for Grid/List: neutral text appearance so SVGs can replace easily */
.hud-toggle {  
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    text-decoration: none;
    color: #505050;
    white-space: nowrap;
    vertical-align: middle;
    background: transparent;
    border: none; 
    padding: 6px 8px; 
    font-size: 13px; 
    color: inherit; 
    cursor: pointer 

}
.hud-toggle[aria-pressed="true"] { font-weight: 600 }

/* Icon buttons: use mask-image so we can recolor via background-color */
.hud-icon {
  --hud-icon-size: 25px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background-color: var(--hud-icon-color);
  border-radius: 999px;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms ease, transform 160ms ease;
}
.hud-icon:hover { background-color: var(--hud-icon-hover-color); }
.hud-icon:active { transform: scale(.92); }

/* Per-icon adaptive contrast classes (set by JS) */
.hud-contrast--dark { /* underlying is dark → use light FG */
  --hud-icon-color: #ffffff;
  --hud-icon-hover-color: #ffffff;
  color: #ffffff !important;
}
.hud-contrast--light { /* underlying is light → use dark FG */
  --hud-icon-color: #111111;
  --hud-icon-hover-color: #000000;
  color: #111111 !important;
}

/* Specific icon masks (ignoring instagram for now) */
.hud-icon--list { -webkit-mask: url(/assets/icons/list.svg) center / 60% no-repeat; mask: url(/assets/icons/list.svg) center / 60% no-repeat; }
.hud-icon--stack { -webkit-mask: url(/assets/icons/stack.svg) center / 60% no-repeat; mask: url(/assets/icons/stack.svg) center / 60% no-repeat; }
.hud-icon--all { -webkit-mask: url(/assets/icons/all.svg) center / 60% no-repeat; mask: url(/assets/icons/all.svg) center / 60% no-repeat; }
.hud-icon--search { -webkit-mask: url(/assets/icons/search.svg) center / 60% no-repeat; mask: url(/assets/icons/search.svg) center / 60% no-repeat; }
.hud-icon--info { -webkit-mask: url(/assets/icons/info.svg) center / 60% no-repeat; mask: url(/assets/icons/info.svg) center / 60% no-repeat; }

/* High contrast / prefers-color-scheme adjustments could go here later */

/* HUD-mounted project header: mirror the pill's translucent, blurred background */
.hud-top-hidden, #hud-top[aria-hidden="true"] { display: none !important; }
.hud-project-top .project-header {
  position: fixed;
  background: transparent;
  top: var(--hud-padding-top);
  left: var(--hud-padding-top);
  right: var(--hud-padding-top);
  z-index: 200;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: var(--hud-search-padding-x);
}

.hud-project-top .project-header-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 400;
  background: var(--hud-shell-bg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  height: var(--hud-pill-height);
  padding-left: 12px;
  padding-right: 12px;
  border-radius: 999px;
  color: #222222;
  display: flex;
  align-items: center;
}

.hud-project-top .project-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--hud-shell-bg);
  -webkit-backdrop-filter: blur(var(--hud-pill-blur));
  backdrop-filter: blur(var(--hud-pill-blur));
  width: calc(var(--hud-pill-height) - .5rem);
  height: var(--hud-pill-height);
  border-radius: var(--hud-pill-radius);
  font-size: var(--hud-font-size);
  line-height: 1;
  text-decoration: none;
  color: inherit;
  margin-right: 0;
  border: none;
  cursor: pointer;
  transition: background 140ms ease;
}

.hud-project-top .project-close:hover { background: rgba(0,0,0,0.06); }
.hud-project-top .project-close:focus { outline: 2px solid rgba(0,0,0,0.08); outline-offset: 4px }

/* Overlay */
/* Hide search button specifically in list view (runtime HUD mode or early preference) */
.hud.hud-mode--list [data-action="overlay"][data-overlay="search"],
html.pref-home-list .hud [data-action="overlay"][data-overlay="search"] {
  display: none !important;
}

/* === HUD Overlay Blur Controls === */


.hud-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(var(--hud-overlay-blur));
  -webkit-backdrop-filter: blur(var(--hud-overlay-blur));
  padding: 24px;
}

.hud-overlay[hidden] { display: none }
.hud-overlay .panel {
  background: var(--hud-panel-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 28px 28px 24px 28px;
  border-radius: 45px;
  width: 50%;
  backdrop-filter: blur(var(--hud-panel-blur));
  -webkit-backdrop-filter: blur(var(--hud-panel-blur));
  position: relative;
  overflow: visible;
}

/* Default modal width for non-search panels: center on page with a readable width */
.hud-overlay .panel:not(.panel--search) {
  width: min(720px, 85vw);
}

.hud-overlay .panel::before {
  content: '';
  position: absolute;
  z-index: 1;
  top: -18px; left: -18px; right: -18px; bottom: -18px;
  border-radius: 22px;
  pointer-events: none;
  background: inherit;
  box-shadow: 0 0 0 18px rgba(255,255,255,0.18);
  filter: blur(18px);
  opacity: 0.7;
}

.hud-overlay .panel > * {
  position: relative;
  z-index: 2;
}

/* === HUD Search Overlay Styles === */
.hud-search-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--hud-search-height);
  height: var(--hud-search-height);
  margin-right: 0;
  border: none;
  background: var(--hud-shell-bg);
  -webkit-backdrop-filter: blur(var(--hud-pill-blur));
  backdrop-filter: blur(var(--hud-pill-blur));
  cursor: pointer;
  font-size: var(--hud-font-size);
  line-height: 1;
  color: #111;
  border-radius: var(--hud-pill-radius);
  transition: background 140ms ease;
}
.hud-search-close:hover { background: rgba(255,255,255,0.75); }
.hud-search-close:focus { outline: 2px solid rgba(0,0,0,0.12); outline-offset: 3px; }


.hud-overlay .panel.panel--search {
  position: fixed;
  background: transparent;
  top: var(--hud-padding-top);
  left: var(--hud-padding-top);
  right: var(--hud-padding-top);
  z-index: 210;
  width: 98%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: var(--hud-search-padding-x);
}
.hud-overlay .panel.panel--search::before { display: none }
.hud-overlay .panel.panel--about::before { display: none }
.hud-search {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0 auto;
  width: 100%;
  
}
.hud-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: calc(100% - var(--hud-search-padding-x));
}

.hud-search-pill {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  Width: 100%;
  background: var(--hud-shell-bg);
  height: var(--hud-pill-height);
  gap: var(--hud-pill-gap);
  padding: 0 var(--hud-search-padding-x);
  background: var(--hud-shell-bg);
  -webkit-backdrop-filter: blur(var(--hud-pill-blur));
  backdrop-filter: blur(var(--hud-pill-blur));
  border-radius: var(--hud-pill-radius);
}
.hud-search-input {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 400;
  font-size:var(--hud-font-size);
  color: #222222;
  padding-left: 5px;
  letter-spacing: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  color: #111;
}
.hud-search-input::placeholder {
  color: #727272;
  font-weight: 400;
}
/* Remove iOS inner shadow/background */
.hud-search-input::-webkit-search-decoration,
.hud-search-input::-webkit-search-cancel-button,
.hud-search-input::-webkit-search-results-button,
.hud-search-input::-webkit-search-results-decoration { display:none }

/* === HUD About Panel Styles (moved from hud-about.css) === */
.hud-about { display:flex; gap:18px; align-items:flex-start }
.hud-about-media img { max-width: 220px; border-radius:6px; display:block }
.hud-about-body { max-width: 760px }
.hud-about h2 { margin:0 0 8px; font-size:18px }
.hud-about-intro { color:#111; line-height:1.6; text-align:center; max-width:680px; margin:0 auto; font-size:1rem; }
.hud-about-intro p { margin:0 0 1.1em; }
.hud-about-intro p:last-child { margin-bottom:0; }

/* Dark mode for About text */
@media (prefers-color-scheme: dark) {
  .hud-about-intro { color: #eee; }
  .hud-about h2 { color: #eee; }
}
.hud-overlay .panel.panel--about {
  /* Transparent card, centered by overlay flex */
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
  padding: 0;
  border: none;
  border-radius: 0;
  position: relative;
  width: min(720px, 85vw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ensure about intro inherits site font and centers text reliably */
.hud-about-intro { font-family: 'Instrument Sans', sans-serif; }
.hud-about-intro p { text-align: inherit; }

/* Accessible hidden label utility (already referenced) */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.hud-search-results {
  display: flex;
  flex-direction: column;
  padding: var(--hud-search-padding-x);
  gap: 0.5rem;
  margin-top: var(--hud-padding-top);
}
.hud-search-item {
  font-family: 'Instrument Sans', sans-serif;
  font-weight: 400;
  font-size: calc(var(--hud-font-size) - 0.2rem);
  color: #222222;
  padding-left: 5px;
  letter-spacing: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  color: #111;
}
.hud-search-item:hover {
  background: #e9e9e9;
}
.hud-search-noresults {
  color: #888;
  font-size: 0.98rem;
  padding: 8px 0;
}

/* Integrated close button inside search pill */


@media (max-width: 720px) {
  /* Keep touch targets and spacing slightly reduced on small tablets/large phones,
     but do NOT change positioning here — that caused the HUD to move to the
     top-left on some viewports and conflict with the mobile bottom-centre rules. */
  #hud { padding: 6px 8px }
  .hud-btn-pill { padding: 6px 8px; font-size: 12px }
  .hud-about { flex-direction:column; align-items:stretch }
  .hud-about-media img { max-width:100% }
}
  

/* Mobile: stick the HUD to bottom as a full-width centered pill with larger tap targets */
@media (max-width: 520px) {
  #hud {
    left: 50%;
    bottom: 12px;
    top: auto;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: none;
    padding: 10px 12px;
    gap: 10px;
  }

  .hud-toggle, .hud-icon { width: 42px; height: 42px; }

  .hud-center { display: none }
}

/* Focus states for accessibility */
.hud-toggle:focus, .hud-icon:focus, .hud-btn:focus { outline: 2px solid rgba(0,0,0,0.08); outline-offset: 4px }
