/* All your base R belong to us. */
.thread-updates {
  position: fixed;
  top: calc(var(--site-header-height) - 12px);
  z-index: 950; /* below header (1000), above content */
  display: flex;
  left: 0;
  right: 0;
  justify-content: center; /* centers the panel */
  pointer-events: none; /* IMPORTANT */
  padding-inline: 1.25rem; /* matches .container */
}



/* Can you handle it? */
.thread-handle {
  position: absolute;

  right: 0;
  bottom: 0;                 /* 🔑 anchor to panel bottom */

  display: flex;
  flex-direction: column;
  align-items: center;

  padding-inline: 15px;
  background: transparent;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  z-index: 1; /* panel sits above the thread */
}


.thread-visual {
  display: flex;
  flex-direction: column;
  align-items: center;

  transform: translateY(100%); /* movement lives HERE */
  z-index: 1;
}




/* */
.thread-handle:focus-visible {
  outline: 2px solid var(--highlight);
  outline-offset: 4px;
}

.thread-handle:hover {
  cursor: pointer;
}


/* Hook, line, and sinker. */
.thread-line {
  width: 3px;
  height: 64px;
  background: linear-gradient(
    to bottom,
    #d6b35c,
    #f2d27c,
    #c9a648
  );
}

/* Probably Knot */
.thread-knot {
  width: 9px;
  height: 9px;
  margin-top: -15px;   /* ← move bead UP the thread */
  align-self: center;
  border-radius: 50%;
  background: #d6b35c;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}


.thread-line,
.thread-knot {
  pointer-events: none; /* clicks go to button */
  align-self: center;
}

/* Thread panel (motion-aware) */
.thread-panel {
  /* motion baseline */
  --thread-rest: calc(-100% - 5px); /* tucked under nav */
  --thread-x: 0px;
  --thread-y: var(--thread-rest);

  transform: translate(var(--thread-x), var(--thread-y));
  transition: transform 0.35s ease;

  position: relative;
  pointer-events: auto;

  max-height: 66vh;
  overflow: visible;
  width: min(90vw, var(--content-width));

  background: var(--surface);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 12px 24px rgba(0,0,0,0.25);

  z-index: 2; /* panel above thread */
}

/* Open state */
.thread-panel.is-open {
  --thread-y: 0px;
}


/* Eyeball Heads */
.thread-panel-header {
  position: relative;

  display: flex;
  align-items: center;
  gap: 0.75rem;

  padding: 0.75rem 1rem;
  z-index: 3;
  background: var(--surface); /* 🔑 must be opaque */
  /* visually blends with nav */
  /*background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.08),
    rgba(255,255,255,0)
  );*/

  border-bottom: 1px solid rgba(255,255,255,0.08);
}


.thread-panel-header h2 {
  font-size: 1rem;
  margin: 0;
}

.thread-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
}


/* Read Me */
.thread-panel-content {
  max-height: calc(66vh - 48px);
  overflow-y: auto;

  padding: 2rem 3rem 2.5rem; /* Top, Sides, Bottom */
}

.thread-panel-header,
.thread-panel-content {
  position: relative;
  z-index: 3;
}

.thread-update {
  padding-bottom: 0;
}


.thread-update + .thread-update {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.thread-update h3 {
  font-size: 1.1rem;
  margin-bottom: 0.35rem;
}

.thread-update p {
  font-size: .95rem;
  color: var(--text-soft);
  margin: 0;
  line-height: 1.55;
}
/*
.thread-panel-lip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 24px;

  background: var(--surface);
  z-index: 4;
  pointer-events: none;
}*/

/* Give it some of that transparent lava. ?wut */
.thread-updates.is-faded .thread-handle {
  opacity: 0.4;
}

.thread-updates.is-preview .thread-handle {
  transform: translateY(-30%);
}


.thread-panel:not(.is-open) .thread-panel-content {
  display: none;
}

@media (max-width: 640px) {

  .thread-panel {
    width: 100%;
    border-radius: 0 0 14px 14px; /* feels more native on mobile */
    pointer-events: auto;
  }

  .thread-panel-content {
    max-height: 40vh;  /* 🔑 limits visible items */
    overflow-y: auto;

    padding: 1.25rem 1.25rem 2.25rem;
  }

  .thread-update + .thread-update {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
  }

  .thread-update h3 {
    font-size: 0.95rem;
  }

  .thread-update p {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .thread-update:nth-child(n + 4) {
    display: none;
  }

}

/* Desktop horizontal offset *//*
@media (min-width: 769px) {
  .thread-panel {
    --thread-x: 30px;
  }
}
*/
@media (min-width: 1024px) {
  .thread-updates {
    justify-content: flex-end;
    padding-right: 2rem;
  }
}