/* Extracted custom styles from index.html */

/* icons row and icon figure styles */
.icons-row {
  display: flex;
  gap: 2rem;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
}

.icon-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #cbd5e1;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial;
}

.slide-icon {
  width: 140px;
  height: 140px;
  object-fit: contain;
  display: block;
}

/* Zed-specific icon size: larger than other icons without affecting them */
.zed-icon {
  width: 220px;
  height: 220px;
}

.icon-figure figcaption {
  margin-top: 0.5rem;
  font-size: 1.15rem;
  color: #9ca3af;
}

.icon-text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (max-width: 640px) {
  .slide-icon {
    width: 110px;
    height: 110px;
  }
  /* scale down the zed icon on small screens */
  .zed-icon {
    width: 150px;
    height: 150px;
  }
}

/* center graphic (SVG network) styles */
.center-graphic {
  width: 80%;
  max-width: 900px;
  margin: 0.8rem auto;
}

.network-svg {
  width: 100%;
  height: auto;
  display: block;
}

.server-box {
  fill: #111827;
  stroke: #7dd3fc;
  stroke-width: 2px;
  filter: url(#glow);
}

.server-label {
  fill: #7dd3fc;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial;
  font-size: 14px;
}

.client-dot {
  fill: #60a5fa;
  stroke: #93c5fd;
  stroke-width: 1.5px;
  cursor: pointer;
  transition: fill 200ms, opacity 200ms, transform 200ms;
}

.client-label {
  fill: #cbd5e1;
  font-size: 12px;
}

.link {
  stroke: #93c5fd;
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 200ms, opacity 200ms;
}

/* server clickable styles */
#server {
  cursor: default;
  transition: fill 200ms, stroke 200ms, opacity 200ms, transform 200ms;
}

#server.offline .server-box {
  fill: #0f1724; /* darker */
  stroke: #475569; /* muted */
  opacity: 0.8;
  transform: scale(0.98);
}

.client.offline .client-dot {
  fill: #374151;
  opacity: 0.6;
  transform: scale(0.95);
}

.client.offline + .link,
.link.offline {
  stroke: #4b5563;
  opacity: 0.35;
}

.figure-caption {
  text-align: center;
  color: #cbd5e1;
  font-size: 12px;
  margin-top: 0.4rem;
}

@media (prefers-reduced-motion: no-preference) {
  .client-dot:hover {
    transform: scale(1.12);
  }
}

/* console styles */
.console {
  background: #0b1020;
  color: #c7d2fe;
  padding: 1rem;
  border-radius: 6px;
  width: 80%;
  max-width: 900px;
  margin: 1rem auto;
  /* center horizontally */
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono",
    "Courier New", monospace;
  font-size: 20px;
}

.console-output {
  white-space: pre-wrap;
  min-height: 4.5rem;
}

.console-input {
  margin-top: 0.5rem;
}

#console-caret {
  display: inline-block;
  min-width: 1ch;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

#console-caret::after {
  content: "\00a0";
  background: #c7d2fe;
  color: #0b1020;
  padding: 0 0.15rem;
  margin-left: 0.2rem;
  animation: blink 1s steps(1) infinite;
}

/* Replicas interactive figure */
.replicas-figure {
  width: 90%;
  max-width: 1000px;
  margin: 0.6rem auto;
  color: #cbd5e1;
}
.replicas-row {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: flex-start;
}
.replica {
  background: #0f1724;
  border: 1px solid rgba(148, 163, 184, 0.08);
  padding: 1rem;
  border-radius: 8px;
  width: 220px;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.6);
}
.replica-header {
  font-weight: 600;
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.status-badge {
  font-size: 11px;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  background: #10b981;
  color: white;
  transition: background-color 300ms ease;
}
.status-badge.offline {
  background: #ef4444;
}
.replica-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 1.02rem;
}
.replica-list li {
  margin: 0.33rem 0;
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}
.replica-connections {
  position: relative;
  height: 40px;
  margin-top: 0.8rem;
}
.replica-lines {
  width: 100%;
  height: 40px;
  overflow: visible;
}
.line {
  stroke: #60a5fa;
  transition: stroke 300ms, opacity 300ms, stroke-dasharray 300ms;
}
.line.offline {
  stroke: #6b7280;
  opacity: 0.35;
  stroke-dasharray: 4 6;
}
.glow {
  filter: drop-shadow(0 0 6px rgba(96, 165, 250, 0.9));
}
.replica-button {
  margin: 0.9rem auto 0;
  display: block;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  background: #2563eb;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}
.replica-button:active {
  transform: translateY(1px);
}
.replica-anim-arrow {
  stroke: #93c5fd;
  stroke-width: 2;
  opacity: 0;
  transition: opacity 300ms, transform 400ms;
}
.replica-anim-arrow.show {
  opacity: 1;
}
.replica-anim-arrowhead {
  fill: #93c5fd;
  opacity: 0;
  transition: opacity 300ms, transform 400ms;
}
.replica-anim-arrowhead.show {
  opacity: 1;
}

@media (max-width: 640px) {
  .replicas-row {
    flex-direction: column;
    align-items: center;
  }
  .replica {
    width: 86%;
  }
}

/* Mini demo: two task lists for Alice and Bob */
.mini-demo .two-lists {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: flex-start;
  width: 80%;
  max-width: 700px;
  margin: 0 auto;
}
.mini-demo .person {
  background: linear-gradient(180deg, #071129, #0f1724);
  border: 1px solid rgba(148, 163, 184, 0.06);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  width: 320px;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.55);
}
.mini-demo .person-name {
  font-weight: 700;
  color: #e6eef8;
  margin-bottom: 0.45rem;
}
.mini-demo .tasks {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mini-demo .task {
  padding: 0.45rem 0;
  color: #cbd5e1;
  font-size: 1.02rem;
}
.mini-demo .task-title {
  font-weight: 600;
  color: #f8fafc;
}
.mini-demo .task-meta {
  color: #9ca3af;
  margin-left: 0.5rem;
  font-style: normal;
}
.mini-demo .meta-time {
  color: #60a5fa;
  font-weight: 600;
}
.mini-demo .meta-comment {
  color: #fbbf24;
  font-weight: 600;
}
.mini-demo .task.merged {
  background: rgba(99, 102, 241, 0.03);
  border-radius: 6px;
  padding: 0.6rem;
}

@media (max-width: 700px) {
  .mini-demo .two-lists {
    flex-direction: column;
    width: 92%;
  }
  .mini-demo .person {
    width: 100%;
  }
}

/* Left-shift helper for copied / summary subsections (slide 11) */
.left-shift {
  display: inline-block;
  transform: translateX(-20rem); /* nudge left; adjust as needed */
}

@media (max-width: 900px) {
  /* reduce shift on smaller screens so content remains visible */
  .left-shift {
    transform: translateX(-4rem);
  }
}

/* Responsive layout for slide 11: ensure left and right columns don't overlap
   by switching to a stacked layout on narrow screens. The HTML uses an outer
   flex-like arrangement inline; target the slide container and the right column. */
@media (max-width: 920px) {
  /* undo large left shift entirely on small screens so the left column stays
     within the viewport and can flow above the right column */
  .left-shift {
    transform: none;
    display: block;
    margin: 0 auto;
  }

  /* Slide right column becomes a normal block below the main content */
  .slide-right-column {
    position: static !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    /* cap the visual width so the column appears as a centered block
       instead of stretching full-width; it will shrink on very small
       screens via the min() value */
    width: min(420px, 92%) !important;
    max-width: 420px !important;
    margin: 1.25rem auto 0;
    text-align: left;
  }

  /* Make sure any absolutely positioned children inside the right column
     behave well when stacked */
  .slide-right-column > * {
    position: relative;
  }
}

/* Extra small screens: slightly reduce spacing and icon/word sizes so the
   slide content remains readable without overlap */
@media (max-width: 700px) {
  .crdts-letter {
    font-size: 3rem; /* smaller big letters */
  }
  .crdts-words {
    font-size: 1.4rem;
    max-width: 24rem;
  }
}
