/* ════════════════════════════════════════════════════════════
   "Let's Connect": original black stage, Courier type.
   Self-contained so any page can include <ContactSection />.
   ════════════════════════════════════════════════════════════ */
#contact {
  --color-paper: #f5f0e8;
  --color-ink: #1a1a1a;
  --grid-size: 1.5rem;
  --font-legacy: "Courier New", Courier, monospace;
  position: relative;
  z-index: 1;
  padding: clamp(4.5rem, 11vh, 7.5rem) clamp(1.25rem, 5vw, 3rem);
}

#contact {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-legacy);
  background-color: #080808;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
}


/* ═══ Kept: contact section, popups, floaters ═══ */
/* ── Contact section ── */
.contact .panel-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
}

.contact-heading {
  font-family: 'Courier New', monospace;
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-paper);
  text-align: center;
  line-height: 0.95;
  text-shadow: 0 2px 40px rgba(255, 255, 255, 0.08);
}

.contact-cards {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── Contact item wrapper (holds card + popup) ── */
.contact-item {
  position: relative;
  z-index: 1;
}
.contact-item:hover { z-index: 10; }

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 1.75rem;
  width: 10rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-paper);
  text-decoration: none;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease,
              background 0.35s ease;
}

.contact-item:nth-child(1) .contact-card { transform: rotate(-4deg); }
.contact-item:nth-child(2) .contact-card { transform: rotate(-1.5deg); }
.contact-item:nth-child(3) .contact-card { transform: rotate(1.5deg); }
.contact-item:nth-child(4) .contact-card { transform: rotate(4deg); }

.contact-item:hover .contact-card,
.contact-item:focus-within .contact-card {
  transform: rotate(0deg) translateY(-10px) scale(1.04);
  box-shadow: 0 16px 48px rgba(255, 255, 255, 0.1), 0 0 0 1px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.contact-card:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 4px;
}

.contact-card-icon {
  width: 1.75rem;
  height: 1.75rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}

.contact-card-label {
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--color-paper);
}

.contact-card-sub {
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: rgba(245, 240, 232, 0.45);
  text-align: center;
  word-break: break-all;
}

/* ── Contact popup card (appears above box on hover) ── */
.contact-popup {
  position: absolute;
  bottom: calc(100% + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(10px) scale(0.96);
  transform-origin: bottom center;
  width: 220px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  text-decoration: none;
  color: inherit;
  z-index: 50;
  transition: opacity 0.2s ease,
              transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-item:hover .contact-popup,
.contact-item:focus-within .contact-popup {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1) rotate(-0.5deg);
  pointer-events: auto;
}

/* Popup header strip */
.popup-header {
  height: 68px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 0 1rem;
}
.popup-header--linkedin { background: linear-gradient(160deg, #0a66c2, #004182); }
.popup-header--github   { background: linear-gradient(135deg, #238636, #6e40c9); }
.popup-header--email    { background: linear-gradient(135deg, #f9c923, #f5a800); }
.popup-header--resume   { background: linear-gradient(135deg, var(--color-mat), #1e2e22); }

/* Profile photo */
.popup-photo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--color-paper);
  object-fit: cover;
  position: absolute;
  bottom: -18px;
  left: 1rem;
  background: var(--color-mat);
}
.popup-photo--placeholder {
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-photo--placeholder svg {
  width: 22px;
  height: 22px;
  color: rgba(255, 255, 255, 0.75);
}

/* Icon circle (email / resume) */
.popup-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--color-paper);
  position: absolute;
  bottom: -18px;
  left: 1rem;
  background: rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.popup-icon svg {
  width: 18px;
  height: 18px;
  color: var(--color-paper);
}

/* Popup body */
.popup-body {
  background: var(--color-paper);
  padding: 1.4rem 1rem 0.9rem;
}
.popup-body--dark {
  background: linear-gradient(160deg, #161b22, #0d1117);
}

.popup-name {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-ink);
  line-height: 1.2;
}
.popup-body--dark .popup-name { color: #fff; }

.popup-title {
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted);
  margin-top: 0.15rem;
}
.popup-body--dark .popup-title { color: rgba(255, 255, 255, 0.5); }

.popup-detail {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding-top: 0.5rem;
  margin-top: 0.55rem;
}
.popup-body--dark .popup-detail { border-top-color: rgba(255, 255, 255, 0.12); }

.popup-platform {
  font-family: 'Courier New', monospace;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--color-mat);
}
.popup-body--dark .popup-platform { color: rgba(255, 255, 255, 0.4); }

.popup-handle {
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: var(--color-ink);
  word-break: break-all;
}
.popup-body--dark .popup-handle { color: rgba(255, 255, 255, 0.85); }

/* Popup stats row */
.popup-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  margin-bottom: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.58rem;
  color: var(--color-ink-muted);
  letter-spacing: 0.04em;
}
.popup-stats strong { color: var(--color-ink); font-weight: 700; }
.popup-stat-sep { opacity: 0.4; }
.popup-body--dark .popup-stats { color: rgba(255, 255, 255, 0.55); }
.popup-body--dark .popup-stats strong { color: #fff; }
.popup-body--dark .popup-stat-sep { color: rgba(255, 255, 255, 0.3); opacity: 1; }

/* Popup title with leading icon */
.popup-title--icon {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}
.popup-title--icon svg {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  position: relative;
  top: 0.5px;
  opacity: 0.65;
}

.contact-caption {
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  line-height: 1.6;
  max-width: 60ch;
  margin: 0 auto;
  color: rgba(245, 240, 232, 0.7);
  text-align: center;
}

/* ── Contact floating background logos ── */
.contact-floaters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.contact-floater {
  position: absolute;
  /* Default size so the icons never render full-bleed if the script
     hasn't (or won't) place them */
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--color-paper);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.07;
  will-change: transform;
}

.contact-heading,
.contact-cards,
.contact-caption {
  position: relative;
  z-index: 1;
}



@media (max-width: 768px) {
  /* Contact (kept behavior) */
  .contact .panel-card { gap: 2rem; }
  .contact-cards { gap: 0.75rem; }
  .contact-item:nth-child(n) .contact-card { transform: none; width: auto; padding: 1.5rem 1rem; }
  .contact-heading { font-size: clamp(2.5rem, 10vw, 4.5rem); }
  .contact-popup { bottom: auto; top: calc(100% + 0.75rem); transform: translateX(-50%) translateY(-8px) scale(0.96); transform-origin: top center; }
  .contact-item:hover .contact-popup,
  .contact-item:focus-within .contact-popup { transform: translateX(-50%) translateY(0) scale(1) rotate(-0.5deg); }

}

/* Fade-to-black stage (pages that include [data-contact-bg] before #contact).
   The section goes transparent only once JS is running, so the black
   fallback above still shows if scripts fail. */
[data-contact-bg] {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background-color: #080808;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
}
/* Let's Connect keeps its own black background so it can never render
   light-on-cream, even if the fade overlay is mid-transition. */
html.contact-fade [data-contact-bg] ~ #contact {
  z-index: 2;
}
