/* ============================================================
   main.css — Keyword Planner Tools
   Theme: Bold / High Contrast
   ============================================================ */

/* --- Custom properties ------------------------------------ */
:root {
  --color-primary:      #1b4fdb;
  --color-primary-dark: #1440b8;
  --color-text:         #0d1117;
  --color-muted:        #6b7280;
  --color-border:       #e5e7eb;
  --color-bg:           #f3f4f6;
  --color-card:         #ffffff;
  --color-count-active: #059669;

  --hero-bg:   #0d1117;
  --hero-text: #ffffff;

  --radius:    8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.16);
}

/* --- Base ------------------------------------------------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #fff;
  color: var(--color-text);
  min-height: 100dvh;
}

.container {
  max-width: 1000px;
  margin-inline: auto;
  padding-inline: 24px;
}

/* --- Nav -------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--hero-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
}

.nav-logo {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.nav-cta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hero-bg);
  background: #fff;
  padding: 7px 16px;
  border-radius: 99px;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.nav-cta:hover { opacity: 0.9; }

/* --- Hero ------------------------------------------------- */
.hero {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 80px 0 88px;
  text-align: center;
}

.hero-inner {
  max-width: 720px;
}

.hero-headline {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: rgba(255,255,255,.72);
  line-height: 1.65;
  max-width: 580px;
  margin-inline: auto;
  margin-bottom: 36px;
}

.hero-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 16px 36px;
  border-radius: 99px;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}

.hero-cta-btn:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

.hero-trust {
  margin-top: 20px;
  font-size: 0.8rem;
  color: rgba(255,255,255,.4);
  letter-spacing: 0.03em;
}

/* --- Shared section layout -------------------------------- */
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--color-text);
}

.section-sub {
  font-size: 1rem;
  color: var(--color-muted);
  margin-bottom: 40px;
  line-height: 1.6;
}

/* --- How it works ----------------------------------------- */
.how-section {
  padding: 72px 0;
  background: var(--color-bg);
}

.steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 0;
  align-items: start;
}

@media (max-width: 680px) {
  .steps {
    grid-template-columns: 1fr;
  }
  .step-arrow { display: none; }
}

.step {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  border-radius: 50%;
  margin-bottom: 14px;
}

.step-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.step-body {
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.6;
}

.step-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  padding-top: 32px;
  font-size: 1.4rem;
  color: var(--color-border);
  font-weight: 300;
}

/* --- What it checks --------------------------------------- */
.checks-section {
  padding: 72px 0;
  background: #fff;
}

.checks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

@media (max-width: 720px) {
  .checks-grid { grid-template-columns: 1fr; }
}

.check-card {
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  border-top-width: 4px;
  transition: box-shadow 0.15s;
}

.check-card:hover { box-shadow: var(--shadow-md); }

.check-coverage { border-top-color: #1b4fdb; }
.check-cannib   { border-top-color: #dc2626; }
.check-neg      { border-top-color: #d97706; }

.check-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.check-coverage .check-icon { background: #eff4ff; color: #1b4fdb; }
.check-cannib   .check-icon { background: #fef2f2; color: #dc2626; }
.check-neg      .check-icon { background: #fffbeb; color: #d97706; }

.check-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.check-body {
  font-size: 0.85rem;
  color: var(--color-muted);
  line-height: 1.65;
  margin-bottom: 16px;
}

.check-tags {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ctag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.01em;
}

.ctag-crit { background: #fef2f2; color: #b91c1c; }
.ctag-high { background: #fff7ed; color: #c2410c; }
.ctag-med  { background: #fffbeb; color: #92400e; }
.ctag-low  { background: #f0fdf4; color: #166534; }
.ctag-warn { background: #fefce8; color: #854d0e; }

/* --- Tool section ----------------------------------------- */
.tool-section {
  padding: 72px 0;
  background: var(--color-bg);
}

/* --- Input section ---------------------------------------- */
.input-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: start;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .input-section { grid-template-columns: 1fr; }
}

/* --- Input cards ------------------------------------------ */
.input-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.input-card:focus-within {
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.card-hint {
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}

.card-hint code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.75rem;
  background: #f3f4f6;
  border-radius: 3px;
  padding: 1px 4px;
}

/* --- Textarea --------------------------------------------- */
.keyword-textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  line-height: 1.6;
  color: var(--color-text);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.keyword-textarea:focus { border-color: var(--color-primary); }
.keyword-textarea::placeholder { color: #adb5bd; }

/* --- Example hint ----------------------------------------- */
.example-hint {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--color-muted);
  text-align: right;
}

.example-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: inherit;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.example-link:hover { color: var(--color-primary-dark); }

/* --- Divider ---------------------------------------------- */
.input-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  padding-top: 80px;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
}

.input-divider::before,
.input-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  background: var(--color-border);
}

.input-divider::before { top: 0; bottom: calc(50% + 14px); }
.input-divider::after  { top: calc(50% + 14px); bottom: 0; }

@media (max-width: 640px) {
  .input-divider {
    width: 100%;
    padding-top: 0;
    padding-block: 12px;
  }
  .input-divider::before,
  .input-divider::after {
    width: auto;
    height: 1px;
    inset: auto;
    transform: none;
    flex: 1;
  }
  .input-divider::before { right: calc(50% + 20px); left: 0; top: 50%; }
  .input-divider::after  { left: calc(50% + 20px); right: 0; top: 50%; }
}

/* --- Upload button ---------------------------------------- */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 12px;
}

.upload-btn:hover { background: var(--color-primary-dark); }

.upload-icon { flex-shrink: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.file-name {
  font-size: 0.8rem;
  color: var(--color-muted);
  min-height: 1.4em;
  word-break: break-all;
}

#upload-card.drag-over {
  border-color: var(--color-primary);
  background: #eff4ff;
  box-shadow: var(--shadow-md);
}

/* --- Parse status ----------------------------------------- */
.parse-status {
  margin-top: 24px;
  text-align: center;
  font-size: 1rem;
  color: var(--color-muted);
  transition: color 0.2s;
}

.parse-status.has-keywords {
  color: var(--color-count-active);
  font-weight: 600;
}

.parse-status.parse-error { color: #dc2626; }

.keyword-count {
  font-size: 2.4rem;
  font-weight: 800;
  display: block;
  line-height: 1;
  margin-bottom: 4px;
  letter-spacing: -0.03em;
}

.keyword-count-label {
  font-size: 0.875rem;
  display: block;
}

/* --- Analyze button --------------------------------------- */
.analyze-row {
  margin-top: 20px;
  text-align: center;
}

.analyze-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-text);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 16px 40px;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  border: none;
  letter-spacing: -0.01em;
}

.analyze-btn:hover:not(:disabled) {
  background: #1a2340;
  transform: translateY(-2px);
}

.analyze-btn:active:not(:disabled) { transform: translateY(0); }

.analyze-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* --- Results -------------------------------------------- */
.results {
  padding: 48px 0;
  background: #fff;
}

.results .container {
  max-width: 1000px;
}

/* Score hero */
.score-hero {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

@media (max-width: 560px) {
  .score-hero { flex-direction: column; align-items: center; text-align: center; }
}

.score-circle {
  flex-shrink: 0;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid currentColor;
}

.grade-a { color: #059669; background: #ecfdf5; }
.grade-b { color: #0ea5e9; background: #f0f9ff; }
.grade-c { color: #d97706; background: #fffbeb; }
.grade-d { color: #f97316; background: #fff7ed; }
.grade-f { color: #dc2626; background: #fef2f2; }

.score-number {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
}

.score-grade {
  font-size: 0.875rem;
  font-weight: 700;
  opacity: 0.7;
}

.score-meta { flex: 1; min-width: 0; }

.diagnosis {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 16px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* Breakdown bars */
.breakdown-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.breakdown-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 3px;
}

.breakdown-weight { color: var(--color-muted); font-weight: 400; }

.breakdown-bar-track {
  height: 6px;
  background: var(--color-border);
  border-radius: 99px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.bar-good { background: #059669; }
.bar-fair { background: #d97706; }
.bar-poor { background: #dc2626; }

.breakdown-score-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--color-muted);
  margin-top: 2px;
}

.breakdown-subscore { font-weight: 600; }

/* Detector sections */
.detector-section {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.detector-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.detector-summary::-webkit-details-marker { display: none; }

.detector-summary::after {
  content: '▸';
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-muted);
  transition: transform 0.15s;
}

.detector-section[open] > .detector-summary::after { transform: rotate(90deg); }

.detector-title { font-weight: 700; font-size: 0.95rem; letter-spacing: -0.01em; }

.detector-badges { display: flex; gap: 6px; flex-wrap: wrap; }

.detector-body {
  padding: 0 20px 20px;
  border-top: 1px solid var(--color-border);
}

/* Severity badges */
.sev-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
}

.sev-critical { background: #fef2f2; color: #dc2626; }
.sev-high     { background: #fff7ed; color: #c2410c; }
.sev-medium   { background: #fffbeb; color: #b45309; }
.sev-warning  { background: #fefce8; color: #a16207; }
.sev-low      { background: #f0fdf4; color: #166534; }
.sev-ok       { background: #f0fdf4; color: #166534; }

/* Match type tags */
.match-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  margin-right: 3px;
}

.match-exact  { background: #eff6ff; color: #1d4ed8; }
.match-phrase { background: #f5f3ff; color: #6d28d9; }
.match-broad  { background: #f0fdf4; color: #166534; }

/* Empty state */
.empty-msg {
  padding: 20px 0 4px;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Findings table */
.table-wrap { overflow-x: auto; margin-top: 12px; }

.findings-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
}

.findings-table th {
  text-align: left;
  font-weight: 600;
  padding: 8px 10px;
  background: #f9fafb;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  color: var(--color-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.findings-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
  line-height: 1.4;
}

.findings-table tr:last-child td { border-bottom: none; }
.findings-table tr:hover td { background: #f9fafb; }

.kw-cell {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.78rem;
}

.tip-cell { color: var(--color-muted); max-width: 280px; }

/* Export */
.export-row { text-align: right; margin-top: 8px; }

.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.export-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* CTA styles reserved for semalytics-ads promotion (deferred) */

/* --- FAQ -------------------------------------------------- */
.faq-section {
  padding: 72px 0;
  background: var(--color-bg);
}

.faq-list {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.faq-item {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-q {
  display: block;
  padding: 18px 20px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  position: relative;
  padding-right: 44px;
  letter-spacing: -0.01em;
  transition: background 0.12s;
}

.faq-q::-webkit-details-marker { display: none; }

.faq-q::after {
  content: '+';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--color-muted);
  font-weight: 300;
  transition: transform 0.15s;
}

.faq-item[open] .faq-q::after {
  content: '−';
}

.faq-q:hover { background: #f9fafb; }

.faq-a {
  padding: 0 20px 18px;
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.7;
  border-top: 1px solid var(--color-border);
  padding-top: 14px;
}

.faq-a code {
  font-family: 'SF Mono', 'Fira Code', Consolas, monospace;
  font-size: 0.78rem;
  background: #f3f4f6;
  border-radius: 3px;
  padding: 1px 5px;
}

/* --- Footer ----------------------------------------------- */
.site-footer {
  background: var(--hero-bg);
  color: rgba(255,255,255,.4);
  padding: 28px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-brand {
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255,255,255,.7);
}

.footer-copy {
  font-size: 0.78rem;
}
