/* =============================================================================
   MLSYSIM LANDING PAGE STYLES
   ============================================================================= */

/* ---------- ANIMATIONS ---------- */
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes grid-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.12; }
  50% { opacity: 0.22; }
}

/* ---------- HIDE DEFAULT TITLE BLOCK ON LANDING PAGE ---------- */
.quarto-page-custom #title-block-header,
body:has(.im-hero) #title-block-header {
  display: none !important;
}

/* ---------- HERO (one cohesive dark section) ---------- */
.im-hero {
  background: linear-gradient(165deg, #0f172a 0%, #1e293b 100%);
  color: white;
  padding: 4.5rem 2rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.im-hero.im-hero-showcase {
  padding: 0 2rem 3rem;
}

/* Subtle animated grid overlay */
.im-hero::before {
  content: '';
  position: absolute;
  inset: -40px;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: grid-drift 20s linear infinite;
  pointer-events: none;
}

/* Radial glow behind the title */
.im-hero::after {
  content: '';
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(2, 132, 199, 0.15) 0%, transparent 70%);
  animation: glow-pulse 6s ease-in-out infinite;
  pointer-events: none;
}

.im-hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* ---------- HERO SPLIT LAYOUT (code + output side-by-side) ---------- */
.im-hero-split {
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  text-align: left;
  align-items: start;
}

.im-hero-code,
.im-hero-output {
  animation: fade-up 0.6s ease both;
}

.im-hero-code { animation-delay: 0.3s; }
.im-hero-output { animation-delay: 0.45s; }

.im-code-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #38bdf8;
  margin-bottom: 0.5rem;
}

.im-code-block {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 1.25rem 1.5rem !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  color: #e2e8f0;
  overflow-x: auto;
  margin: 0;
}

.im-code-block code {
  background: none !important;
  padding: 0 !important;
  font-size: inherit;
  color: inherit;
}

.im-kw { color: #c084fc; }
.im-str { color: #86efac; }
.im-num { color: #fbbf24; }
.im-cmt { color: #64748b; }

/* Output panel */
.im-output-block {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 10px;
  padding: 1.25rem 1.5rem !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  line-height: 1.85;
  color: #e2e8f0;
  overflow-x: auto;
  margin: 0;
}

.im-output-block code {
  background: none !important;
  padding: 0 !important;
  font-size: inherit;
  color: inherit;
}

.im-out-key { color: #94a3b8; }
.im-out-val { color: #e2e8f0; font-weight: 600; }
.im-out-warn { color: #fbbf24; }
.im-out-dim { color: #64748b; font-weight: 400; }

/* ---------- HERO ELEMENTS ---------- */
.im-title {
  font-size: clamp(3rem, 6vw, 4.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  padding-bottom: 0.1em;
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, #e0f2fe, #7dd3fc, #38bdf8, #0ea5e9, #7dd3fc, #e0f2fe);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient-shift 6s ease infinite, fade-up 0.6s ease both;
  animation-delay: 0s, 0.2s;
}

.im-subtitle {
  font-size: 1.15rem;
  color: #cbd5e1;
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  animation: fade-up 0.6s ease both;
  animation-delay: 0.35s;
}

/* ---------- TRUST BAR ---------- */
.im-trust-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem;
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: #64748b;
  animation: fade-up 0.6s ease both;
  animation-delay: 0.9s;
}

.im-trust-bar a {
  color: #7dd3fc !important;
  text-decoration: none;
}

.im-trust-bar a:hover {
  color: #bae6fd !important;
  text-decoration: underline;
}

.im-trust-sep {
  margin: 0 0.35rem;
  color: #475569;
}

/* ---------- INSTALL ROW ---------- */
.im-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0 auto 1rem;
  flex-wrap: wrap;
  animation: fade-up 0.6s ease both;
  animation-delay: 0.55s;
}

code.im-cmd {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  padding: 0.6rem 1.25rem !important;
  border-radius: 8px !important;
  font-family: 'JetBrains Mono', 'Fira Code', monospace !important;
  font-size: 0.95rem !important;
  color: #7dd3fc !important;
  letter-spacing: 0.01em !important;
}

.im-copy-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: #94a3b8;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 150ms ease;
}

.im-copy-btn:hover {
  background: rgba(255,255,255,0.06);
  color: white;
  border-color: rgba(255,255,255,0.25);
}

/* ---------- CTA BUTTONS ---------- */
.im-ctas {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0;
  animation: fade-up 0.6s ease both;
  animation-delay: 0.7s;
}

.im-btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: all 150ms ease;
}

.im-btn-primary {
  background: #0284c7;
  color: white !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.im-btn-primary:hover {
  background: #0369a1;
  color: white !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

.im-btn-ghost {
  background: transparent;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255,255,255,0.18);
}

.im-btn-ghost:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.30);
  color: white !important;
}

/* ---------- CAPABILITY CARDS (static 2x2 grid) ---------- */
.im-cap-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.im-cap-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  transition: box-shadow 0.2s, transform 0.2s;
}

.im-cap-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.im-cap-viz {
  background: #0f172a;
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.im-cap-viz svg {
  width: 100%;
  height: auto;
  display: block;
}

.im-cap-card h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.25rem;
  border-left: none !important;
  border-bottom: none !important;
  padding-left: 0 !important;
  padding-bottom: 0 !important;
}

.im-cap-card p {
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

/* ---------- STATS BAR ---------- */
.im-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 700px;
  margin: 1.5rem auto;
  padding: 0;
}

.im-stat {
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: rgba(2, 132, 199, 0.06);
  border-radius: 10px;
  border: 1px solid rgba(2, 132, 199, 0.12);
  transition: transform 0.2s ease, background 0.2s ease;
}

.im-stat:hover {
  background: rgba(2, 132, 199, 0.1);
  transform: translateY(-2px);
}

.im-stat-num {
  display: block;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-weight: 800;
  color: #0284c7;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.im-stat-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
  white-space: nowrap;
}

/* ---------- CONTENT CONTAINER ---------- */
.im-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 2rem;
}

.im-section {
  padding: 3rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.im-section-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #0f172a;
  border-left: none !important;
  border-bottom: none !important;
  padding-left: 0 !important;
  padding-bottom: 0 !important;
}

.im-section > p {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.im-section-last {
  border-bottom: none;
}

/* ---------- "SEE ALL" LINKS ---------- */
.im-see-all {
  display: inline-block;
  margin-top: 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #0284c7 !important;
  text-decoration: none !important;
}

.im-see-all:hover {
  text-decoration: underline !important;
}

/* ---------- QUESTIONS GRID ---------- */
.im-questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.im-question {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.55;
  border-left: 3px solid #0284c7;
}

.im-question strong {
  color: #0f172a;
}

/* ---------- SOLVER CARDS ---------- */
.im-solvers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.875rem;
  margin-top: 1.5rem;
}

.im-solver-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  border-top: 3px solid #e2e8f0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.im-solver-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.im-solver-roofline    { border-top-color: #0284c7; }
.im-solver-distributed { border-top-color: #7c3aed; }
.im-solver-serving     { border-top-color: #059669; }
.im-solver-tco         { border-top-color: #d97706; }
.im-solver-sustain     { border-top-color: #16a34a; }
.im-solver-reliability { border-top-color: #dc2626; }

.im-solver-card strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.im-solver-card p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0;
}

/* ---------- TUTORIAL CARDS (fully clickable) ---------- */
.im-tutorial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}

a.im-tutorial-card-link {
  text-decoration: none !important;
  color: inherit !important;
  display: block;
}

.im-tutorial-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  height: 100%;
}

a.im-tutorial-card-link:hover .im-tutorial-card {
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.1);
  transform: translateY(-2px);
}

.im-tutorial-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0.5rem 0 0.4rem;
  color: #1e293b;
  border-left: none !important;
  border-bottom: none !important;
  padding-left: 0 !important;
  padding-bottom: 0 !important;
}

.im-tutorial-card h4 a {
  color: #1e293b !important;
  text-decoration: none !important;
}

a.im-tutorial-card-link:hover .im-tutorial-card h4 {
  color: #0284c7;
}

.im-tutorial-card p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.55;
  margin: 0;
}

.im-tutorial-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.im-badge-beginner     { background: #dcfce7; color: #166534; }
.im-badge-intermediate { background: #dbeafe; color: #1e40af; }
.im-badge-advanced     { background: #fef3c7; color: #92400e; }

/* Colored left-border accent per difficulty */
.im-tutorial-card.im-card-beginner     { border-left: 3px solid #22c55e; }
.im-tutorial-card.im-card-intermediate { border-left: 3px solid #3b82f6; }
.im-tutorial-card.im-card-advanced     { border-left: 3px solid #f59e0b; }

/* ---------- FOOTER ---------- */
.im-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3rem 2rem 2rem;
  margin-top: 0;
}

.im-footer-inner {
  max-width: 860px;
  margin: 0 auto;
}

.im-footer-brand {
  margin-bottom: 2rem;
}

.im-footer-brand strong {
  display: block;
  font-size: 1.1rem;
  color: #e2e8f0;
  margin-bottom: 0.25rem;
}

.im-footer-brand span {
  font-size: 0.82rem;
  color: #64748b;
}

.im-footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
}

.im-footer-col strong {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
}

.im-footer-col a {
  display: block;
  font-size: 0.82rem;
  color: #94a3b8 !important;
  text-decoration: none !important;
  padding: 0.2rem 0;
  transition: color 0.15s;
}

.im-footer-col a:hover {
  color: #e2e8f0 !important;
}

.im-footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid #1e293b;
  font-size: 0.75rem;
  color: #475569;
}

.im-footer-bottom em {
  font-style: italic;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .im-hero-split {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.5rem;
  }

  .im-cap-grid {
    grid-template-columns: 1fr;
  }

  .im-footer-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .im-hero {
    padding: 3rem 1.5rem 2rem;
  }

  .im-hero.im-hero-showcase {
    padding: 0 1.5rem 2rem;
  }

  .im-title {
    font-size: clamp(2.25rem, 8vw, 3rem);
  }

  .im-subtitle {
    font-size: 1rem;
  }

  .im-stats {
    grid-template-columns: repeat(2, 1fr);
    max-width: 400px;
    gap: 0.75rem;
  }

  .im-stat-num {
    font-size: 1.2rem;
  }

  .im-content {
    padding: 0 1.25rem;
  }

  .im-solvers-grid {
    grid-template-columns: 1fr;
  }

  .im-tutorial-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .im-questions-grid {
    grid-template-columns: 1fr;
  }

  .im-trust-bar {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .im-hero {
    padding: 2.5rem 1.25rem 1.5rem;
  }

  .im-hero.im-hero-showcase {
    padding: 0 1.25rem 1.5rem;
  }

  .im-stats {
    gap: 0.6rem;
  }

  .im-stat-num {
    font-size: 1.1rem;
  }

  .im-stat-label {
    font-size: 0.55rem;
  }

  .im-ctas {
    flex-direction: column;
    align-items: center;
  }

  .im-btn {
    text-align: center;
    width: 100%;
    max-width: 240px;
  }

  .im-tutorial-grid {
    grid-template-columns: 1fr;
  }

  .im-footer-links {
    grid-template-columns: 1fr;
  }
}

/* ---------- DARK MODE ---------- */
[data-bs-theme="dark"] .im-section {
  border-bottom-color: #334155;
}

[data-bs-theme="dark"] .im-section-header h3 {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .im-section > p {
  color: #94a3b8;
}

[data-bs-theme="dark"] .im-question {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #0284c7;
  color: #cbd5e1;
}

[data-bs-theme="dark"] .im-question strong {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .im-solver-card {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .im-solver-card strong {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .im-solver-card p {
  color: #94a3b8;
}

[data-bs-theme="dark"] .im-tutorial-card {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] a.im-tutorial-card-link:hover .im-tutorial-card {
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

[data-bs-theme="dark"] .im-tutorial-card h4,
[data-bs-theme="dark"] a.im-tutorial-card-link:hover .im-tutorial-card h4 {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .im-tutorial-card p {
  color: #94a3b8;
}

[data-bs-theme="dark"] .im-stat {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.2);
}

[data-bs-theme="dark"] .im-stat-num {
  color: #38bdf8;
}

[data-bs-theme="dark"] .im-stat-label {
  color: #94a3b8;
}

[data-bs-theme="dark"] .im-cap-card {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .im-cap-card h4 {
  color: #e2e8f0;
}

[data-bs-theme="dark"] .im-cap-card p {
  color: #94a3b8;
}

[data-bs-theme="dark"] .im-cap-viz {
  background: #0c1322;
  border: 1px solid #1e293b;
}
