/* Zoth Blueprint Foundry — Design System & Styles */
:root {
  --bg-dark: #05070d;
  --bg-card: rgba(13, 19, 33, 0.7);
  --bg-card-hover: rgba(22, 32, 54, 0.85);
  --bg-glass: rgba(10, 15, 26, 0.6);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 240, 255, 0.3);
  --border-amber: rgba(245, 158, 11, 0.4);
  
  --cyan-bright: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.15);
  --amber-bright: #f59e0b;
  --emerald-bright: #10b981;
  --purple-bright: #a855f7;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Figtree', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-display: 'Syne', sans-serif;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body.zoth-foundry-body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 20px;
  background: var(--cyan-bright);
  color: #000;
  padding: 10px 16px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  z-index: 1000;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus-visible {
  top: 20px;
}

/* Accessible Focus States */
:focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 3px;
}

/* Background Atmosphere */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 10%, rgba(0, 240, 255, 0.05) 0%, transparent 60%),
              radial-gradient(circle at 90% 40%, rgba(168, 85, 247, 0.04) 0%, transparent 50%),
              radial-gradient(circle at 10% 70%, rgba(245, 158, 11, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.bg-neural-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}

/* Top Navigation Header */
.foundry-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
}

.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--cyan-bright);
  background: var(--cyan-glow);
  border: 1px solid var(--border-glow);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  letter-spacing: 0.05em;
}
.brand-by {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--muted, #8b93a7);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--emerald-bright);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--emerald-bright);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald-bright);
  animation: pulse-ring 2s infinite ease-in-out;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-btn:hover {
  color: var(--text-main);
  border-color: var(--border-glow);
}

.btn-deck {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition-fast);
}
.btn-deck:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  color: var(--cyan-bright);
}

/* Main Container */
.foundry-main {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
}

/* Hero Section */
.foundry-hero {
  margin-bottom: 3rem;
}

.hero-tagline .kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--cyan-bright);
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}

.hero-tagline h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 1rem;
}

.hero-lede {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 900px;
  line-height: 1.65;
}
.hero-lede strong {
  color: var(--text-main);
}

/* Metrics HUD */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.25s ease;
}
.metric-card:hover { border-color: rgba(0, 240, 255, 0.45); }

.metric-val {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--cyan-bright);
}

.metric-lbl {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Interactive Composer Section */
.composer-section {
  background: rgba(10, 16, 28, 0.75);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 3.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.composer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.badge-chip {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--amber-bright);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--border-amber);
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.4rem;
}

.composer-title-group h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}
.composer-title-group p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-primary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--cyan-bright);
  color: #04060c;
  border-color: var(--cyan-bright);
}
.btn-primary:hover {
  background: #38f8ff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}
.btn-ghost:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.composer-active-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.slot-empty, .slot-filled {
  min-height: 90px;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition-smooth);
}

.slot-empty {
  border: 1px dashed var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.slot-num {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.slot-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}

.slot-filled {
  border: 1px solid var(--border-glow);
  background: rgba(0, 240, 255, 0.06);
}
.slot-filled .slot-num {
  background: var(--cyan-bright);
  color: #04060c;
}
.slot-filled-meta h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}
.slot-filled-meta p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan-bright);
}
.slot-remove-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
}
.slot-remove-btn:hover {
  color: #ef4444;
}

/* Output Tray */
.composer-output-tray {
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  animation: fadeIn 0.3s ease;
}
.composer-output-tray.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.tray-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-main);
}
.terminal-dot {
  width: 8px;
  height: 8px;
  background: var(--cyan-bright);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--cyan-bright);
}

.btn-copy {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid var(--border-glow);
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-copy:hover {
  background: var(--cyan-bright);
  color: #04060c;
}

.terminal-block {
  background: #020408;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #a5f3fc;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* Explorer Section */
.explorer-controls {
  margin-bottom: 2rem;
}

.search-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 3rem 0.85rem 2.8rem;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: var(--transition-fast);
}
.search-wrap input:focus {
  border-color: var(--border-glow);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}

.search-kbd {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-fast);
}
.pill-btn:hover {
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}
.pill-btn.is-active {
  background: var(--cyan-glow);
  border-color: var(--border-glow);
  color: var(--cyan-bright);
  font-weight: 700;
}

/* Blueprints Cards Grid */
.blueprints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
}

.blueprint-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: var(--transition-smooth);
  position: relative;
}

.blueprint-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.cat-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}
.cat-tag.ai-agents { color: var(--purple-bright); background: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.3); }
.cat-tag.saas-apps { color: var(--cyan-bright); background: var(--cyan-glow); border: 1px solid var(--border-glow); }
.cat-tag.security-osint { color: var(--emerald-bright); background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); }
.cat-tag.games-arcade { color: #f43f5e; background: rgba(244, 63, 94, 0.1); border: 1px solid rgba(244, 63, 94, 0.3); }
.cat-tag.crypto-web3 { color: var(--amber-bright); background: rgba(245, 158, 11, 0.1); border: 1px solid var(--border-amber); }
.cat-tag.clients-services { color: #38bdf8; background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.3); }
.cat-tag.fintech-tools { color: #e2e8f0; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border-subtle); }

.stack-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.card-archetype {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan-bright);
  margin-bottom: 0.9rem;
}

.card-why-block {
  background: rgba(0, 0, 0, 0.3);
  border-left: 2px solid var(--cyan-bright);
  padding: 0.65rem 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.card-why-block strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}

.features-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.feat-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

.btn-card-detail {
  background: transparent;
  border: none;
  color: var(--cyan-bright);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0;
}
.btn-card-detail:hover {
  text-decoration: underline;
}

.btn-card-add {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-card-add:hover {
  background: var(--cyan-bright);
  color: #04060c;
  border-color: var(--cyan-bright);
}

/* Modal Styling */
.blueprint-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #090e1a;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 680px;
  width: 90vw;
  max-height: 85vh;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  z-index: 100;
  color: var(--text-main);
  overflow: hidden;
}
.blueprint-modal::backdrop {
  background: rgba(3, 5, 10, 0.8);
  backdrop-filter: blur(8px);
}

.modal-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-cat-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--cyan-bright);
  margin-bottom: 0.3rem;
}

.modal-title-group h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.modal-archetype-text {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close-btn:hover {
  color: #fff;
  border-color: var(--border-glow);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-section h4 {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--cyan-bright);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.modal-prose {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.modal-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.spec-list {
  list-style: none;
}
.spec-list li {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  padding: 0.25rem 0;
  position: relative;
  padding-left: 1.1rem;
}
.spec-list li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--cyan-bright);
}

.modal-code {
  background: #04060b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #a5f3fc;
  white-space: pre-wrap;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .foundry-header { padding: 0.6rem 1rem; }
  .header-status .status-indicator { display: none; }
  .composer-header { flex-direction: column; }
  .modal-grid-two { grid-template-columns: 1fr; }
  .blueprints-grid { grid-template-columns: 1fr; }
}
