/*
 * themes/alder/css/alder-search.css
 * The search modal (partials/_search-modal.tpl.php). Phone first: a full
 * screen sheet whose height follows the visual viewport (--al-vvh, written
 * by js/alder-search-modal.js) so the field stays above the keyboard; from
 * 921px a centred panel over a dimmed page. html.al-smod-open locks the page
 * behind it without a layout shift (the scrollbar width is paid back as
 * padding). Motion is short and off under reduced motion.
 */

.al-smod[hidden] { display: none; }
.al-smod { position: fixed; inset: 0; z-index: 90; }
.al-smod__back { position: absolute; inset: 0; background: rgba(14, 42, 27, .46); opacity: 0; transition: opacity .16s var(--al-ease, ease); }
.al-smod.is-open .al-smod__back { opacity: 1; }

.al-smod__panel {
  position: absolute; left: 0; right: 0; top: 0; height: var(--al-vvh, 100dvh);
  display: flex; flex-direction: column; background: var(--al-page, #FAFAF8); color: var(--al-ink, #0E2A1B);
  padding-top: env(safe-area-inset-top, 0px);
  transform: translateY(24px); opacity: 0; transition: transform .22s var(--al-ease, ease), opacity .18s var(--al-ease, ease);
}
.al-smod.is-open .al-smod__panel { transform: none; opacity: 1; }

/* The field row, pinned at the top of the sheet. */
.al-smod__form {
  position: relative; display: flex; align-items: center; gap: 8px; flex: none;
  min-height: 64px; margin: 0; padding: 10px var(--al-gutter, 24px);
  border-bottom: 1px solid var(--al-line, rgba(14, 42, 27, .16));
}
.al-smod__glyph { width: 24px; height: 24px; flex: none; fill: none; stroke: rgba(14, 42, 27, .62); stroke-width: 1.5; stroke-linecap: round; }
.al-smod__glyph .lit { stroke: var(--al-brand, #3D8850); stroke-width: 1.7; }
.al-smod__form .al-smod__input, .al-smod__form .al-smod__input:hover, .al-smod__form .al-smod__input:focus {
  flex: 1; width: auto; min-width: 0; height: 44px; min-height: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; outline: none; box-shadow: none;
  -webkit-appearance: none; appearance: none;
  font: 400 17px/1.2 var(--al-sans, sans-serif); color: var(--al-ink, #0E2A1B); text-overflow: ellipsis;
}
.al-smod__input::placeholder { color: var(--al-muted, #5B6E66); opacity: 1; }
.al-smod__input::-webkit-search-cancel-button { -webkit-appearance: none; }
.al-smod__clear, .al-smod__close {
  display: inline-grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--al-ink, #0E2A1B);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.al-smod__clear[hidden] { display: none; }
.al-smod__clear .al-ico, .al-smod__close .al-ico { width: 20px; height: 20px; }
.al-smod__clear { color: var(--al-muted, #5B6E66); }
.al-smod__close { border-color: var(--al-line, rgba(14, 42, 27, .16)); margin-right: -6px; }
@media (hover: hover) { .al-smod__close:hover, .al-smod__clear:hover { background: var(--al-sand, #F5EFE6); } }
.al-smod__clear:focus-visible, .al-smod__close:focus-visible { outline: 2px solid var(--al-brand, #3D8850); outline-offset: 2px; }

/* Module chips as filters: one row, scrolls sideways on phones. */
.al-smod__chips {
  display: flex; gap: 8px; flex: none; padding: 12px var(--al-gutter, 24px) 4px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding-inline: var(--al-gutter, 24px);
}
.al-smod__chips::-webkit-scrollbar { display: none; }
.al-smod__chip { flex: none; cursor: pointer; }
.al-smod__chip[aria-pressed="true"] { background: var(--al-pill, #14532D); color: #fff; }
.al-smod__chip:focus-visible { outline: 2px solid var(--al-brand, #3D8850); outline-offset: 2px; }

/* The scrolling body. */
.al-smod__body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px var(--al-gutter, 24px) calc(24px + env(safe-area-inset-bottom, 0px)); }
.al-smod__home[hidden], .al-smod__results[hidden], .al-smod__sec[hidden] { display: none; }
.al-smod__sec { margin-top: 22px; }
.al-smod__sec:first-child { margin-top: 10px; }
.al-smod__sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.al-smod__eb { margin: 0 0 8px; font: italic 400 15px/1.3 var(--al-serif, serif); color: var(--al-moss, #1C6B3C); }
.al-smod__forget { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--al-muted, #5B6E66); font: 500 13.5px/1 var(--al-sans, sans-serif); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Hints and recents: question rows, one per line, a glyph on the left. */
.al-smod__hints { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.al-smod__hint {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px; margin: 0 -10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--al-ink, #0E2A1B); text-align: left;
  font: 400 16px/1.35 var(--al-sans, sans-serif); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.al-smod__hint .al-smod__glyph { width: 20px; height: 20px; stroke: rgba(14, 42, 27, .4); }
.al-smod__hint .al-smod__glyph .lit { stroke: var(--al-brand, #3D8850); }
.al-smod__hint--recent .al-smod__glyph { stroke: var(--al-muted, #5B6E66); }
@media (hover: hover) { .al-smod__hint:hover { background: var(--al-paper, #E6F5EC); } }
.al-smod__hint:focus-visible, .al-smod__tile:focus-visible, .al-smod__row:focus-visible { outline: 2px solid var(--al-brand, #3D8850); outline-offset: 2px; }

/* Tiles: thumbnail (or a numeral), title, a meta line. */
.al-smod__tiles { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.al-smod__tiles li[hidden] { display: none; }
.al-smod__tile {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px; margin: 0 -8px;
  border-radius: 14px; color: var(--al-ink, #0E2A1B); text-decoration: none;
  transition: background-color .15s;
}
@media (hover: hover) { .al-smod__tile:hover { background: var(--al-sand, #F5EFE6); } .al-smod__tile:hover .al-smod__t { color: var(--al-moss, #1C6B3C); } }
.al-smod__pic {
  display: grid; place-items: center; flex: none; width: 84px; height: 60px; overflow: hidden;
  border-radius: 10px; background: var(--al-sand-2, #ECE3D4); box-shadow: inset 0 0 0 1px rgba(14, 42, 27, .12);
}
.al-smod__pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.al-smod__pic--art { background: var(--al-paper, #E6F5EC); }
.al-smod__num { font: italic 500 22px/1 var(--al-serif, serif); color: var(--al-moss, #1C6B3C); }
.al-smod__text { display: grid; gap: 3px; min-width: 0; }
.al-smod__t { font: 600 15.5px/1.3 var(--al-sans, sans-serif); overflow-wrap: anywhere; }
.al-smod__m { font: 400 13px/1.3 var(--al-sans, sans-serif); color: var(--al-muted, #5B6E66); }

/* Live results: grouped, the typed words lit. */
.al-smod__group { margin-top: 20px; }
.al-smod__group:first-child { margin-top: 10px; }
.al-smod__rows { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.al-smod__row {
  display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 10px 10px; margin: 0 -10px;
  border-radius: 12px; color: var(--al-ink, #0E2A1B); text-decoration: none; transition: background-color .15s;
}
@media (hover: hover) { .al-smod__row:hover { background: var(--al-sand, #F5EFE6); } }
.al-smod__kind {
  flex: none; margin-top: 2px; min-width: 56px; padding: 3px 8px; border-radius: 999px; text-align: center;
  background: var(--al-paper, #E6F5EC); color: var(--al-moss, #1C6B3C); font: 600 11.5px/1.2 var(--al-sans, sans-serif); letter-spacing: .02em; text-transform: uppercase;
}
.al-smod__kind--quiz { background: var(--al-sand, #F5EFE6); color: var(--al-deep, #123C27); }
.al-smod__kind--article { background: var(--al-dawn, #F7EFDF); color: var(--al-deep, #123C27); }
.al-smod__rt { display: block; font: 600 15.5px/1.3 var(--al-sans, sans-serif); overflow-wrap: anywhere; }
.al-smod__rs { display: block; margin-top: 2px; font: 400 13.5px/1.4 var(--al-sans, sans-serif); color: var(--al-body, #4A5568); }
.al-smod mark { background: var(--al-sage, #A8DEB5); color: var(--al-ink, #0E2A1B); padding: 0 1px; border-radius: 3px; }
.al-smod__more { display: flex; justify-content: center; margin-top: 18px; }
.al-smod__empty { padding: 18px 0 4px; }
.al-smod__empty p { margin: 0 0 14px; font: 400 16px/1.5 var(--al-sans, sans-serif); color: var(--al-body, #4A5568); }
.al-smod__empty strong { color: var(--al-ink, #0E2A1B); font-weight: 600; }
.al-smod__status { margin: 14px 0 0; font: italic 400 14px/1.4 var(--al-serif, serif); color: var(--al-muted, #5B6E66); }

.al-smod__foot { display: none; }
.al-smod kbd {
  display: inline-block; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--al-line, rgba(14, 42, 27, .16));
  background: #fff; font: 500 11.5px/1.5 var(--al-sans, sans-serif); color: var(--al-ink, #0E2A1B);
}

/* Page lock behind the modal: no scroll, no shift. */
html.al-smod-open { overflow: hidden; }
html.al-smod-open body { overflow: hidden; padding-right: var(--al-sbw, 0px); }
html.al-smod-open .al-askfab { opacity: 0; visibility: hidden; }
/* The consent banner (z 950 in the base) steps behind the modal, as it does for the Ask panel. */
html.al-smod-open .ocd-cb { z-index: 60; }

@media (min-width: 921px) {
  .al-smod__back { backdrop-filter: blur(3px); }
  .al-smod__panel {
    left: 50%; right: auto; top: max(6vh, 48px); width: min(880px, 100% - 48px); height: auto;
    max-height: min(78vh, 760px); padding-top: 0; border-radius: 24px; overflow: hidden;
    box-shadow: 0 32px 80px -24px rgba(14, 42, 27, .55), 0 0 0 1px rgba(14, 42, 27, .12);
    transform: translate(-50%, 10px) scale(.985);
  }
  .al-smod.is-open .al-smod__panel { transform: translate(-50%, 0) scale(1); }
  .al-smod__form { min-height: 72px; padding: 12px 20px 12px 28px; }
  .al-smod__form .al-smod__input { font-size: 19px; }
  .al-smod__chips { padding: 14px 28px 6px; flex-wrap: wrap; overflow: visible; }
  .al-smod__body { padding: 8px 28px 24px; }
  .al-smod__tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 20px; }
  .al-smod__hints { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .al-smod__foot { display: flex; gap: 8px; align-items: center; flex: none; margin: 0; padding: 10px 28px; border-top: 1px solid var(--al-line, rgba(14, 42, 27, .16)); font: 400 12.5px/1.4 var(--al-sans, sans-serif); color: var(--al-muted, #5B6E66); }
}

@media (prefers-reduced-motion: reduce) {
  .al-smod__back, .al-smod__panel, .al-smod__tile, .al-smod__row { transition: none; }
  .al-smod__panel { transform: none; }
  .al-smod.is-open .al-smod__panel { transform: none; }
  @media (min-width: 921px) { .al-smod__panel, .al-smod.is-open .al-smod__panel { transform: translate(-50%, 0); } }
}
