/* Kelpie for Mac: one window, two engines.

   The window is drawn in HTML and CSS and measured in cqw (hundredths of the
   drawing's width), so it keeps its proportions at any size. One loop moves
   the toolbar switch from Safari to Chrome, loads the page again and prints
   the agent's call underneath; its keyframes live in engines-loop.css.

   Every resting style is the finished frame: Chrome selected, the page loaded
   and both console lines printed. That is what reduced motion shows. */

.engines {
  --loop: 11s;
  position: relative;
  width: 100%;
  max-width: 580px;
  isolation: isolate;
  justify-self: center;
  container-type: inline-size;
}

.engines::before {
  position: absolute;
  inset: -14% 0;
  z-index: -1;
  background:
    radial-gradient(closest-side at 30% 34%, rgba(66, 244, 188, 0.24), transparent),
    radial-gradient(closest-side at 70% 66%, rgba(249, 67, 154, 0.18), transparent);
  content: "";
}

/* The window */
.mac {
  overflow: hidden;
  margin-right: 5%;
  border: 1px solid #c9cdd9;
  border-radius: 2.2cqw;
  background: #fff;
  box-shadow: 0 40px 70px -40px rgba(0, 12, 48, 0.5), 0 2px 6px rgba(0, 12, 48, 0.12);
  font-size: max(9px, 2.35cqw);
}

/* Title strip: window controls and one tab. */
.mac-tabs {
  display: flex;
  gap: 1.5cqw;
  align-items: center;
  height: 7.4cqw;
  padding: 0 2.8cqw;
  background: #e2e4f0;
}

.mac-tabs i {
  width: 2.3cqw;
  height: 2.3cqw;
  flex: none;
  border-radius: 50%;
  background: #ff5f57;
}

.mac-tabs i:nth-child(2) {
  background: #febc2e;
}

.mac-tabs i:nth-child(3) {
  background: #28c840;
}

.mac-tabs span {
  display: flex;
  align-items: center;
  align-self: flex-end;
  height: 5.8cqw;
  margin-left: 2.6cqw;
  padding: 0 3.2cqw;
  border-radius: 1.6cqw 1.6cqw 0 0;
  background: #fff;
  font-weight: 500;
}

/* Navigation row: back, forward, reload, the address and the engine switch. */
.mac-bar {
  display: flex;
  gap: 2.4cqw;
  align-items: center;
  padding: 1.8cqw 2.8cqw;
  border-bottom: 1px solid var(--k-line);
}

.mac-bar i {
  width: 1.9cqw;
  height: 1.9cqw;
  flex: none;
  border: solid #5c6170;
  border-width: 0 0 1.5px 1.5px;
  transform: rotate(45deg);
}

.mac-bar i:nth-child(2) {
  margin-left: -0.6cqw;
  opacity: 0.35;
  transform: rotate(-135deg);
}

.mac-bar i:nth-child(3) {
  width: 2.5cqw;
  height: 2.5cqw;
  border-width: 1.5px;
  border-radius: 50%;
  border-right-color: transparent;
  transform: rotate(-35deg);
}

.mac-url {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  padding: 1.25cqw 2.8cqw;
  border-radius: 999px;
  background: #eef0f6;
  color: #4a4f5e;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mac-switch {
  position: relative;
  display: grid;
  flex: none;
  grid-template-columns: 1fr 1fr;
  padding: 0.5cqw;
  border-radius: 1.7cqw;
  background: #e6e8f0;
  font-weight: 600;
}

/* The selected half. */
.mac-switch::before {
  position: absolute;
  top: 0.5cqw;
  bottom: 0.5cqw;
  left: 0.5cqw;
  width: calc(50% - 0.5cqw);
  border-radius: 1.3cqw;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 12, 48, 0.2);
  content: "";
  transform: translateX(100%);
  animation: mac-thumb var(--loop) infinite both;
}

.mac-switch b {
  position: relative;
  padding: 0.8cqw 2.2cqw;
  color: #8a8f9c;
  font-weight: inherit;
  text-align: center;
  animation: mac-label-on var(--loop) infinite both;
}

.mac-switch b:last-child {
  color: var(--k-ink);
  animation-name: mac-label-off;
}

/* The page: an account page that knows who you are. */
.mac-page {
  position: relative;
  padding: 3.6cqw 4.2cqw 10.5cqw;
}

/* Loading bar along the top of the page. */
.mac-page::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--k-pink);
  content: "";
  opacity: 0;
  transform-origin: left;
  animation: mac-load var(--loop) infinite both;
}

.mac-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5cqw;
}

.mac-nav i {
  width: 5.4cqw;
  height: 5.4cqw;
  border-radius: 1.5cqw;
  background: var(--k-ink);
}

.mac-user {
  position: relative;
  display: flex;
  gap: 1.5cqw;
  align-items: center;
  padding: 0.8cqw 2.4cqw 0.8cqw 0.9cqw;
  border-radius: 999px;
  background: #e3f9f1;
  color: #06634f;
  font-weight: 600;
}

.mac-user::before {
  width: 3.6cqw;
  height: 3.6cqw;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--k-teal), var(--k-mint));
  content: "";
}

/* A ring on the account badge once the page is back: still signed in. */
.mac-user::after {
  position: absolute;
  inset: -0.9cqw;
  border: 2px solid var(--k-teal);
  border-radius: 999px;
  content: "";
  opacity: 0;
  animation: mac-kept var(--loop) infinite both;
}

.mac-page > b,
.mac-text {
  display: block;
  width: 46%;
}

.mac-page > b {
  height: 3.6cqw;
  margin-bottom: 1.7cqw;
  border-radius: 1cqw;
  background: #1d2233;
}

.mac-page > b.s,
.mac-text.s {
  width: 31%;
}

.mac-text {
  height: 1.9cqw;
  margin-top: 1.7cqw;
  border-radius: 1cqw;
  background: #dfe2ea;
}

.mac-art {
  position: absolute;
  top: 13cqw;
  right: 4.2cqw;
  width: 38%;
  height: 25cqw;
  border-radius: 2.4cqw 16cqw 2.4cqw 2.4cqw;
  background: linear-gradient(135deg, var(--k-pink), #ff7ab8);
}

.mac-nav,
.mac-page > b,
.mac-text,
.mac-art {
  animation: mac-reload var(--loop) infinite both;
}

/* Which engine drew the page. Both names share one cell and swap. */
.mac-engine {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 0.35em;
  margin-top: 8cqw;
  padding: 1cqw 2.6cqw;
  border-radius: 999px;
  background: var(--k-ink);
  color: rgba(255, 255, 255, 0.72);
}

.mac-engine em {
  grid-area: 1 / 2;
  color: #fff;
  font-style: normal;
  font-weight: 600;
  opacity: 0;
  animation: mac-show var(--loop) infinite both;
}

.mac-engine em:last-child {
  opacity: 1;
  animation-name: mac-hide;
}

/* The agent's call and the reply, on a card that overlaps the window's foot. */
.mac-log {
  position: relative;
  width: min(94%, 440px);
  margin: -6.5cqw 0 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--k-ink);
  box-shadow: 0 24px 48px -20px rgba(0, 12, 48, 0.6);
  color: #fff;
  font-family: var(--k-mono);
  font-size: 12.5px;
  line-height: 1.7;
  list-style: none;
  animation: mac-call var(--loop) infinite both;
}

.mac-log li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mac-log li:last-child {
  animation: mac-reply var(--loop) infinite both;
}

@media (max-width: 560px) {
  .mac {
    margin-right: 0;
  }

  .mac-page {
    padding-bottom: 4cqw;
  }

  .mac-log {
    width: 100%;
    margin-top: 12px;
    font-size: 11px;
  }
}
