/* ═══════════════════════════════════════════════════════════════
   KIKR — BLUEPRINT & DRAFTING STYLE SYSTEM
   Classic cyanotype engineering schematic design
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-color: #071529;       /* Cyanotype Deep Blue */
  --pen-color: #a8d4ff;      /* Blueprint Light Blue Pencil */
  --pen-dim: rgba(168, 212, 255, 0.4);
  --pen-very-dim: rgba(168, 212, 255, 0.1);
  --accent-copper: #d4a373;  /* Drafting Wood/Copper */
  --accent-red: #ef4444;     /* Red Ink Marks */
  --accent-green: #34d399;   /* Green Active Lead */
  
  --font-title: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-mono);
  background-color: var(--bg-color);
  color: var(--pen-color);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* ── BLUEPRINT BACKGROUND GRID ──────────────────────────────── */
.blueprint-grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image: 
    linear-gradient(var(--pen-very-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--pen-very-dim) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
  background-position: center;
  opacity: 0.85;
}

/* Subtle drafting creases / texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(3, 7, 18, 0.4) 100%);
  z-index: 2;
}

/* Container */
.blueprint-container {
  position: relative;
  z-index: 5;
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 30px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-height: 100vh;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.blueprint-header {
  border: 1px solid var(--pen-dim);
  padding: 24px;
  background: rgba(7, 21, 41, 0.6);
  position: relative;
}

/* Overlapping corners - architectural drafting signature */
.blueprint-header::before, .blueprint-header::after,
.blueprint-panel::before, .blueprint-panel::after,
.schematic-canvas::before, .schematic-canvas::after,
.cyanotype-monitor::before, .cyanotype-monitor::after {
  content: "";
  position: absolute;
  background: var(--pen-color);
  opacity: 0.5;
  pointer-events: none;
}

/* Simple logic to draw small ticks at card corners */
.blueprint-header::before { top: -6px; left: -1px; width: 1px; height: 12px; }
.blueprint-header::after { top: -1px; left: -6px; width: 12px; height: 1px; }

.header-markings {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  opacity: 0.7;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--pen-very-dim);
  padding-bottom: 6px;
}

.header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

@media (max-width: 768px) {
  .header-main {
    flex-direction: column;
    align-items: flex-start;
  }
}

.title-group h1 {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  line-height: 1.1;
}

.subtitle {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 4px;
}

.drawing-status-badge {
  font-size: 0.72rem;
  border: 1px solid var(--accent-green);
  padding: 6px 12px;
  border-radius: 2px;
  background: rgba(52, 211, 153, 0.05);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.pulse-green {
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ── WORKSPACE SPLIT ────────────────────────────────────────── */
.blueprint-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 40px;
}

@media (max-width: 1024px) {
  .blueprint-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.blueprint-panel {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* ── LEFT PANEL: SPECS & DOCUMENTATION ─────────────────────── */

/* Title block */
.engineering-title-block {
  border: 2px solid var(--pen-color);
  background: rgba(7, 21, 41, 0.4);
  font-size: 0.75rem;
}

.title-row {
  display: flex;
  padding: 10px 14px;
}

.title-row-split {
  display: flex;
}

.title-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
}

.border-right { border-right: 1px solid var(--pen-color); }
.border-top { border-top: 1px solid var(--pen-color); }

.engineering-title-block .lbl {
  font-size: 0.58rem;
  opacity: 0.65;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.engineering-title-block .val {
  font-weight: 700;
  color: #ffffff;
}

.main-title .val {
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}

/* Specification Blocks */
.specification-block {
  border: 1px dashed var(--pen-dim);
  padding: 24px;
  background: rgba(7, 21, 41, 0.2);
}

.panel-section-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  color: #ffffff;
  border-left: 3px solid var(--accent-copper);
  padding-left: 10px;
}

/* BOM table */
.bom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.bom-table th {
  border-bottom: 1.5px solid var(--pen-color);
  padding: 8px;
  text-align: left;
  font-weight: 700;
  opacity: 0.8;
}

.bom-table td {
  border-bottom: 1px solid var(--pen-very-dim);
  padding: 10px 8px;
  vertical-align: top;
}

.bom-table tr:last-child td {
  border-bottom: none;
}

.td-desc {
  font-size: 0.7rem;
  opacity: 0.7;
}

.txt-teal { color: var(--pen-color); }

/* CLI Setup boxes */
.cli-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cli-label {
  font-size: 0.6rem;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.draft-command {
  background: rgba(3, 7, 18, 0.4);
  border: 1px solid var(--pen-dim);
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--pen-color);
  overflow-x: auto;
  position: relative;
}

.draft-command::after {
  content: "✏️";
  position: absolute;
  right: 12px;
  top: 8px;
  opacity: 0.4;
  font-size: 0.7rem;
}

/* ── RIGHT PANEL: SCHEMATICS & PARSER ─────────────────────── */

/* Mascot Schematic Canvas */
.schematic-canvas {
  border: 1px solid var(--pen-dim);
  background: rgba(7, 21, 41, 0.3);
  position: relative;
}

.canvas-header {
  padding: 10px 14px;
  border-bottom: 1px dashed var(--pen-dim);
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  opacity: 0.8;
}

.canvas-body {
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.blueprint-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

@keyframes monitor-glow {
  0% {
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2), 0 15px 40px rgba(0,0,0,0.4);
    border-color: rgba(6, 182, 212, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.5), 0 15px 40px rgba(0,0,0,0.4);
    border-color: rgba(6, 182, 212, 0.8);
  }
  100% {
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2), 0 15px 40px rgba(0,0,0,0.4);
    border-color: rgba(6, 182, 212, 0.3);
  }
}

/* Cyanotype Ingestion Monitor */
.cyanotype-monitor {
  border: 1px solid var(--pen-color);
  background: rgba(7, 21, 41, 0.5);
  box-shadow: 0 15px 40px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  animation: monitor-glow 3s infinite ease-in-out;
}

.cyanotype-monitor .monitor-header {
  padding: 10px 16px;
  background: rgba(7, 21, 41, 0.8);
  border-bottom: 1px solid var(--pen-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.indicator-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.monitor-data-reads {
  display: flex;
  gap: 16px;
  font-size: 0.68rem;
}

.monitor-data-reads .data-block {
  display: flex;
  gap: 4px;
}

/* Playground Controls inside blueprint */
.playground-controls {
  padding: 10px 16px;
  border-bottom: 1px dashed var(--pen-dim);
  background: rgba(3, 7, 18, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.play-btn {
  background: transparent;
  border: 1px solid var(--pen-color);
  color: var(--pen-color);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.2s;
}

.play-btn:hover {
  background: rgba(168, 212, 255, 0.1);
  box-shadow: 0 0 8px rgba(168, 212, 255, 0.2);
}

.playground-tabs {
  display: flex;
  gap: 6px;
}

.play-tab {
  background: transparent;
  border: none;
  color: var(--pen-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.play-tab:hover {
  color: var(--pen-color);
}

.play-tab.active {
  color: #ffffff;
  border-bottom-color: var(--pen-color);
  font-weight: 700;
}

/* Workspace Panels */
.playground-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 250px;
}

@media (max-width: 768px) {
  .playground-workspace {
    grid-template-columns: 1fr;
    height: 400px;
  }
}

.editor-pane, .output-pane {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--pen-dim);
}

.output-pane {
  border-right: none;
}

.pane-label {
  font-size: 0.58rem;
  opacity: 0.7;
  padding: 6px 12px;
  border-bottom: 1px solid var(--pen-very-dim);
  background: rgba(255,255,255,0.02);
  text-transform: uppercase;
}

#enex-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #818cf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 12px;
  resize: none;
  outline: none;
  line-height: 1.4;
}

#output-display {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #ffffff;
  white-space: pre-wrap;
  line-height: 1.4;
}

/* ── FOOTER ─────────────────────────────────────────────────── */
.blueprint-footer {
  border-top: 1px solid var(--pen-dim);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  opacity: 0.7;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .blueprint-footer {
    flex-direction: column;
    gap: 10px;
  }
  .align-right {
    text-align: left !important;
  }
}

.align-right {
  text-align: right;
}

.blueprint-footer a {
  color: #ffffff;
  text-decoration: underline;
}


/* ── 3D SHEET FLIP BLOG STYLES ───────────────────────────────── */
.blog-sheet-container {
  perspective: 1200px;
  width: 100%;
  min-height: 450px;
  position: relative;
}

.blog-sheet {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.blog-sheet.flipped {
  transform: rotateY(180deg);
}

.blog-sheet-front, .blog-sheet-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 2px;
  padding: 30px;
  box-sizing: border-box;
}

.blog-sheet-front {
  border: 1px dashed var(--pen-dim);
  background: rgba(7, 21, 41, 0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  z-index: 2;
  transform: rotateY(0deg);
}

.blog-sheet-back {
  border: 1px solid var(--pen-color);
  background: rgba(7, 21, 41, 0.98);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  z-index: 1;
}

/* Mobile responsive swipe/slide fallback */
@media (max-width: 768px) {
  .blog-sheet-container {
    perspective: none;
    min-height: auto;
  }
  .blog-sheet {
    transform-style: flat;
    transition: none;
  }
  .blog-sheet.flipped {
    transform: none;
  }
  .blog-sheet-front, .blog-sheet-back {
    position: relative;
    transform: none !important;
    backface-visibility: visible;
  }
  .blog-sheet-back {
    display: none; /* Hide back initially on mobile */
  }
  .blog-sheet.flipped .blog-sheet-front {
    display: none;
  }
  .blog-sheet.flipped .blog-sheet-back {
    display: flex;
  }
}
