:root {
  --bg: #050505;
  --border: #1A1A1A;
  --border-subtle: #141414;
  --crosshair: #525252;
  --text-primary: #F5F5F5;
  --text-secondary: #737373;
  --text-tertiary: #333333;
  --text-nav: #A3A3A3;
  --status-online: #22C55E;

  --font-display: 'Geist', 'Instrument Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html,
body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

::selection {
  background-color: #F5F5F5;
  color: #050505;
}

/* Outer viewport container */
.viewport {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 20px;
  overflow: hidden;
  background-color: var(--bg);
}

/* Inner hairline frame with 4 corner crosshairs */
.frame {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid var(--border);
  background-color: var(--bg);
}

.frame::before,
.frame::after,
.frame-grid::before,
.frame-grid::after {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  z-index: 10;
  background:
    linear-gradient(var(--crosshair), var(--crosshair)) center / 9px 1px no-repeat,
    linear-gradient(var(--crosshair), var(--crosshair)) center / 1px 9px no-repeat;
}

/* Top corners */
.frame::before {
  top: -5px;
  left: -5px;
}

.frame::after {
  top: -5px;
  right: -5px;
}

/* Bottom corners */
.frame-grid::before {
  bottom: -5px;
  left: -5px;
}

.frame-grid::after {
  bottom: -5px;
  right: -5px;
}

/* 3-row vertical layout: Header / Hero Canvas / Footer */
.frame-grid {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Row 1: Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px;
  z-index: 2;
}

.identity {
  min-width: 0;
}

.name {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.35vw, 18px);
  font-weight: 500;
  letter-spacing: 0.15em;
  line-height: 1.2;
  color: var(--text-primary);
}

.role {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.4;
  color: var(--text-secondary);
}

.telemetry {
  flex-shrink: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1.5;
  color: var(--text-secondary);
}

.telemetry-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--status-online);
  flex-shrink: 0;
  animation: status-pulse 3.2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.clock {
  display: block;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

/* Row 2: Hero Canvas */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.armillary-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.armillary-canvas:focus-visible {
  box-shadow: inset 0 0 0 1px var(--crosshair);
}

.mode-indicator {
  position: absolute;
  left: 24px;
  bottom: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: #525252;
  user-select: none;
  pointer-events: none;
  transition: color 200ms ease;
}

.mode-indicator.is-flashing {
  color: var(--text-primary);
}

/* Row 3: Footer */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-subtle);
  z-index: 2;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--text-secondary);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-shrink: 0;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--text-nav);
  text-decoration: none;
  white-space: nowrap;
  transition: color 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: #FFFFFF;
  outline: none;
}

.nav-link.is-copied {
  color: var(--text-primary);
}

.nav-button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
}

/* Responsive: Mobile (< 768px) */
@media (max-width: 767px) {
  .viewport {
    padding: 12px;
  }

  .header {
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
  }

  .name {
    font-size: 15px;
    letter-spacing: 0.14em;
  }

  .role {
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .telemetry {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    font-size: 10px;
  }

  .mode-indicator {
    left: 16px;
    bottom: 10px;
    font-size: 9px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
  }

  .tagline {
    font-size: 11px;
  }

  .nav {
    width: 100%;
    gap: 16px;
    justify-content: space-between;
  }

  .nav-link {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}
