/* The contacts import with the rows that fall into place: the import card of a CRM, Fernwood, on a black page. The
   rows sit in one layer and each one is placed by a CSS variable (--slot, in rows), so they can fall, overlap and swap
   places while the height of a row (--row) follows the window. GSAP moves the inner box and the cells, never .row. */
:root {
  --page: #000000;            /* the page */
  --card: #0e0f12;            /* the body of the card */
  --card-top: #16171c;        /* the top of the card, where the light falls */
  --edge: rgba(255, 255, 255, 0.08); /* the edge at rest */
  --ink: #ecedf1;             /* the words */
  --muted: #80828e;           /* the small words */
  --line: rgba(255, 255, 255, 0.06); /* the lines between the rows */
  --accent: #8f86ff;          /* the light, the bar, the matched columns */
  --bad: #ff6f6f;             /* the cells that are wrong */
  --amber: #f3b04c;           /* the rows that need a look */
  --button: #f3f3f6;          /* the View contacts button */
  --button-ink: #0b0b10;      /* the words on the button */
}

* {
  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: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* the card */
.imp {
  --mx: 30%;
  --my: 0%;
  --warm: 0;
  --row: clamp(23px, 6.3vh, 34px);
  --fs: clamp(10px, 2.75vh, 12.5px);
  position: relative;
  width: min(540px, 94vw);
  padding: clamp(12px, 3.4vh, 20px) clamp(12px, 3.6vw, 18px) clamp(10px, 2.8vh, 16px);
  border-radius: 20px;
  background:
    radial-gradient(110% 60% at var(--mx) var(--my), rgba(255, 255, 255, 0.045), transparent 62%),
    linear-gradient(180deg, var(--card-top), var(--card) 42%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 20px 44px -20px rgba(0, 0, 0, 0.9),
    0 40px 90px -46px color-mix(in srgb, var(--accent) calc(var(--warm) * 40%), transparent);
  isolation: isolate;
  opacity: 0;
}

/* a fine grain over the glass */
.imp::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* the light that runs once around the edge when the import is complete */
.imp__beam {
  --a: 0deg;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--a), transparent 0deg, transparent 240deg, color-mix(in srgb, var(--accent) 60%, transparent) 305deg, #ffffff 342deg, var(--accent) 352deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

.imp > *:not(.imp__beam) {
  position: relative;
  z-index: 1;
}

/* the head */
.imp__head {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4vw, 12px);
}

.imp__mark {
  flex: none;
  width: clamp(26px, 7vh, 34px);
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 34%, #1b1c24), #15161c);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 6px 14px -8px var(--accent);
}

.imp__mark svg {
  width: 58%;
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.imp__titles {
  min-width: 0;
  flex: 1;
}

.imp__title {
  margin: 0;
  font-size: clamp(13px, 3.6vh, 16px);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-stretch: 105%;
}

.imp__file {
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: calc(var(--fs) * 0.95);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

.imp__file span:not(.imp__dim) {
  overflow: hidden;
  text-overflow: ellipsis;
}

.imp__file-icon {
  flex: none;
  width: 10px;
  height: 12px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.imp__dim {
  opacity: 0.7;
}

.imp__count {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}

.odo {
  display: inline-flex;
  font-size: clamp(17px, 5vh, 24px);
  font-weight: 620;
  font-stretch: 92%;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.odo__col {
  display: inline-block;
  height: 1em;
  width: 0.62em;
  overflow: hidden;
  line-height: 1;
  transition: color 0.35s ease, opacity 0.35s ease;
}

.odo__col.is-zero,
.odo__comma.is-zero {
  opacity: 0.22;
}

.odo__strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.odo__strip span {
  display: block;
  height: 1em;
  text-align: center;
}

.odo__comma {
  line-height: 1;
  transition: opacity 0.35s ease;
}

.imp__count-word {
  margin-top: 3px;
  font-size: calc(var(--fs) * 0.9);
  color: var(--muted);
}

/* the progress bar */
.imp__bar {
  height: 2px;
  margin: clamp(9px, 2.6vh, 14px) 0 clamp(6px, 1.8vh, 10px);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.imp__bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent) 80%, #ffffff);
  box-shadow: 0 0 10px var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* the table */
.imp__table {
  position: relative;
  font-size: var(--fs);
}

.cols,
.row__in {
  display: grid;
  grid-template-columns: 1.75fr 1.4fr 0.95fr 5.7em;
  gap: 8px;
  align-items: center;
  padding: 0 8px;
}

.cols {
  height: calc(var(--row) * 0.82);
  color: var(--muted);
  font-size: calc(var(--fs) * 0.88);
  letter-spacing: 0.02em;
}

.cols__cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.cols__cell svg {
  flex: none;
  width: 9px;
  height: 9px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cols__cell.is-raw {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.92em;
  letter-spacing: 0;
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}

.rows {
  position: relative;
  height: calc(var(--row) * 7);
  clip-path: inset(0 -10px 0 -10px);
}

/* the light that passes over the rows */
.rows__light {
  --sweep: 0;
  position: absolute;
  left: -10px;
  right: -10px;
  top: 0;
  height: calc(var(--row) * 2);
  transform: translateY(calc(var(--sweep) * 9 * var(--row) - 2 * var(--row)));
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 12%, transparent) 70%, transparent);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: screen;
}

.rows__light-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 72%;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent) 25%, #ffffff 55%, color-mix(in srgb, var(--accent) 70%, transparent) 80%, transparent);
  box-shadow: 0 0 12px var(--accent);
}

.row {
  --slot: 0;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: var(--row);
  transform: translateY(calc(var(--slot) * var(--row)));
  z-index: 1;
}

.row__in {
  height: calc(100% - 2px);
  margin-top: 1px;
  border-radius: 8px;
  background: transparent;
  box-shadow: inset 0 -1px 0 var(--line);
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

.row--dup {
  z-index: 3;
}

.row--dup .row__in {
  background: #1a1b22;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 8px 18px -8px rgba(0, 0, 0, 0.9);
}

.row.is-lit .row__in {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.row.is-warn .row__in {
  background: color-mix(in srgb, var(--amber) 7%, transparent);
  box-shadow: inset 2px 0 0 var(--amber), inset 0 -1px 0 var(--line);
}

.cell {
  position: relative;
  display: grid;
  min-width: 0;
  white-space: nowrap;
}

.cell > span {
  grid-area: 1 / 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell__raw {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
  font-size: 0.92em;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
}

.cell[data-bad] .cell__raw {
  color: var(--bad);
}

/* the red tint behind a wrong cell */
.cell[data-bad]::before {
  content: '';
  position: absolute;
  inset: -3px -5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--bad) 13%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 30%, transparent);
  opacity: var(--tint, 1);
}

.cell__clean {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0;
}

.cell--email .cell__clean {
  display: block;
  color: color-mix(in srgb, var(--ink) 74%, transparent);
}

.cell[data-keep] .cell__clean {
  display: inline-flex;
  color: var(--bad);
  transition: color 0.45s ease;
}

.row.is-warn .cell[data-keep] .cell__clean {
  color: var(--amber);
}

.row.is-warn .cell[data-keep]::before {
  background: color-mix(in srgb, var(--amber) 11%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 26%, transparent);
}

.warn {
  flex: none;
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cell--status .cell__clean {
  display: grid;
}

.cell--status .cell__clean > * {
  grid-area: 1 / 1;
  justify-self: start;
}

.pill {
  display: inline-block;
  padding: 2px 7px 2px;
  border-radius: 999px;
  font-size: 0.86em;
  font-weight: 560;
  line-height: 1.25;
  color: #c3c5cf;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.pill--customer {
  color: color-mix(in srgb, var(--accent) 50%, #ffffff);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}

.pill--partner {
  color: var(--ink);
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

[data-status-b] {
  opacity: 0;
}

/* the small Merged tag */
.cell__name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px 1px 5px;
  border-radius: 999px;
  font-size: 0.76em;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent) 45%, #ffffff);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 34%, transparent);
  max-width: 8em;
  opacity: 0;
  overflow: hidden;
  transform-origin: 0 50%;
}

/* hidden, the tag takes no room, so the name is whole until the rows are merged */
.tag.is-shut {
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  margin-left: -5px;
}

.tag svg {
  width: 9px;
  height: 9px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

/* the note over the rows that need a look */
.row--note .row__in {
  display: flex;
  gap: 6px;
  color: var(--amber);
  box-shadow: none;
  font-weight: 560;
}

.warn--big {
  width: 12px;
  height: 12px;
}

.note__words {
  flex: 1;
}

.note__btn {
  font: inherit;
  font-size: 0.95em;
  font-weight: 600;
  color: var(--amber);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  border: 0;
  border-radius: 999px;
  padding: 3px 9px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 28%, transparent);
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.note__btn:active {
  transform: scale(0.95);
}

.note__btn:focus-visible,
.imp__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* the drop zone and the file */
.drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 8;
}

.drop__edge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.drop__edge rect {
  width: calc(100% - 1px);
  height: calc(100% - 1px);
  fill: color-mix(in srgb, var(--accent) calc(var(--hot, 0) * 7%), rgba(255, 255, 255, 0.015));
  stroke: color-mix(in srgb, var(--accent) calc(30% + var(--hot, 0) * 70%), rgba(255, 255, 255, 0.14));
  stroke-width: 1;
  stroke-dasharray: 5 5;
}

.drop__words {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.drop__up {
  width: 22px;
  height: 22px;
  margin-bottom: 4px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop__title {
  font-size: clamp(12px, 3.3vh, 14px);
  font-weight: 600;
}

.drop__sub {
  font-size: calc(var(--fs) * 0.92);
  color: var(--muted);
}

.chip {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 9px;
  border-radius: 12px;
  background: linear-gradient(180deg, #22232c, #17181f);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 18px 30px -12px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  opacity: 0;
}

.chip__doc {
  position: relative;
  width: 26px;
  height: 32px;
}

.chip__doc svg {
  width: 100%;
  height: 100%;
}

.chip__paper {
  fill: #eef0f6;
}

.chip__fold {
  fill: #c9ccd8;
  stroke: #c9ccd8;
  stroke-width: 0.6;
  stroke-linejoin: round;
}

.chip__ext {
  position: absolute;
  left: -3px;
  bottom: 5px;
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #ffffff;
  background: var(--accent);
}

.chip__words {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chip__name {
  font-size: 12px;
  font-weight: 600;
}

.chip__size {
  font-size: 10.5px;
  color: var(--muted);
}

/* the foot */
.imp__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: clamp(8px, 2.4vh, 12px);
  min-height: clamp(28px, 7.4vh, 34px);
}

.state {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.state__icon {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.state__track {
  stroke: rgba(255, 255, 255, 0.09);
}

.state__arc {
  stroke: var(--accent);
  stroke-dasharray: 0.28 0.72;
  opacity: 0;
}

.state__ring {
  stroke: var(--accent);
  stroke-dasharray: 1;
}

.state__tick {
  stroke: #ffffff;
  stroke-dasharray: 1;
}

.state__lines {
  display: grid;
  min-width: 0;
  overflow: hidden;
  padding: 2px 0;
  font-size: var(--fs);
  color: var(--muted);
}

.state__line {
  grid-area: 1 / 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
}

.state__line--ok {
  color: var(--ink);
  font-weight: 600;
}

.imp__pct {
  flex: none;
  font-size: var(--fs);
  font-weight: 560;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.imp__btn {
  position: absolute;
  right: 0;
  top: 50%;
  margin-top: calc(clamp(26px, 6.8vh, 32px) / -2);
  height: clamp(26px, 6.8vh, 32px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  opacity: 0;
  pointer-events: none;
}

.imp__btn.is-on {
  pointer-events: auto;
}

.imp__btn-face {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  border-radius: 999px;
  font-size: var(--fs);
  font-weight: 600;
  font-stretch: 100%;
  color: var(--button-ink);
  background: var(--button);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12), 0 6px 16px -8px rgba(255, 255, 255, 0.4);
  transition: font-stretch 0.45s cubic-bezier(0.3, 1.6, 0.5, 1), transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.imp__btn:active .imp__btn-face {
  transform: scale(0.95);
}

@media (hover: hover) {
  .imp__btn:hover .imp__btn-face {
    font-stretch: 112%;
    transform: scale(1.03);
  }
  .note__btn:hover {
    background: color-mix(in srgb, var(--amber) 18%, transparent);
  }
  .row:not(.row--note):hover .row__in {
    background: rgba(255, 255, 255, 0.035);
  }
}

/* narrow screens: the company column goes */
@media (max-width: 440px) {
  .cols,
  .row__in {
    grid-template-columns: 1.55fr 1.2fr 6.1em;
    gap: 6px;
    padding: 0 6px;
  }
  .pill {
    font-size: 0.82em;
    padding: 2px 6px;
  }
  .cols__cell--company,
  .cell--company {
    display: none;
  }
  .tag svg {
    display: none;
  }
  .tag {
    padding: 1px 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .imp__btn-face,
  .note__btn {
    transition: none;
  }
}
