/* ==========================================================================
   Find Your Symptoms
   --------------------------------------------------------------------------
   A search box, then two tabs: Body Area (illustrated tiles) and Symptom
   (text bubbles). Tiles use the watercolour illustrations in
   assets/img/body-areas/. On phones the tiles become a swipe row
   (components.css) so ten tiles do not run to five screens.
   Layer 3 tokens only.
   ========================================================================== */

.sfind [hidden] { display: none !important; }

.sfind__head { margin-inline: auto; text-align: center; }
.sfind__eyebrow { margin-bottom: var(--sp-2); }

/* --- Search ---------------------------------------------------------------- */

.sfind__search {
  position: relative;
  display: flex;
  gap: var(--sp-2);
  max-width: 40rem;
  margin: 0 auto var(--sp-5);
}

.sfind__search-icon {
  position: absolute;
  /* Pinned to the input's height, not the form's: on phones the button
     stacks underneath and the form is twice as tall. */
  inset-block-start: 0;
  block-size: 52px;
  inset-inline-start: var(--sp-4);
  display: flex;
  align-items: center;
  color: var(--color-heading);
  pointer-events: none;
}
.sfind__search-icon svg { stroke-width: 1.75; }

.sfind .sfind__input {   /* beats input[type="search"] in base.css */
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0.75rem var(--sp-4) 0.75rem calc(var(--sp-4) + 30px);
  font: inherit;
  color: var(--color-text-strong);
  background: var(--color-surface);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-pill);
}
.sfind__input:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* The box and its clear button (26 Oct 2026). The browser's own small x is
   hidden so there are not two. */
.sfind__field { position: relative; flex: 1; min-width: 0; display: flex; }
/* The field is now positioned, so the magnifier (earlier in the markup) has
   to be lifted above the white input or it disappears behind it. */
.sfind__search-icon { z-index: 1; }
.sfind .sfind__field .sfind__input { padding-inline-end: calc(var(--sp-4) + 32px); }
.sfind__input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.sfind__clear {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--sp-3);
  transform: translateY(-50%);
  display: grid; place-items: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--color-bg-alt);
  color: var(--color-heading);
  cursor: pointer;
}
.sfind__clear:hover { background: var(--color-btn-primary-bg); color: var(--color-btn-primary-fg); }
.sfind__clear:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.sfind__clear[hidden] { display: none; }
.sfind__submit { border-radius: var(--radius-pill); flex: none; }

/* --- Tabs ------------------------------------------------------------------ */

.sfind__tabs {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  margin: 0 auto var(--sp-5);
  padding: var(--sp-1);
  width: fit-content;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-pill);
}

.sfind__tab {
  font: inherit;
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-heading);
  cursor: pointer;
}
.sfind__tab[aria-selected="true"] {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);
}
.sfind__tab:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.sfind__count { font-weight: var(--fw-normal); }

/* With JavaScript the tabs label the panels; without it these headings do. */
.sfind--tabbed [data-sfind-nojs-title] { display: none; }
.sfind__panel-title {
  font-size: var(--fs-h5);
  color: var(--color-heading);
  margin: var(--sp-5) 0 var(--sp-4);
}

/* --- Body-area tiles -------------------------------------------------------- */

.sfind__areas {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr));
}

@media (min-width: 64rem) {
  .sfind__areas { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.sfind__area-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.sfind__area-link:hover {
  border-color: var(--color-accent-gold);
  box-shadow: var(--shadow-md);
}
.sfind__area-link:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* Square photographs since 22 Oct 2026 (Kim chose photos over the
   watercolour illustrations). Each file is already cropped 1:1 around the
   body area, so cover loses nothing. */
.sfind__art {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  background: var(--color-surface);
  overflow: hidden;
  position: relative;
}
/* Pinned to all four edges (1 Dec 2026): in a centring grid Safari sized the
   photo from its own proportions instead of filling the tile. */
.sfind__art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}
.sfind__area-link:hover .sfind__art img { transform: scale(1.04); }
.sfind__art-fallback { color: var(--color-accent-gold); stroke-width: 1.25; }

.sfind__area-label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: var(--sp-3) var(--sp-3) var(--sp-4);
  font-weight: var(--fw-semi);
  font-size: var(--fs-sm);
  line-height: var(--lh-snug);
  text-align: center;
  color: var(--color-heading);
  border-top: 2px solid var(--color-accent-gold);
}

/* --- Symptom bubbles -------------------------------------------------------- */

.sfind__bubbles {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 60rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-3);
}

.sfind__bubble {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1.125rem;
  background: var(--color-surface);
  border: 1px solid var(--color-edge-teal);
  border-radius: var(--radius-pill);
  color: var(--color-heading);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.sfind__bubble:hover {
  background: var(--color-btn-primary-bg);
  border-color: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);
}
.sfind__bubble:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.sfind__empty {
  text-align: center;
  color: var(--color-text-muted);
  margin: var(--sp-4) 0 0;
}

/* --- Phones ------------------------------------------------------------------ */

@media (max-width: 39.99rem) {
  .sfind__search { flex-direction: column; }
  .sfind__submit { width: 100%; }
  .sfind__tabs { width: 100%; }
  .sfind__tab { flex: 1; padding-inline: var(--sp-3); }
  /* Tiles in the swipe row: narrower than the 78% default, so two and a bit
     show and the row reads as a set of options rather than one card. */
  .sfind__areas.swipe-row { grid-auto-columns: 42%; }
  .sfind__bubbles { justify-content: flex-start; gap: var(--sp-2); }
}

@media (prefers-reduced-motion: reduce) {
  .sfind__area-link, .sfind__art img, .sfind__bubble { transition: none; }
  .sfind__area-link:hover .sfind__art img { transform: none; }
}
