/* styles.css for Amanah BioSystems
   Built on ui-craft Utility Console design system
   Loads after tokens.css and base.css */

:root {
  --z-header: 40;
  --z-modal: 100;
  --z-skip: 200;
}

/* Page Frame */
body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: var(--border-w) solid var(--line);
  height: 64px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-weight: var(--weight-strong);
  font-size: var(--step-1);
  color: var(--ink);
  text-decoration: none;
  letter-spacing: var(--tracking-display);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--surface-2);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  background: var(--accent-tint);
  color: var(--accent-ink);
  padding: 2px 6px;
  border-radius: var(--radius-1);
  border: var(--border-w) solid color-mix(in srgb, var(--accent) 30%, transparent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.nav-link {
  color: var(--ink-2);
  font-size: var(--step-0);
  font-weight: var(--weight-strong);
  text-decoration: none;
  padding: var(--space-2) var(--space-1);
  transition: color var(--dur-1) var(--ease);
}

.nav-link:hover {
  color: var(--ink);
  text-decoration: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.menu-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-1);
  background: var(--surface);
}

/* Hero */
.hero {
  padding-block: clamp(2.5rem, 2rem + 2vw, 4.5rem);
  border-bottom: var(--border-w) solid var(--line);
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--paper) 100%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--space-7);
  align-items: center;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-2);
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius-1);
  margin-bottom: var(--space-4);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.hero-title {
  font-size: clamp(2rem, 1.6rem + 1.8vw, 3rem);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-4);
}

.hero-title span {
  color: var(--accent-ink);
}

.hero-desc {
  font-size: var(--step-1);
  color: var(--ink-2);
  margin-bottom: var(--space-6);
  max-width: var(--measure);
}

.hero-cta {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}

.hero-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  padding-top: var(--space-5);
  border-top: var(--border-w) solid var(--line);
}

.spec-item .label {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-2);
  display: block;
}

.spec-item .value {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  font-weight: var(--weight-strong);
  color: var(--ink);
  margin-block: 2px;
  display: block;
}

.spec-item .sub {
  font-size: var(--step--2);
  color: var(--ink-2);
}

/* Console Window */
.terminal-window {
  background: var(--surface);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-2);
  overflow: hidden;
}

.terminal-header {
  background: var(--surface-2);
  padding: var(--space-2) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: var(--border-w) solid var(--line);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-2);
}

.terminal-body {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink);
  line-height: 1.6;
}

.log-line {
  margin-bottom: var(--space-2);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.log-timestamp {
  color: var(--ink-3);
}

.log-level {
  padding: 1px 4px;
  border-radius: var(--radius-1);
  font-size: var(--step--2);
  font-weight: var(--weight-strong);
}

.level-info {
  background: var(--accent-tint);
  color: var(--accent-ink);
}

.level-warn {
  background: var(--warn-tint);
  color: var(--warn-ink);
}

.telemetry-card {
  margin-top: var(--space-3);
  background: var(--surface-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  padding: var(--space-3);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

.telemetry-stat {
  font-size: var(--step--2);
  color: var(--ink-3);
}

.telemetry-stat strong {
  color: var(--ink);
  display: block;
  font-size: var(--step-0);
}

/* Section Common */
.section-head {
  max-width: var(--measure);
  margin-bottom: var(--space-6);
}

.section-tag {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent-ink);
  font-weight: var(--weight-strong);
  margin-bottom: var(--space-2);
  display: block;
}

.section-title {
  font-size: var(--step-4);
  margin-bottom: var(--space-3);
}

.section-desc {
  font-size: var(--step-0);
  color: var(--ink-2);
  max-width: var(--measure);
}

/* Sandbox Component */
.sandbox-card {
  background: var(--surface);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-3);
  overflow: hidden;
}

.sandbox-nav {
  display: flex;
  background: var(--surface-2);
  border-bottom: var(--border-w) solid var(--line);
  overflow-x: auto;
}

.sandbox-tab {
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-text);
  font-size: var(--step-0);
  font-weight: var(--weight-strong);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  transition: all var(--dur-1) var(--ease);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.sandbox-tab:hover {
  color: var(--ink);
  background: var(--surface);
}

.sandbox-tab.active {
  color: var(--ink);
  background: var(--surface);
  border-bottom-color: var(--accent);
}

.sandbox-content {
  padding: var(--space-5);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* Specimen Viewfinder in Sandbox */
.specimen-viewfinder {
  position: relative;
  width: 100%;
  height: 220px;
  background: var(--surface-2);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-1);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.specimen-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vision-hud-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-2);
  background: linear-gradient(180deg, rgba(7, 13, 10, 0.4) 0%, transparent 40%, rgba(7, 13, 10, 0.6) 100%);
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--accent);
}

.hud-bbox {
  position: absolute;
  top: 25%;
  left: 20%;
  width: 55%;
  height: 50%;
  border: 2px dashed var(--accent);
  border-radius: var(--radius-1);
  display: flex;
  align-items: flex-start;
  padding: 4px;
}

.hud-bbox-label {
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  font-weight: var(--weight-strong);
  padding: 1px 4px;
  border-radius: 2px;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-2);
}

/* Facility Showcase */
.facility-showcase {
  margin-top: var(--space-5);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.facility-card {
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  overflow: hidden;
}

.facility-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.facility-caption {
  padding: var(--space-3);
  font-size: var(--step--1);
  color: var(--ink-2);
}

.facility-caption strong {
  display: block;
  color: var(--ink);
  font-size: var(--step-0);
  margin-bottom: 2px;
}

.case-info {
  display: flex;
  flex-direction: column;
}

.case-title {
  font-size: var(--step-2);
  margin-bottom: var(--space-2);
}

.case-desc {
  font-size: var(--step-0);
  color: var(--ink-2);
  margin-bottom: var(--space-4);
}

.case-meta {
  background: var(--surface-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1) 0;
  border-bottom: var(--border-w) solid var(--line);
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-key {
  color: var(--ink-3);
}

.meta-val {
  color: var(--ink);
  font-weight: var(--weight-strong);
}

.inference-box {
  background: var(--surface-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
}

.inference-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: var(--border-w) solid var(--line);
}

.engine-pill {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--accent-ink);
  background: var(--accent-tint);
  padding: 2px 6px;
  border-radius: var(--radius-1);
}

.inference-output {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.6;
  color: var(--ink);
  min-height: 240px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Architecture */
.arch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.arch-node {
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-5);
}

.node-step {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--accent-ink);
  font-weight: var(--weight-strong);
  margin-bottom: var(--space-2);
  display: block;
}

.node-title {
  font-size: var(--step-1);
  margin-bottom: var(--space-2);
}

.node-desc {
  font-size: var(--step-0);
  color: var(--ink-2);
  line-height: var(--leading-body);
}

.node-tech {
  margin-top: var(--space-4);
  padding-top: var(--space-2);
  border-top: var(--border-w) solid var(--line);
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--ink-3);
}

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.feature-card {
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-5);
}

.feature-icon {
  width: 40px;
  height: 40px;
  background: var(--surface-2);
  color: var(--accent);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.feature-title {
  font-size: var(--step-1);
  margin-bottom: var(--space-2);
}

.feature-desc {
  font-size: var(--step-0);
  color: var(--ink-2);
}

/* Telemetry Board */
.monitor-board {
  background: var(--surface);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-2);
  padding: var(--space-5);
}

.monitor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: var(--border-w) solid var(--line);
}

.monitor-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent-ink);
}

.live-pulse {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.sensor-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.sensor-box {
  background: var(--surface-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  padding: var(--space-4);
}

.sensor-label {
  font-size: var(--step--1);
  color: var(--ink-3);
  display: block;
}

.sensor-value {
  font-family: var(--font-mono);
  font-size: var(--step-3);
  font-weight: var(--weight-strong);
  color: var(--ink);
  margin-block: var(--space-1);
}

.sensor-status {
  font-size: var(--step--2);
  color: var(--ok-ink);
}

/* Company */
.company-card {
  background: var(--surface);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-2);
  padding: clamp(1.25rem, 1rem + 1vw, 2.5rem);
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-6);
}

.company-card > div {
  min-width: 0;
  max-width: 100%;
}

.company-lead {
  font-size: var(--step-1);
  color: var(--ink-2);
  margin-bottom: var(--space-4);
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.team-member {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.team-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  border: var(--border-w) solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-strong);
  color: var(--accent-ink);
  font-size: var(--step-0);
}

.team-name {
  font-weight: var(--weight-strong);
  font-size: var(--step-0);
}

.team-role {
  font-size: var(--step--1);
  color: var(--ink-3);
}

.company-meta-box {
  background: var(--surface-2);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-1);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.meta-field .meta-title {
  font-size: var(--step--2);
  color: var(--ink-3);
  font-family: var(--font-mono);
  display: block;
}

.meta-field .meta-desc {
  font-size: var(--step-0);
  color: var(--ink);
  font-weight: var(--weight-strong);
}

/* Waitlist Box */
.cta-box {
  background: var(--surface);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-3);
  padding: clamp(2rem, 1.5rem + 1.5vw, 3.5rem);
  text-align: start;
  max-width: 720px;
  margin-inline: auto;
}

.cta-title {
  font-size: var(--step-4);
  margin-bottom: var(--space-2);
}

.cta-desc {
  font-size: var(--step-0);
  color: var(--ink-2);
  margin-bottom: var(--space-5);
}

.waitlist-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.form-label {
  font-size: var(--step--1);
  font-weight: var(--weight-strong);
  color: var(--ink-2);
}

.form-group {
  display: flex;
  gap: var(--space-2);
}

.form-input {
  flex: 1;
  min-height: 44px;
  background: var(--surface-2);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-1);
  padding: var(--space-2) var(--space-3);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--step-0);
}

.form-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--focus);
}

.form-feedback {
  padding: var(--space-3);
  border-radius: var(--radius-1);
  font-size: var(--step--1);
  display: none;
}

.form-feedback.success {
  display: block;
  background: var(--ok-tint);
  border: var(--border-w) solid var(--ok-ink);
  color: var(--ok-ink);
}

.form-feedback.error {
  display: block;
  background: var(--danger-tint);
  border: var(--border-w) solid var(--danger-ink);
  color: var(--danger-ink);
}

/* Modals - inaccessible when closed */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease), visibility var(--dur-2) var(--ease);
}

.modal-overlay.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--surface);
  border: var(--border-w) solid var(--line-strong);
  border-radius: var(--radius-2);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: var(--space-5);
  box-shadow: var(--shadow-2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: var(--border-w) solid var(--line);
}

.modal-close {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--step-2);
  color: var(--ink-2);
  background: none;
  border: none;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-content {
  font-size: var(--step-0);
  color: var(--ink-2);
  line-height: var(--leading-body);
}

.modal-content p {
  margin-bottom: var(--space-3);
}

.modal-content h4 {
  color: var(--ink);
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--step-1);
}

/* Footer */
.site-footer {
  margin-top: auto;
  border-top: var(--border-w) solid var(--line);
  background: var(--surface-2);
  padding: var(--space-7) 0 var(--space-4);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.footer-brand-desc {
  font-size: var(--step--1);
  color: var(--ink-3);
  margin-top: var(--space-2);
  max-width: 280px;
}

.footer-col-title {
  font-size: var(--step--1);
  font-family: var(--font-mono);
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer-link {
  font-size: var(--step-0);
  color: var(--ink-2);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-modal-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--step-0);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-align: start;
}

.footer-modal-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-bottom {
  padding-top: var(--space-4);
  border-top: var(--border-w) solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--step--1);
  color: var(--ink-3);
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Breakpoints */
@media (max-width: 992px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  .arch-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sandbox-content {
    grid-template-columns: 1fr;
  }
  .sensor-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .company-card {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
  }
  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: var(--border-w) solid var(--line);
    padding: var(--space-4);
    gap: var(--space-3);
    align-items: flex-start;
    box-shadow: var(--shadow-2);
  }
  .header-actions {
    display: none; /* Prevents horizontal overflow on phones */
  }
  .hero-cta {
    flex-direction: column;
  }
  .hero-cta .btn {
    width: 100%;
  }
  .menu-toggle {
    display: inline-flex;
  }
  .feature-grid, .arch-grid, .hero-specs {
    grid-template-columns: 1fr;
  }
  .sensor-row {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  .form-group {
    flex-direction: column;
  }
  .footer-bottom {
    flex-direction: column;
    gap: var(--space-2);
    text-align: start;
  }
}
