/* ============================================================
   Section Graphics — Tactics Journal Research Page
   ============================================================ */

/* Language color palette */
.research-page {
  --lang-en: #E5534B;
  --lang-es: #F0883E;
  --lang-de: #539BF5;
  --lang-fr: #A371F7;
  --lang-pt: #347D39;
  --lang-it: #57AB5A;
  --lang-nl: #DAAA3F;
  --lang-ar: #DB6D28;
  --accent-ingest: #539BF5;
  --accent-detect: #A371F7;
  --accent-report: #57AB5A;
  --accent-tune: #DAAA3F;
}

/* Shared animation entrance */
.r-offerings,
.r-oss-compare,
.r-pricing-graphic {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.r-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   Expandable Steps (How It Works details)
   ============================================================ */

.r-step-compact {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.r-step-compact:hover {
  border-color: var(--border-hover);
}
.r-step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
}
.r-step-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Geist Mono', monospace;
  flex-shrink: 0;
}
.r-step-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
/* Color-code step numbers to match pipeline */
.r-step-compact:nth-child(1) .r-step-num { color: var(--accent-ingest); }
.r-step-compact:nth-child(2) .r-step-num { color: var(--accent-detect); }
.r-step-compact:nth-child(3) .r-step-num { color: var(--accent-report); }
.r-step-compact:nth-child(4) .r-step-num { color: var(--accent-tune); }
/* Step icons */
.r-step-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.r-step-icon svg {
  width: 100%;
  height: 100%;
}
.r-step-icon--ingest { color: var(--accent-ingest); }
.r-step-icon--detect { color: var(--accent-detect); }
.r-step-icon--report { color: var(--accent-report); }
.r-step-icon--tune   { color: var(--accent-tune); }

/* Ingest: arrows flowing down */
@keyframes r-ingest-flow {
  0%   { opacity: 0; transform: translateY(-6px); }
  30%  { opacity: 1; transform: translateY(0); }
  70%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(4px); }
}
.r-icon-arrow--1 { animation: r-ingest-flow 1.2s ease-in-out infinite; }
.r-icon-arrow--2 { animation: r-ingest-flow 1.2s ease-in-out 0.2s infinite; }
.r-icon-arrow--3 { animation: r-ingest-flow 1.2s ease-in-out 0.4s infinite; }

/* Detect: radar sweep rotation */
@keyframes r-radar-rotate {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes r-radar-ping {
  0%   { opacity: 0.15; }
  50%  { opacity: 0.6; }
  100% { opacity: 0.15; }
}
.r-icon-radar-sweep {
  transform-origin: 12px 12px;
  animation: r-radar-rotate 2s linear infinite;
}
.r-icon-radar-ring--1 { animation: r-radar-ping 1.6s ease-in-out infinite; }
.r-icon-radar-ring--2 { animation: r-radar-ping 1.6s ease-in-out 0.3s infinite; }
.r-icon-radar-ring--3 { animation: r-radar-ping 1.6s ease-in-out 0.6s infinite; }

/* Report: lines writing in */
@keyframes r-line-write {
  0%   { stroke-dashoffset: 16; opacity: 0; }
  50%  { opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
.r-icon-line {
  stroke-dasharray: 16;
  stroke-dashoffset: 0;
}
.r-icon-line--1 { animation: r-line-write 2s ease forwards infinite; }
.r-icon-line--2 { animation: r-line-write 2s ease 0.15s forwards infinite; }
.r-icon-line--3 { animation: r-line-write 2s ease 0.3s forwards infinite; }

/* Tune: knobs sliding */
@keyframes r-knob-slide-right {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
@keyframes r-knob-slide-left {
  0%   { transform: translateX(0); }
  50%  { transform: translateX(-4px); }
  100% { transform: translateX(0); }
}
.r-icon-knob--1 { animation: r-knob-slide-right 1.4s ease-in-out infinite; }
.r-icon-knob--2 { animation: r-knob-slide-left 1.4s ease-in-out 0.2s infinite; }

.r-step-expand {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 300;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.r-step-detail {
  padding: 0 18px 18px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}
.r-step-detail .r-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.r-step-detail .r-tag {
  font-size: 10px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 3px 10px;
  font-weight: 500;
}

/* ============================================================
   Offerings (What You Get)
   ============================================================ */
.r-offerings {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}
.r-offering {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.15s ease, transform 0.2s ease;
  cursor: default;
}
.r-offering:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
@media (prefers-color-scheme: dark) {
  .r-offering:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
}
.r-offering-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
}
.r-offering-icon svg {
  width: 100%;
  height: 100%;
}
/* Offering icons — each card gets a distinct accent */
.r-icon-stroke {
  stroke: var(--text-muted);
}
.r-icon-fill {
  fill: var(--text-muted);
}
/* Daily Trend Reports icon — report green */
.r-offering:nth-child(1) .r-icon-stroke { stroke: var(--accent-report); }
.r-offering:nth-child(1) .r-icon-fill { fill: var(--accent-report); }
/* Early Signals icon — detect purple */
.r-offering:nth-child(2) .r-icon-stroke { stroke: var(--accent-detect); }
.r-offering:nth-child(2) .r-icon-fill { fill: var(--accent-detect); }
/* Cross-Language icon — ingest blue */
.r-offering:nth-child(3) .r-icon-stroke { stroke: var(--accent-ingest); }
.r-offering:nth-child(3) .r-icon-fill { fill: var(--accent-ingest); }

@keyframes r-radar-sweep {
  0% { opacity: 0.2; }
  50% { opacity: 0.7; }
  100% { opacity: 0.2; }
}
.r-radar-ring {
  animation: r-radar-sweep 2s ease-in-out infinite;
}
.r-offering-text {
  flex: 1;
  min-width: 0;
}
.r-offering-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.r-offering-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================================
   OSS Compare (Open Source section)
   ============================================================ */
.r-oss-compare {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  margin: 24px 0;
  align-items: stretch;
}
.r-oss-col {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.15s ease;
}
.r-oss-col:hover {
  border-color: var(--border-hover);
}
.r-oss-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}
.r-oss-free .r-oss-header svg {
  color: var(--accent-report);
  flex-shrink: 0;
}
.r-oss-sub .r-oss-header svg {
  color: var(--accent-detect);
  flex-shrink: 0;
}
.r-oss-header svg {
  flex-shrink: 0;
}
.r-oss-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.r-oss-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}
.r-oss-divider span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Geist Mono', monospace;
}

/* ============================================================
   Pricing Section
   ============================================================ */
.r-pricing-graphic {
  margin: 24px 0;
}
.r-pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}
.r-tier-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.015), rgba(0, 0, 0, 0));
  box-shadow: 0 10px 24px rgba(17, 17, 17, 0.04);
  transition: border-color 0.15s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.r-tier-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}
.r-tier-card--featured {
  border-color: rgba(163, 113, 247, 0.45);
  box-shadow: 0 14px 32px rgba(163, 113, 247, 0.12);
}
.r-tier-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.r-tier-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: "Inter", sans-serif;
}
.r-tier-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-family: "Inter", sans-serif;
}
.r-tier-badge {
  flex-shrink: 0;
  border: 1px solid rgba(163, 113, 247, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-detect);
  background: rgba(163, 113, 247, 0.08);
}
.r-tier-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
  font-family: "Inter", sans-serif;
}
.r-tier-price-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.r-tier-price {
  font-size: 44px;
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  font-family: "Inter", sans-serif;
}
.r-tier-price-suffix {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  font-family: "Inter", sans-serif;
}
.r-tier-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--text-secondary);
}
.r-tier-list-item {
  position: relative;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.65;
  font-family: "Inter", sans-serif;
}
.r-tier-list-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23539BF5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}
.r-tier-card--featured .r-tier-list-item::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A371F7' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}
.r-tier-list-item--x::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23E5534B' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}
.r-tier-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  width: 100%;
  margin-top: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  transition: border-color 0.15s ease, transform 0.2s ease, background 0.15s ease, color 0.15s ease;
  font-family: "Inter", sans-serif;
}
.r-tier-cta:hover {
  border-color: var(--border-hover);
  background: rgba(0, 0, 0, 0.03);
  transform: translateY(-1px);
  text-decoration: none;
}
.r-tier-cta.r-tier-cta--featured {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-detect), #8c5cf6);
}
.r-tier-cta.r-tier-cta--featured:hover {
  color: #fff;
  background: linear-gradient(135deg, #8c5cf6, var(--accent-detect));
  text-decoration: none;
}

/* Pricing toggle */
.r-pricing-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.r-pricing-toggle-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}
.r-pricing-toggle-label--active {
  color: var(--text);
}
.r-pricing-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.r-pricing-toggle--active {
  background: var(--accent-detect);
}
.r-pricing-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.r-pricing-toggle--active .r-pricing-toggle-knob {
  transform: translateX(22px);
}
.r-tier-yearly-note {
  font-size: 12px;
  color: var(--text-muted);
  font-family: "Inter", sans-serif;
}

@media (min-width: 768px) {
  .r-pricing-grid {
    gap: 16px;
  }

  .r-tier-card {
    padding: 20px;
    gap: 18px;
  }

  .r-tier-name {
    font-size: 18px;
  }

  .r-tier-price {
    font-size: 36px;
  }

  .r-tier-description,
  .r-tier-list-item {
    font-size: 14px;
  }

  .r-tier-cta,
  .r-pricing-toggle-label,
  .r-tier-price-suffix,
  .r-tier-yearly-note {
    font-size: 12px;
  }
}

@media (prefers-color-scheme: dark) {
  .r-tier-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0));
    box-shadow: none;
  }
  .r-tier-card--featured {
    border-color: rgba(163, 113, 247, 0.6);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  }
  .r-tier-badge {
    background: rgba(163, 113, 247, 0.14);
  }
  .r-tier-cta:hover {
    background: rgba(255, 255, 255, 0.06);
    text-decoration: none;
  }
  .r-tier-cta.r-tier-cta--featured {
    color: #fff;
  }
  .r-pricing-toggle-knob {
    background: var(--bg);
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 569px) {
  .r-pricing-grid {
    grid-template-columns: 1fr;
  }
  .r-tier-card {
    gap: 20px;
    padding: 22px 18px;
  }
  .r-tier-head-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .r-tier-price {
    font-size: 38px;
  }
  .r-oss-compare {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .r-oss-divider {
    padding: 4px 0;
  }
  .r-pricing-toggle-wrapper {
    gap: 10px;
  }
}
