/* ==========================================================================
   INTERVIEW WIDGET — Quick Interview With Bill
   Vanilla CSS, no dependencies. Themed to the portfolio2026 design system.
   ========================================================================== */

/* ---------- DESIGN TOKENS (scoped to widget) ---------- */
.iw-root {
  --iw-bg:           #FFFFFF;
  --iw-bg-soft:      #FAF8F5;
  --iw-border:       oklch(0.90 0.008 60);
  --iw-border-hover: color-mix(in oklab, oklch(0.58 0.115 42) 30%, transparent);
  --iw-text:         oklch(0.24 0.012 60);
  --iw-text-soft:    oklch(0.42 0.012 60);
  --iw-text-mute:    oklch(0.54 0.012 60);
  --iw-accent:       oklch(0.58 0.115 42);
  --iw-accent-soft:  color-mix(in oklab, oklch(0.58 0.115 42) 9%, transparent);
  --iw-shadow-sm:    0 4px 12px -4px rgba(40, 30, 20, 0.10);
  --iw-shadow-md:    0 18px 40px -16px rgba(40, 30, 20, 0.22);
  --iw-shadow-lg:    0 32px 64px -24px rgba(40, 30, 20, 0.30);
  --iw-radius:       14px;
  --iw-radius-sm:    10px;
  --iw-ease:         cubic-bezier(0.2, 0.8, 0.2, 1);

  --iw-sans:    'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --iw-display: 'Newsreader', Georgia, serif;
  --iw-mono:    'IBM Plex Mono', ui-monospace, monospace;

  font-family: var(--iw-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--iw-text);
}

/* ---------- FLOATING LAUNCHER (visible when widget minimized) ---------- */
.iw-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: var(--iw-text);
  color: #FFFFFF;
  border: none;
  border-radius: 100px;
  font: 500 13px/1 var(--iw-sans);
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: var(--iw-shadow-md);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.4s var(--iw-ease), opacity 0.4s var(--iw-ease), background 0.25s;
}
.iw-launcher.iw-visible {
  display: inline-flex;
  transform: translateY(0);
  opacity: 1;
}
.iw-launcher:hover { background: var(--iw-accent); }
.iw-launcher-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}
.iw-launcher-ico svg { width: 15px; height: 15px; display: block; }

.iw-title-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.iw-title-ico svg { width: 16px; height: 16px; display: block; }

/* ---------- WIDGET PANEL ---------- */
.iw-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  width: 380px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--iw-bg);
  border: 1px solid var(--iw-border);
  border-radius: var(--iw-radius);
  box-shadow: var(--iw-shadow-lg);
  overflow: hidden;
  transform-origin: bottom right;
  transition: transform 0.45s var(--iw-ease), opacity 0.35s var(--iw-ease);
}
.iw-panel.iw-hidden {
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
}

/* ---------- HEADER ---------- */
.iw-header {
  position: relative;
  padding: 20px 22px 18px;
  background: var(--iw-accent);
  border-bottom: 1px solid var(--iw-accent);
  flex-shrink: 0;
}
.iw-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.iw-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.iw-title {
  font-family: var(--iw-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #FFFFFF;
  margin: 0;
}
.iw-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.iw-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  padding: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--iw-ease);
}
.iw-icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: transparent;
  color: #FFFFFF;
}
.iw-icon-btn:active { transform: scale(0.94); }
.iw-icon-btn svg { width: 14px; height: 14px; display: block; }

.iw-subtitle {
  font-size: 12.5px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  letter-spacing: 0;
}

/* ---------- BODY (scrollable list) ---------- */
.iw-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 12px 14px;
  scroll-behavior: smooth;
}
.iw-body::-webkit-scrollbar { width: 6px; }
.iw-body::-webkit-scrollbar-thumb {
  background: color-mix(in oklab, var(--iw-text) 12%, transparent);
  border-radius: 3px;
}
.iw-body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklab, var(--iw-text) 22%, transparent);
}

/* ---------- ACCORDION ITEM ---------- */
.iw-item { border-bottom: 1px solid var(--iw-border); }
.iw-item:last-child { border-bottom: none; }

.iw-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 10px;
  background: transparent;
  border: none;
  border-radius: 10px;
  text-align: left;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--iw-text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.iw-question:hover {
  background: var(--iw-accent-soft);
  color: var(--iw-accent);
}
.iw-question:focus-visible {
  outline: 2px solid var(--iw-accent);
  outline-offset: 2px;
}
.iw-q-text { flex: 1; min-width: 0; }
.iw-q-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--iw-bg-soft);
  border: 1px solid var(--iw-border);
  color: var(--iw-text-mute);
  transition: transform 0.4s var(--iw-ease), background 0.25s, border-color 0.25s, color 0.25s;
}
.iw-q-icon svg { width: 10px; height: 10px; }
.iw-item.iw-open .iw-q-icon {
  transform: rotate(45deg);
  background: var(--iw-accent);
  border-color: var(--iw-accent);
  color: #FFFFFF;
}
.iw-item.iw-open .iw-question {
  color: var(--iw-accent);
  font-weight: 600;
}

/* ---------- ANSWER (collapses via max-height) ---------- */
.iw-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s var(--iw-ease), opacity 0.3s ease;
  opacity: 0;
}
.iw-item.iw-open .iw-answer { opacity: 1; }

.iw-answer-inner {
  padding: 4px 10px 18px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--iw-text-soft);
}
.iw-answer-inner p { margin: 0 0 12px; }
.iw-answer-inner p:last-child { margin-bottom: 0; }
.iw-answer-inner strong { color: var(--iw-text); font-weight: 600; }

/* Video container */
.iw-video {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: 12px 0;
  background: linear-gradient(135deg, #2a241f, #3a332c);
  border-radius: var(--iw-radius-sm);
  overflow: hidden;
  box-shadow: var(--iw-shadow-sm);
}
.iw-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--iw-radius-sm);
}
.iw-video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--iw-mono);
}
.iw-video-placeholder .iw-play-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.iw-video-placeholder .iw-play-icon::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 12px solid #FFFFFF;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 3px;
}

/* Optional image */
.iw-image {
  width: 100%;
  margin: 12px 0;
  border-radius: var(--iw-radius-sm);
  display: block;
  box-shadow: var(--iw-shadow-sm);
}

/* Optional CTA */
.iw-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 16px;
  background: var(--iw-text);
  color: #FFFFFF;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background 0.25s, transform 0.25s var(--iw-ease);
}
.iw-cta:hover { background: var(--iw-accent); transform: translateY(-1px); }
.iw-cta-arrow { transition: transform 0.25s; }
.iw-cta:hover .iw-cta-arrow { transform: translateX(2px); }

/* ---------- FOOTER ---------- */
.iw-footer {
  flex-shrink: 0;
  padding: 10px 18px 12px;
  background: var(--iw-bg-soft);
  border-top: 1px solid var(--iw-border);
  font-family: var(--iw-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--iw-text-mute);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.iw-footer-typing { display: inline-flex; align-items: center; gap: 5px; }
.iw-footer-typing span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--iw-accent);
  opacity: 0.4;
  animation: iw-typing 1.4s infinite ease-in-out;
}
.iw-footer-typing span:nth-child(2) { animation-delay: 0.18s; }
.iw-footer-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes iw-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ---------- MINIMIZED STATE (compact bar) ---------- */
.iw-panel.iw-minimized .iw-body,
.iw-panel.iw-minimized .iw-footer,
.iw-panel.iw-minimized .iw-subtitle { display: none; }
.iw-panel.iw-minimized { width: auto; max-width: 380px; }
.iw-panel.iw-minimized .iw-header { padding: 14px 18px; border-bottom: none; }
.iw-panel.iw-minimized .iw-header-top { margin-bottom: 0; }

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  .iw-panel, .iw-launcher, .iw-answer, .iw-q-icon,
  .iw-icon-btn, .iw-cta, .iw-footer-typing span {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .iw-panel {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 12px;
    max-height: calc(100vh - 24px);
    border-radius: 14px;
  }
  .iw-launcher { right: 12px; bottom: 12px; }
  .iw-header { padding: 18px 18px 16px; }
  .iw-body { padding: 8px 8px 12px; }
  .iw-question { padding: 13px 8px; font-size: 13px; }
  .iw-answer-inner { padding: 4px 8px 16px; }
}
@media (max-width: 380px) {
  .iw-title { font-size: 16px; }
  .iw-subtitle { font-size: 12px; }
}
