/* Shared study header for pages that use older local tool shells. */
.study-header {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid rgba(215, 222, 234, 0.92) !important;
  border-radius: 0 !important;
  background: rgba(244, 247, 251, 0.9) !important;
  color: #111827 !important;
  backdrop-filter: blur(16px);
}

.study-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.study-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 20px;
}

.study-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  color: #111827;
  font-family: "Aptos Display", Aptos, "Segoe UI", Arial, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.1;
  text-decoration: none;
}

.study-brand:hover,
.study-brand:focus-visible {
  color: #1236a3;
  text-decoration: none;
}

.study-brand img {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  margin-right: 10px;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.14);
}

.study-nav {
  display: flex !important;
  grid-template-columns: none !important;
  flex-wrap: wrap;
  align-items: center !important;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}

.study-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto !important;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #1535a7;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
}

.study-nav a:hover,
.study-nav a:focus-visible,
.study-nav a[aria-current="page"] {
  border-color: #d7deea !important;
  background: #ffffff !important;
  color: #1236a3 !important;
  text-decoration: none !important;
}

.study-nav a:focus-visible,
.study-brand:focus-visible {
  outline: 3px solid rgba(36, 87, 245, 0.28);
  outline-offset: 3px;
}

.tool-intro {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0 0 18px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
}

.tool-intro h1 {
  margin: 0;
}

.tool-intro .sub,
.tool-intro .page-intro {
  max-width: 72ch;
}

.tool-nav {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 0;
}

.tool-nav .back,
.tool-nav .btn,
.tool-nav .card-button {
  width: auto !important;
}

.tool-nav .back::before,
.tool-nav .btn::before,
.tool-nav .card-button::before {
  content: none !important;
  display: none !important;
}

.tool-nav [aria-current="page"] {
  border-color: #9ac515 !important;
  background: #efffc2 !important;
  color: #111827 !important;
}

body.documentation-page .documentation-header.tool-intro {
  padding: 22px 0 18px;
}

@media (max-width: 680px) {
  .study-shell {
    width: calc(100% - 28px) !important;
    max-width: 1180px;
  }

  .study-header-inner {
    display: grid !important;
    grid-template-columns: 1fr;
    flex-wrap: wrap;
    align-content: center;
    min-height: 119px;
    padding: 12px 0;
    gap: 10px;
  }

  .study-brand,
  .study-nav {
    width: 100%;
  }

  .study-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    justify-content: stretch !important;
  }

  .study-nav a {
    width: 100% !important;
    max-width: none;
    flex: none !important;
    min-width: 0;
    padding: 0 8px;
  }

  .tool-nav .btn,
  .tool-nav .back,
  .tool-nav .card-button {
    width: 100% !important;
    max-width: none;
    flex: none !important;
  }

  .tool-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    align-items: stretch !important;
  }

  .study-header + .wrap {
    width: calc(100% - 32px) !important;
    max-width: 1120px !important;
    padding-right: 0 !important;
    padding-left: 0 !important;
  }
}

@media (max-width: 340px) {
  .study-nav,
  .tool-nav {
    gap: 6px;
  }

  .study-nav a,
  .tool-nav .btn,
  .tool-nav .back,
  .tool-nav .card-button {
    font-size: 0.88rem;
  }
}

/* Keep every header destination available on phones and narrow tablets. */
@media (max-width: 960px) {
  .study-header {
    position: static;
  }

  .study-header .study-header-inner {
    display: flex !important;
    flex-wrap: wrap;
    min-height: 0;
    gap: 8px;
    padding-block: 10px 12px;
  }

  .study-header .study-brand {
    width: 100%;
    min-width: 0;
  }

  .study-header .study-nav {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)) !important;
    align-items: stretch !important;
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .study-header .study-nav a {
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }

  .study-header .study-brand strong {
    white-space: normal;
  }
}
