/* ============================================================================
   IDENTITY BAR: replaces the fixed 275px sidebar column.
   Same markup, same toggle (script.js): the sidebar becomes a slim top row and
   the contact list drops down from a "Contacts" button. Loaded after
   editorial-craft.css, so it overrides with matching !important.
============================================================================ */

main {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 18px !important;
  max-width: 1200px !important;
  margin: 28px auto 110px !important;
  padding: 0 20px !important;
}

.main-content {
  width: 100% !important;
  min-width: 0;
  margin: 0 !important;
}

main > .sidebar {
  position: relative !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 6px 200px 14px 4px !important; /* right gap clears the fixed theme switcher */
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1.5px dashed var(--border-subtle) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  z-index: 200 !important;
}

.sidebar-telemetry-bar,
.sidebar-tagline,
.sidebar .separator:first-child {
  display: none !important;
}

.sidebar-info {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  flex-wrap: wrap;
  gap: 8px 16px !important;
  text-align: left !important;
  width: 100%;
  margin: 0 !important;
  padding: 0 !important;
  height: auto !important;
}

.sidebar .avatar-box {
  width: 52px !important;
  height: 52px !important;
  margin: 0 !important;
  flex: none;
  border-radius: 50% !important;
  box-shadow: 0 0 0 3px var(--surface-card), 0 0 0 4.5px var(--accent-purple) !important;
}

.sidebar .avatar-box img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
}

.sidebar .info-content {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
  margin: 0 !important;
  min-width: 0;
}

.sidebar .info-content .name {
  margin: 0 !important;
  font-size: 18px !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: nowrap;
}

.sidebar .info-content .article-title {
  margin: 0 !important;
  min-height: 0 !important;
  padding: 2px 10px !important;
  font-size: 11.5px !important;
  line-height: 1.5 !important;
  min-width: 96px;
  text-align: center;
}

.sidebar .open-to-work-badge {
  margin: 0 !important;
  flex: none;
}

/* Contacts button: pushed to the right edge of the bar */
.sidebar .info_more-btn {
  position: static !important;
  margin: 0 0 0 auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  width: auto !important;
  padding: 8px 16px !important;
  border-radius: 999px !important;
  border: 1.5px solid var(--border-strong) !important;
  background: var(--surface-card) !important;
  color: var(--ink-primary) !important;
  box-shadow: 0 3px 0 var(--border-strong) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  cursor: pointer;
}

.sidebar .info_more-btn::before {
  display: none !important;
}

.sidebar .info_more-btn ion-icon {
  transition: transform 0.2s ease;
}

.sidebar.active .info_more-btn ion-icon {
  transform: rotate(180deg);
}

.sidebar .info_more-btn:focus-visible {
  outline: 3px solid var(--accent-purple);
  outline-offset: 3px;
}

/* Contact list becomes a dropdown sheet */
.sidebar .sidebar-info_more {
  display: none !important;
  position: absolute !important;
  top: calc(100% + 10px);
  right: 200px;
  width: min(360px, calc(100vw - 40px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 8px 18px 14px !important;
  background: var(--surface-card) !important;
  border: 1.5px solid var(--border-strong) !important;
  border-radius: 20px !important;
  box-shadow: var(--shadow-offset), 0 24px 50px rgba(20, 20, 22, 0.16) !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 70;
}

.sidebar.active .sidebar-info_more {
  display: block !important;
  animation: craftSheetIn 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes craftSheetIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* Long bio text reads better at a measure; the card is now wider */
.craft-story-body p,
.about-text > p {
  max-width: 72ch;
}

/* ---------------------------------------------------------------- tablet --- */
@media (max-width: 1100px) {
  main > .sidebar { padding-right: 190px !important; }
  .sidebar .sidebar-info_more { right: 190px; }
}

/* ---------------------------------------------------------------- mobile --- */
@media (max-width: 768px) {
  main {
    margin: 64px 0 100px !important;
    padding: 0 12px !important;
    gap: 14px !important;
  }

  main > .sidebar {
    padding: 4px 0 12px !important;
  }

  .sidebar-info {
    display: grid !important;
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas:
      "avatar who search btn"
      "badge  badge badge badge";
    gap: 10px 12px !important;
  }

  .sidebar .avatar-box { grid-area: avatar; width: 46px !important; height: 46px !important; }
  .sidebar .info-content { grid-area: who; }
  .sidebar .open-to-work-badge { grid-area: badge; justify-self: start; }
  .sidebar .craft-pal-bar-btn { grid-area: search; }
  .sidebar .info_more-btn { grid-area: btn; margin: 0 !important; padding: 7px 12px !important; }

  .sidebar .sidebar-info_more {
    right: 0;
    left: 0;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar.active .sidebar-info_more { animation: none; }
  .sidebar .info_more-btn ion-icon { transition: none; }
}

/* Small phones (360px and below): keep the bottom nav on one row and let the role pill show in full. */
@media (max-width: 420px) {
  .navbar-list { flex-wrap: nowrap !important; }
  .navbar-link { padding: 8px 8px !important; font-size: 12px !important; white-space: nowrap !important; }
  .sidebar .info-content { min-width: 0; }
  .sidebar .info-content .article-title { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px !important; padding: 2px 8px !important; }
  .sidebar .info-content .article-title #changing-text { overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 340px) {
  .navbar-link { padding: 8px 3px !important; font-size: 10.5px !important; }
  .navbar-list { gap: 0 !important; }
  .navbar { width: calc(100% - 12px) !important; }
  .sidebar-info { column-gap: 8px !important; }
}
