/* Help Trigger, Guided Callout & Help Modal — Aligned with Tutaim light/dark tokens */

.help-button-container {
  display: flex;
  justify-content: center;
  margin: 14px auto 0;
  max-width: var(--content-w, 720px);
}

.help-button {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  padding: 9px 18px;
  min-height: 40px;
  border-radius: 9999px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.help-button svg {
  color: var(--brand);
  flex-shrink: 0;
}

.help-button:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .help-button:hover {
    border-color: var(--brand);
    color: var(--text);
    background: var(--panel-2);
  }
}

/* Guided Callout & Target Highlight on Main Page */
.guided-hint {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: var(--radius, 10px);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  animation: guidedHintEnter 220ms cubic-bezier(0.23, 1, 0.32, 1) both;
}

.guided-hint[hidden] {
  display: none;
}

.guided-hint-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.guided-hint-content svg {
  color: var(--brand);
  flex-shrink: 0;
}

.guided-hint-close {
  appearance: none;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .guided-hint-close:hover {
    color: var(--text);
  }
}

.uploader.is-guided-highlight,
.text-uploader.is-guided-highlight {
  position: relative;
  border-color: var(--brand);
}

.guided-hint::after,
.uploader.is-guided-highlight::after,
.text-uploader.is-guided-highlight::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
  pointer-events: none;
  animation: guidedBreathe 2.2s ease-in-out infinite;
}

@keyframes guidedHintEnter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guidedBreathe {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.996);
  }
  50% {
    opacity: 1;
    transform: scale(1.006);
  }
}

/* Modal Overlay & Shell */
.help-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  background: rgba(12, 16, 14, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  overscroll-behavior: contain;
  box-sizing: border-box;
  transition: opacity 180ms ease, visibility 180ms ease;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    calc(16px + env(safe-area-inset-right, 0px))
    calc(16px + env(safe-area-inset-bottom, 0px))
    calc(16px + env(safe-area-inset-left, 0px));
}

.help-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.help-modal-content {
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg, 16px);
  box-shadow: var(--shadow-lg);
  max-width: 720px;
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  overscroll-behavior: contain;
  transform: scale(0.97) translateY(6px);
  opacity: 0;
  transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1), opacity 180ms ease;
}

.help-modal-overlay.active .help-modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.help-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.help-header-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-header-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.help-modal-header h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.help-modal-header .modal-close {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms ease;
}

.help-modal-header .modal-close:active {
  transform: scale(0.95);
}

@media (hover: hover) and (pointer: fine) {
  .help-modal-header .modal-close:hover {
    background: var(--panel-3);
    color: var(--text);
  }
}

.help-modal-body {
  padding: 20px 22px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.help-screen {
  display: none;
}

.help-screen.is-active {
  display: block;
}

.help-back-link {
  appearance: none;
  background: none;
  border: none;
  padding: 6px 2px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .help-back-link:hover {
    color: var(--text);
  }
}

.help-step-heading {
  margin: 0 0 14px;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--text);
  text-align: center;
}

/* Step 1: Neutral Choice Cards */
.help-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.help-type-card {
  appearance: none;
  text-align: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-family: var(--font-body);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 150ms ease, background-color 150ms ease, transform 150ms cubic-bezier(0.23, 1, 0.32, 1);
}

.help-type-card:active {
  transform: scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .help-type-card:hover {
    border-color: var(--border-strong);
    background: var(--panel-3);
  }
}

.help-type-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.help-type-sub {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.4;
}

/* SVG Illustrations (neutral consistent palette) */
.help-illustration {
  width: 100%;
  max-width: 210px;
  margin-bottom: 4px;
}

.help-guide-diagram {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 12px;
  margin-bottom: 14px;
}

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

.svg-surface {
  fill: var(--panel);
  stroke: var(--border-strong);
}

.svg-card-inner {
  fill: var(--panel-2);
  stroke: var(--border-strong);
}

.svg-bubble {
  fill: var(--brand-soft);
}

.svg-highlight-box {
  fill: var(--brand-soft);
  stroke: var(--brand);
}

.svg-line-light {
  stroke: var(--text);
  opacity: 0.7;
}

.svg-line-muted {
  stroke: var(--muted);
  opacity: 0.45;
}

.svg-brand-stroke {
  stroke: var(--brand);
}

.svg-brand-fill {
  fill: var(--brand);
}

.svg-ok-fill {
  fill: var(--ok);
}

.svg-badge-text {
  fill: var(--btn-primary-text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.help-guide-text {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
  text-align: center;
}

.help-guide-text code,
.help-steps-list code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
}

.help-action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.help-action-row .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.help-action-row-end {
  margin-top: 18px;
}

/* Step 3: Email Clients & UI Mockups */
.help-client-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 14px;
}

.help-client-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .help-client-pill:hover {
    color: var(--text);
    border-color: var(--border-strong);
  }
}

.help-client-pill.is-active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.help-client-panel {
  display: none;
}

.help-client-panel.is-active {
  display: block;
}

.help-video-card {
  background: #0c100e;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius, 10px);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.help-tutorial-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0c100e;
  object-fit: contain;
}

.client-mockup {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius, 10px);
  padding: 14px;
  margin-bottom: 14px;
}

.mockup-topbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mockup-sender {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.mockup-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mockup-line {
  height: 7px;
  border-radius: 999px;
  background: var(--border-strong);
}

.mockup-line-strong {
  width: 120px;
  max-width: 100%;
  margin-bottom: 5px;
}

.mockup-line-sub {
  width: 84px;
  opacity: 0.65;
}

.mockup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mockup-dot-btn {
  color: var(--muted);
  font-size: 0.85rem;
}

.mockup-kebab {
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.mockup-kebab.is-highlighted,
.mockup-menubar-item.is-highlighted {
  background: var(--brand);
  color: var(--btn-primary-text);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.mockup-menu {
  width: 200px;
  margin: 8px 0 0 auto;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 5px;
  box-shadow: var(--shadow-sm);
}

.mockup-menu-inline {
  width: 100%;
  margin-top: 8px;
}

.mockup-menu-item {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.mockup-menu-item.is-target {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.mockup-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mockup-subbox {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.mockup-subbox-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}

.mockup-menubar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.mockup-menubar-item {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
}

.mockup-menubar-item.is-target-chip {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-family: var(--font-mono);
}

.mockup-menubar-arrow {
  color: var(--muted);
  font-size: 0.8rem;
}

.mockup-filetype {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.mockup-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.help-steps-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.55;
}

/* Footer */
.help-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.help-faq-link {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .help-faq-link:hover {
    color: var(--text);
  }
}

.help-action-row .btn,
.help-modal-footer .btn {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Responsive */
@media (max-width: 640px) {
  .help-modal-overlay {
    padding:
      calc(12px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      calc(12px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
  }

  .help-modal-content {
    width: 100%;
    max-height: 100%;
    border-radius: 14px;
  }

  .help-type-grid,
  .mockup-split {
    grid-template-columns: 1fr;
  }

  .help-modal-header {
    padding: 13px 16px;
  }

  .help-modal-body {
    padding: 16px;
  }

  .help-modal-footer {
    padding: 12px 16px;
  }

  .help-tutorial-video {
    max-height: 42dvh;
  }

  .help-action-row {
    flex-direction: column;
  }

  .help-action-row .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .help-modal-overlay {
    padding:
      calc(10px + env(safe-area-inset-top, 0px))
      calc(10px + env(safe-area-inset-right, 0px))
      calc(10px + env(safe-area-inset-bottom, 0px))
      calc(10px + env(safe-area-inset-left, 0px));
  }

  .help-modal-content {
    width: 100%;
    max-height: 100%;
  }

  .help-modal-header {
    padding: 12px 14px;
  }

  .help-modal-header h2 {
    font-size: 1.12rem;
  }

  .help-modal-body {
    padding: 14px;
  }

  .help-illustration {
    max-width: 155px;
  }

  .help-type-card {
    padding: 12px;
  }

  .help-button {
    width: 100%;
    min-height: 44px;
    font-size: 0.86rem;
  }

  .help-modal-footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    gap: 10px;
  }

  .help-modal-footer .btn {
    width: auto;
    min-width: 96px;
    justify-content: center;
    padding: 8px 16px;
  }

  .help-faq-link {
    text-align: left;
    padding: 6px 0;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .help-modal-overlay {
    padding:
      calc(8px + env(safe-area-inset-top, 0px))
      calc(12px + env(safe-area-inset-right, 0px))
      calc(8px + env(safe-area-inset-bottom, 0px))
      calc(12px + env(safe-area-inset-left, 0px));
  }

  .help-modal-header,
  .help-modal-footer {
    padding: 9px 14px;
  }

  .help-modal-body {
    padding: 12px 14px;
  }

  .help-tutorial-video {
    max-height: 46dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .help-modal-overlay,
  .help-modal-content,
  .help-button,
  .help-type-card,
  .help-client-pill {
    transition-duration: 0.01ms !important;
  }

  .guided-hint {
    animation: none;
  }

  .guided-hint::after,
  .uploader.is-guided-highlight::after,
  .text-uploader.is-guided-highlight::after {
    animation: none;
    opacity: 0.9;
    transform: none;
  }
}
