/* ═══════════════════════════════════════════════
   ZIP TIE GARAGE — Chat-style Article Layout
   Reads like scrolling through the real group chat
═══════════════════════════════════════════════ */

/* ── Page shell ──────────────────────────────── */
.chat-page {
  max-width: 680px;
  margin: 0 auto;
  padding: calc(var(--nav-h) + 24px) 0 80px;
}

/* ── Article header (stays traditional) ─────── */
.chat-article-header {
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.chat-article-header .article-category-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--border-hot);
  padding: 3px 8px;
  border-radius: 2px;
  margin-bottom: 12px;
}

.chat-article-header h1 {
  font-family: var(--font-head);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.chat-article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.chat-article-meta .author-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.chat-article-meta .sep { color: var(--text-dim); }

/* ── TL;DR ───────────────────────────────────── */
.chat-tldr {
  margin: 0 20px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 14px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.chat-tldr .tldr-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 6px;
}

.chat-tldr p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Affiliate disclosure note ───────────────── */
.affiliate-note {
  margin: 0 20px 14px;
  padding: 8px 14px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-left: 2px solid var(--border);
  line-height: 1.5;
  font-style: italic;
  opacity: 0.8;
}
.affiliate-note a {
  color: var(--text-muted);
  text-decoration: underline;
}
.affiliate-note a:hover {
  color: var(--accent);
}

/* ── Thread container ────────────────────────── */
.chat-thread {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Date dividers ───────────────────────────── */
.chat-date-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chat-date-divider::before,
.chat-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Base message row ────────────────────────── */
/* Override the hero-chat animation from style.css (.chat-msg starts at opacity:0) */
.chat-thread .chat-msg {
  opacity: 1;
  transform: none;
  padding: 0;
  color: inherit;
  line-height: inherit;
}

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 1px 8px;
  max-width: 100%;
}

.chat-msg + .chat-msg {
  margin-top: 1px;
}

/* Extra space when sender changes */
.chat-msg.new-sender {
  margin-top: 10px;
}

/* ── Avatars ─────────────────────────────────── */
.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: #0a0a0a;
  align-self: flex-end;
}

.chat-avatar.scott  { background: var(--scott); }
.chat-avatar.steve  { background: var(--steve); }
.chat-avatar.jamie  { background: var(--jamie); }
.chat-avatar.david  { background: var(--david); }
.chat-avatar.jim    { background: var(--jim); }

/* Hidden avatar for consecutive messages from same sender */
.chat-avatar.hidden {
  visibility: hidden;
}

/* ── Bubble wrapper ──────────────────────────── */
.chat-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 480px);
}

/* ── Sender label (shows once per run) ──────── */
.chat-sender-name {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0 4px;
  margin-bottom: 3px;
}

.chat-sender-name.scott { color: var(--scott); }
.chat-sender-name.steve { color: var(--steve); }
.chat-sender-name.jamie { color: var(--jamie); }
.chat-sender-name.david { color: var(--david); }
.chat-sender-name.jim   { color: var(--jim); }

/* ── Bubble ──────────────────────────────────── */
.chat-bubble {
  background: #2c2c2c;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  font-size: 0.925rem;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

/* Per-sender left border accent */
.chat-msg.scott .chat-bubble { border-left: 3px solid var(--scott); }
.chat-msg.steve .chat-bubble { border-left: 3px solid var(--steve); }
.chat-msg.jamie .chat-bubble { border-left: 3px solid var(--jamie); }
.chat-msg.david .chat-bubble { border-left: 3px solid var(--david); }
.chat-msg.jim   .chat-bubble { border-left: 3px solid var(--jim); }

/* Timestamp */
.chat-time {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 3px;
  padding: 0 4px;
  align-self: flex-end;
}

/* ── Photo bubble ────────────────────────────── */
.chat-bubble.photo {
  padding: 3px;
  background: transparent;
  border-color: var(--border);
  border-radius: 12px;
  overflow: hidden;
  max-width: 320px;
}

.chat-bubble.photo img {
  width: 100%;
  height: auto;
  max-height: 380px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* ── Narrator (ZTG editorial voice) ─────────── */
.chat-narrator {
  margin: 20px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-narrator-label {
  background: var(--surface);
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.chat-narrator-body {
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-muted);
  background: var(--surface);
}

.chat-narrator-body p + p {
  margin-top: 10px;
}

/* Tip / warning inside narrator */
.chat-narrator .inline-tip,
.chat-narrator .inline-warn {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.chat-narrator .inline-tip {
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.chat-narrator .inline-warn {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

/* ── Inline Ad bubble ────────────────────────── */
.chat-ad {
  margin: 20px 8px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.chat-ad-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.chat-ad-bubble {
  background: #252525;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  max-width: min(72%, 480px);
  position: relative;
}

.chat-ad-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-ad-label::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
}

.chat-ad-sender {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.chat-ad-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
}

.chat-ad-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.15s;
}

.chat-ad-cta:hover {
  background: var(--accent-bright);
}

/* ── Reply-quote (message referencing another) ── */
.chat-quote {
  background: var(--surface);
  border-left: 2px solid var(--border);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.chat-quote .quote-sender {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.68rem;
  margin-bottom: 2px;
}

/* ── List items in narrator ──────────────────── */
.chat-narrator-body ul {
  margin: 8px 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chat-narrator-body li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.chat-narrator-body li strong {
  color: var(--text);
}

/* ── Inline affiliate links (Amazon) ─────────── */
/* Scoped to article content so global a {} reset in style.css doesn't win */
.chat-narrator-body a[href*="tag=ziptiegarage-20"],
.chat-tldr a[href*="tag=ziptiegarage-20"],
.chat-msg a[href*="tag=ziptiegarage-20"] {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(255, 153, 0, 0.45);
  text-underline-offset: 2px;
  font-weight: 600;
  transition: color 0.15s, text-decoration-color 0.15s;
}

.chat-narrator-body a[href*="tag=ziptiegarage-20"]:hover,
.chat-tldr a[href*="tag=ziptiegarage-20"]:hover,
.chat-msg a[href*="tag=ziptiegarage-20"]:hover {
  color: #ffb347;
  text-decoration-color: #ff9900;
}

.chat-narrator-body a[href*="tag=ziptiegarage-20"]::after,
.chat-tldr a[href*="tag=ziptiegarage-20"]::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.7;
}

/* ── Sponsored in-thread product card ────────── */
.chat-sponsor {
  margin: 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #ff9900;
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-sponsor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.chat-sponsor-avatar {
  font-size: 0.95rem;
}

/* Initials avatar variant (matches .chat-avatar style) */
.chat-sponsor-avatar.david {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--david);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: #0a0a0a;
  flex-shrink: 0;
}

.chat-sponsor-name {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.chat-sponsor-name.david { color: var(--david); }

.chat-sponsor-chip {
  margin-left: auto;
  padding: 2px 7px;
  background: rgba(255, 153, 0, 0.12);
  color: #ffb347;
  border: 1px solid rgba(255, 153, 0, 0.35);
  border-radius: 2px;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-sponsor-body {
  padding: 12px 16px 14px;
}

.chat-sponsor-pitch {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.chat-sponsor-cta {
  display: inline-block;
  padding: 11px 16px;
  background: #ff9900;
  color: #1a1a1a !important;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 4px;
  text-decoration: none !important;
  transition: background 0.15s, transform 0.15s;
}

.chat-sponsor-cta:hover {
  background: #ffb347;
  transform: translateY(-1px);
}

/* ── Article nav at bottom ───────────────────── */
.chat-article-nav {
  padding: 24px 20px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  display: flex;
  gap: 12px;
}

.chat-article-nav a {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s;
}

.chat-article-nav a:hover {
  border-color: var(--accent);
}

.chat-article-nav .nav-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.chat-article-nav .nav-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
}

/* ── Photo lightbox ──────────────────────────── */
#ztg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

#ztg-lightbox.open {
  display: flex;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.lb-frame {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 900px);
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lb-in 0.18s ease;
}

@keyframes lb-in {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.lb-img {
  display: block;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
}

.lb-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lb-close:hover { opacity: 1; }

/* Make photo bubbles show a zoom cursor */
.chat-bubble.photo img {
  cursor: zoom-in;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 600px) {
  .chat-page {
    padding-top: calc(var(--nav-h) + 12px);
  }

  .chat-bubble-wrap {
    max-width: 82%;
  }

  .chat-ad-bubble {
    max-width: 82%;
  }
}
