/* The column search: a white field on a white page, the words typed in the middle of it, and under it the list of
   recipes lined up on those words, with a highlighter stroke down the column. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1c1d19;           /* the words */
  --muted: #72746c;         /* the rest of a recipe's name, the hints */
  --line: #e3e4de;          /* the edges */
  --field: #ffffff;         /* the field and the list */
  --band: #f1f2ec;          /* the band on the recipe picked */
  --beam: #ffe476;          /* the highlighter down the column */
  --beam-soft: #fff3c4;     /* the highlighter on a word to try */
  --miss: #ecece6;          /* the highlighter when nothing matches */
  --go: #1c1d19;            /* the search button */
  --go-ink: #ffffff;        /* its arrow */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Alegreya Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* held from the top: the list grows downwards and the field does not move */
.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-content: center;
  padding: 32px 16px;
}

/* the field and the room the list opens in */
.seek {
  --pad: 62px;              /* the room each side of the words, so they sit in the middle */
  --size: 18px;             /* the size of the words, in the field and in the list */
  position: relative;
  width: min(560px, 100%);
  height: 374px;
  font-size: var(--size);
}

.seek__form {
  margin: 0;
}

/* ---------------------------------------------------------------- the field */
.seek__field {
  position: relative;
  height: 60px;
  border-radius: 18px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(28, 29, 25, 0.05), 0 10px 26px -16px rgba(28, 29, 25, 0.22);
  transition: box-shadow 0.25s ease;
}

.seek__field:focus-within,
.seek.is-pretend .seek__field {
  box-shadow: inset 0 0 0 1px #a3a59c, 0 0 0 4px rgba(28, 29, 25, 0.07), 0 10px 26px -16px rgba(28, 29, 25, 0.22);
}

/* the highlighter under the words typed: the top of the column */
.seek__swipe {
  position: absolute;
  left: 0;
  top: 15px;
  width: 0;
  height: 30px;
  border-radius: 8px;
  background: var(--beam);
  filter: url(#seek-marker);
  opacity: 0;
  pointer-events: none;
}

.seek__lens {
  position: absolute;
  left: 20px;
  top: 50%;
  width: 22px;
  height: 22px;
  margin-top: -11px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.9;
  stroke-linecap: round;
  pointer-events: none;
}

/* nothing matches: the highlighter in the field goes grey */
.seek.is-miss .seek__swipe {
  background: var(--miss);
}

/* the real input, over the whole field; the words sit in its middle */
.seek__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 var(--pad);
  border: 0;
  border-radius: inherit;
  outline: none;
  background: transparent;
  color: var(--ink);
  caret-color: var(--ink);
  font: 420 var(--size) / normal 'Alegreya Variable', Georgia, serif;
  font-kerning: normal;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.seek__input::placeholder {
  color: var(--muted);
  font-style: italic;
  opacity: 1;
}

/* while a recipe rises into the field, the words typed give way to it */
.seek.is-flying .seek__input {
  color: transparent;
  caret-color: transparent;
}

/* the caret of the library's preview, which types without taking the focus */
.seek__caret {
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.5px;
  height: 24px;
  margin-top: -12px;
  border-radius: 1px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
}

.seek.is-pretend .seek__caret.is-on {
  animation: blink 1.06s steps(1) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }

  50.01%,
  100% {
    opacity: 0;
  }
}

.seek__clear,
.seek__go {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* the cross that empties the field takes the lens's place while there are words in it */
.seek__clear {
  left: 12px;
  width: 38px;
  height: 38px;
  margin-top: -19px;
  border-radius: 50%;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.seek__clear svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

/* the search button: a dark square with an arrow, which goes off to the right and comes back when it searches */
.seek__go {
  right: 8px;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--go);
  color: var(--go-ink);
  transition: background-color 0.25s ease, color 0.25s ease, transform 0.16s ease-out;
}

.seek__arrow {
  display: grid;
  place-items: center;
}

.seek__go svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.45s cubic-bezier(0.3, 1.7, 0.45, 1);
}

.seek__go[aria-disabled='true'] {
  background: var(--band);
  color: #a9aba3;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  .seek__go:not([aria-disabled='true']):hover svg {
    transform: translateX(3px);
  }

  .seek__clear:hover {
    color: var(--ink);
    background: var(--band);
  }
}

.seek__go:not([aria-disabled='true']):active {
  transform: scale(0.93);
}

.seek__go:focus-visible,
.seek__clear:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- the list */
.seek__panel {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 68px;
  height: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px var(--line), 0 18px 40px -22px rgba(28, 29, 25, 0.3);
  visibility: hidden;
}

/* the rows' room fills the list (the rows inside it are placed by the script) */
.seek__rows {
  position: absolute;
  inset: 0;
}

/* the band on the recipe picked, moved by the script */
.seek__band {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 0;
  height: 44px;
  border-radius: 12px;
  background: var(--band);
  opacity: 0;
  pointer-events: none;
}

/* the highlighter down the column, moved and widened by the script */
.seek__beam {
  position: absolute;
  left: 0;
  top: 8px;
  width: 0;
  height: 0;
  border-radius: 10px;
  background: var(--beam);
  filter: url(#seek-marker);
  mix-blend-mode: multiply;
  transform-origin: 50% 0;
  pointer-events: none;
}

/* the rows' words fade at the two edges, if a long name ever reaches them */
.seek__list {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent);
}

.opt {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* a recipe's name, slid sideways by the script so the letters found sit in the column */
.opt__text {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted);
  font-weight: 420;
  white-space: pre;
  transition: color 0.2s ease;
}

.opt[aria-selected='true'] .opt__text {
  color: var(--ink);
}

.opt__text mark {
  background: none;
  color: var(--ink);
  font-weight: 700;
}

/* nothing found: what was looked for, and what to try instead */
.seek__none {
  padding: 22px 24px 24px;
  text-align: center;
}

.seek__none[hidden] {
  display: none;
}

.none__what {
  margin: 0;
  font-size: 1em;
  font-weight: 560;
  color: var(--ink);
}

.none__tip {
  margin: 6px 0 0;
  font-size: 1em;
  font-style: italic;
  text-wrap: balance;
  color: var(--muted);
}

/* a word to try is a button, marked with the highlighter: its letters rise into the field when it is taken */
.none__try {
  display: inline;
  margin: 0;
  padding: 1px 3px 2px;
  border: 0;
  border-radius: 6px;
  background: var(--beam-soft);
  color: var(--ink);
  font: inherit;
  font-style: normal;
  font-weight: 620;
  cursor: pointer;
  transition: background-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .none__try:hover {
    background: var(--beam);
  }
}

.none__try:active {
  background: var(--beam);
}

.none__try:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- after a search or a choice */
.seek__note {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  top: 76px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.94em;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
}

.seek__note svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.seek__note b {
  color: var(--ink);
  font-weight: 640;
}

.seek__defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* a recipe on its way into the field, above the list and the field */
.seek__flight {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.flier {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--muted);
  font-weight: 420;
  white-space: pre;
}

.flier mark {
  background: none;
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 520px) {
  .seek {
    --pad: 56px;
    --size: 17px;
  }

  .seek__lens {
    left: 16px;
  }

  .seek__clear {
    left: 8px;
  }

  .seek__go {
    right: 7px;
  }
}
