/* ─── Calc Lightbox + Stacked Inputs + Dual CTA + Section Labels + Use-This-Result — v3.9 ─── */

.calc-diagram-section { padding: 32px 0 8px; text-align: center; }
.calc-diagram-trigger { border: 0; padding: 0; background: transparent; cursor: zoom-in; max-width: 100%; display: inline-block; }
.calc-diagram-trigger img { max-width: 100%; height: auto; display: block; border-radius: 6px; transition: transform 0.2s ease; }
.calc-diagram-trigger:hover img { transform: scale(1.005); }

.calc-diagram-hint { display: none; margin-top: 12px; padding: 6px 14px; font-size: 12px; font-weight: 500; color: #4b5563; background: #f5f5f7; border: 1px solid #d2d2d7; border-radius: 999px; letter-spacing: 0.2px; }
@media (hover: none) and (pointer: coarse) { .calc-diagram-hint { display: inline-block; } }

/* MODAL */
.calc-diagram-modal:not([open]) { display: none !important; }
.calc-diagram-modal { border: 0; padding: 0; margin: 0; background: transparent; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; overflow: hidden; }
.calc-diagram-modal[open] { display: block; }
.calc-diagram-modal::backdrop { background: rgba(0, 0, 0, 0.92); }
.calc-diagram-modal img { width: 100%; height: 100%; object-fit: contain; touch-action: pinch-zoom; user-select: none; transition: transform 0.3s ease; }
.calc-diagram-modal-close { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.95); color: #1d1d1f; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); z-index: 2; }
.calc-diagram-modal-close:hover { background: #fff; }

@media (orientation: portrait) and (max-width: 1024px) {
  .calc-diagram-modal img { position: absolute; top: 50%; left: 50%; width: 100vh; height: 100vw; max-width: 100vh; max-height: 100vw; transform: translate(-50%, -50%) rotate(90deg); transform-origin: center center; }
  .calc-diagram-modal[open]::after { content: "↻  Tilt phone for landscape view"; position: fixed; top: 16px; left: 16px; padding: 8px 14px; background: rgba(255, 255, 255, 0.95); border-radius: 999px; font-size: 12px; font-weight: 600; color: #1d1d1f; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); z-index: 2; pointer-events: none; animation: tiltHintFade 5s forwards; max-width: calc(100vw - 32px - 60px); }
}
@keyframes tiltHintFade { 0%, 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-4px); } }

/* STACKED INPUTS — divs natively block, !important defends against sticky-bar overrides */
.ki-row { display: block !important; line-height: 1.45 !important; font-size: 13px; margin: 2px 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ki-label { color: #6e6e73 !important; font-weight: 500 !important; margin-right: 4px; }
.ki-value { color: #1d1d1f !important; font-weight: 600 !important; }
#result-summary, .calc-card-sub#result-summary, [id="result-summary"] { display: block !important; white-space: pre-line; }

/* DUAL CTA below diagram */
.calc-diagram-ctas { display: flex; gap: 12px; justify-content: center; margin-top: 16px; flex-wrap: wrap; padding: 0 16px; }
.calc-cta { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; border: 1.5px solid; transition: transform 0.15s, box-shadow 0.15s; white-space: nowrap; }
.calc-cta-primary { background: #1e3a8a; color: #fff !important; border-color: #1e3a8a; }
.calc-cta-primary:hover { background: #1e40af; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(30, 58, 138, 0.25); }
.calc-cta-secondary { background: #fff; color: #1e3a8a !important; border-color: #1e3a8a; }
.calc-cta-secondary:hover { background: #eff6ff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(30, 58, 138, 0.15); }

/* BRIEF mirror cards */
.cug-mirror-cards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 8px; }
@media (max-width: 768px) { .cug-mirror-cards { grid-template-columns: 1fr; gap: 12px; } }
.cug-mirror-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px; }
.cug-mirror-title { font-size: 13px; font-weight: 700; color: #1e3a8a; margin-bottom: 12px; letter-spacing: 0.3px; text-transform: uppercase; }
.cug-mirror-card.cug-outputs .cug-mirror-title { color: #7c2d12; }
.cug-mirror-card.cug-outcomes .cug-mirror-title { color: #047857; }
.cug-mirror-list { list-style: none; padding: 0; margin: 0; }
.cug-mirror-list li { padding: 6px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; line-height: 1.5; }
.cug-mirror-list li:last-child { border-bottom: 0; }
.cug-mirror-list li strong { color: #111827; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; font-weight: 600; }
.cug-mirror-list li .desc { color: #4b5563; display: block; }
.cug-outcome { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f4f6; }
.cug-outcome:last-child { border-bottom: 0; }
.cug-outcome-emoji { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.cug-outcome-text strong { display: block; font-size: 13px; color: #111827; margin-bottom: 2px; }
.cug-outcome-text p { margin: 0; font-size: 12px; color: #4b5563; line-height: 1.45; }

/* ─── NEW: Section labels above CALCULATOR + RESULTS cards ─────── */
.calc-section-label {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #1e3a8a;
  text-transform: uppercase;
  margin: 0 0 10px;
  padding: 0 0 8px;
  border-bottom: 2px solid #e0e7ff;
  display: block;
}
@media (max-width: 768px) {
  .calc-section-label { font-size: 0.78rem; letter-spacing: 1.5px; margin: 0 0 8px; }
}

/* ─── NEW: "Use this result" block at bottom of results card ────── */
.results-use-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  /* Width matches content area of standard 1200px-wide layouts with 20px padding */
  max-width: 1160px;
  margin: 20px auto 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}
@media (max-width: 1200px) {
  .results-use-section { margin-left: 20px; margin-right: 20px; }
}
@media (max-width: 768px) {
  .results-use-section {
    padding: 16px;
    margin: 16px 20px 20px;
    border-radius: 10px;
    max-width: none;
  }
}

/* ─── ai-model-finder: hide secondary columns on mobile ─────────────────
   .mf-table has 11 columns. On phones, keep the highest-signal ones:
   Model, Input $/M, Output $/M, Context. Hide checkbox, Provider (implied by
   model name), Cached, Batch, Modalities, Tags, Compare action. */
@media (max-width: 768px) {
  .mf-table th:nth-child(1),  .mf-table td:nth-child(1),   /* checkbox */
  .mf-table th:nth-child(3),  .mf-table td:nth-child(3),   /* Provider */
  .mf-table th:nth-child(6),  .mf-table td:nth-child(6),   /* Cached $/M */
  .mf-table th:nth-child(7),  .mf-table td:nth-child(7),   /* Batch */
  .mf-table th:nth-child(9),  .mf-table td:nth-child(9),   /* Modalities */
  .mf-table th:nth-child(10), .mf-table td:nth-child(10),  /* Tags */
  .mf-table th:nth-child(12), .mf-table td:nth-child(12) { /* Compare action */
    display: none;
  }
  .mf-table { font-size: 0.82rem; }
  .mf-table th, .mf-table td { padding: 6px 8px; }
}

/* ─── context-window-cost: tighten 4-col threshold grid on mobile ─────── */
@media (max-width: 768px) {
  .cw-threshold-row {
    font-size: 0.78rem;
    gap: 6px;
  }
  /* If the row's grid is too tight, designer can manually drop a column */
}

/* CRITICAL: prevent grid items from growing to fit wide content (tables, etc).
   Without min-width:0, a wide table forces the grid item wider, blowing past
   the viewport on mobile. */
.te-grid > *,
.calc-layout > * {
  min-width: 0;
  max-width: 100%;
}

/* Force any table inside a calc-card to scroll within an overflow container,
   not push the parent card wider */
.calc-card table {
  max-width: 100%;
  table-layout: auto;
}
.calc-card [style*="overflow-x"] {
  max-width: 100%;
}
@media (max-width: 768px) {
  .calc-card .te-result-table,
  .calc-card table { font-size: 0.85rem; }

  /* token-estimator: hide "Per request" column (col 2 — values like $0.0001 are
     too small to read on mobile; "Per 1K" and "Per 1M" are more meaningful) */
  .te-result-table th:nth-child(2),
  .te-result-table td:nth-child(2) {
    display: none;
  }
}
.results-use-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: #047857;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.results-use-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}
.results-use-list li {
  font-size: 0.875rem;
  padding: 6px 0;
  color: #1f2937;
  line-height: 1.45;
  border-bottom: 1px solid #f3f4f6;
}
.results-use-list li:last-child { border-bottom: 0; }
.results-use-list li strong { color: #111827; font-weight: 700; }
.results-use-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  background: #1e3a8a;
  color: #fff !important;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}
.results-use-cta:hover {
  background: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

/* ────────────────────────────────────────────────────────────────
   PILOT: Calculator at a glance eyebrow + full-guide link
   Added 2026-05-30 as part of cost-calculator unified pattern.
   ──────────────────────────────────────────────────────────────── */

/* "📊 Calculator at a glance" header above diagram */
.calc-snapshot-header {
  max-width: 1160px !important;
  margin: 28px auto 12px !important;
  padding: 0 20px !important;
  text-align: center !important;          /* CENTERED — must override cascade */
  display: block !important;
}
.calc-snapshot-header .calc-snapshot-eyebrow,
.calc-snapshot-eyebrow {
  display: inline-block !important;
  font-size: 1.25rem !important;          /* bumped up for visibility */
  font-weight: 800 !important;            /* BOLD — must override cascade */
  letter-spacing: 1.5px !important;
  color: #1e3a8a !important;
  padding-bottom: 8px !important;
  border-bottom: 3px solid #fbbf24 !important;
  text-align: center !important;
}
@media (max-width: 768px) {
  .calc-snapshot-header {
    margin: 16px 20px 6px;
    padding: 0;
  }
  .calc-snapshot-eyebrow {
    font-size: 1rem;
    letter-spacing: 1px;
  }
}

/* "📖 Read the full guide →" link row in WHAT/WHY/WHO area */
.cug-guide-link-row {
  max-width: 1160px;
  margin: 12px auto 0;
  padding: 0 20px;
  text-align: right;
}
.cug-guide-link {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e3a8a;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #c7d2fe;
  transition: all 0.15s ease;
}
.cug-guide-link:hover {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 58, 138, 0.2);
}
@media (max-width: 768px) {
  .cug-guide-link-row { margin: 8px 20px 0; padding: 0; }
  .cug-guide-link { font-size: 0.85rem; padding: 5px 12px; }
}


/* ────────────────────────────────────────────────────────────────
   Calculator + Results section eyebrows (above each card title)
   Wrap-up block at bottom of results card with CloudIntelligence CTA
   Added 2026-05-31
   ──────────────────────────────────────────────────────────────── */

.calc-section-eyebrow {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: #1e3a8a;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid #e0e7ff;
}
@media (max-width: 768px) {
  .calc-section-eyebrow {
    font-size: 0.72rem;
    letter-spacing: 2px;
  }
}

/* ── Results wrap-up block ── */
.calc-results-wrapup {
  margin-top: 24px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border: 1px solid #c7d2fe;
  border-left: 4px solid #1e3a8a;
  border-radius: 10px;
}
.calc-wrapup-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 10px;
}
.calc-wrapup-list {
  margin: 0 0 14px;
  padding-left: 18px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #334155;
}
.calc-wrapup-list li {
  margin-bottom: 6px;
}
.calc-wrapup-list strong {
  color: #1e3a8a;
}
.calc-wrapup-cta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #c7d2fe;
}
.calc-wrapup-cta-prefix {
  font-size: 0.9rem;
  color: #475569;
}
.calc-wrapup-cta-btn {
  display: inline-block;
  padding: 9px 16px;
  background: #1e3a8a;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 999px;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s ease;
}
.calc-wrapup-cta-btn:hover {
  background: #1e40af;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(30, 58, 138, 0.25);
}
@media (min-width: 600px) {
  .calc-wrapup-cta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .calc-wrapup-cta-btn {
    flex-shrink: 0;
  }
}
