/* ==========================================================================
   Mooney Regulator Selector — Design System + Styles
   Industrial engineering tool: cool slate surfaces, single teal accent
   (echoing the Baker Hughes Mooney brand mark), monospace for spec data.
   ========================================================================== */

/* ---- Type scale (fluid, per design tokens) ---- */
:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --content-default: 960px;
  --content-wide: 1180px;

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

:root,
[data-theme='light'] {
  --color-bg: #f3f7f7;
  --color-surface: #ffffff;
  --color-surface-2: #fbfdfd;
  --color-surface-offset: #ebf1f1;
  --color-surface-offset-2: #e0e8e8;
  --color-divider: #dde5e5;
  --color-border: #c7d3d3;
  --color-text: #142020;
  --color-text-muted: #5a6c6c;
  --color-text-faint: #96a5a5;
  --color-text-inverse: #f3f7f7;

  --color-primary: #0b7c77;
  --color-primary-hover: #096660;
  --color-primary-active: #084f4b;
  --color-primary-highlight: #cfe6e3;

  --color-success: #2f7d4f;
  --color-success-highlight: #d6e9dc;
  --color-warning: #ad6e0e;
  --color-warning-highlight: #f1e0c4;
  --color-error: #b3261e;
  --color-error-highlight: #f1d5d3;

  --shadow-sm: 0 1px 2px oklch(0.25 0.02 195 / 0.08);
  --shadow-md: 0 4px 14px oklch(0.25 0.02 195 / 0.10);
  --shadow-lg: 0 16px 36px oklch(0.25 0.02 195 / 0.16);
}

[data-theme='dark'] {
  --color-bg: #0c1414;
  --color-surface: #121b1b;
  --color-surface-2: #16201f;
  --color-surface-offset: #1a2524;
  --color-surface-offset-2: #202d2c;
  --color-divider: #223030;
  --color-border: #324241;
  --color-text: #dce6e5;
  --color-text-muted: #8ba09f;
  --color-text-faint: #5e7473;
  --color-text-inverse: #101818;

  --color-primary: #52c6bb;
  --color-primary-hover: #78d6cc;
  --color-primary-active: #3aab9f;
  --color-primary-highlight: #1c3532;

  --color-success: #70c48d;
  --color-success-highlight: #203228;
  --color-warning: #e2ab4a;
  --color-warning-highlight: #392c18;
  --color-error: #e6716a;
  --color-error-highlight: #3a2422;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.35);
  --shadow-md: 0 4px 14px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 16px 36px oklch(0 0 0 / 0.5);
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background:
    radial-gradient(1200px 500px at 90% -10%, color-mix(in oklab, var(--color-primary) 8%, transparent), transparent),
    var(--color-bg);
}

img, svg { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; text-wrap: balance; letter-spacing: -0.01em; }

:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 3px; border-radius: var(--radius-sm); }

a, button, input, select, textarea, [role='button'] {
  transition: color var(--transition-interactive), background var(--transition-interactive),
    border-color var(--transition-interactive), box-shadow var(--transition-interactive), transform var(--transition-interactive);
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ---- Layout shell ---- */
.shell { max-width: var(--content-wide); margin: 0 auto; padding: 0 var(--space-5); }

.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.site-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: var(--space-4);
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 36px; height: 36px; color: var(--color-primary); flex-shrink: 0; }
.brand-text h1 { font-size: var(--text-base); margin: 0; }
.brand-text p { font-size: var(--text-xs); color: var(--color-text-muted); margin: 0; }

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-full); border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.theme-toggle:hover { color: var(--color-primary); border-color: var(--color-primary); }

main { padding-block: var(--space-10) var(--space-24); }

#intro { padding-top: var(--space-6); }
.page-title { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.page-subtitle { color: var(--color-text-muted); max-width: 60ch; margin-bottom: var(--space-8); font-size: var(--text-base); }

/* ---- Stepper ---- */
.stepper-wrap {
  position: relative;
  margin-bottom: var(--space-10);
}
.stepper {
  display: flex; gap: var(--space-2);
  overflow-x: auto; padding-bottom: var(--space-1);
  scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
@media (max-width: 720px) {
  .stepper-wrap::after {
    content: "";
    position: absolute; top: 0; right: 0; bottom: var(--space-1);
    width: 28px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--color-bg));
  }
}
.step-pip {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-xs); color: var(--color-text-muted);
  white-space: nowrap; flex-shrink: 0;
}
.step-pip .num {
  display: grid; place-items: center; width: 20px; height: 20px; border-radius: var(--radius-full);
  background: var(--color-surface-offset); font-family: var(--font-mono); font-size: 0.7rem;
}
.step-pip.active { border-color: var(--color-primary); color: var(--color-text); background: var(--color-primary-highlight); }
.step-pip.active .num { background: var(--color-primary); color: var(--color-text-inverse); }
.step-pip.done { color: var(--color-text); }
.step-pip.done .num { background: var(--color-success); color: white; }

/* ---- Wizard card ---- */
.wizard-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}
.wizard-panel h2 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.wizard-panel .step-hint { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-6); }

.option-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-6);
}
.option-card {
  text-align: left; padding: var(--space-4) var(--space-5);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  display: flex; flex-direction: column; gap: var(--space-1);
}
.option-card:hover { border-color: var(--color-primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.option-card .label { font-weight: 600; font-size: var(--text-sm); }
.option-card .desc { font-size: var(--text-xs); color: var(--color-text-muted); }
.option-card.selected { border-color: var(--color-primary); background: var(--color-primary-highlight); }
.option-card.selected .label { color: var(--color-primary-active); }
[data-theme='dark'] .option-card.selected .label { color: var(--color-primary); }

.field-group { margin-bottom: var(--space-5); }
.field-group .field-label {
  display: block; font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-2);
}
.field-help { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-5); }

.input, select.input {
  width: 100%; padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-2); color: var(--color-text);
  font-size: var(--text-base); font-family: var(--font-mono);
}
.input:focus, select.input:focus { border-color: var(--color-primary); }
.input-unit-wrap { display: flex; gap: var(--space-2); }
.input-unit-wrap select { max-width: 120px; font-family: var(--font-body); }

.checkbox-row { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--color-primary); }
.checkbox-row .ctext strong { display: block; font-size: var(--text-sm); }
.checkbox-row .ctext span { font-size: var(--text-xs); color: var(--color-text-muted); }

.wizard-nav { display: flex; justify-content: space-between; margin-top: var(--space-8); gap: var(--space-3); }

.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-6); border-radius: var(--radius-md);
  font-weight: 600; font-size: var(--text-sm);
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--color-text-muted); border: 1.5px solid var(--color-border); }
.btn-ghost:hover { color: var(--color-text); border-color: var(--color-text-muted); }

/* ---- Results ---- */
.results-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-6); }
.results-summary { font-size: var(--text-sm); color: var(--color-text-muted); font-family: var(--font-mono); }

.result-card {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--space-6);
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-md);
  padding: var(--space-6); margin-bottom: var(--space-6);
}
@media (max-width: 720px) { .result-card { grid-template-columns: 1fr; } }

.result-photo {
  border-radius: var(--radius-lg); overflow: hidden; background: var(--color-surface-offset);
  display: grid; place-items: center; padding: var(--space-3); aspect-ratio: 1;
}
.result-photo img { max-height: 100%; object-fit: contain; }

.result-body h3 { font-size: var(--text-lg); margin-bottom: var(--space-1); }
.result-tagline { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-4); }

.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; margin-bottom: var(--space-4);
}
.badge-recommended { background: var(--color-success-highlight); color: var(--color-success); }
.badge-notes { background: var(--color-warning-highlight); color: var(--color-warning); }
.badge-excluded { background: var(--color-error-highlight); color: var(--color-error); }

.spec-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-4);
}
.spec-item { background: var(--color-surface-offset); border-radius: var(--radius-md); padding: var(--space-3); }
.spec-item .k { font-size: var(--text-xs); color: var(--color-text-muted); display: block; margin-bottom: var(--space-1); }
.spec-item .v { font-family: var(--font-mono); font-size: var(--text-sm); font-weight: 600; }

.note-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.note-list li {
  font-size: var(--text-sm); color: var(--color-text); background: var(--color-surface-offset);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border-left: 3px solid var(--color-primary);
}
.note-list li.warn { border-left-color: var(--color-warning); }

.accessory-chip {
  display: inline-flex; flex-direction: column; gap: var(--space-1);
  background: var(--color-primary-highlight); border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4);
}
.accessory-chip .label { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary-active); font-weight: 700; }
[data-theme='dark'] .accessory-chip .label { color: var(--color-primary); }
.accessory-chip .name { font-weight: 600; font-size: var(--text-sm); }
.accessory-chip .why { font-size: var(--text-xs); color: var(--color-text-muted); }

.accessory-section { margin-top: var(--space-2); margin-bottom: var(--space-4); }
.accessory-section-title { font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-3); }
.accessory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3); }
.accessory-card {
  border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  background: var(--color-surface-2); padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.accessory-card-photo {
  border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-offset);
  display: grid; place-items: center; padding: var(--space-2); aspect-ratio: 4/3;
}
.accessory-card-photo img { max-height: 100%; object-fit: contain; }
.accessory-card-body { display: flex; flex-direction: column; gap: var(--space-1); }
.accessory-card-kicker { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-primary-active); font-weight: 700; }
[data-theme='dark'] .accessory-card-kicker { color: var(--color-primary); }
.accessory-card-name { font-weight: 600; font-size: var(--text-sm); }
.accessory-card-spec { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }
.accessory-card-why { font-size: var(--text-xs); color: var(--color-text-muted); }

.source-tag { font-size: var(--text-xs); color: var(--color-text-faint); font-family: var(--font-mono); }

details.excluded-panel { margin-top: var(--space-8); border: 1px solid var(--color-divider); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--color-surface); }
details.excluded-panel summary { cursor: pointer; font-weight: 600; font-size: var(--text-sm); }
.excluded-item { font-size: var(--text-sm); color: var(--color-text-muted); padding: var(--space-3) 0; border-top: 1px solid var(--color-divider); }
.excluded-item strong { color: var(--color-text); }

.inputs-summary {
  border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  background: var(--color-surface); padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
}
.inputs-summary-title { font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-4); }
.inputs-summary-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4) var(--space-5);
}
.inputs-summary-item { display: flex; flex-direction: column; gap: 2px; }
.inputs-summary-item .k { font-size: var(--text-xs); color: var(--color-text-muted); }
.inputs-summary-item .v { font-size: var(--text-sm); font-weight: 600; font-family: var(--font-mono); }

.results-actions { margin-top: var(--space-8); display: flex; gap: var(--space-3); flex-wrap: wrap; }

footer.site-footer { text-align: center; padding: var(--space-8) 0; color: var(--color-text-faint); font-size: var(--text-xs); }

.hidden { display: none !important; }

/* ---- Print (Save as PDF) ---- */
@media print {
  :root, [data-theme='dark'], [data-theme='light'] {
    --color-bg: #ffffff; --color-surface: #ffffff; --color-surface-2: #f4f6f5;
    --color-surface-offset: #eef1f0; --color-text: #10201d; --color-text-muted: #4c5c58;
    --color-text-faint: #7a8a86; --color-divider: #d8e0de; --color-border: #cdd7d4;
    --color-primary: #0b7c77; --color-primary-hover: #096763; --color-primary-active: #0b7c77;
    --color-primary-highlight: #cfe6e3; --color-warning: #ad6e0e; --color-warning-highlight: #f1e0c4;
    --color-success: #0b7c77; --color-success-highlight: #cfe6e3;
    --color-error: #b3261e; --color-error-highlight: #f1d5d3;
  }
  body { background: #fff; }
  .site-header, .stepper-wrap, .site-footer, .wizard-nav, #wizard-form,
  .theme-toggle, .results-actions, details.excluded-panel { display: none !important; }
  .shell { max-width: 100%; padding: 0 var(--space-4); }
  .result-card {
    box-shadow: none; border: 1px solid var(--color-divider);
    break-inside: avoid; page-break-inside: avoid; margin-bottom: var(--space-6);
  }
  .accessory-card { break-inside: avoid; page-break-inside: avoid; }
  .inputs-summary { break-inside: avoid; page-break-inside: avoid; }
  .accessory-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  a { color: var(--color-primary); }
}
