/* Porch Widget — cw> _ terminal trigger + slide-up chat panel */

/* ── Trigger Button ──────────────────────────── */

.porch-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9997;
  background: #0a1628;
  border: 1px solid rgba(212, 168, 75, 0.2);
  border-radius: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 10px 18px;
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #d4a84b;
  text-decoration: none;
  transition: border-color 0.3s, padding 0.3s;
  line-height: 1;
}

.porch-widget:hover {
  border-color: rgba(212, 168, 75, 0.6);
  text-decoration: none;
}

.porch-widget:visited {
  color: #d4a84b;
}

.porch-widget:focus-visible {
  outline: 2px solid #d4a84b;
  outline-offset: 2px;
}

.porch-widget-prompt {
  white-space: nowrap;
}

.porch-widget-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: #d4a84b;
  margin-left: 2px;
  vertical-align: middle;
  animation: porch-blink 1s step-end infinite;
}

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

.porch-widget-hover {
  display: none;
}

.porch-widget:hover .porch-widget-hover {
  display: inline;
}

.porch-widget:hover .porch-widget-cursor {
  display: none;
}

/* ── Chat Panel ──────────────────────────────── */

.porch-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  height: 520px;
  z-index: 9998;
  background: #0a1628;
  border: 1px solid rgba(212, 168, 75, 0.15);
  border-radius: 12px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.porch-panel.open {
  display: flex;
}

/* Panel Header */
.porch-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.porch-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d4a84b;
}

.porch-panel-close {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.porch-panel-close:hover {
  color: #d4a84b;
}

/* Messages Area */
.porch-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.porch-msg {
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 85%;
}

.porch-msg-cw {
  color: #e0e0e0;
  align-self: flex-start;
}

.porch-msg-cw::before {
  content: 'cw> ';
  color: #d4a84b;
  font-weight: 600;
}

.porch-msg-you {
  color: #9ca3af;
  align-self: flex-end;
  text-align: right;
}

.porch-msg-typing {
  color: #6b7280;
  align-self: flex-start;
}

.porch-msg-typing::before {
  content: 'cw> ';
  color: #d4a84b;
  font-weight: 600;
}

/* Prompt Chips */
.porch-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  flex-shrink: 0;
}

.porch-chip {
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.porch-chip:hover {
  color: #d4a84b;
  border-color: rgba(212, 168, 75, 0.3);
}

/* Input Area */
.porch-panel-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.porch-panel-textarea {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #f0f0f0;
  resize: none;
  min-height: 36px;
  max-height: 80px;
  line-height: 1.4;
}

.porch-panel-textarea::placeholder {
  color: #6b7280;
}

.porch-panel-textarea:focus {
  outline: none;
  border-color: rgba(212, 168, 75, 0.3);
}

.porch-panel-send {
  background: none;
  border: 1px solid rgba(212, 168, 75, 0.3);
  border-radius: 8px;
  color: #d4a84b;
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.porch-panel-send:hover {
  background: rgba(212, 168, 75, 0.1);
}

.porch-panel-send:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Disclaimer */
.porch-panel-disclaimer {
  font-size: 0.65rem;
  color: #4b5563;
  text-align: center;
  padding: 6px 16px 10px;
  flex-shrink: 0;
}

/* Vernie Gate */
.porch-vernie-gate {
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.porch-vernie-gate.open {
  display: flex;
}

.porch-vernie-gate p {
  font-size: 0.85rem;
  color: #e0e0e0;
  line-height: 1.6;
}

.porch-vernie-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'IBM Plex Mono', 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #f0f0f0;
  text-align: center;
  letter-spacing: 0.2em;
}

.porch-vernie-input:focus {
  outline: none;
  border-color: rgba(212, 168, 75, 0.3);
}

.porch-vernie-error {
  font-size: 0.8rem;
  color: #ef4444;
  text-align: center;
  display: none;
}

/* ── Mobile ──────────────────────────────────── */

@media (max-width: 480px) {
  .porch-widget {
    bottom: 16px;
    right: 16px;
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .porch-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 85vh;
    border-radius: 12px 12px 0 0;
  }
}

/* ── Reduced motion ──────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .porch-widget-cursor {
    animation: none;
    opacity: 1;
  }
}

/* ── Print ───────────────────────────────────── */

@media print {
  .porch-widget,
  .porch-panel {
    display: none !important;
  }
}
