/* ==========================================================================
   Shubham Pawar // 4x Founder & Systems Architect
   Design System: Matte Black (#0B0B0D) + Warm Sand (#D8CBB3)
   High-Craft Founder Portfolio (benchmark: Paco Coursey, Rauno Freiberg, Linear)
   ========================================================================== */

:root {
  /* Strict Palette Tokens */
  --bg-base: #0B0B0D;              /* Matte Black canvas */
  --bg-surface: #121215;           /* Card surface */
  --bg-elevated: #18181C;          /* Card hover & drawers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(216, 203, 179, 0.38);
  
  --text-primary: #F4F4F5;         /* Pure Light Zinc */
  --text-secondary: #A1A1AA;       /* Slate Grey */
  --text-muted: #71717A;           /* Muted Grey */
  
  --accent: #D8CBB3;               /* Signature Warm Sand */
  --accent-hover: #E6DCC8;         /* Lighter Warm Sand */
  --accent-fg: #0B0B0D;            /* Crisp Dark text on Warm Sand fills */
  --accent-soft: rgba(216, 203, 179, 0.10);
  --accent-glow: rgba(216, 203, 179, 0.28);

  /* Semantic Status Tokens */
  --status-live: #10B981;          /* Muted Emerald for LIVE dots only */
  --status-break: #EF4444;         /* Semantic Crimson for CHAIN BROKEN state only */

  /* Compatibility Aliases */
  --bg-primary: var(--bg-base);
  --bg-secondary: #0F0F12;
  --bg-card: var(--bg-surface);
  --bg-card-hover: var(--bg-elevated);
  --bg-card-inset: #08080A;
  --border-hairline: var(--border-subtle);
  --accent-sand: var(--accent);
  --accent-sand-hover: var(--accent-hover);
  --accent-sand-glow: var(--accent-glow);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
  min-height: 100vh;
  position: relative;
  background-color: var(--bg-base);
  color: var(--text-secondary);
}

/* Subtle Engineering Grid Backdrop on Matte Black */
.engineering-grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: 
    radial-gradient(circle at 50% -10%, rgba(216, 203, 179, 0.07), transparent 50%),
    radial-gradient(circle at 85% 25%, rgba(216, 203, 179, 0.03), transparent 45%),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 48px 48px, 48px 48px;
}

/* Subtle Matte Noise Grain */
.noise-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  content: "";
  opacity: 0.022;
  pointer-events: none;
  z-index: 99;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Section scroll margin for fixed navigation */
section {
  scroll-margin-top: 5rem;
}

/* ==========================================================================
   Signature Headline Word Highlight (Warm Sand fill with Matte Black bold text)
   ========================================================================== */
.hero-highlight {
  background-color: var(--accent);
  color: var(--accent-fg);
  padding: 0.15rem 0.55rem;
  border-radius: 0.45rem;
  display: inline-block;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 18px rgba(216, 203, 179, 0.22);
}

/* ==========================================================================
   Linear-Grade Specular Hairline Border & Zero-CLS Bento Physics
   Uses mask-composite: exclude (Linear / Raycast / Paco Coursey technique)
   ========================================================================== */
.bento-card, .minimal-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: 1rem;
  border: 1px solid var(--border-subtle);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.25s ease,
              border-color 0.25s ease,
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  overflow: hidden;
}

/* Specular border glow using mask-composite */
.bento-card::before, .minimal-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    320px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(216, 203, 179, 0.65),
    rgba(216, 203, 179, 0.18) 42%,
    transparent 78%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 2;
}

/* Subtle internal surface wash */
.bento-card::after, .minimal-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(216, 203, 179, 0.05),
    transparent 70%
  );
  pointer-events: none;
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 1;
}

.bento-card:hover, .minimal-card:hover {
  background: var(--bg-elevated);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -10px rgba(0, 0, 0, 0.6), 0 0 25px rgba(216, 203, 179, 0.06);
}

/* Flagship Venture Card */
.flagship-card {
  position: relative;
  background: linear-gradient(145deg, #151519 0%, #0E0E11 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 1.25rem;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  will-change: transform;
}

.flagship-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(
    360px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(216, 203, 179, 0.70),
    rgba(216, 203, 179, 0.20) 45%,
    transparent 80%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 2;
}

.flagship-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    480px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(216, 203, 179, 0.06),
    transparent 70%
  );
  pointer-events: none;
  opacity: var(--spotlight-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 1;
}

.flagship-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(216, 203, 179, 0.08);
  transform: translateY(-2px);
}

/* Minimalist Navbar */
.minimal-nav {
  background: rgba(11, 11, 13, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

/* Status Pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  background: var(--accent-soft);
  border: 1px solid rgba(216, 203, 179, 0.22);
  color: var(--accent);
}

.pulsing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--status-live);
  position: relative;
}

.pulsing-dot::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background-color: inherit;
  animation: pulsePulse 1.8s ease-out infinite;
}

@keyframes pulsePulse {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(3.0); opacity: 0; }
}

/* ==========================================================================
   Button Styles (Matte Black + Warm Sand Craft)
   ========================================================================== */
/* Primary Warm Sand Pill Button */
.btn-sand, .btn-primary {
  background: var(--accent);
  color: var(--accent-fg) !important;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 9999px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(216, 203, 179, 0.20);
  flex-shrink: 0;
  border: 1px solid transparent;
}

.btn-sand:hover, .btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(216, 203, 179, 0.32);
  color: var(--accent-fg) !important;
}

/* Clean White Pill Button */
.btn-white {
  background: #FFFFFF;
  color: #0B0B0D !important;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 9999px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-white:hover {
  transform: translateY(-1px);
  background: #F4F4F5;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.2);
}

/* Ghost Pill Button */
.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9999px;
  backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.btn-ghost:hover {
  background: rgba(216, 203, 179, 0.08);
  color: var(--text-primary);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Icon-only circular or rounded button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: rgba(216, 203, 179, 0.08);
  color: var(--accent);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Monospace Numbers & Metrics */
.font-mono-val {
  font-family: var(--font-mono);
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

code, pre, .font-mono, [class*="font-mono"] {
  font-variant-numeric: tabular-nums;
  -webkit-font-feature-settings: "tnum" 1, "zero" 1;
  font-feature-settings: "tnum" 1, "zero" 1;
}

h1, h2, h3, h4 {
  letter-spacing: -0.03em;
}

/* Keyboard Tag Badge */
.kbd-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* ==========================================================================
   Hero Interactive Device Mockup
   ========================================================================== */
.hero-device-wrapper {
  background: linear-gradient(145deg, #151518 0%, #0E0E11 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 1.5rem;
  padding: 1.25rem;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(216, 203, 179, 0.04);
  position: relative;
  overflow: hidden;
}

.hero-phone-container {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: #09090C;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.75rem;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  position: relative;
}

.hero-phone-screen {
  background: #09090C;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: #FFFFFF;
}

/* ==========================================================================
   Command Palette (⌘K) Modal
   ========================================================================== */
.cmd-modal-backdrop {
  background: rgba(11, 11, 13, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.cmd-modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-hover);
  box-shadow: 0 35px 80px -15px rgba(0, 0, 0, 0.8), 0 0 35px rgba(216, 203, 179, 0.08);
  animation: cmdZoom 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cmdZoom {
  0% { opacity: 0; transform: scale(0.97) translateY(-6px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.cmd-item {
  transition: background 0.15s ease, color 0.15s ease;
}

.cmd-item:hover, .cmd-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ==========================================================================
   Interactive Architecture Spec Drawer
   ========================================================================== */
.spec-drawer-backdrop {
  background: rgba(11, 11, 13, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.3s ease;
}

.spec-drawer-panel {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-hover);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

.spec-topology-diagram {
  background: #08080A;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  overflow-x: auto;
  line-height: 1.5;
}

/* Toast Notification */
#toast-notification {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(80px);
  opacity: 0;
  pointer-events: none;
}

#toast-notification.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Focus Visible for A11y */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Custom Scrollbar for True Matte Black Theme */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #0B0B0D;
}

::-webkit-scrollbar-thumb {
  background: #1C1C22;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2D2D36;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Responsive code blocks and overflow prevention */
pre, code {
  max-width: 100%;
  box-sizing: border-box;
}

pre {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile browser hardening (zero horizontal overflow, smooth padding) */
@media (max-width: 640px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative;
  }

  .hero-device-wrapper {
    padding: 1rem 0.75rem !important;
    border-radius: 1.25rem !important;
  }

  .hero-phone-container {
    max-width: 100% !important;
    border-radius: 1.5rem !important;
  }

  .bento-card, .minimal-card, .flagship-card {
    border-radius: 1rem !important;
  }

  .spec-drawer-panel, .cmd-modal-box {
    border-radius: 1.25rem !important;
  }

  .btn-sand, .btn-ghost, .btn-white {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .engineering-grid-bg,
  .noise-overlay,
  #neural-canvas,
  nav,
  footer,
  #deck-modal,
  #cmd-modal,
  #contact-modal,
  #architecture-drawer,
  #toast-notification,
  .no-print {
    display: none !important;
  }
  .bento-card, .minimal-card, .flagship-card {
    background: #ffffff !important;
    border: 1px solid #e4e4e7 !important;
    color: #000000 !important;
    box-shadow: none !important;
  }
}
