/* ============================================================================
   GOD-TIER MASTER PLAN — CSS
   Phase 1: Recruiter Mode styles
   Phase 4: Figma Polish — 8px grid · 70ch · prefers-reduced-motion · A11y
   ============================================================================ */

/* ─── §0 · DESIGN TOKEN: 8px SPACING SCALE ─────────────────────────────── */
:root {
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
}

/* ─── §1 · PHASE 4 · TYPOGRAPHY — 70ch readability cap ─────────────────── */
.s-desc,
.coll-desc,
.adr-body,
.pmodal-desc,
.arch-tooltip-text,
.incident-event-desc,
p:not([class]) {
  max-width: 70ch;
  line-height: 1.75;
}

/* Hero value prop — crisp 3-second scan */
.hero p,
.hero .h-desc {
  max-width: 56ch;
  line-height: 1.7;
}

/* ─── §2 · PHASE 4 · A11Y — FOCUS RINGS ────────────────────────────────── */
/* Visible focus rings for keyboard nav — WCAG 2.1 AA */
:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.8) !important;
  outline-offset: 3px !important;
  border-radius: 4px !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.8) !important;
  outline-offset: 3px !important;
}

/* ─── §3 · PHASE 4 · RESUME CTA — MAXIMUM CONTRAST ─────────────────────── */
/* The YC Founder said: "I need to find this in 3 seconds"              */
.resume-btn {
  background: linear-gradient(135deg, #4285F4, #1A73E8) !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(66, 133, 244, 0.6) !important;
  box-shadow:
    0 0 0 0 rgba(66, 133, 244, 0),
    0 4px 16px rgba(66, 133, 244, 0.35) !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  transition: transform 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)), opacity 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)), background-color 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)), border-color 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)), box-shadow 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)), color 0.25s var(--ease, cubic-bezier(0.16,1,0.3,1)) !important;
  padding: 8px 18px !important;
  border-radius: 8px !important;
  animation: resume-pulse-ring 3s ease-in-out infinite;
}

@keyframes resume-pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(66,133,244,0.4), 0 4px 16px rgba(66,133,244,0.35); }
  50%       { box-shadow: 0 0 0 4px rgba(66,133,244,0.0), 0 4px 20px rgba(66,133,244,0.5); }
}

.resume-btn:hover {
  background: linear-gradient(135deg, #1A73E8, #1557B0) !important;
  box-shadow: 0 0 0 3px rgba(66,133,244,0.25), 0 8px 24px rgba(66,133,244,0.4) !important;
  transform: translateY(-2px) !important;
}

/* ─── §4 · PHASE 4 · IMPACT METRIC PILLS (YC Founder) ───────────────────── */
.proj-impact-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 8px 0 12px;
  line-height: 1.3;
  border: 1px solid;
  width: fit-content;
}

.proj-impact-pill.green {
  background: rgba(52, 168, 83, 0.10);
  border-color: rgba(52, 168, 83, 0.25);
  color: #34A853;
}
.proj-impact-pill.blue {
  background: rgba(66, 133, 244, 0.10);
  border-color: rgba(66, 133, 244, 0.25);
  color: #4285F4;
}
.proj-impact-pill.cyan {
  background: rgba(34, 211, 238, 0.10);
  border-color: rgba(34, 211, 238, 0.20);
  color: #22D3EE;
}
.proj-impact-pill.amber {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.22);
  color: #F59E0B;
}
html.light .proj-impact-pill.green { background: rgba(52,168,83,0.08); color: #188038; }
html.light .proj-impact-pill.blue  { background: rgba(66,133,244,0.08); color: #1A73E8; }
html.light .proj-impact-pill.cyan  { background: rgba(34,211,238,0.08); color: #0891b2; }
html.light .proj-impact-pill.amber { background: rgba(245,158,11,0.08); color: #b45309; }

/* ─── §5 · PHASE 4 · MERMAID ARCHITECTURE MODAL ────────────────────────── */
.arch-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.arch-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.arch-modal-box {
  background: var(--bg-2, #0d0d10);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 20px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.95) translateY(16px);
  transition: transform 0.38s cubic-bezier(0.16,1,0.3,1);
  box-shadow: 0 60px 120px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
}
.arch-modal-overlay.open .arch-modal-box {
  transform: scale(1) translateY(0);
}
html.light .arch-modal-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.arch-modal-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.arch-modal-title {
  font-family: var(--font-display, 'Outfit', sans-serif);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary, #f1f5f9);
  letter-spacing: -0.02em;
}
html.light .arch-modal-title { color: #0f172a; }
.arch-modal-subtitle {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  color: var(--accent-indigo-hi, #818cf8);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 3px;
}
.arch-modal-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-3, rgba(255,255,255,0.07));
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.arch-modal-close:hover {
  background: rgba(239,68,68,0.15);
  border-color: rgba(239,68,68,0.35);
  color: #f87171;
}

/* Mermaid diagram container */
.arch-diagram-wrap {
  padding: 20px 32px;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.arch-diagram-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: 12px;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.arch-diagram-loading i { animation: spin 1s linear infinite; }
.mermaid-rendered {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  overflow-x: auto;
  display: flex;
  justify-content: center;
}
html.light .mermaid-rendered {
  background: #fff;
  border-color: #e2e8f0;
}
.mermaid-rendered svg {
  max-width: 100%;
  height: auto;
  font-family: var(--font-mono, monospace) !important;
}

/* Tab system for project modal (Overview | Architecture | Post-Mortem) */
.pmodal-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
}
.pmodal-tab {
  padding: 12px 20px;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.pmodal-tab:hover { color: var(--text-secondary); }
.pmodal-tab.active {
  color: var(--accent-indigo-hi, #818cf8);
  border-bottom-color: var(--accent-indigo, #6366f1);
}
.pmodal-tab-content { display: none; }
.pmodal-tab-content.active { display: block; }

/* Architecture deep-dive button on project cards */
.proj-arch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 5px;
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(66, 133, 244, 0.08);
  border: 1px solid rgba(66, 133, 244, 0.2);
  color: #4285F4;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  text-decoration: none;
}
.proj-arch-btn:hover {
  background: rgba(66, 133, 244, 0.16);
  border-color: rgba(66, 133, 244, 0.4);
  transform: translateY(-1px);
}

/* ─── §6 · PHASE 1 · RECRUITER MODE ─────────────────────────────────────── */
/* Recruiter Mode toggle button */
#recruiter-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  color: var(--text-muted, #64748b);
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
  margin-left: 6px;
}
#recruiter-mode-btn:hover {
  border-color: rgba(52, 168, 83, 0.4);
  color: #34A853;
  background: rgba(52, 168, 83, 0.06);
}
#recruiter-mode-btn.active {
  background: rgba(52, 168, 83, 0.12);
  border-color: rgba(52, 168, 83, 0.45);
  color: #34A853;
  box-shadow: 0 0 12px rgba(52, 168, 83, 0.15);
}

/* Recruiter Mode Banner */
#recruiter-banner {
  display: none;
  position: sticky;
  top: 0;
  z-index: 99998;
  background: linear-gradient(90deg, rgba(52,168,83,0.15), rgba(66,133,244,0.15));
  border-bottom: 1px solid rgba(52,168,83,0.25);
  padding: 8px 24px;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #34A853;
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#recruiter-banner .rb-exit {
  margin-left: 16px;
  color: var(--text-muted);
  cursor: pointer;
  text-transform: none;
  font-weight: 400;
  font-size: 0.7rem;
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 4px;
  transition: transform 0.2s, opacity 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}
#recruiter-banner .rb-exit:hover {
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.2);
}

/* Recruiter Mode: body-level overrides */
body.recruiter-mode #sp,
body.recruiter-mode #space-canvas,
body.recruiter-mode canvas {
  display: none !important;
}

/* Disable heavy animations in Recruiter Mode */
body.recruiter-mode .glass-card::after,
body.recruiter-mode .sk::before,
body.recruiter-mode body::before {
  display: none !important;
}

body.recruiter-mode .proj,
body.recruiter-mode .sk,
body.recruiter-mode .tcrd,
body.recruiter-mode .ac,
body.recruiter-mode .tl-item {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* Recruiter mode: clean card style */
body.recruiter-mode .proj,
body.recruiter-mode .sk,
body.recruiter-mode .tcrd {
  background: var(--bg-card, rgba(18,18,22,0.8)) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

html.light body.recruiter-mode .proj,
html.light body.recruiter-mode .sk,
html.light body.recruiter-mode .tcrd {
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
}

/* Recruiter quickscan panel */
#recruiter-quickscan {
  display: none;
  background: var(--bg-card, rgba(18,18,22,0.9));
  border: 1px solid rgba(52,168,83,0.25);
  border-radius: 16px;
  padding: 28px 32px;
  margin: 0 auto 32px;
  max-width: 860px;
  font-family: var(--font-mono, monospace);
}
html.light #recruiter-quickscan {
  background: #fff;
  border-color: rgba(52,168,83,0.3);
}
body.recruiter-mode #recruiter-quickscan { display: block; }

.rqs-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #34A853;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rqs-title::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  background: #34A853;
  border-radius: 50%;
  box-shadow: 0 0 8px #34A853;
  animation: avail-pulse 2s infinite;
}
.rqs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.rqs-item { }
.rqs-label {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted, #64748b);
  margin-bottom: 4px;
}
.rqs-value {
  font-size: 0.85rem;
  color: var(--text-primary, #f1f5f9);
  font-weight: 600;
  line-height: 1.4;
}
html.light .rqs-value { color: #0f172a; }
.rqs-skills {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.rqs-skill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.rqs-chip {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(66,133,244,0.1);
  border: 1px solid rgba(66,133,244,0.2);
  color: #4285F4;
}
html.light .rqs-chip { background: rgba(66,133,244,0.07); }

/* ─── §7 · PHASE 4 · prefers-reduced-motion ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.1ms !important;
    scroll-behavior: auto !important;
  }

  /* Specifically kill expensive GPU animations */
  #sp,
  canvas,
  .sk::before,
  body::before {
    display: none !important;
  }

  .availability-dot,
  .pulse-dot,
  .tl-dot {
    animation: none !important;
    box-shadow: none !important;
  }
}

/* ─── §8 · PHASE 4 · SPACING AUDIT — 8px grid corrections ──────────────── */
.section-header {
  margin-bottom: var(--sp-10, 40px) !important;
}

.s-title {
  margin-bottom: var(--sp-3, 12px) !important;
}

.s-desc {
  margin-bottom: 0 !important;
}

.proj-bento,
.proj-grid {
  gap: var(--sp-5, 20px) !important;
}

.skills-grid {
  gap: var(--sp-5, 20px) !important;
}

/* Consistent card padding across all card types */
.proj,
.sk,
.tcrd,
.coll-card,
.adr-card,
.arch-node-card {
  padding: var(--sp-6, 24px) !important;
}

/* ─── §9 · PHASE 4 · BACKDROP FILTER COMMAND PALETTE ───────────────────── */
#cmd-overlay {
  backdrop-filter: blur(24px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
}

#cmd-modal {
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    0 32px 64px rgba(0,0,0,0.5),
    0 0 80px rgba(99,102,241,0.08) !important;
}

/* ─── §10 · PHASE 4 · SCREEN READER ONLY UTILITY ───────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ─── §11 · LIGHT MODE CONTRAST IMPROVEMENTS ───────────────────────────── */
html.light .adr-body,
html.light .arch-node-desc,
html.light .incident-event-desc,
html.light .gh-lang-name {
  color: #475569 !important;
}

html.light .pmodal-category,
html.light .adr-type.type-adr {
  color: #4338ca !important;
}

/* ─── §12 · GOD-TIER ENHANCEMENTS: SPINNING GLOW BORDER ───────────────── */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

.proj, .sk {
  position: relative;
  /* Override any previous relative positioning to ensure pseudo-elements work */
  z-index: 1;
}

.proj::before, .sk::before {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(
    from var(--angle),
    transparent 80%,
    var(--accent-indigo, #6366F1) 90%,
    var(--accent-cyan, #22D3EE) 100%
  );
  -webkit-mask: 
    linear-gradient(#fff 0 0) content-box, 
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
  pointer-events: none;
  animation: spin 4s linear infinite;
  z-index: -1;
}

.proj:hover::before, .sk:hover::before {
  opacity: 1;
}

@keyframes spin {
  from { --angle: 0deg; }
  to { --angle: 360deg; }
}

/* ─── §13 · LIQUID GLASS REFINEMENTS ───────────────────────────────────── */
.glass-card, .proj, .sk {
  background: rgba(255, 255, 255, 0.03) !important;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 
    0 2px 4px -1px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.05) !important;
}

html.light .glass-card, html.light .proj, html.light .sk {
  background: rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 
    0 10px 15px -3px rgba(0,0,0,0.1),
    0 4px 6px -2px rgba(0,0,0,0.05) !important;
}
