.sidebar {
  width: 380px;
  min-width: 380px;
  background: #252829;
  color: #e8e8e8;
  display: flex;
  flex-direction: column;
  padding: 64px 48px 56px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-top { flex: 1; }

.avatar {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  margin-bottom: 28px;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sidebar-name {
  font-size: 1em;
  font-weight: 400;
  color: #ffffff;
  margin-bottom: 14px;
  line-height: 1.3;
}

.sidebar-bio {
  font-size: 0.9375em;
  color: #9a9a9e;
  line-height: 1.7;
  margin-bottom: 36px;
}

.sidebar-bio a {
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.sidebar-bio a:hover { text-decoration: underline; }

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.sidebar-nav li a {
  display: block;
  font-size: 1.05em;
  color: #ffffff;
  padding: 6px 0;
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 720px) {
  .sidebar {
    display: none;
  }
}

/* ── Mobile top bar ─────────────────────────────────────── */

.mobile-topbar {
  display: none;
}

@media (max-width: 720px) {
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: #252829;
    padding: 0 20px;
    z-index: 300;
    box-sizing: border-box;
  }

  .mobile-topbar-name {
    font-size: 0.92em;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
  }

  .mobile-topbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .mobile-search-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #9a9a9e;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.15s;
  }

  .mobile-search-btn:hover { color: #fff; }

  .mobile-hamburger {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
  }

  .mobile-hamburger span {
    display: block;
    height: 2px;
    background: #9a9a9e;
    border-radius: 2px;
    transition: all 0.2s ease;
    transform-origin: center;
  }

  .mobile-hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
    background: #fff;
  }
  .mobile-hamburger.open span:nth-child(2) {
    opacity: 0;
  }
  .mobile-hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
    background: #fff;
  }

  /* Nav drawer */
  .mobile-nav-drawer {
    position: fixed;
    top: 52px;
    left: 0; right: 0;
    background: #252829;
    z-index: 299;
    padding: 8px 0 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    animation: drawerSlide 0.18s ease;
  }

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

  .mobile-nav-drawer[hidden] { display: none; }

  .mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-nav-list li a {
    display: block;
    padding: 12px 20px;
    font-size: 0.95em;
    color: #9a9a9e;
    text-decoration: none;
    transition: color 0.15s;
  }

  .mobile-nav-list li a:hover,
  .mobile-nav-list li a.active {
    color: #ffffff;
  }
}

/* ── Sidebar bottom (search icon) ───────────────────────── */

.sidebar-bottom {
  padding-top: 32px;
}

.search-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  padding: 10px;
  cursor: pointer;
  color: #9a9a9e;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.search-btn:hover,
.search-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ── Search overlay ─────────────────────────────────────── */

.search-overlay {
  position: fixed;
  top: 0;
  left: 380px;
  right: 0;
  bottom: 0;
  background: #ffffff;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-overlay[hidden] {
  display: none;
}

.search-inner {
  width: 70%;
  padding-left: 56px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.search-header {
  padding: 60px 0 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 2px;
  padding: 8px 12px;
  transition: border-color 0.15s;
}

.search-input-wrap:focus-within {
  border-color: #c8c8c8;
}

.search-input-icon {
  color: #aaa;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  font-family: inherit;
  font-size: 1.1em;
  color: #1a1a1a;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  caret-color: #1a1a1a;
  text-decoration: none;
  -webkit-text-decoration: none;
}

.search-input::placeholder {
  color: #bbb;
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-esc-hint {
  font-family: inherit;
  font-size: 0.7em;
  color: #bbb;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 2px 6px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  margin-left: 16px;
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 80px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.search-results::-webkit-scrollbar {
  display: none;
}

.search-status {
  font-size: 0.9em;
  color: #888;
  margin-top: 32px;
}

.search-error {
  color: #c0392b;
}

.search-count {
  font-size: 0.8em;
  color: #aaa;
  margin-bottom: 12px;
}

.search-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-item {
  border-top: 1px solid #ebebeb;
}

.search-item:last-child {
  border-bottom: 1px solid #ebebeb;
}

.search-item-link {
  display: block;
  padding: 16px 0;
  text-decoration: none;
  color: inherit;
}

.search-item-link:hover {
  text-decoration: none;
}

.search-item-link:hover .search-item-title {
  text-decoration: underline;
  text-decoration-color: #1a1a1a;
  text-underline-offset: 3px;
}

.search-item-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.search-item-title {
  font-size: 0.9875em;
  color: #1a1a1a;
  line-height: 1.4;
  flex: 1;
}

.search-item-title mark {
  background: #fff3bf;
  color: #1a1a1a;
  border-radius: 2px;
  padding: 0 1px;
}

.search-badge {
  font-size: 0.7em;
  padding: 1px 7px;
  border-radius: 3px;
  border: 1px solid #e0e0e0;
  color: #888;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge-newsletter {
  border-color: #d0e4ff;
  color: #5b8dee;
}

.search-item-meta {
  font-size: 0.8em;
  color: #aeaeb2;
  margin-bottom: 6px;
}

.search-item-snippet {
  font-size: 0.84em;
  color: #666;
  line-height: 1.6;
}

.search-item-snippet mark {
  background: #fff3bf;
  color: #1a1a1a;
  border-radius: 2px;
  padding: 0 1px;
}

@media (max-width: 720px) {
  .search-overlay {
    left: 0;
    top: 52px;
  }

  .search-inner {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
  }

  .search-header {
    padding: 32px 0 20px;
  }

  .search-results {
    padding: 20px 0 40px;
  }
}
