/*
 * tool-search.css - styles for the site search widget:
 *   the magnifier in the header's phone line and the AJAX results panel.
 *
 * Credits:        JKM, Claude
 * Original date:  11/15/2026
 * Build date:     11/19/2026   <- update for every new version
 * Build number:   2            <- add 1 for every new version
 * Changes:        2 = div#ts-search gets a .15em top margin (11/19/2026)
 *
 * Companions:
 *   tool-search.php  results (modes: ?q=... page, &f fragment, &j json)
 *   header markup    <div class="phoneNumber ts-search" id="ts-search"> ... </div>
 *                    <div id="ts-panel" class="ts-panel" hidden> ... </div>
 *   search script    jQuery handler that loads &f results into #ts-out
 *
 * INTEGRATION RULES (for anyone editing the main stylesheet, human or AI):
 *  - Load this file AFTER the main stylesheet (southern-combined-canonical-*.css).
 *    Several rules rely on source order to win ties against the site's global
 *    a, p and body rules.
 *  - Every selector here starts with .ts- or #ts- . Keep it that way, and keep
 *    this file separate: do not merge it into the main stylesheet, and do not
 *    rename the ts- classes or ids (the markup and script depend on them).
 *  - Colors come from the site palette (--shOrange, --shBlue, ...) with
 *    fallbacks, so the file also works if the palette is missing.
 *  - Do not add title="" attributes to the widget markup: the site's jQuery UI
 *    tooltip styles would take them over. Use aria-label instead.
 */

/* ---------- palette (site variables, with fallbacks) ---------- */
.ts-search,
.ts-panel {
  --ts-accent:      var(--shOrange, #e68120);
  --ts-accent-dark: var(--shOrangeDark, #c66b12);
  --ts-blue:        var(--shBlue, #069);
  --ts-hover:       var(--shLinkHover, #9f5800);
  --ts-border:      var(--shInputBorder, #7a7a7a);
}

/* ---------- header widget (wrapper is the .phoneNumber div) ---------- */
.ts-search { position: relative; }
div#ts-search { margin-top: .15em; }

/* magnifier / close button: ~43px touch target without making the line taller */
.ts-toggle {
  display: inline-block;
  vertical-align: middle;
  margin: -.55rem 0 -.55rem .25rem;
  padding: .55rem;
  background: none;
  border: 0;
  border-radius: 50%;
  color: var(--ts-blue);
  font-style: normal;
  line-height: 0;
  cursor: pointer;
}
.ts-toggle:hover,
.ts-toggle:focus-visible { background: rgba(0, 102, 153, .1); }
.ts-toggle:hover { color: var(--ts-accent-dark); }
.ts-toggle:focus-visible { outline: 2px solid var(--ts-blue); outline-offset: 1px; }
.ts-toggle svg { display: block; }
.ts-ico-close { display: none; }

/* open state: phone text keeps its space but is hidden (and unfocusable);
   the icon becomes an x at the right edge */
.ts-search.open .ts-phone-text { visibility: hidden; }
.ts-search.open .ts-ico-search { display: none; }
.ts-search.open .ts-ico-close  { display: inline; }
.ts-search.open .ts-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
}

/* search field: sits over the phone line */
.ts-form {
  position: absolute;
  left: 0;
  right: 2.8rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: .4rem;
  margin: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility 0s linear .2s;
}
.ts-search.open .ts-form {
  opacity: 1;
  visibility: visible;
  transition: opacity .2s ease, visibility 0s;
}
.ts-form input {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  height: 2.25rem;
  padding: 0 .6rem;
  font: 400 1rem/1.2 Arial, Helvetica, sans-serif;   /* 16px: stops iOS zoom on focus */
  font-style: normal;
  color: #222;
  background: #fff;
  border: 1px solid var(--ts-border);
  border-radius: 4px;
  -webkit-appearance: none;
  appearance: none;
}
.ts-form input:focus {
  outline: none;
  border-color: var(--ts-blue);
  box-shadow: 0 0 0 2px rgba(0, 102, 153, .35);
}
.ts-go {
  box-sizing: border-box;
  height: 2.25rem;
  padding: 0 .8rem;
  font: 700 .9rem/1 Arial, Helvetica, sans-serif;
  font-style: normal;
  color: #222;                                       /* dark text: white fails contrast on the orange */
  background: var(--ts-accent);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.ts-go:hover { background: var(--ts-accent-dark); }
.ts-go:focus-visible { outline: 2px solid var(--ts-blue); outline-offset: 2px; }

@media (max-width: 400px) {
  .ts-go { padding: 0 .55rem; font-size: .85rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ts-form, .ts-search.open .ts-form { transition: none; }
}

/* ---------- results panel (appended to <body> by the script) ---------- */
.ts-panel {
  position: fixed;                /* the script sets top and max-height each time it opens */
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(46rem, 94vw);
  max-height: 80vh;
  overflow: auto;
  padding: 1rem 1.25rem;
  background: #fff;
  color: #333;
  text-align: left;               /* body is text-align:center on this site */
  text-transform: none;
  font: 400 14px/1.5 Verdana, Arial, Helvetica, sans-serif;
  font-style: normal;
  border: 1px solid #ccc;
  border-top: 3px solid var(--ts-accent);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .25);
  z-index: 10000;                 /* above the nav dropdowns (51) and jQuery UI tooltips (9999) */
}
.ts-panel[hidden] { display: none; }
.ts-panel p,
.ts-panel a,
.ts-panel b { font-family: inherit; }   /* site sets its own families on these */

.ts-close {
  position: absolute;
  top: .3rem;
  right: .6rem;
  padding: 0 .25rem;
  background: none;
  border: 0;
  color: #333;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.ts-close:hover { color: var(--ts-accent-dark); }
.ts-close:focus-visible { outline: 2px solid var(--ts-blue); }

/* ---------- results ---------- */
.ts-panel .ts-meta { margin: 0 2rem 1rem 0; color: #555; font-size: .9em; }
.ts-panel .ts-r { margin: 0 0 1.2rem; }

/* the site's global "a" rule is orange, uppercase and underlines on hover; override it here */
.ts-panel a { text-transform: none; text-align: left; font-weight: normal; }
.ts-panel .ts-r a,
.ts-panel .ts-r a:visited {
  color: var(--ts-blue);
  font-size: 1.1em;
  font-weight: 700;
  text-decoration: none;
}
.ts-panel .ts-r a:hover { color: var(--ts-hover); text-decoration: underline; }

.ts-panel .ts-u { color: #080; font-size: .85em; word-break: break-all; }
.ts-panel .ts-s { margin: .2rem 0 0; color: #444; font-size: 1em; }
.ts-panel mark { background: #fde3c0; color: inherit; padding: 0 .1em; border-radius: 2px; }

/* ---------- pager ---------- */
.ts-panel .ts-pager { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1.2rem 0 .2rem; }
.ts-panel .ts-pager a,
.ts-panel .ts-pager span {
  padding: .3rem .65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  text-decoration: none;
}
.ts-panel .ts-pager a,
.ts-panel .ts-pager a:visited { color: var(--ts-blue); font-weight: 700; }
.ts-panel .ts-pager a:hover { background: rgba(0, 102, 153, .08); border-color: var(--ts-blue); text-decoration: none; }
.ts-panel .ts-pager .ts-cur { background: var(--ts-blue); color: #fff; border-color: var(--ts-blue); }
