/*
 * POC – AI search
 * Figma : LORA26 - Beauty in motion › search_open_step_1 / 2 / 3
 *
 * Figma strokes are "inside": every bordered box removes 1px from its padding
 * so that content sits exactly where it is in Figma.
 */

:root {
  --white: #fff;
  --black: #000;
  --grey: #717171;
  --corner-s: 8px;
  --corner-m: 12px;
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --glass-border: rgba(255, 255, 255, .1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #797979; /* Figma canvas */
  font-family: 'Instrument Sans', sans-serif;
  font-variation-settings: 'wdth' 100;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* Text XS : Instrument Sans Medium 12 / 17.5 */
.search__cta-label,
.search__input,
.search__label,
.search__chip,
.search__card-title,
.search__card-desc,
.search__figure-text,
.search__more {
  font-size: 12px;
  font-weight: 500;
  line-height: 17.5px;
}

/* ---------------------------------------------------------------- Layout */

.search {
  width: 463px;
}

/* Closed field and open bar share the same spot: the field morphs into the bar */
.search__inner {
  position: relative;
  min-height: 56px;
}

/* ---------------------------------------------------------------- Closed */

.search__cta {
  position: absolute;
  z-index: 1;
  top: 8px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 439px;
  height: 48px;
  padding: 11px 19px 11px 23px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(95, 95, 95, .15);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
  color: var(--white);
  text-align: left;
}

.search__cta-label {
  opacity: .8;
}

.search__icon {
  display: block;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* ----------------------------------------------------------------- Panel */

.search__panel {
  /* per-state spacings, see modifiers below */
  --body-top: 38px;
  --body-left: 36px;
  --body-bottom: 31px;
  --body-width: 374px;

  width: 463px;
  overflow: hidden; /* height is animated between states */
  padding: 8px 0 calc(var(--body-bottom) - 1px);
  border: 1px solid var(--glass-border);
  border-top: 0;
  border-radius: 0 0 15px 15px;
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(100px);
  -webkit-backdrop-filter: blur(100px);
}

/* Figma values differ slightly from one step to another, reproduced as is */
.search__panel--home {
  --body-top: 39px;
  --body-left: 36px;
  --body-bottom: 32px;
  --body-width: 358px;
}

.search__panel--text {
  --body-left: 45px;
  --body-bottom: 56px;
}

.search__panel--figure {
  --body-left: 36px;
  --body-bottom: 31px;
}

.search__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 439px;
  height: 48px;
  margin: 0 auto;
  padding: 11px 19px 11px 23px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--white);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}

.search__input {
  flex: 1;
  min-width: 0;
  height: 18px;
  margin: 0 12px 0 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--black);
}

.search__input::placeholder {
  color: var(--black);
  opacity: 1;
}

.search__close {
  display: block;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.search__close img {
  display: block;
}

.search__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-32);
  width: var(--body-width);
  margin: var(--body-top) 0 0 calc(var(--body-left) - 1px);
}

/* ---------------------------------------------------------------- Blocks */

.search__block {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.search__block--articles {
  gap: var(--space-16);
}

.search__label {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 18px;
  margin: 0;
  color: var(--white);
}

.search__label img {
  display: block;
  width: 14px;
  height: 14px;
}

.search__label span {
  opacity: .8;
}

/* Step 1 – themes */

.search__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.search__chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--corner-s);
  background: rgba(147, 147, 147, .2);
  color: var(--white);
  white-space: nowrap;
}

/* Step 2 – text insight (Text S : Medium 16 / 1.41, Figma lays lines out at 23px) */

.search__insight {
  margin: 0;
  color: var(--white);
  font-size: 16px;
  font-weight: 500;
  line-height: 23px;
}

/* words revealed one after the other */
.search__word {
  display: inline-block;
}

/* Step 3 – key figure insight (Title M : Bold 64 / 0.9, -2%) */

.search__figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  color: var(--white);
}

.search__figure-number {
  height: 58px;
  margin: 0;
  font-size: 64px;
  font-weight: 700;
  line-height: .9;
  letter-spacing: -1.28px;
}

.search__figure-text {
  width: 287px;
  margin: 0;
}

/* steady digits while the figure counts up */
.search__figure-number.is-counting {
  font-variant-numeric: tabular-nums;
}

/* Related context articles */

.search__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.search__card {
  display: flex;
  align-items: center;
  gap: var(--space-24);
  height: 110px;
  padding: 10px 34px 10px 10px;
  border-radius: var(--corner-m);
  background: var(--white);
  color: var(--black);
  text-decoration: none;
}

.search__card-visual {
  position: relative;
  flex-shrink: 0;
  width: 90px;
  height: 90px;
  overflow: hidden;
  border-radius: var(--corner-s);
  background: #ececec; /* while loading, or no picture */
}

.search__card-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

.search__card-texts {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  width: 215px;
}

.search__card-title {
  margin: 0;
}

.search__card-desc {
  display: -webkit-box;
  width: 230px;
  margin: 0;
  overflow: hidden;
  color: var(--grey);
  opacity: .8;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search__more {
  width: 373px;
  height: 18px;
  color: var(--white);
  text-align: center;
  opacity: .8;
}

/* ------------------------------------------- Model comparison page (POC only) */

/* Independent search bar, above the three engines */
.compare {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 40px 16px 32px;
}

.compare__bar {
  display: flex;
  align-items: center;
  width: 640px;
  max-width: 100%;
  height: 56px;
  padding: 0 15px 0 23px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--white);
}

.compare__input {
  flex: 1;
  min-width: 0;
  margin-right: 12px;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--black);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.compare__input::placeholder {
  color: var(--grey);
}

.compare__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--corner-s);
  background: var(--black);
}

.compare__lang {
  display: flex;
  gap: 16px;
  font-size: 12px;
  font-weight: 500;
  line-height: 17.5px;
}

.compare__lang a {
  color: var(--white);
  text-decoration: none;
  opacity: .5;
}

.compare__lang a[aria-current="true"] {
  opacity: 1;
}

/* Three engines side by side (wrapping on narrow screens) */
.engines {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 40px 32px;
  padding: 0 16px 64px;
}

.engine {
  width: 463px;
}

.engine__header {
  min-height: 72px;
  padding: 0 12px 12px;
  color: var(--white);
}

.engine__model {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 22px;
}

.engine__stats {
  min-height: 36px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 17.5px;
  font-variant-numeric: tabular-nums;
}

.engine__stats strong {
  font-weight: 700;
}

.engine__error {
  display: block;
  color: #ffd2d2;
}

.engine__pending {
  opacity: .8;
}

/* ------------------------------------------------- Thinking (answer pending) */

.search__label--pending img {
  animation: search-sparkle 1.6s ease-in-out infinite;
}

.search__label--pending span {
  background: linear-gradient(90deg, rgba(255, 255, 255, .45) 0%, #fff 50%, rgba(255, 255, 255, .45) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: search-shimmer 1.6s linear infinite;
}

/* 3 lines placeholder, laid out like the 16 / 23px insight text */
.search__skeleton {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 5.5px 0;
}

.search__skeleton span {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .3) 50%, rgba(255, 255, 255, .1) 100%) 0 0 / 200% 100%;
  animation: search-shimmer 1.6s linear infinite;
}

.search__skeleton span:nth-child(2) {
  width: 92%;
  animation-delay: .12s;
}

.search__skeleton span:nth-child(3) {
  width: 62%;
  animation-delay: .24s;
}

@keyframes search-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: -100% 0; }
}

@keyframes search-sparkle {
  0%, 100% { opacity: .55; transform: scale(.85) rotate(0deg); }
  50%      { opacity: 1;   transform: scale(1.1) rotate(12deg); }
}

@media (prefers-reduced-motion: reduce) {
  .search__label--pending img,
  .search__label--pending span,
  .search__skeleton span {
    animation: none;
  }
}
