/* created 2026-07-12 */
/* HQ v4 shared chrome. Namespaced hqc-. Must survive hostile page CSS. */

@font-face {
  font-family: 'Fast Sans';
  src: url('/assets/fonts/Fast_Sans.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'Fast Mono';
  src: url('/assets/fonts/Fast_Mono.ttf') format('truetype');
  font-display: swap;
}

/* ===== Bar ===== */
#hqc-bar {
  all: initial;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  z-index: 2147482000;
  background: #f6f3ec;
  border-bottom: 1px solid #e3dccb;
  color: #211d16;
  padding: 8px 14px;
  font-family: 'Fast Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  width: 100%;
}

#hqc-bar * {
  box-sizing: border-box;
}

#hqc-menu {
  all: unset;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fast Mono', monospace;
  font-size: 18px;
  color: #211d16;
  cursor: pointer;
  border-radius: 8px;
  flex-shrink: 0;
}

#hqc-menu:hover {
  background: #f3e7d3;
}

#hqc-trail {
  font-family: 'Fast Mono', monospace;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}

#hqc-trail a.hqc-crumb {
  color: #1d4ed8;
  text-decoration: none;
}

#hqc-trail a.hqc-crumb:hover {
  text-decoration: underline;
}

#hqc-trail .hqc-sep {
  color: #6b6357;
}

#hqc-trail .hqc-current {
  color: #b45309;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hqc-stamp {
  font-family: 'Fast Mono', monospace;
  font-size: 11px;
  color: #6b6357;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 480px) {
  #hqc-stamp {
    display: none;
  }
}

/* ===== Sidebar (drawer, default state on all pages) ===== */
#hqc-side {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  width: 248px;
  height: 100vh;
  background: #ffffff;
  border-right: 1px solid #e3dccb;
  z-index: 2147482500;
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
  font-family: 'Fast Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #211d16;
}

#hqc-side * {
  box-sizing: border-box;
}

#hqc-side.hqc-open {
  transform: translateX(0);
}

#hqc-scrim {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  background: rgba(33, 29, 22, 0.35);
  z-index: 2147482400;
  display: none;
}

#hqc-scrim.hqc-open {
  display: block;
}

.hqc-side-brand {
  font-family: 'Fast Mono', monospace;
  font-weight: bold;
  font-size: 14px;
  color: #211d16;
  padding: 20px 20px 16px;
  letter-spacing: 0.5px;
}

.hqc-side-group {
  margin-bottom: 20px;
}

.hqc-side-group-label {
  font-family: 'Fast Mono', monospace;
  font-size: 11px;
  color: #6b6357;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 20px 8px;
  display: block;
}

.hqc-side-item {
  display: block;
  padding: 10px 20px;
  color: #211d16;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hqc-side-item:hover {
  background: #f3e7d3;
}

.hqc-side-item.hqc-active {
  border-left-color: #b45309;
  background: #f3e7d3;
  color: #b45309;
}

.hqc-side-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid #e3dccb;
  margin-top: 8px;
}

.hqc-pin-btn {
  all: unset;
  box-sizing: border-box;
  font-family: 'Fast Mono', monospace;
  font-size: 11px;
  color: #6b6357;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid #e3dccb;
  border-radius: 6px;
  display: inline-block;
}

.hqc-pin-btn:hover {
  background: #f3e7d3;
  color: #211d16;
}

/* ===== Pinned mode (>=1200px, page mode "pinned", localStorage hqcPin != "0") ===== */
@media (min-width: 1200px) {
  html.hqc-pinned #hqc-side {
    transform: translateX(0);
  }

  html.hqc-pinned body {
    margin-left: 248px !important;
  }

  html.hqc-pinned #hqc-scrim {
    display: none !important;
  }
}

/* ===== Hover card (.hqc-card) ===== */
#hqc-popover {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  z-index: 2147483000;
  background: #ffffff;
  border: 1px solid #e3dccb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(33, 29, 22, 0.12);
  max-width: 300px;
  padding: 12px 14px;
  font-family: 'Fast Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: none;
}

#hqc-popover.hqc-visible {
  display: block;
}

#hqc-popover .hqc-pop-title {
  font-family: 'Fast Mono', monospace;
  font-size: 12px;
  color: #b45309;
  margin-bottom: 6px;
}

#hqc-popover .hqc-pop-body {
  font-size: 13px;
  color: #211d16;
  line-height: 1.4;
}

#hqc-popover .hqc-pop-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: #1d4ed8;
  text-decoration: none;
}

#hqc-popover .hqc-pop-link:hover {
  text-decoration: underline;
}

/* ===== Modal viewer ===== */
#hqc-viewer-backdrop {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  background: rgba(33, 29, 22, 0.45);
  z-index: 2147483200;
  display: none;
  align-items: center;
  justify-content: center;
}

#hqc-viewer-backdrop.hqc-visible {
  display: flex;
}

#hqc-viewer {
  all: initial;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 12px;
  width: min(960px, 94vw);
  height: min(84vh, 900px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  font-family: 'Fast Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
}

#hqc-viewer * {
  box-sizing: border-box;
}

.hqc-viewer-titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #e3dccb;
  background: #f6f3ec;
  font-family: 'Fast Mono', monospace;
  font-size: 12px;
  color: #6b6357;
  flex-shrink: 0;
}

.hqc-viewer-chain {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hqc-viewer-btn {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  color: #6b6357;
  font-family: 'Fast Mono', monospace;
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
}

.hqc-viewer-btn:hover {
  background: #f3e7d3;
  color: #211d16;
}

.hqc-viewer-body {
  flex: 1 1 auto;
  overflow: auto;
  position: relative;
}

.hqc-viewer-body iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.hqc-viewer-md {
  padding: 28px 32px;
  font-size: 14px;
  line-height: 1.6;
  color: #211d16;
  max-width: 760px;
  margin: 0 auto;
}

.hqc-viewer-md h1, .hqc-viewer-md h2, .hqc-viewer-md h3,
.hqc-viewer-md h4, .hqc-viewer-md h5, .hqc-viewer-md h6 {
  font-family: 'Fast Mono', monospace;
  color: #211d16;
  margin: 20px 0 10px;
  line-height: 1.3;
}

.hqc-viewer-md h1 { font-size: 24px; }
.hqc-viewer-md h2 { font-size: 20px; }
.hqc-viewer-md h3 { font-size: 17px; }
.hqc-viewer-md h4, .hqc-viewer-md h5, .hqc-viewer-md h6 { font-size: 14px; }

.hqc-viewer-md p {
  margin: 0 0 14px;
}

.hqc-viewer-md code {
  font-family: 'Fast Mono', monospace;
  background: #f3e7d3;
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 13px;
}

.hqc-viewer-md pre {
  background: #211d16;
  color: #f6f3ec;
  padding: 14px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 14px;
}

.hqc-viewer-md pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.hqc-viewer-md ul, .hqc-viewer-md ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.hqc-viewer-md li {
  margin-bottom: 6px;
}

.hqc-viewer-md a {
  color: #1d4ed8;
  text-decoration: none;
}

.hqc-viewer-md a:hover {
  text-decoration: underline;
}

.hqc-viewer-md blockquote {
  border-left: 3px solid #b45309;
  padding: 4px 0 4px 14px;
  color: #6b6357;
  margin: 0 0 14px;
}

.hqc-viewer-md hr {
  border: none;
  border-top: 1px solid #e3dccb;
  margin: 20px 0;
}

.hqc-viewer-md table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 14px;
  font-size: 13px;
}

.hqc-viewer-md th, .hqc-viewer-md td {
  border: 1px solid #e3dccb;
  padding: 6px 10px;
  text-align: left;
}

.hqc-viewer-md th {
  background: #f6f3ec;
  font-family: 'Fast Mono', monospace;
}

.hqc-viewer-state {
  padding: 40px 20px;
  text-align: center;
  color: #6b6357;
  font-size: 13px;
}

.hqc-viewer-state a {
  color: #1d4ed8;
  text-decoration: none;
}

.hqc-viewer-state a:hover {
  text-decoration: underline;
}

/* Minimized pill */
#hqc-viewer-pill {
  all: initial;
  box-sizing: border-box;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483100;
  display: none;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e3dccb;
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 8px 24px rgba(33, 29, 22, 0.15);
  font-family: 'Fast Mono', monospace;
  font-size: 12px;
  color: #211d16;
  cursor: pointer;
  max-width: 260px;
}

#hqc-viewer-pill.hqc-visible {
  display: flex;
}

#hqc-viewer-pill .hqc-pill-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Mobile full-screen viewer ===== */
@media (max-width: 375px) {
  #hqc-viewer-backdrop.hqc-visible {
    padding: 0;
  }

  #hqc-viewer {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
}

/* ===== Iframe embed detection: chrome self-hides ===== */
html.hqc-embed #hqc-bar,
html.hqc-embed #hqc-side,
html.hqc-embed #hqc-scrim {
  display: none !important;
}

html.hqc-embed body {
  margin-left: 0 !important;
}
