/* ASTRO Corrosion — public demo page (/demo). Builds on /index.css tokens. */

.demo-body {
  padding-top: 60px;
  background: var(--page-bg);
}

.demo-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Header --- */
.demo-header {
  position: fixed;
  inset: 0 0 auto 0;
  height: 60px;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--gray-200);
}

.demo-header-inner {
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.demo-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: var(--gray-900);
}

.demo-logo { height: 30px; width: auto; }

.demo-product {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.12rem;
  white-space: nowrap;
}

.demo-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--secondary);
  background: rgba(0, 114, 151, 0.08);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.demo-header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* --- Intro + well picker --- */
.demo-intro {
  background: radial-gradient(circle at 50% 0%, rgba(0, 114, 151, 0.35) 0%, #0b1b2b 70%), #081420;
  color: #fff;
  padding: 2.75rem 0 2.25rem;
}

.demo-intro h1 {
  color: #fff;
  font-size: 2.3rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.demo-intro-sub {
  color: rgba(240, 244, 248, 0.85);
  font-size: 1.05rem;
  max-width: 760px;
  margin-bottom: 1.75rem;
}

.demo-wells {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.demo-well {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-body);
  transition: var(--transition);
}

.demo-well strong { font-size: 0.95rem; }
.demo-well span { font-size: 0.76rem; color: rgba(255, 255, 255, 0.65); }
.demo-well:hover { border-color: rgba(142, 193, 75, 0.6); }

.demo-well.is-active {
  background: rgba(142, 193, 75, 0.14);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary) inset;
}

/* --- Main grid --- */
.demo-main { padding: 2rem 0 3rem; }

.demo-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.75rem;
  align-items: start;
}

.demo-controls {
  position: sticky;
  top: 76px;
}

.demo-panel,
.demo-card,
.demo-kpi {
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.demo-panel { padding: 1.4rem; }

.demo-panel-title {
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

/* Sliders */
.demo-slider { margin-bottom: 1.2rem; }

.demo-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.demo-slider-head label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
}

.demo-slider-head output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--secondary);
  white-space: nowrap;
}

.demo-slider input[type=range] {
  width: 100%;
  accent-color: var(--secondary);
  height: 28px;           /* comfortable touch target */
  cursor: pointer;
}

.demo-slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--gray-500);
  margin-top: -0.2rem;
}

.demo-slider-dose {
  border-top: 1px dashed var(--gray-200);
  padding-top: 1rem;
}

.demo-slider-dose input[type=range] { accent-color: var(--primary-dark); }

.demo-fixed {
  border-top: 1px solid var(--gray-200);
  padding-top: 0.75rem;
  font-size: 0.82rem;
}

.demo-fixed summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--gray-600);
}

.demo-fixed dl { margin-top: 0.6rem; }

.demo-fixed dl > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.demo-fixed dt { color: var(--gray-500); }
.demo-fixed dd { color: var(--gray-800); text-align: right; font-weight: 500; }

/* Results */
.demo-results { min-width: 0; }

.demo-story {
  font-size: 0.95rem;
  color: var(--gray-600);
  margin-bottom: 1rem;
}

.demo-sour {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: rgba(232, 160, 32, 0.1);
  border: 1px solid rgba(232, 160, 32, 0.45);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--gray-700);
}

.demo-sour i { color: var(--warning); flex-shrink: 0; width: 20px; height: 20px; }
.demo-sour strong { display: block; color: var(--gray-900); }

.demo-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.demo-kpi { padding: 1rem 1.1rem; }

.demo-kpi-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.demo-kpi-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  margin: 0.25rem 0;
}

.demo-kpi-value small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-500);
}

.demo-kpi-value-sm { font-size: 1.1rem; line-height: 1.35; }

.demo-kpi-sub {
  font-size: 0.78rem;
  color: var(--gray-600);
  line-height: 1.45;
}

.demo-kpi-warn { border-left: 3px solid var(--warning); }
.demo-kpi-good { border-left: 3px solid var(--success); }

.demo-badge {
  display: inline-block;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.45rem;
  border-radius: 4px;
  margin-right: 0.3rem;
}

.demo-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.demo-card { padding: 1.2rem 1.3rem; min-width: 0; }
.demo-card h3 { font-size: 1.02rem; margin-bottom: 0.2rem; }

.demo-card-sub {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-bottom: 0.75rem;
}

.demo-chart { position: relative; height: 280px; }

.demo-error {
  grid-column: 1 / -1;
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(217, 79, 61, 0.08);
  color: var(--error);
}

.demo-loading .demo-results { opacity: 0.55; transition: opacity 0.15s; }

/* In-results CTA */
.demo-cta {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.6rem 1.75rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #091823 0%, #007297 100%);
  color: #fff;
}

.demo-cta h3 { color: #fff; font-size: 1.2rem; margin-bottom: 0.35rem; }
.demo-cta p { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin: 0; max-width: 560px; }
.demo-cta .btn-hero { flex-shrink: 0; }

/* Contact */
.demo-contact-section {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  padding: 3.5rem 0;
  scroll-margin-top: 60px;
}

.demo-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
}

.demo-contact-grid h2 { font-size: 1.9rem; margin-bottom: 0.75rem; }
.demo-contact-grid > div > p { color: var(--gray-600); font-size: 1rem; }

.demo-footer {
  background: #081420;
  color: var(--gray-400);
  font-size: 0.78rem;
  line-height: 1.6;
  padding: 1.75rem 0;
}

.demo-readout { display: none; }

/* --- Responsive --- */
@media (max-width: 1100px) {
  .demo-kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .demo-grid { grid-template-columns: 1fr; }
  .demo-controls { position: static; }
  .demo-charts { grid-template-columns: 1fr; }
  .demo-wells { grid-template-columns: repeat(2, 1fr); }
  .demo-contact-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .demo-cta { flex-direction: column; align-items: stretch; text-align: left; }
  .demo-cta .btn-hero { justify-content: center; }
}

@media (max-width: 600px) {
  .demo-container,
  .demo-header-inner { padding: 0 1rem; }
  .demo-logo { height: 22px; }
  .demo-product { font-size: 0.95rem; }
  .demo-pill, .demo-back span { display: none; }
  .demo-back { padding: 0.35rem 0.5rem; }
  .demo-header-actions .btn-sm { font-size: 0.78rem; padding: 0.35rem 0.6rem; }

  .demo-intro { padding: 1.75rem 0 1.5rem; }
  .demo-intro h1 { font-size: 1.6rem; }
  .demo-intro-sub { font-size: 0.92rem; margin-bottom: 1.1rem; }
  .demo-wells { gap: 0.5rem; }
  .demo-well { padding: 0.6rem 0.7rem; }
  .demo-well strong { font-size: 0.84rem; }
  .demo-well span { font-size: 0.68rem; }

  .demo-main { padding: 1.25rem 0 2rem; }
  .demo-kpis { gap: 0.6rem; }
  .demo-kpi { padding: 0.8rem; }
  .demo-kpi-value { font-size: 1.4rem; }
  .demo-kpi-value-sm { font-size: 0.95rem; }
  .demo-kpi-label { font-size: 0.66rem; }
  .demo-kpi-sub { font-size: 0.72rem; }
  .demo-card { padding: 1rem; }
  .demo-chart { height: 240px; }
  .demo-contact-section { padding: 2.5rem 0 5rem; }
  .demo-contact-grid h2 { font-size: 1.5rem; }
  .contact-card .form-input { font-size: 16px; }   /* no iOS zoom-on-focus */

  /* Live readout pinned to the bottom while the sliders are on screen */
  .demo-readout {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    justify-content: space-around;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
    background: rgba(8, 20, 32, 0.95);
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transform: translateY(110%);
    transition: transform 0.2s ease;
  }
  .demo-readout.is-visible { transform: translateY(0); }
  .demo-readout-rate { font-weight: 700; filter: brightness(1.4); }
}
