/* ═══════════════════════════════════════════════════════════
   Cymela — Research Page Styles
   ═══════════════════════════════════════════════════════════ */

/* ─── Featured Publication ─── */
.featured-pub {
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--surface-200);
  margin-bottom: var(--space-8);
}

.featured-pub__image {
  position: relative;
  min-height: 360px;
  overflow: hidden;
}

.featured-pub__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease-out-expo);
}

.featured-pub:hover .featured-pub__image img {
  transform: scale(1.04);
}

.featured-pub__body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-5);
}

.featured-pub__tag {
  display: inline-flex;
}

.featured-pub__title {
  font-family: var(--font-mono);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--text-100);
  line-height: var(--leading-snug);
}

.featured-pub__abstract {
  font-size: var(--text-sm);
  color: var(--text-50);
  line-height: var(--leading-relaxed);
  max-width: none;
}

.featured-pub__meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-25);
}

.featured-pub__meta span {
  color: var(--text-50);
}

@media (max-width: 768px) {
  .featured-pub {
    grid-template-columns: 1fr;
  }

  .featured-pub__image {
    min-height: 220px;
  }

  .featured-pub__body {
    padding: var(--space-5);
  }
}


/* ─── Publications Grid ─── */
.pub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
}

.pub-card {
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-200);
  transition: background var(--transition-slow);
  gap: var(--space-4);
}

.pub-card:nth-child(3n) {
  border-right: none;
}

.pub-card:hover {
  background: var(--surface-300);
}

.pub-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.pub-card__title {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-90);
  line-height: var(--leading-snug);
  flex: 1;
}

.pub-card__authors {
  font-size: var(--text-sm);
  color: var(--text-50);
}

.pub-card__date {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-25);
}

.pub-card__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--text-50);
  transition: color var(--transition-fast);
}

.pub-card__link:hover {
  color: var(--accent);
}

@media (max-width: 1024px) {
  .pub-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pub-card:nth-child(3n) {
    border-right: 1px solid var(--border);
  }

  .pub-card:nth-child(2n) {
    border-right: none;
  }
}

@media (max-width: 640px) {
  .pub-grid {
    grid-template-columns: 1fr;
  }

  .pub-card {
    border-right: none;
  }
}

/* ─── CLI Page Layout ─── */
.cli-header {
  min-height: 50vh;
  /* the chameleon floats in the corner and may hang past the header —
     the shared .page-header clips, so opt out here */
  overflow: visible;
}

.cli-main {
  min-height: 45vh;
  display: flex;
  align-items: center;
}

/* butterfly flight zone — kept to a band around the widget rather
   than the full page width */
.cli-install {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}


/* ─── Chameleon Window ─── */
/* Top-right corner of the header, inset from both edges so it never
   touches, and never vertically centred (that pushed it off the bottom). */
.cham-window {
  position: absolute;
  right: clamp(var(--space-5), 4vw, var(--space-16));
  top: calc(var(--header-height) + var(--space-6));
  z-index: 2;
  width: min(40vw, 800px);
  border: 1px solid var(--border-hover);
  border-radius: 6px;
  overflow: hidden;
  background: #060608;
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color var(--transition-base);
}

@media (max-width: 1100px) {
  .cli-header {
    min-height: 40vh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
  }

  .cham-window {
    position: static;
    width: calc(100% - var(--space-10));
    max-width: 560px;
    margin: var(--space-10) auto 0;
  }
}

.cham-window:hover {
  border-color: var(--accent-muted);
}

.cham-window__bar {
  display: flex;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.cham-window__title {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-widest);
  color: var(--text-50);
}

.cham-window__screen {
  display: block;
  background: #000;
  line-height: 0;
}

.chameleon__canvas {
  display: block;
  width: 100%;
  height: auto;
  /* keeps the terminal pixel-art crisp when upscaled */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}


/* ─── CLI Widget ─── */
.cli-widget-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* soft bloom of light spilling out from behind the block */
.cli-widget-wrap::before {
  content: '';
  position: absolute;
  left: -10%;
  right: -10%;
  top: 12%;
  bottom: -22%;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 55%,
    rgba(200, 216, 76, 0.20),
    rgba(255, 168, 203, 0.12) 45%,
    transparent 72%);
  filter: blur(34px);
  opacity: 0.7;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.cli-widget-wrap:hover::before {
  opacity: 1;
}

/* ─── shell tabs ─── */
.cli-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.cli-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-25);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast),
              background var(--transition-fast);
}

.cli-tab:hover {
  color: var(--text-70);
}

.cli-tab.is-active {
  color: var(--surface-000);
  background: var(--accent);
  border-color: var(--accent);
}

.cli-widget {
  position: relative;
  z-index: 1;
  background: #060608;
  border: 1px solid var(--border-hover);
  border-radius: 6px;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 176 / 44;   /* matches the garden canvas */
  box-shadow:
    0 20px 45px rgba(0, 0, 0, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color var(--transition-base);
}

.cli-widget:hover {
  border-color: var(--accent-muted);
}

.cli-widget.is-pulsing {
  animation: cliWidgetPulse 0.7s ease-out;
}

@keyframes cliWidgetPulse {
  0% { box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 rgba(200, 216, 76, 0); }
  35% { box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 26px rgba(200, 216, 76, 0.4); }
  100% { box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 rgba(200, 216, 76, 0); }
}

/* pixel garden sits behind everything in the widget */
.cli-widget__garden {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.cli-widget__content {
  position: relative;
  z-index: 2;
  padding: var(--space-4) var(--space-6) 0;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.cli-widget__code {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-100);
  letter-spacing: 0.5px;
  user-select: all;
  font-weight: 500;
}

.cli-widget__prompt {
  color: var(--accent);
  margin-right: var(--space-2);
  user-select: none;
}

.cli-widget__butterfly {
  position: absolute;
  left: var(--x-start, -8%);
  top: var(--y0, 50%);
  z-index: 5;
  pointer-events: none;
  animation-name: cliButterflyFly;
  animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1);
  animation-fill-mode: forwards;
}

.cli-butterfly__wings-left,
.cli-butterfly__wings-right {
  transform-origin: 11px 8px;
  animation: cliButterflyFlap 0.16s ease-in-out infinite;
}

@keyframes cliButterflyFlap {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.35); }
}

@keyframes cliButterflyFly {
  0%   { left: var(--x-start); top: var(--y0); opacity: 0; transform: scaleX(var(--flip, 1)) rotate(var(--r0, 0deg)) scale(var(--bscale, 1)); }
  10%  { opacity: 0.9; }
  30%  { top: var(--y1); transform: scaleX(var(--flip, 1)) rotate(var(--r1, 0deg)) scale(var(--bscale, 1)); }
  50%  { top: var(--y2); transform: scaleX(var(--flip, 1)) rotate(var(--r2, 0deg)) scale(var(--bscale, 1)); }
  70%  { top: var(--y3); transform: scaleX(var(--flip, 1)) rotate(var(--r3, 0deg)) scale(var(--bscale, 1)); }
  90%  { opacity: 0.9; }
  100% { left: var(--x-end); top: var(--y4); opacity: 0; transform: scaleX(var(--flip, 1)) rotate(var(--r0, 0deg)) scale(var(--bscale, 1)); }
}

/* the whole box is the copy target — hover anywhere blooms the
   flower, click anywhere copies */
.cli-widget__copy {
  position: absolute;
  z-index: 3;
  inset: 0;
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.cli-widget__copy:focus-visible {
  outline: 1px solid var(--accent-muted);
  outline-offset: 2px;
}

/* "copied" — outside the box, to its right */
.cli-widget__copied {
  position: absolute;
  left: calc(100% + var(--space-5));
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  color: var(--petal-pink, #ffa8cb);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.cli-widget__copied.is-shown {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 560px) {
  .cli-widget__copied {
    left: auto;
    right: 0;
    top: calc(100% + var(--space-2));
    transform: none;
  }

  .cli-widget__copied.is-shown {
    transform: none;
  }
}

.cli-widget__hint {
  position: relative;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-25);
}


/* ─── "There is no Python package" disclosure ─── */
.cli-note {
  position: relative;
  z-index: 1;
  align-self: stretch;
  margin-top: var(--space-2);
  border-top: 1px solid var(--border);
  text-align: left;
}

.cli-note__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--text-50);
  cursor: pointer;
  list-style: none;
  transition: color var(--transition-fast);
}

.cli-note__summary::-webkit-details-marker { display: none; }

.cli-note__summary:hover,
.cli-note[open] .cli-note__summary { color: var(--text-90); }

.cli-note__chevron {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.cli-note[open] .cli-note__chevron { transform: rotate(180deg); }

.cli-note__body {
  padding-bottom: var(--space-5);
}

.cli-note__body p {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-50);
}

.cli-note code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--text-90);
  white-space: nowrap;
}

.cli-note__quote {
  margin-top: var(--space-4);
  padding-left: var(--space-4);
  border-left: 1px solid var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-xs) !important;
  line-height: 1.9;
  color: var(--text-70) !important;
}

