/* ============================================================
   ashwinyadav.com — Search, Services Sidebar & Case Study
   Filter Enhancements  (append to main.css)
   Phase 1: Global search overlay
   Phase 2: Services sticky sidebar + topic tag filter
   Phase 3: Case study URL-param filter indicator
   ============================================================ */


/* ══════════════════════════════════════════════════════════════
   PHASE 1 — GLOBAL SEARCH OVERLAY
   ══════════════════════════════════════════════════════════════ */

/* ── Nav search button ─────────────────────────────────────── */
#search-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-dark-strong);
  background: transparent;
  color: var(--text-dark-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  margin-right: 8px;
}

#search-nav-btn:hover {
  background: var(--dark-3);
  color: var(--text-dark);
  border-color: var(--border-dark-strong);
}

/* Mobile search button in mobile nav */
.search-mobile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 24px;
  background: none;
  border: none;
  border-top: 1px solid var(--border-dark);
  color: var(--text-dark-muted);
  font-family: var(--sans);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s;
  margin-top: 4px;
}

.search-mobile-btn:hover { color: var(--text-dark); }

/* ── Overlay backdrop ──────────────────────────────────────── */
#search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease);
}

#search-overlay.open {
  opacity: 1;
  pointer-events: all;
}

#search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 26, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* ── Search modal ──────────────────────────────────────────── */
#search-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 20px;
  background: var(--dark-2);
  border: 1px solid var(--border-dark-strong);
  border-radius: 14px;
  overflow: hidden;
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.2s var(--ease-out);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

#search-overlay.open #search-modal {
  transform: translateY(0) scale(1);
}

/* ── Input row ─────────────────────────────────────────────── */
#search-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-dark);
}

#search-icon {
  color: var(--text-dark-muted);
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text-dark);
  caret-color: var(--cyan);
}

#search-input::placeholder { color: var(--text-dark-muted); }

/* Hide browser-default clear button on search type inputs */
#search-input::-webkit-search-cancel-button { display: none; }

#search-esc {
  font-family: var(--sans);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--border-dark-strong);
  color: var(--text-dark-muted);
  background: var(--dark-3);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
}

/* ── Results container ─────────────────────────────────────── */
#search-results {
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Group label ───────────────────────────────────────────── */
.sr-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dark-dim);
  padding: 12px 18px 4px;
}

/* ── Individual result item ────────────────────────────────── */
.sr-item {
  border-bottom: 1px solid var(--border-dark);
}

.sr-item:last-child { border-bottom: none; }

.sr-item a {
  display: block;
  padding: 11px 18px;
  text-decoration: none;
  transition: background 0.12s;
}

.sr-item a:hover,
.sr-item.active a {
  background: var(--dark-3);
}

.sr-item-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}

.sr-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.35;
}

.sr-title mark {
  background: transparent;
  color: var(--cyan);
  font-weight: 600;
}

.sr-cat {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.sr-excerpt {
  font-size: 12px;
  color: var(--text-dark-muted);
  margin-top: 3px;
  line-height: 1.45;
}

.sr-excerpt mark {
  background: transparent;
  color: var(--cyan);
  font-weight: 500;
}

/* ── Empty / no results state ─────────────────────────────── */
#search-empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--text-dark-muted);
  font-size: 14px;
}

#search-empty svg { margin: 0 auto 12px; display: block; }
#search-empty strong { color: var(--text-dark); }

/* ── Hints (shown when input is empty) ─────────────────────── */
#search-hints {
  padding: 16px 18px 20px;
}

.sh-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dark-dim);
  margin-bottom: 10px;
}

.sh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sh-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--dark-3);
  border: 1px solid var(--border-dark-strong);
  color: var(--text-dark-muted);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.14s;
}

.sh-chip:hover {
  background: var(--dark-4);
  color: var(--text-dark);
  border-color: var(--cyan-border);
}

/* ── Footer shortcut hints ─────────────────────────────────── */
#search-footer {
  display: flex;
  gap: 16px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-dark);
  font-size: 11px;
  color: var(--text-dark-dim);
}

#search-footer kbd {
  display: inline-block;
  background: var(--dark-3);
  border: 1px solid var(--border-dark-strong);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--sans);
  font-size: 10px;
  color: var(--text-dark-muted);
  margin-right: 2px;
}

/* ── Prevent body scroll while search is open ──────────────── */
body.search-open { overflow: hidden; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 640px) {
  #search-overlay { padding-top: 60px; }
  #search-modal { margin: 0 12px; border-radius: 12px; }
  #search-results { max-height: 60vh; }
  #search-footer { display: none; }

  /* Tighter button on very narrow screens */
  #search-nav-btn {
    width: 32px;
    height: 32px;
    margin-right: 2px;
  }
}


/* ══════════════════════════════════════════════════════════════
   PHASE 2 — SERVICES PAGE SIDEBAR + TOPIC FILTER
   ══════════════════════════════════════════════════════════════ */

/* ── Services layout wrapper (sidebar + main) ──────────────── */
#services-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
  align-items: start;
}

/* ── Sticky sidebar ────────────────────────────────────────── */
#services-sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  padding-right: 24px;
  border-right: 1px solid var(--border-light);
}

.ssb-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light-dim);
  margin-bottom: 14px;
}

#services-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ssb-link {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-light-muted);
  text-decoration: none;
  transition: background 0.14s, color 0.14s;
  line-height: 1.35;
}

.ssb-link:hover {
  background: var(--light-2);
  color: var(--text-light);
}

.ssb-link.active {
  background: var(--navy-light);
  color: var(--navy);
  font-weight: 500;
}

.ssb-divider {
  height: 1px;
  background: var(--border-light);
  margin: 16px 0;
}

.ssb-cta {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 6px;
  transition: background 0.14s;
}

.ssb-cta:hover { background: var(--navy-light); }

/* ── Topic tag filter bar ──────────────────────────────────── */
#topic-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.topic-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-light-strong);
  background: transparent;
  color: var(--text-light-muted);
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.15s;
}

.topic-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

.topic-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

/* ── Mobile pill scroll nav ────────────────────────────────── */
#services-mobile-nav {
  display: none; /* hidden on desktop */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  padding: 0 24px 16px;
  margin: 0 -24px;
  white-space: nowrap;
}

#services-mobile-nav::-webkit-scrollbar { display: none; }

.smn-pill {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--light-2);
  border: 1px solid var(--border-light);
  color: var(--text-light-muted);
  font-size: 12px;
  text-decoration: none;
  transition: all 0.14s;
  white-space: nowrap;
}

.smn-pill:hover {
  background: var(--navy-light);
  border-color: var(--navy);
  color: var(--navy);
}

/* ── Mobile layout (collapse sidebar) ──────────────────────── */
@media (max-width: 900px) {
  #services-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  #services-sidebar {
    display: none;
  }

  /* Mobile pill nav hidden — topic filter row covers this role */
  #services-mobile-nav {
    display: none !important;
  }

  #topic-filter-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    /* Negative margin so chips bleed to screen edge, fade hint */
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  #topic-filter-bar::-webkit-scrollbar { display: none; }
  .topic-btn { white-space: nowrap; }
}


/* ══════════════════════════════════════════════════════════════
   PHASE 3 — CASE STUDIES FILTER ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */

/* ── Active filter indicator bar ─────────────────────────────  */
#cs-active-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--navy-light);
  border: 1px solid rgba(30,58,138,0.15);
  border-radius: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.caf-label {
  font-size: 13px;
  color: var(--navy);
}

.caf-label strong { font-weight: 600; }

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

.caf-share-btn,
.caf-clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--sans);
  cursor: pointer;
  transition: all 0.14s;
  border: 1px solid;
}

.caf-share-btn {
  background: transparent;
  border-color: rgba(30,58,138,0.3);
  color: var(--navy);
}

.caf-share-btn:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.caf-clear-btn {
  background: transparent;
  border-color: rgba(30,58,138,0.25);
  color: var(--text-light-muted);
}

.caf-clear-btn:hover {
  background: var(--light-2);
  color: var(--text-light);
  border-color: var(--border-light-strong);
}

/* ── Share view button in filter bar ─────────────────────────  */
.cs-share-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  font-style: italic;
  opacity: 0.75;
}

.cs-share-btn:hover { opacity: 1; }

/* ── Card highlight on anchor deep-link ─────────────────────  */
.case-study-card.cs-highlight {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  transition: outline 0.4s ease-out;
}

/* ── URL param filter — "Share view" button responsive ───────  */
@media (max-width: 640px) {
  .cs-share-btn { display: none !important; }
  #cs-active-filter { flex-direction: column; align-items: flex-start; }
}


/* ── Hide audience filter on mobile — topic filter covers it ── */
@media (max-width: 640px) {
  .audience-filter {
    display: none !important;
  }
}


/* ── Prevent horizontal overflow globally on mobile ─────────── */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }

  /* Services page — ensure section inner doesn't overflow */
  .section-inner {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* Service card — ensure card doesn't exceed viewport */
  .service-detail-card {
    border-radius: 10px;
  }

  /* Right panel pricing area — smaller text to fit */
  .sdc-price { font-size: 16px; }

  /* CTA button in card — full width feels better on mobile */
  .sdc-cta {
    padding: 13px;
    font-size: 13px;
  }

  /* Section header text — scale down */
  .section-title { font-size: clamp(26px, 6vw, 38px); }
}
