/* Light, focused tool surfaces layered on top of the shared dark shell. */

.page-tool .content {
  width: min(var(--container), calc(100% - 48px));
  margin-inline: auto;
}

.tool-shell {
  display: grid;
  min-width: 0;
  gap: 28px;
}

.tool-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
  align-items: stretch;
  gap: 28px;
}

.tool-hero-copy,
.tool-hero-proof,
.tool-panel,
.tool-detail-card {
  min-width: 0;
  padding: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: var(--radius-lg);
  background: rgba(247, 245, 239, 0.98);
  color: var(--ink-900);
  box-shadow: var(--shadow-md);
}

.tool-hero-copy h1,
.tool-panel h2,
.tool-detail-card h2 {
  margin-top: 0;
  color: var(--ink-900);
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tool-hero-copy h1 {
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 4vw, 3.1rem);
  line-height: 1.08;
}

.tool-hero-copy p,
.tool-panel p,
.tool-detail-card p,
.tool-detail-card li {
  color: #334155;
}

.tool-hero-copy .eyebrow,
.tool-panel .eyebrow,
.tool-detail-card .eyebrow {
  color: #086f82;
}

.tool-hero-copy .topic-pill {
  border-color: #cbd5e1;
  color: #475569;
}

.tool-hero-copy .button-secondary {
  border-color: #cbd5e1;
  background: #ffffff;
  color: var(--ink-900);
}

.tool-hero-copy .button-secondary:hover {
  border-color: #64748b;
  background: #f8fafc;
}

.tool-hero-copy .notice {
  padding: 18px 20px;
  border-left-color: var(--cyan-strong);
  background: #ecfeff;
  color: #334155 !important;
  font-size: 0.96rem;
  font-weight: 600;
}

.tool-hero-proof {
  display: grid;
  align-content: start;
  gap: 18px;
  background:
    linear-gradient(155deg, rgba(84, 221, 245, 0.22), rgba(199, 243, 107, 0.16)),
    rgba(247, 245, 239, 0.98);
}

.tool-proof-card {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--text);
}

.tool-proof-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.9rem;
  line-height: 1;
}

.tool-proof-card span {
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.tool-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.tool-panel.controls {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 18px;
}

.tool-panel.chart {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.control-group {
  padding: 16px;
  border: 1px solid #dbe3ec;
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.label-row,
.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.toggle-row {
  align-items: center;
}

.toggle-row > div {
  min-width: 0;
}

.control-label {
  color: var(--ink-900);
  font-weight: 700;
}

.control-value {
  flex: 0 0 auto;
  color: #1d4ed8;
  font-weight: 700;
  white-space: nowrap;
}

.control-hint {
  margin: 8px 0 0;
  color: #475569 !important;
  font-size: 0.88rem;
}

.slider {
  width: 100%;
  height: 10px;
  margin-top: 12px;
  appearance: none;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(90deg, var(--cyan-strong), #4f46e5);
}

.slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  appearance: none;
  border: 2px solid var(--ink-900);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink-900);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.2);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 58px;
  height: 32px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  cursor: pointer;
  transition: background 160ms ease;
}

.switch-slider::before {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  content: '';
  transition: transform 160ms ease;
}

.switch input:checked + .switch-slider {
  background: linear-gradient(120deg, var(--cyan-strong), #4f46e5);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(26px);
}

.switch input:focus-visible + .switch-slider {
  outline: 3px solid var(--lime);
  outline-offset: 4px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid rgba(79, 70, 229, 0.28);
  border-radius: 999px;
  background: #eef2ff;
  color: #312e81;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease;
}

.preset-button:hover,
.preset-button.is-active {
  transform: translateY(-1px);
  background: linear-gradient(120deg, rgba(84, 221, 245, 0.24), rgba(79, 70, 229, 0.18));
}

.simulator-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-tile {
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--ink-900);
  color: var(--text);
}

.metric-tile span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.metric-tile strong {
  font-size: 1.18rem;
  overflow-wrap: anywhere;
}

.chart-topline {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.chart-topline > * {
  min-width: 0;
}

.chart-topline p {
  margin: 0;
}

#plot {
  width: 100%;
  min-width: 0;
  min-height: 760px;
  overflow: hidden;
}

.tool-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.tool-detail-card ul {
  margin: 0;
  padding-left: 20px;
}

.tool-detail-card li + li {
  margin-top: 10px;
}

.tool-detail-card a {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (max-width: 1100px) {
  .tool-hero,
  .tool-layout,
  .tool-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-panel.controls {
    position: static;
  }

  #plot {
    min-height: 560px;
  }
}

@media (max-width: 640px) {
  .page-tool .content {
    width: min(100% - 28px, var(--container));
  }

  .tool-shell,
  .tool-hero,
  .tool-layout,
  .tool-detail-grid {
    gap: 18px;
  }

  .tool-hero-copy,
  .tool-hero-proof,
  .tool-panel,
  .tool-detail-card {
    padding: 20px;
  }

  .tool-hero-copy h1 {
    font-size: clamp(2rem, 10.5vw, 2.75rem);
  }

  .simulator-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-topline,
  .label-row {
    align-items: flex-start;
    flex-direction: column;
  }

  #plot {
    min-height: 440px;
  }
}

@media (max-width: 400px) {
  .tool-hero-copy,
  .tool-hero-proof,
  .tool-panel,
  .tool-detail-card {
    padding: 17px;
    border-radius: var(--radius-md);
  }

  .control-group {
    padding: 14px;
  }

  .preset-button {
    flex: 1 1 calc(50% - 5px);
  }

  #plot {
    min-height: 360px;
  }
}
