/*
 * EduAvenues site search: header trigger, search panel, results page.
 * Source of truth: packages/eduavenues-ui/css/site-search.css (synced to each site).
 * Inherits each site's font. Navy for selection, the site's CTA blue for actions.
 */

:root {
  --es-ink: #111827;
  --es-text: #374151;
  --es-muted: #6b7280;
  --es-faint: #9ca3af;
  --es-line: #e5e7eb;
  --es-line-strong: #d1d5db;
  --es-surface: #fff;
  --es-hover: #f5f7fa;
  --es-navy: var(--color-primary, #002e54);
  --es-cta: var(--color-cta, #0070d4);
  --es-cta-hover: var(--color-cta-hover, #005fb3);
  --es-mark: rgb(1 138 253 / 28%);
  --es-backdrop: rgb(0 20 40 / 42%);
  --es-focus: rgb(0 46 84 / 12%);
  --radius-es-none: 0;
  --radius-es-sm: 4px;
  --radius-es: 8px;
  --radius-es-field: 10px;
  --radius-es-panel: 12px;
  --shadow-es-panel: 0 28px 70px -18px rgb(0 20 40 / 38%), 0 2px 6px rgb(0 20 40 / 6%);
  --shadow-es-focus: 0 0 0 3px var(--es-focus);
  --shadow-es-mark: inset 0 -0.34em 0 var(--es-mark);
  --es-app-ink: #030712;
  --es-target: rgb(1 138 253 / 14%);
}

/* Signed-in apps follow the App Kit: near-black selection and actions. */
.es-app {
  --es-navy: var(--es-app-ink);
  --es-cta: var(--es-app-ink);
  --es-cta-hover: var(--es-ink);
}

/* ------------------------------------------------------------------ */
/* Header trigger                                                      */
/* ------------------------------------------------------------------ */

.es-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-width: 36px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--es-line-strong);
  border-radius: var(--radius-es);
  background: var(--es-surface);
  color: var(--es-muted);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.es-trigger:hover {
  border-color: var(--es-faint);
  color: var(--es-ink);
}

.es-trigger:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: 2px;
}

.es-trigger .es-icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.es-trigger-label {
  padding-right: 18px;
}

.es-kbd {
  display: inline-block;
  padding: 3px 5px;
  border: 1px solid var(--es-line);
  border-radius: var(--radius-es-sm);
  color: var(--es-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
}

/* Icon-only on small screens and in tight headers. */
@media (max-width: 1100px) {
  .es-trigger--compact-md .es-trigger-label,
  .es-trigger--compact-md .es-kbd {
    display: none;
  }
  .es-trigger--compact-md {
    padding: 0;
    justify-content: center;
    width: 36px;
  }
}

@media (max-width: 900px), (hover: none) {
  .es-trigger .es-kbd {
    display: none;
  }
}

@media (max-width: 900px) {
  .es-trigger .es-trigger-label {
    display: none;
  }
  .es-trigger {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    border-color: transparent;
    background: transparent;
    color: var(--es-ink);
  }
  .es-trigger .es-icon {
    width: 20px;
    height: 20px;
  }
}

/* ------------------------------------------------------------------ */
/* Panel                                                               */
/* ------------------------------------------------------------------ */

html.es-lock,
html.es-lock body {
  overflow: hidden;
}

.es-root {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  color: var(--es-ink);
}

.es-root[hidden] {
  display: none;
}

.es-backdrop {
  position: absolute;
  inset: 0;
  background: var(--es-backdrop);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.es-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 16vh));
  margin: 11vh auto 0;
  overflow: hidden;
  border: 1px solid var(--es-line);
  border-radius: var(--radius-es-panel);
  background: var(--es-surface);
  box-shadow: var(--shadow-es-panel);
  opacity: 0;
  transform: translateY(-6px) scale(0.995);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.es-root.is-open .es-backdrop {
  opacity: 1;
}

.es-root.is-open .es-panel {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .es-backdrop,
  .es-panel {
    transition: none;
  }
}

.es-bar {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  border-bottom: 1px solid var(--es-line);
}

.es-bar .es-icon {
  position: absolute;
  left: 20px;
  width: 20px;
  height: 20px;
  color: var(--es-muted);
  pointer-events: none;
}

.es-input {
  flex: 1;
  min-width: 0;
  height: 62px;
  padding: 0 12px 0 54px;
  border: 0;
  background: transparent;
  color: var(--es-ink);
  font: inherit;
  font-size: 18px;
  letter-spacing: -0.005em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.es-input::placeholder {
  color: var(--es-faint);
}

.es-input::-webkit-search-cancel-button,
.es-page-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.es-esc {
  flex: none;
  margin-right: 14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--es-muted);
  font: inherit;
  cursor: pointer;
}

.es-esc-key {
  display: inline-block;
  padding: 4px 6px;
  border: 1px solid var(--es-line);
  border-radius: var(--radius-es-sm);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.es-esc-text {
  display: none;
  font-size: 15px;
  color: var(--es-cta);
}

.es-esc:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: 2px;
  border-radius: var(--radius-es-sm);
}

/* Filters: quiet text tabs, navy underline for the active one. */
.es-filters {
  display: flex;
  flex: none;
  gap: 20px;
  padding: 0 20px;
  overflow-x: auto;
  border-bottom: 1px solid var(--es-line);
  scrollbar-width: none;
}

.es-filters::-webkit-scrollbar {
  display: none;
}

.es-filters[hidden],
.es-filters:empty {
  display: none;
}

.es-filter {
  position: relative;
  flex: none;
  padding: 11px 0 10px;
  border: 0;
  background: none;
  color: var(--es-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.es-filter:hover {
  color: var(--es-ink);
}

.es-filter.is-active {
  color: var(--es-navy);
  font-weight: 600;
}

.es-filter.is-active::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--es-navy);
}

.es-filter:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: -2px;
}

.es-count {
  margin-left: 6px;
  color: var(--es-faint);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.es-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 8px;
}

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

.es-group {
  padding: 14px 20px 6px;
  color: var(--es-muted);
  font-size: 12px;
  font-weight: 500;
}

.es-row {
  position: relative;
  margin: 0 8px;
  border-radius: var(--radius-es);
}

.es-row.is-active {
  background: var(--es-hover);
}

.es-link {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding: 10px 12px;
  color: inherit;
  text-decoration: none;
}

.es-link:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: -2px;
  border-radius: var(--radius-es);
}

.es-title {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--es-ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.es-meta {
  grid-column: 2;
  grid-row: 1;
  align-self: baseline;
  color: var(--es-muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.es-sep {
  margin: 0 6px;
  color: var(--es-line-strong);
}

.es-parent {
  grid-column: 1 / span 2;
  margin-top: 2px;
  overflow: hidden;
  color: var(--es-muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.es-snippet {
  grid-column: 1 / span 2;
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--es-text);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

.es-enter {
  display: none;
}

.es-row-recent .es-title {
  font-weight: 500;
}

.es-row-recent .es-link {
  padding-right: 84px;
}

.es-forget {
  position: absolute;
  top: 50%;
  right: 12px;
  padding: 2px 4px;
  border: 0;
  background: none;
  color: var(--es-muted);
  font: inherit;
  font-size: 12px;
  opacity: 0;
  transform: translateY(-50%);
  cursor: pointer;
}

.es-row-recent:hover .es-forget,
.es-row-recent.is-active .es-forget,
.es-forget:focus-visible {
  opacity: 1;
}

.es-row-recent .es-enter {
  display: none;
}

.es-root mark,
.es-page mark {
  padding: 0;
  background: none;
  color: inherit;
  box-shadow: var(--shadow-es-mark);
}

.es-status:empty {
  display: none;
}

.es-status {
  padding: 14px 20px;
  color: var(--es-muted);
  font-size: 14px;
}

.es-empty {
  padding: 26px 20px 20px;
  line-height: 1.6;
}

.es-empty p {
  margin: 0 0 6px;
}

.es-empty-title {
  color: var(--es-ink);
  font-size: 15px;
  font-weight: 600;
}

.es-status a {
  color: var(--es-cta);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.es-dim {
  color: var(--es-faint);
}

.es-foot {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--es-line);
  color: var(--es-muted);
  font-size: 12px;
}

.es-keys kbd {
  display: inline-block;
  min-width: 18px;
  margin: 0 2px;
  padding: 2px 4px;
  border: 1px solid var(--es-line);
  border-radius: var(--radius-es-sm);
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
}

.es-all {
  margin-left: auto;
  color: var(--es-cta);
  font-weight: 600;
  text-decoration: none;
}

.es-all:hover {
  color: var(--es-cta-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.es-all[hidden] {
  display: none;
}

/* Phones: full-height sheet, bigger targets. */
@media (max-width: 700px) {
  .es-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: var(--radius-es-none);
    transform: none;
  }
  .es-input {
    height: 58px;
    padding-left: 48px;
    font-size: 17px;
  }
  .es-bar .es-icon {
    left: 16px;
  }
  .es-esc-key {
    display: none;
  }
  .es-esc-text {
    display: inline;
  }
  .es-filters {
    padding: 0 16px;
  }
  .es-row {
    margin: 0 4px;
  }
  .es-link {
    padding: 12px;
  }
  .es-title {
    grid-column: 1 / span 2;
    white-space: normal;
  }
  .es-meta {
    grid-column: 1 / span 2;
    grid-row: 2;
    margin-top: 2px;
  }
  .es-snippet {
    -webkit-line-clamp: 2;
  }
  .es-keys {
    display: none;
  }
  .es-foot {
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }
}

/* ------------------------------------------------------------------ */
/* Results page                                                        */
/* ------------------------------------------------------------------ */

.es-page {
  max-width: 760px;
  color: var(--es-ink);
}

.es-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.es-page-form {
  display: flex;
  gap: 10px;
}

.es-page-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.es-page-field .es-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--es-muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.es-page-input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  border: 1px solid var(--es-line-strong);
  border-radius: var(--radius-es-field);
  background: var(--es-surface);
  color: var(--es-ink);
  font: inherit;
  font-size: 17px;
  -webkit-appearance: none;
  appearance: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.es-page-input:focus {
  border-color: var(--es-navy);
  outline: none;
  box-shadow: var(--shadow-es-focus);
}

.es-page-submit {
  flex: none;
  height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-es);
  background: var(--es-cta);
  color: var(--es-surface);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.es-page-submit:hover {
  background: var(--es-cta-hover);
}

.es-page-submit:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: 2px;
}

.es-page-summary {
  margin: 22px 0 0;
  color: var(--es-muted);
  font-size: 14px;
}

.es-page-summary:empty {
  display: none;
}

.es-page-summary strong {
  color: var(--es-ink);
  font-weight: 600;
}

.es-page-filters {
  margin-top: 12px;
  padding: 0;
}

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

.es-page-row {
  border-bottom: 1px solid var(--es-line);
}

.es-page-link {
  display: block;
  padding: 22px 0;
  color: inherit;
  text-decoration: none;
}

.es-page-meta {
  display: block;
  color: var(--es-muted);
  font-size: 12.5px;
  line-height: 1.4;
}

.es-page-title {
  display: block;
  margin-top: 4px;
  color: var(--es-ink);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.es-page-link:hover .es-page-title {
  color: var(--es-cta);
}

.es-page-link:focus-visible {
  outline: 2px solid var(--es-navy);
  outline-offset: 4px;
  border-radius: var(--radius-es-sm);
}

.es-page-snippet {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--es-text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.es-page-url {
  display: block;
  margin-top: 6px;
  overflow: hidden;
  color: var(--es-faint);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.es-page-after:empty {
  display: none;
}

.es-page-more {
  display: block;
  margin: 28px auto 0;
  padding: 11px 20px;
  border: 1px solid var(--es-line-strong);
  border-radius: var(--radius-es);
  background: var(--es-surface);
  color: var(--es-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.es-page-more:hover {
  background: var(--es-hover);
}

.es-page-empty {
  margin-top: 8px;
  color: var(--es-text);
  font-size: 16px;
  line-height: 1.7;
}

.es-page-empty p {
  margin: 0 0 8px;
}

.es-page-empty a,
.es-page-popular a {
  color: var(--es-cta);
}

.es-page-h2 {
  margin: 40px 0 4px;
  color: var(--es-ink);
  font-size: 15px;
  font-weight: 600;
}

.es-page-popular {
  margin: 0;
  padding: 0;
  list-style: none;
}

.es-page-popular li {
  padding: 14px 0;
  border-bottom: 1px solid var(--es-line);
}

.es-page-popular a {
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.es-page-popular a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.es-page-popular span {
  display: block;
  margin-top: 3px;
  color: var(--es-muted);
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 700px) {
  .es-page-submit {
    display: none;
  }
  .es-page-title {
    font-size: 17px;
  }
  .es-page-snippet {
    font-size: 14.5px;
  }
}

/* ------------------------------------------------------------------ */
/* Static sites (TJTestPrep, AcademiesPrep)                            */
/* ------------------------------------------------------------------ */

/* The header's action slot hides on phones by default; search stays. */
.header-container > .header-actions.es-slot {
  display: flex;
}

@media (max-width: 900px) {
  .header-container > .header-actions.es-slot {
    margin-left: auto;
    margin-right: calc(-1 * var(--space-lg, 24px) + 8px);
  }
}

.es-page-section {
  padding: 40px 0 96px;
  background: var(--es-surface);
}

.es-page-section .es-page {
  margin: 0 auto;
}

/* A result that jumps to a section briefly marks where it landed. */
[id]:target {
  scroll-margin-top: 96px;
  animation: es-target 2.4s ease-out 1;
}

@keyframes es-target {
  0%,
  35% {
    background-color: var(--es-target);
  }
  100% {
    background-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  [id]:target {
    animation: none;
  }
}
