/*
  Site header, matched to devtron.ai.
  Markup: partials/devtron-header.hbs. Every class uses the "dh-" prefix.
  Breakpoints match devtron.ai: phone < 810px, tablet 810-1279px, desktop >= 1280px.
*/

:root {
  --top-bar-height: 62px;
  --dh-brand: #2f1f9c;
  --dh-cta: #5b45f7;
  --dh-text: #1c1c1f;
  --dh-muted: #697386;
  --dh-pill: #f1f4ff;
  --dh-hover: #eef3ff;
  --dh-line: #e6e8ee;
  --dh-chevron: #9aa1ad;
}

@media (min-width: 810px) {
  :root { --top-bar-height: 66px; }
}

@media (min-width: 1280px) {
  :root { --top-bar-height: 72px; }
}

/* Reset the theme's header chrome; the header is now only a fixed frame. */
.f-header {
  background: #fff;
}

.dh,
:where(.dh) * {
  box-sizing: border-box;
}

.dh {
  position: relative;
  height: 100%;
  background: #fff;
  font-family: Manrope, sans-serif;
  color: var(--dh-text);
  -webkit-font-smoothing: antialiased;
}

:where(.dh) ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

:where(.dh) a {
  color: inherit;
  text-decoration: none;
}

:where(.dh) p {
  margin: 0;
}

/* ---------- Bar ---------- */

.dh-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px;
}

.dh-logo {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  width: 161px;
  height: 33px;
}

/* Light/dark logo pair, driven by the theme's --display-*-logo variables (app.css). */
.dh-logo img.f-logo__image-light { display: var(--display-light-logo, block); }
.dh-logo img.f-logo__image-dark { display: var(--display-dark-logo, none); }

.dh-logo__svg,
.dh-logo__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

/* ---------- Desktop navigation ---------- */

.dh-nav {
  display: none;
  align-self: stretch;
}

.dh-nav__list {
  display: flex;
  height: 100%;
  gap: 18px;
}

.dh-nav__item {
  position: relative;
  display: flex;
  align-items: center;
}

.dh-nav__link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.dh-nav__link:hover,
.dh-nav__link:focus-visible {
  color: #000;
}

.dh-chevron {
  width: 9px;
  height: 6px;
  margin: 0 2px;
  color: var(--dh-chevron);
  transition: transform 0.2s ease;
}

/* ---------- Hover panels ---------- */

.dh-panel {
  position: absolute;
  top: calc(100% + 4px);
  z-index: 10;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

/* Bridge the 4px gap so the panel stays open while the pointer moves to it. */
.dh-panel::before {
  content: "";
  position: absolute;
  inset: -8px 0 auto;
  height: 8px;
}

.has-panel:hover > .dh-panel,
.has-panel:focus-within > .dh-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dh-panel--centered {
  left: 50%;
  transform: translate(-50%, -4px);
}

.has-panel:hover > .dh-panel--centered,
.has-panel:focus-within > .dh-panel--centered {
  transform: translate(-50%, 0);
}

.dh-panel--platform {
  left: -217px;
}

.dh-panel--right {
  right: 0;
}

.dh-panel__inner {
  display: flex;
  border: 1px solid var(--dh-line);
  border-radius: 8px;
}

.dh-panel__col {
  padding: 16px 16px 4px;
}

.dh-panel--resources .dh-panel__inner {
  padding-bottom: 27px;
}

.dh-panel--platform .dh-panel__col {
  padding-bottom: 23px;
}

.dh-panel__col + .dh-panel__col {
  border-left: 1px solid var(--dh-line);
}

.dh-panel__col--intro {
  width: 250px;
}

.dh-panel__inner > .dh-panel__list {
  width: 220px;
  padding: 16px;
}

.dh-panel__title {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--dh-muted);
}

.dh-panel__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 188px;
}

.dh-panel__grid {
  display: grid;
  grid-template-columns: repeat(2, 226px);
  gap: 4px 10px;
}

.dh-panel__link {
  display: block;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.dh-panel__link.is-brand {
  color: var(--dh-brand);
}

.dh-panel__link:hover,
.dh-panel__link:focus-visible {
  background: var(--dh-hover);
}

.dh-panel__overview {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: var(--dh-brand);
}

.dh-panel__desc {
  margin-top: 9px;
  font-size: 14px;
  line-height: 20px;
  color: var(--dh-muted);
}

.dh-panel__explore {
  display: inline-flex;
  align-items: center;
  height: 39px;
  margin-top: 22px;
  padding: 0 13px;
  border: 1px solid var(--dh-line);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 41, 0.05);
  font-size: 16px;
  font-weight: 500;
  color: #0f1729;
  transition: background-color 0.15s ease;
}

.dh-panel__explore:hover {
  background: #f7f8fa;
}

/* ---------- Actions ---------- */

.dh-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dh-search {
  display: none;
  position: relative;
}

.dh-search.enabled {
  display: block;
}

.dh-search .f-icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--dh-text);
}

.dh-search .f-icon-button:hover {
  background: var(--dh-pill);
}

/* Same 20px stroke icon as devtron.ai, in place of the theme's icon-font glyph. */
.dh-search .icon-search::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dh .dh-search .f-search {
  top: calc(100% + 10px);
  right: 0;
  bottom: auto;
  left: auto;
}

.dh-github {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--dh-pill);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  transition: background-color 0.15s ease;
}

.dh-github:hover {
  background: #e6ebff;
}

.dh-github__icon {
  width: 18px;
  height: 18px;
}

/* custom.js writes "5.6K"; devtron.ai shows "5.6k". */
.dh-github__count {
  text-transform: lowercase;
}

.dh-demo {
  display: none;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 8px 13px;
  border-radius: 10px;
  background: var(--dh-brand);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.dh .dh-demo {
  color: #f7f8f8;
}

.dh-demo:hover {
  background: #24177f;
}

.dh-demo__arrow {
  width: 24px;
  height: 20px;
}

.dh-account {
  position: relative;
  display: flex;
  align-items: center;
  height: 40px;
}

.dh-account__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--dh-pill);
}

.dh-account__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Menu button ---------- */

.dh-burger {
  position: relative;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.dh-burger__line {
  position: absolute;
  left: 8px;
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--dh-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.dh-burger__line:nth-child(1) { top: 11px; }
.dh-burger__line:nth-child(2) { top: 17px; }
.dh-burger__line:nth-child(3) { top: 23px; }

.dh.is-open .dh-burger__line:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.dh.is-open .dh-burger__line:nth-child(2) { opacity: 0; }
.dh.is-open .dh-burger__line:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Drawer (tablet and phone) ---------- */

.dh-drawer {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  max-height: calc(100vh - var(--top-bar-height));
  max-height: calc(100dvh - var(--top-bar-height));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 9px 20px 25px;
  background: #fff;
  box-shadow: 0 16px 24px rgba(15, 23, 41, 0.06);
}

.dh.is-open .dh-drawer {
  display: block;
}

.dh-drawer__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  cursor: pointer;
  list-style: none;
}

.dh-drawer__item::-webkit-details-marker {
  display: none;
}

.dh-drawer__item .dh-chevron {
  margin-right: 4px;
}

.dh-acc[open] > .dh-drawer__item .dh-chevron {
  transform: rotate(180deg);
}

.dh-acc__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
}

.dh-acc__link {
  display: block;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 20px;
}

.dh-acc__link:hover,
.dh-acc__link:focus-visible {
  background: var(--dh-hover);
}

.dh-drawer__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  margin-top: 24px;
  padding: 8px 13px;
  border-radius: 10px;
  background: var(--dh-cta);
  font-size: 14px;
  font-weight: 600;
  line-height: 22px;
}

.dh .dh-drawer__cta {
  color: #f7f8f8;
}

/* ---------- Tablet ---------- */

@media (min-width: 810px) {
  .dh-search.enabled { display: block; }
  .dh-demo { display: flex; }
  .dh-drawer { padding: 14px 12px 8px; box-shadow: none; }
  .dh-drawer__item { padding: 6px 4px; }
  .dh-drawer__cta { display: none; }
}

@media (max-width: 809px) {
  .dh-search,
  .dh-search.enabled { display: none; }
}

/* ---------- Desktop ---------- */

@media (min-width: 1280px) {
  .dh-bar { padding: 12px 36px; }
  .dh-logo { width: 205px; height: 42px; }
  .dh-nav { display: block; }
  .dh-burger,
  .dh.is-open .dh-drawer { display: none; }
}
