/* ==========================================================================
   New Tab: Search
   ========================================================================== */

.newtab-hero {
  position: relative;
  flex: 1 0 auto;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--frame-inline);
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
}

body:not(.theme-night) .newtab-hero {
  color: var(--color-text-day);
  text-shadow: none;
}

.search-form {
  width: min(640px, 100%);
}

.search-prompt {
  display: block;
  margin-bottom: 16px;
  font-family: var(--serif-font);
  font-size: var(--text-title);
  font-style: italic;
  font-weight: 400;
  line-height: var(--leading-tight);
  color: inherit;
  opacity: 0.55;
  text-shadow: none;
}

.search-box {
  position: relative;
}

.search-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-family: var(--serif-font);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  letter-spacing: -0.005em;
  opacity: 0.45;
  transition: opacity 0.35s ease;
}

.search-placeholder.is-hidden {
  opacity: 0;
}

/* Hide the overlay label whenever the field is focused or holds text,
   even when the new-tab script hasn't run (blocked, failed, or cached). */
.search-box:focus-within .search-placeholder,
.search-box:has(.search-input:not(:placeholder-shown)) .search-placeholder {
  opacity: 0;
}

.search-input {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  outline: none;
  padding: 10px 0 14px;
  font-family: var(--mono-font);
  font-size: var(--text-2xl);
  line-height: 1.2;
  text-align: center;
  color: inherit;
  caret-color: rgba(255, 255, 255, 0.45);
  text-shadow: none;
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

body:not(.theme-night) .search-input {
  caret-color: rgba(39, 37, 34, 0.45);
}

.search-input::placeholder {
  color: transparent;
}

.search-input:focus,
.search-input:not(:placeholder-shown) {
  opacity: 1;
}

.search-input::selection {
  background: rgba(25, 24, 22, 0.2);
  color: inherit;
}

.theme-night .search-input::selection {
  background: rgba(240, 240, 240, 0.25);
}

.search-engines {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  font-family: var(--mono-font);
  font-size: var(--font-size-xs);
  line-height: var(--leading-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-engine {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  color: inherit;
  text-decoration: none;
  text-shadow: none;
  opacity: 0.45;
  transition: opacity 0.2s ease;
  cursor: var(--cursor-light), pointer;
}

.search-engine.is-active {
  opacity: 0.9;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
}

.search-engine:hover,
.search-engine:focus-visible {
  opacity: 0.95;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.14em;
  cursor: var(--cursor-dark), pointer;
}

.theme-night .search-engine {
  cursor: var(--cursor-dark), pointer;
}

.theme-night .search-engine:hover,
.theme-night .search-engine:focus-visible {
  cursor: var(--cursor-light), pointer;
}

.search-engine::after {
  content: "";
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  background: url('../cursor-light.svg') center/contain no-repeat;
  transform-origin: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body:not(.theme-night) .search-engine::after {
  background-image: url('../cursor-dark.svg');
}

.search-engine:hover::after,
.search-engine:focus-visible::after {
  opacity: 1;
  animation: navLinkStarSpin 1.15s linear infinite;
}

@media (max-width: 800px) {
  .search-input {
    font-size: var(--text-xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-engine:hover::after,
  .search-engine:focus-visible::after {
    animation: none;
  }

  #theme-toggle:hover::after,
  #theme-toggle:focus-visible::after,
  #lang-toggle:hover::after,
  #lang-toggle:focus-visible::after {
    animation: none;
  }
}

