/* S30 Helper — shared stylesheet
   Clean modern technical theme. */

:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --bg-code: #f1f3f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2328;
  --text-soft: #4b5563;
  --text-mute: #6b7280;
  --accent: #c8392f;       /* Z-orange / period red */
  --accent-soft: #fde9e7;
  --link: #0c64c0;
  --link-hover: #0a4d96;
  --warn-bg: #fff8e1;
  --warn-border: #f1c40f;
  --ok-bg: #ecfdf5;
  --ok-border: #10b981;
  --info-bg: #eff6ff;
  --info-border: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --max-w: 1180px;
  --content-w: 760px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img, svg { max-width: 100%; height: auto; }

/* ============ HEADER ============ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; color: var(--text); }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--text);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.brand-mark .stripe {
  width: 4px;
  height: 18px;
  background: var(--accent);
  margin-right: 2px;
  border-radius: 1px;
}
.brand-mark-text {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
  align-items: center;
}
.nav a {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--text); border-bottom-color: var(--accent); }

/* ============ LAYOUT ============ */

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

.content {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 48px 24px 80px;
}

main h1 {
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
main h2 {
  font-size: 22px;
  margin: 40px 0 12px;
  letter-spacing: -0.01em;
  scroll-margin-top: 80px;
}
main h3 {
  font-size: 17px;
  margin: 28px 0 8px;
  scroll-margin-top: 80px;
}
main p { margin: 12px 0; color: var(--text-soft); }
main p strong { color: var(--text); }
main ul, main ol { color: var(--text-soft); padding-left: 22px; }
main li { margin: 4px 0; }

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--bg-code);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* ============ HERO ============ */

.hero {
  padding: 72px 24px 48px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse at top right, rgba(200,57,47,0.06), transparent 60%),
    radial-gradient(ellipse at bottom left, rgba(12,100,192,0.04), transparent 60%);
}
.hero-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}
.hero p {
  font-size: 18px;
  color: var(--text-soft);
  margin: 0 0 24px;
  max-width: 560px;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-photo {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.08);
  aspect-ratio: 16 / 10;
  background: var(--bg-soft);
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-photo::after {
  /* subtle inner ring for polish */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
  pointer-events: none;
}
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--text);
  color: #fff;
}
.btn-primary:hover {
  background: #000;
  color: #fff;
  text-decoration: none;
}
.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover {
  background: var(--bg-soft);
  text-decoration: none;
  color: var(--text);
}

/* ============ SECTION GRID ============ */

.section-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.section-card {
  display: block;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg);
  transition: all 0.15s;
  color: var(--text);
}
.section-card:hover {
  border-color: var(--text);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text);
  transform: translateY(-2px);
}
.section-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.section-card .icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--bg-soft);
  border-radius: 8px;
  margin-bottom: 14px;
  color: var(--accent);
}
.section-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}
.section-card p {
  margin: 0;
  color: var(--text-mute);
  font-size: 14px;
}
.section-card .badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-mute);
  margin-top: 12px;
}
.section-card .badge.live {
  background: var(--ok-bg);
  color: #047857;
}

/* ============ CONTENT NAV (sidebar layout) ============ */

.doc-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  padding: 32px 24px 80px;
}

.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  font-size: 14px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.sidebar-section {
  margin-bottom: 24px;
}
.sidebar-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.sidebar a {
  display: block;
  padding: 5px 10px;
  margin: 0 -10px;
  border-radius: 4px;
  color: var(--text-soft);
  font-weight: 400;
}
.sidebar a:hover {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}
.sidebar a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.doc-content { min-width: 0; }

/* ============ SUBSYSTEM CARD GRID (electrical index) ============ */

.subsystem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.subsystem-card {
  display: block;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: all 0.15s;
}
.subsystem-card:hover {
  border-color: var(--text);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.subsystem-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.subsystem-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-mute);
}
.subsystem-card .models {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.subsystem-card .models span {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-soft);
  color: var(--text-soft);
}

/* ============ DIAGRAM ============ */

.diagram {
  margin: 24px 0;
  padding: 20px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.diagram svg { display: block; margin: 0 auto; max-width: 100%; }
.diagram-caption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-mute);
  font-style: italic;
}

/* ============ CALLOUTS ============ */

.callout {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 3px solid var(--info-border);
  background: var(--info-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout.warn { border-color: var(--warn-border); background: var(--warn-bg); }
.callout.tip  { border-color: var(--ok-border);   background: var(--ok-bg); }
.callout-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============ TABLES ============ */

.table-wrap { overflow-x: auto; margin: 20px 0; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-soft);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
}
tbody tr:hover { background: var(--bg-soft); }

/* Wire color swatches */
.wire {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.wire .swatch {
  display: inline-block;
  width: 28px;
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* ============ STEPS ============ */

.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 16px 0;
}
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 14px 16px 14px 56px;
  margin: 8px 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.steps > li strong { display: block; color: var(--text); margin-bottom: 4px; }

/* ============ MODEL BADGES ============ */

.model-badges {
  display: flex;
  gap: 8px;
  margin: 12px 0 24px;
  flex-wrap: wrap;
}
.model-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-soft);
}
.model-badge.applies {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ============ BREADCRUMB ============ */

.breadcrumb {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.breadcrumb a { color: var(--text-mute); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { margin: 0 6px; color: var(--border-strong); }

/* ============ FOOTER ============ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 32px 24px;
  margin-top: 60px;
}
.site-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.6;
}
.site-footer p { margin: 6px 0; color: var(--text-mute); }
.site-footer a { color: var(--text-soft); }

/* ============ MODAL ============ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 22, 0.55);
  backdrop-filter: blur(2px);
  animation: modal-fade 160ms ease-out;
}
@keyframes modal-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.35), 0 4px 16px rgba(0,0,0,0.10);
  padding: 28px 28px 24px;
  animation: modal-rise 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--text-mute);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

/* ============ FORM ============ */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.field-hint {
  font-weight: 400;
  color: var(--text-mute);
  font-size: 12px;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.contact-form textarea { resize: vertical; min-height: 100px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.form-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.form-status-info {
  background: var(--info-bg);
  color: var(--text);
  border-left: 3px solid var(--info-border);
}
.form-status-success {
  background: var(--ok-bg);
  color: var(--text);
  border-left: 3px solid var(--ok-border);
}
.form-status-error {
  background: #fdecea;
  color: var(--text);
  border-left: 3px solid #e74c3c;
}

/* ============ RESPONSIVE ============ */

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero h1 { font-size: 36px; }
  .section-grid { grid-template-columns: 1fr; }
  .doc-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .nav { gap: 14px; }
}

@media (max-width: 600px) {
  .hero { padding: 48px 24px 32px; }
  .hero h1 { font-size: 30px; }
  main h1 { font-size: 28px; }
  .nav a { font-size: 13px; }
}
