/* ============================================================
   Profile Matcher – style.css
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #0d1117;
  --surface:       #161b22;
  --surface-2:     #1c2128;
  --border:        #30363d;
  --border-subtle: #21262d;
  --text:          #e6edf3;
  --text-muted:    #8b949e;
  --text-dimmed:   #6e7681;

  --accent-from: #0d9488;
  --accent-to:   #0891b2;
  --accent:      #0d9488;

  /* strong: bright green – clearly vivid */
  --strong-bg:           rgba(74, 222, 128, 0.07);
  --strong-border:       rgba(74, 222, 128, 0.22);
  --strong-border-hover: rgba(74, 222, 128, 0.65);
  --strong-text:         #4ade80;
  --strong-badge-bg:     rgba(74, 222, 128, 0.13);

  /* partial: softer emerald – midpoint between vivid and neutral */
  --partial-bg:           rgba(52, 211, 153, 0.06);
  --partial-border:       rgba(52, 211, 153, 0.2);
  --partial-border-hover: rgba(52, 211, 153, 0.6);
  --partial-text:         #34d399;
  --partial-badge-bg:     rgba(52, 211, 153, 0.11);

  /* to discuss: visible neutral – clearly readable, not hidden */
  --discuss-bg:           rgba(139, 148, 158, 0.06);
  --discuss-border:       rgba(139, 148, 158, 0.22);
  --discuss-border-hover: rgba(139, 148, 158, 0.55);
  --discuss-text:         #8b949e;
  --discuss-badge-bg:     rgba(139, 148, 158, 0.13);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-lift: 0 4px 12px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.25);

  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-heading: 'Vollkorn', Georgia, 'Times New Roman', serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }

.container { max-width: 860px; margin: 0 auto; padding: 0 24px; width: 100%; }

.section { padding: 48px 0; }

.hidden { display: none !important; }

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  padding: 22px 0;
  background: var(--bg);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-logo { display: flex; align-items: center; gap: 12px; }

.logo-img { width: 36px; height: 36px; display: block; flex-shrink: 0; }

.logo-text {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.header-sub { font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; }

/* ---- Input Section ---- */
.section-input { flex: 1; padding-top: 64px; }

.input-headline {
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.input-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 32px;
  line-height: 1.65;
}

.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.job-textarea {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.6;
  padding: 20px 22px;
  resize: vertical;
  min-height: 160px;
  outline: none;
}

.job-textarea::placeholder { color: var(--text-dimmed); line-height: 1.8; }

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  gap: 12px;
}

.char-hint { font-size: 0.75rem; color: var(--text-dimmed); }
.char-hint.warn { color: #f59e0b; }

.input-footer-hint {
  font-size: 0.75rem;
  color: var(--text-dimmed);
  margin-top: 12px;
  text-align: center;
}

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent-from), var(--accent-to));
  color: #fff;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  opacity: 0.88;
  box-shadow: 0 1px 4px rgba(13, 148, 136, 0.15);
}

.btn-primary:active { transform: translateY(0); opacity: 1; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn-ghost:hover { border-color: var(--text-muted); color: var(--text); background: var(--surface-2); }

.btn-icon { font-size: 1rem; line-height: 1; }

/* ---- Loading ---- */
.section-loading { flex: 1; display: flex; align-items: center; padding: 80px 0; }
.section-loading.hidden { display: none !important; }

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.spinner { width: 48px; height: 48px; }

.spinner-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-from) 0%, var(--accent-to) 65%, transparent 80%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), white calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), white calc(100% - 3.5px));
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-phase { font-size: 1rem; color: var(--text-muted); min-height: 1.5em; transition: opacity 0.3s; }

/* ---- Error ---- */
.error-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 20px 24px;
}

.error-icon { font-size: 1.25rem; flex-shrink: 0; margin-top: 1px; color: #f87171; }
.error-title { font-weight: 600; color: #fca5a5; margin-bottom: 4px; }
.error-message { font-size: 0.875rem; color: var(--text-muted); }
.error-card .btn-ghost { margin-left: auto; flex-shrink: 0; }

/* ---- Results ---- */
.section-results { padding-bottom: 80px; }

/* Venn Header */
.venn-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 560px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-card);
}

.venn-side {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.venn-left {
  align-items: flex-start;
  padding-left: 14px;
  border-left: 3px solid rgba(15, 118, 110, 0.7);
}

.venn-right {
  align-items: flex-end;
  text-align: right;
  padding-right: 14px;
  border-right: 3px solid rgba(103, 232, 249, 0.5);
}

.venn-role {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.venn-left  .venn-role { color: #5eead4; }
.venn-right .venn-role { color: #67e8f9; }

.venn-title {
  font-family: var(--font-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Expand card to full container width when job title is long */
.venn-header.title-long {
  max-width: 100%;
}

.venn-sub { font-size: 0.8125rem; color: var(--text-muted); }

/* When job title wraps to 2 lines, add one line of space under the candidate name */
.venn-header.title-two-line .venn-right .venn-sub {
  margin-top: calc(1.3 * 1.0625rem);
}

.venn-center { display: flex; justify-content: center; align-items: center; }

.venn-logo { width: 84px; height: 84px; display: block; }

/* Disclaimer */
.disclaimer-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.disclaimer-inner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 18px;
}

.disclaimer-icon { font-size: 0.9375rem; color: var(--text-dimmed); flex-shrink: 0; margin-top: 2px; font-style: normal; }

.disclaimer-text { font-size: 0.8125rem; color: var(--text-dimmed); line-height: 1.6; flex: 1; }

.btn-show-prompt { flex-shrink: 0; padding: 5px 12px; font-size: 0.75rem; }

.prompt-panel { border-top: 1px solid var(--border-subtle); padding: 16px 18px; background: var(--bg); }

.prompt-text {
  font-family: 'Menlo', 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Stats Chart */
.stats-chart { margin-bottom: 28px; }

.stats-bar-track {
  height: 8px;
  border-radius: 4px;
  display: flex;
  overflow: hidden;
  gap: 2px;
  margin-bottom: 10px;
}

.stats-segment { height: 100%; border-radius: 2px; min-width: 4px; }
.stats-segment.seg-strong  { background: var(--strong-text); }
.stats-segment.seg-partial { background: var(--partial-text); }
.stats-segment.seg-discuss { background: var(--discuss-text); }

.stats-labels { display: flex; gap: 20px; font-size: 0.8125rem; }

.stats-lbl { display: flex; align-items: center; gap: 6px; font-weight: 500; }

.stats-lbl-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.stats-lbl.lbl-strong  .stats-lbl-dot { background: var(--strong-text); }
.stats-lbl.lbl-strong  .stats-lbl-text { color: var(--strong-text); }
.stats-lbl.lbl-partial .stats-lbl-dot { background: var(--partial-text); }
.stats-lbl.lbl-partial .stats-lbl-text { color: var(--partial-text); }
.stats-lbl.lbl-discuss .stats-lbl-dot { background: var(--discuss-text); }
.stats-lbl.lbl-discuss .stats-lbl-text { color: var(--discuss-text); }

.stats-lbl-count { font-weight: 700; }
.stats-lbl-text  { color: var(--text-muted); }

/* Match Cards Grid */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.match-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
  opacity: 0;
  transform: translateY(12px);
  animation: card-enter 0.35s ease forwards;
}

.match-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }

.match-card.strength-strong  { background: var(--strong-bg);  border-color: var(--strong-border); }
.match-card.strength-partial { background: var(--partial-bg); border-color: var(--partial-border); }
.match-card.strength-gap     { background: var(--discuss-bg); border-color: var(--discuss-border); }

.match-card.strength-strong:hover  { border-color: var(--strong-border-hover); }
.match-card.strength-partial:hover { border-color: var(--partial-border-hover); }
.match-card.strength-gap:hover     { border-color: var(--discuss-border-hover); }

@keyframes card-enter { to { opacity: 1; transform: translateY(0); } }

.match-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.match-requirement { font-size: 0.875rem; font-weight: 600; color: var(--text); line-height: 1.45; flex: 1; }

.strength-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.strength-badge.badge-strong  { background: var(--strong-badge-bg);  color: var(--strong-text); }
.strength-badge.badge-partial { background: var(--partial-badge-bg); color: var(--partial-text); }
.strength-badge.badge-gap     { background: var(--discuss-badge-bg); color: var(--discuss-text); }

.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.match-evidence { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.65; }

/* Summary Card – gradient accent left bar; box-shadow ring on hover */
.summary-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.35s ease, transform 0.2s ease;
}

/* Always-visible gradient accent bar – left side, full height */
.summary-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-from), var(--accent-to));
  pointer-events: none;
}

.summary-card:hover {
  box-shadow: var(--shadow-lift), 0 0 0 2px rgba(13, 148, 136, 0.4);
  transform: translateY(-1px);
}

.summary-card-inner {
  display: grid;
  grid-template-columns: 160px 1fr;
}

.summary-label {
  padding: 28px 20px 24px 24px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dimmed);
  border-right: 1px solid var(--border-subtle);
  line-height: 1.6;
  white-space: pre-line;
}

.summary-text { padding: 24px 28px; font-size: 0.9375rem; color: var(--text-muted); line-height: 1.75; }

/* Action Row (app-related) */
.action-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 48px;
}

/* Profile Contact Card */
.profile-contact-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  background: rgba(103, 232, 249, 0.04);
  border: 1px solid rgba(103, 232, 249, 0.14);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.portrait-img {
  height: 280px;
  width: 210px;
  border-radius: var(--radius-md);
  object-fit: cover;
  object-position: top;
  flex-shrink: 0;
}

.profile-info { flex: 1; }

.profile-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.profile-links .btn-primary,
.profile-links .btn-ghost { justify-content: center; }

.profile-links .btn-ghost {
  color: var(--text);
  border-color: var(--text-dimmed);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .section { padding: 32px 0; }
  .section-input { padding-top: 40px; }

  .header-inner { flex-direction: column; align-items: flex-start; gap: 4px; }
  .header-sub { white-space: normal; }

  .input-headline { font-size: 1.5rem; }

  .venn-header { padding: 16px; gap: 12px; }
  .venn-logo { width: 48px; height: 48px; }
  .venn-left { padding-left: 10px; }
  .venn-right { padding-right: 10px; }
  .venn-title { font-size: 0.875rem; }

  .matches-grid { grid-template-columns: 1fr; }

  .summary-card-inner { grid-template-columns: 1fr; }
  .summary-label {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 18px 20px 14px;
  }
  .summary-text { padding: 16px 20px 20px; }

  .action-row { justify-content: stretch; }
  .action-row .btn-ghost { flex: 1; justify-content: center; }

  .profile-contact-card { flex-direction: column; }
  .portrait-img { height: 200px; width: 150px; }

  .disclaimer-inner { flex-wrap: wrap; }
  .btn-show-prompt { width: 100%; justify-content: center; }

  .stats-labels { flex-wrap: wrap; gap: 10px; }

  .error-card { flex-wrap: wrap; }
  .error-card .btn-ghost { margin-left: 0; width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .input-actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .btn-primary { justify-content: center; }
}

/* ================================================================
   PRINT STYLES – clean light mode for PDF export
   ================================================================ */
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }

  :root {
    --bg:            #ffffff;
    --surface:       #f8fafc;
    --surface-2:     #f1f5f9;
    --border:        #e2e8f0;
    --border-subtle: #f1f5f9;
    --text:          #1e293b;
    --text-muted:    #475569;
    --text-dimmed:   #94a3b8;

    --strong-bg:       #f0fdf4;
    --strong-border:   rgba(34, 197, 94, 0.4);
    --strong-text:     #15803d;
    --strong-badge-bg: rgba(34, 197, 94, 0.15);

    --partial-bg:       #f0fdfa;
    --partial-border:   rgba(52, 211, 153, 0.4);
    --partial-text:     #0d9488;
    --partial-badge-bg: rgba(52, 211, 153, 0.15);

    --discuss-bg:       #f8fafc;
    --discuss-border:   rgba(100, 116, 139, 0.3);
    --discuss-text:     #64748b;
    --discuss-badge-bg: rgba(100, 116, 139, 0.1);

    --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lift:  none;
  }

  body { background: #fff; color: #1e293b; }

  /* Hide non-print sections */
  #section-input,
  #section-loading,
  #section-error { display: none !important; }

  .action-row,
  #btn-show-prompt,
  #prompt-panel { display: none !important; }

  /* Show results always when printing */
  #section-results { display: block !important; }
  #section-results.hidden { display: block !important; }

  .section-results { padding-bottom: 20px; }

  /* Header */
  .site-header { border-bottom: 1px solid #e2e8f0; padding: 14px 0; }

  /* Venn header */
  .venn-header { background: #f8fafc; border: 1px solid #e2e8f0; box-shadow: none; }
  .venn-left  { border-left-color:  rgba(15, 118, 110, 0.5); }
  .venn-right { border-right-color: rgba(8,  145, 178, 0.4); }
  .venn-left  .venn-role { color: #0d9488; }
  .venn-right .venn-role { color: #0891b2; }

  /* Summary card */
  .summary-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    box-shadow: none;
  }
  .summary-card::before {
    background: linear-gradient(180deg, #0d9488, #0891b2);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .summary-label { border-right-color: #e2e8f0; }

  /* Match cards */
  .matches-grid { grid-template-columns: 1fr 1fr; }
  .match-card {
    opacity: 1 !important;
    transform: none !important;
    box-shadow: none;
    break-inside: avoid;
  }

  /* Profile contact */
  .profile-contact-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    break-inside: avoid;
  }
  .portrait-img { height: 180px; width: 135px; }

  /* Stats – force color rendering in print */
  .stats-bar-track {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .stats-segment.seg-strong  { background: #15803d !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .stats-segment.seg-partial { background: #0d9488 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .stats-segment.seg-discuss { background: #64748b !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* Disclaimer */
  .disclaimer-card { background: #f8fafc; border-color: #e2e8f0; }

  /* Buttons: show as plain text links when printing */
  .btn-primary, .btn-ghost {
    border: 1px solid #cbd5e1;
    background: transparent;
    color: #334155;
    box-shadow: none;
  }

  .summary-card { break-inside: avoid; }

  @page { margin: 18mm 16mm; }
}
