/* =========================================================
   pixel.css — "Lunar Pixel" design system
   Extends the hero video's pixel-art moon-city world through
   the rest of the site. Loads AFTER custom.css and overrides
   its tokens + softens. Hero section internals are untouched.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&display=swap');

/* ----- Tokens: deep night + lantern warmth ----- */
:root {
  --bg:        #05070D;
  --card-bg:   #0C111C;
  --muted-bg:  #121829;
  --muted-fg:  #9B948B;
  --border:    #202A40;
  --text:      #ECE6DC;
  --surface:   #0C111C;

  --px-amber:  #D97B4F;
  --px-terra:  #E25C5C;
  --px-moon:   #B0A49D;
  --px-star:   #E8E4DF;
  --px-shadow: rgba(0, 0, 0, 0.55);
  --px-font:   'Silkscreen', 'Space Grotesk', monospace;
}

html.light {
  /* Lunar daylight — warm paper, ink lines */
  --bg:        #F4EDE1;
  --card-bg:   #FBF7EF;
  --muted-bg:  #ECE2D0;
  --muted-fg:  #6E6258;
  --border:    #D8CBB6;
  --text:      #2B2520;
  --surface:   #FBF7EF;

  --px-amber:  #9C5A2E;
  --px-terra:  #B54238;
  --px-shadow: rgba(43, 37, 32, 0.22);
}

/* ----- Starfield behind everything (not the hero — it has its own sky) ----- */
html { background-color: var(--bg); }
body { background-color: transparent; position: relative; }
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg fill='%23E8E4DF'%3E%3Crect x='18' y='30' width='2' height='2' opacity='.5'/%3E%3Crect x='70' y='12' width='2' height='2' opacity='.25'/%3E%3Crect x='130' y='44' width='2' height='2' opacity='.45'/%3E%3Crect x='196' y='20' width='2' height='2' opacity='.3'/%3E%3Crect x='44' y='96' width='2' height='2' opacity='.3'/%3E%3Crect x='104' y='80' width='3' height='3' opacity='.5'/%3E%3Crect x='168' y='108' width='2' height='2' opacity='.25'/%3E%3Crect x='12' y='150' width='2' height='2' opacity='.4'/%3E%3Crect x='84' y='170' width='2' height='2' opacity='.3'/%3E%3Crect x='148' y='190' width='2' height='2' opacity='.45'/%3E%3Crect x='206' y='160' width='3' height='3' opacity='.3'/%3E%3C/g%3E%3Cg fill='%23D97B4F'%3E%3Crect x='58' y='58' width='2' height='2' opacity='.4'/%3E%3Crect x='186' y='84' width='2' height='2' opacity='.35'/%3E%3Crect x='118' y='136' width='2' height='2' opacity='.35'/%3E%3C/g%3E%3C/svg%3E");
  animation: pxTwinkle 7s ease-in-out infinite alternate;
}
html.light body::before { opacity: 0.35; }
@keyframes pxTwinkle {
  from { opacity: 0.55; }
  to   { opacity: 1; }
}

/* ----- CRT scanlines, whole page, barely there ----- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.10) 0px,
    rgba(0, 0, 0, 0.10) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.22;
}
html.light body::after { opacity: 0.08; }
@media (max-width: 767px) {
  body::after { display: none; }
}

/* ----- Kill the soft radii everywhere EXCEPT inside the hero ----- */
.rounded-md:not(#hero-section *),
.rounded-lg:not(#hero-section *),
.rounded-xl:not(#hero-section *),
.rounded-2xl:not(#hero-section *) {
  border-radius: 0 !important;
}

/* ----- Hard pixel shadows on cards ----- */
.card-hover,
.featured-card,
.transcript,
article.fade-in {
  border-radius: 0 !important;
  border-width: 2px !important;
  box-shadow: 5px 5px 0 0 var(--px-shadow);
}
.card-hover {
  transition: transform 0.12s steps(2, end), box-shadow 0.12s steps(2, end),
    background-color var(--transition), border-color var(--transition);
}
.card-hover:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 0 var(--px-shadow);
  border-color: var(--px-amber) !important;
}
html.light .card-hover:hover {
  box-shadow: 8px 8px 0 0 var(--px-shadow);
}

/* ----- Pixel display font helpers ----- */
.px-eyebrow {
  font-family: var(--px-font);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--px-amber);
  display: flex;
  align-items: center;
  gap: 0.6em;
}
.px-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--px-terra);
  box-shadow: 9px 0 0 0 var(--px-amber);
  margin-right: 9px;
  flex-shrink: 0;
}

.px-logo {
  font-family: var(--px-font) !important;
  font-size: 1rem !important;
  letter-spacing: 0 !important;
}
.px-cursor {
  color: var(--px-terra);
  animation: pxBlink 1.1s step-end infinite;
}
@keyframes pxBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ----- Pixel buttons ----- */
.px-btn {
  border-radius: 0 !important;
  border: 2px solid var(--border) !important;
  box-shadow: 4px 4px 0 0 var(--px-shadow) !important;
  transition: transform 0.1s steps(2, end), box-shadow 0.1s steps(2, end) !important;
}
.px-btn:hover {
  transform: translate(-2px, -2px) !important;
  box-shadow: 6px 6px 0 0 var(--px-shadow) !important;
  opacity: 1 !important;
}
.px-btn:active {
  transform: translate(2px, 2px) !important;
  box-shadow: 1px 1px 0 0 var(--px-shadow) !important;
}
.px-btn--primary {
  background-color: var(--px-amber) !important;
  border-color: var(--px-amber) !important;
  color: #14100C !important;
}

/* ----- Status chips (ventures) ----- */
.px-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--px-font);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.3rem 0.55rem;
  border: 1px solid currentColor;
  box-shadow: 2px 2px 0 0 var(--px-shadow);
  line-height: 1;
  white-space: nowrap;
}
.px-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  background: currentColor;
  flex-shrink: 0;
}
.px-chip--live     { color: #5FD068; }
.px-chip--live::before { animation: pxBlink 1.6s step-end infinite; }
.px-chip--building { color: var(--px-amber); }
.px-chip--research { color: var(--px-moon); }
.px-chip--sunset   { color: var(--muted-fg); opacity: 0.9; }
html.light .px-chip--live { color: #2E8540; }
html.light .px-chip--research { color: #7A6E63; }

/* Re-skin legacy badge classes to pixel chips (projects page pills etc.) */
.badge-active, .badge-exploring, .badge-shipped {
  border-radius: 0;
  font-family: var(--px-font);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  box-shadow: 2px 2px 0 0 var(--px-shadow);
}
.badge-active::before, .badge-exploring::before, .badge-shipped::before {
  border-radius: 0;
}
.stat-pill { border-radius: 0; box-shadow: 2px 2px 0 0 var(--px-shadow); }

/* ----- Category line (projects h2 prefix) → pixel squares ----- */
.category-line {
  width: 10px !important;
  height: 10px !important;
  border-radius: 0 !important;
  box-shadow: 14px 0 0 0 currentColor;
  margin-right: 1.6rem !important;
  opacity: 0.9;
}

/* ----- Section divider: faint hairline, fades at the ends ----- */
.px-divider {
  display: block;
  height: 1px;
  width: calc(100% - 3rem);
  max-width: 72rem;
  margin: 12px auto;
  padding: 0;
  background: linear-gradient(90deg, transparent, var(--border) 22%, var(--border) 78%, transparent);
  pointer-events: none;
}
.px-divider::after { content: none; }
.px-divider--flip { transform: none; }

/* ----- Terminal transcript: pixel chrome, airy layout ----- */
.transcript {
  border-radius: 0;
  border: 2px solid var(--border);
  box-shadow: 6px 6px 0 0 var(--px-shadow);
}
.transcript-header {
  font-family: var(--px-font);
  padding: 0.8rem 1.25rem;
}
.transcript-title {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.transcript-dots span {
  border-radius: 0;
  width: 0.5rem;
  height: 0.5rem;
}
.transcript-body {
  padding: 2.5rem 2.5rem 2.75rem;
  gap: 2.4rem;
}
.transcript-msg {
  gap: 2.2rem;
  align-items: center;
}
.transcript-logo {
  border-radius: 0.5rem;
  width: 4.8rem;
  height: 4.8rem;
  margin-top: 0;
  box-shadow: 3px 3px 0 0 var(--px-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.transcript-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0.5rem;
}
.transcript-text {
  border-left: none;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--muted-fg);
  max-width: 58ch;
}
.transcript-text p { margin: 0; }
.transcript-co {
  font-family: var(--px-font);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--px-amber);
  margin-bottom: 0.5rem !important;
}
@media (max-width: 640px) {
  .transcript-body { padding: 1.5rem 1.25rem 1.75rem; gap: 1.75rem; }
  .transcript-msg { gap: 1rem; align-items: flex-start; }
  .transcript-logo { width: 3.2rem; height: 3.2rem; }
  .transcript-text { font-size: 0.875rem; }
  .transcript-co { font-size: 0.62rem; }
}

/* ----- Section heading underline accent ----- */
.px-heading {
  position: relative;
  display: inline-block;
}
.px-heading::after {
  content: '';
  display: block;
  margin-top: 0.55rem;
  height: 5px;
  width: 64px;
  background:
    linear-gradient(to right,
      var(--px-terra) 0 20px,
      transparent 20px 26px,
      var(--px-amber) 26px 40px,
      transparent 40px 46px,
      var(--px-moon) 46px 56px,
      transparent 56px);
}

/* ----- Now-chip / hero protections (hero stays soft) ----- */
#hero-section .now-chip { border-radius: 999px; }

/* ----- Nav: pixel underline for current page ----- */
.nav-link[aria-current="page"]::after {
  border-radius: 0;
  height: 3px;
  background:
    linear-gradient(to right,
      var(--px-terra) 0 8px, transparent 8px 11px,
      var(--px-terra) 11px 19px, transparent 19px 22px,
      var(--px-terra) 22px 100%);
}

/* ----- Command palette: pixelate the panel ----- */
.cmdk-panel { border-radius: 0; border-width: 2px; box-shadow: 8px 8px 0 0 var(--px-shadow); }
.cmdk-item { border-radius: 0; }
.cmdk-kbd { border-radius: 0; font-family: var(--px-font); font-size: 0.55rem; }
.cmdk-toast { border-radius: 0; box-shadow: 4px 4px 0 0 var(--px-shadow); }

/* ----- Footer ----- */
.px-footer-tag {
  font-family: var(--px-font);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ----- Projects page: square the bespoke image components ----- */
.project-card-img,
.project-card .img-wrap,
.project-gallery,
.project-gallery img,
.featured-card,
.tesla-group,
.nda-banner {
  border-radius: 0 !important;
}
.tesla-group { box-shadow: 5px 5px 0 0 var(--px-shadow); }
.project-card:hover .project-card-img { transform: none; }

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .px-cursor, .px-chip--live::before { animation: none; }
  .card-hover:hover, .px-btn:hover, .px-btn:active { transform: none !important; }
}
