/* ==========================================================================
   Nehemiah Drook — Contact Page
   Apple Liquid Glass inspired / Dark / Rainbow refractive hover
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@property --gradient-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

:root {
  /* Apple SF Pro via system stack */
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Helvetica Neue', 'Segoe UI', sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', sans-serif;

  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.8125rem;  /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-lg:   1.0625rem;  /* 17px — Apple's standard body */
  --text-xl:   1.375rem;   /* 22px */
  --text-2xl:  2rem;        /* 32px */
  --text-3xl:  2.8125rem;  /* 45px */

  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Apple-like radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Dark color system — Apple-inspired */
  --color-bg: #000000;
  --color-surface: rgba(255, 255, 255, 0.04);
  --color-glass: rgba(255, 255, 255, 0.06);
  --color-glass-hover: rgba(255, 255, 255, 0.1);
  --color-glass-border: rgba(255, 255, 255, 0.08);
  --color-glass-border-hover: rgba(255, 255, 255, 0.18);
  --color-text: rgba(255, 255, 255, 0.92);
  --color-text-secondary: rgba(255, 255, 255, 0.55);
  --color-text-tertiary: rgba(255, 255, 255, 0.3);
  --color-accent: #0a84ff;  /* Apple blue */

  /* Specular highlight gradient — subtle refraction */
  --specular: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    rgba(255, 255, 255, 0) 60%,
    rgba(255, 255, 255, 0.03) 100%
  );

  /* Rainbow refraction for hover — Liquid Glass style (muted pastels) */
  --rainbow: conic-gradient(
    from var(--gradient-angle),
    rgba(255, 130, 130, 0.8),
    rgba(255, 200, 130, 0.8),
    rgba(255, 230, 140, 0.7),
    rgba(130, 255, 200, 0.7),
    rgba(130, 200, 255, 0.8),
    rgba(170, 140, 255, 0.8),
    rgba(255, 140, 200, 0.8),
    rgba(255, 130, 130, 0.8)
  );
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.47;
  letter-spacing: -0.022em;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

::selection {
  background: rgba(10, 132, 255, 0.3);
  color: #fff;
}

:focus-visible {
  outline: 3px solid rgba(10, 132, 255, 0.5);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Ambient Background --- */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Soft ambient light — very Apple */
.bg-mesh::before {
  content: '';
  position: absolute;
  width: 800px;
  height: 800px;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(
    circle,
    rgba(60, 60, 80, 0.25) 0%,
    rgba(30, 30, 40, 0.1) 40%,
    transparent 70%
  );
  filter: blur(80px);
}

.bg-mesh::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  bottom: -15%;
  right: -10%;
  background: radial-gradient(
    circle,
    rgba(40, 40, 70, 0.15) 0%,
    transparent 65%
  );
  filter: blur(80px);
}

/* --- Layout --- */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  padding: var(--space-8) var(--space-5);
}

.container {
  width: 100%;
  max-width: 440px;
}

/* --- Header --- */
.header {
  text-align: center;
  margin-bottom: var(--space-10);
}

/* Avatar with Liquid Glass ring */
.avatar {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-6);
  position: relative;
}

.avatar-glass {
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-full);
  background: conic-gradient(
    from 0deg,
    rgba(255, 107, 107, 0.4),
    rgba(255, 184, 107, 0.4),
    rgba(107, 255, 184, 0.4),
    rgba(107, 197, 255, 0.4),
    rgba(163, 107, 255, 0.4),
    rgba(255, 107, 181, 0.4),
    rgba(255, 107, 107, 0.4)
  );
  animation: ring-rotate 8s linear infinite;
  filter: blur(1px);
}

@keyframes ring-rotate {
  to { transform: rotate(360deg); }
}

.avatar-img {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
  z-index: 1;
  /* Specular highlight on glass avatar */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.name {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: #fff;
}

.subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* --- Glass Card System --- */
.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  position: relative;
  display: block;
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: var(--color-text);
  overflow: visible;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-smooth);
}

.card:hover {
  transform: translateY(-1px) scale(1.008);
}

.card:active {
  transform: scale(0.985);
  transition-duration: 100ms;
}

/* Liquid Glass surface */
.card-surface {
  position: relative;
  border-radius: var(--radius-xl);
  background: var(--color-glass);
  backdrop-filter: blur(50px) saturate(180%) brightness(1.1);
  -webkit-backdrop-filter: blur(50px) saturate(180%) brightness(1.1);
  overflow: hidden;
  z-index: 1;
  /* Glass edge highlight — top specular */
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 0.5px var(--color-glass-border),
    0 2px 8px rgba(0, 0, 0, 0.15);
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-smooth);
}

.card:hover .card-surface {
  background: var(--color-glass-hover);
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.15),
    inset 0 0 0 0.5px var(--color-glass-border-hover),
    0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Specular light sweep on hover */
.card-surface::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  background: var(--specular);
  opacity: 0;
  transition: opacity var(--transition-smooth);
  pointer-events: none;
}

.card:hover .card-surface::after {
  opacity: 1;
}

/* Rainbow refraction border — Liquid Glass specular highlight */
.card-refraction {
  position: absolute;
  inset: -1px;
  border-radius: calc(var(--radius-xl) + 1px);
  z-index: 0;
  opacity: 0;
  transition: opacity 500ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  background: var(--rainbow);
  animation: refract 4s linear infinite;
  /* Mask to create a thin border ring, not a filled overlay */
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  padding: 1.5px;
}

@keyframes refract {
  to { --gradient-angle: 360deg; }
}

.card:hover .card-refraction {
  opacity: 0.55;
}

/* Mouse-follow illumination */
.card-illuminate {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-smooth);
  background: radial-gradient(
    500px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.06),
    transparent 40%
  );
}

.card:hover .card-illuminate {
  opacity: 1;
}

/* Card content */
.card-content {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 14px 18px;
}

.card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  /* Nested glass for icon bg */
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.06);
  color: var(--color-text-secondary);
  transition:
    color var(--transition-fast),
    background var(--transition-fast);
}

.card:hover .card-icon {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.card-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.card-value {
  font-size: var(--text-base);
  color: var(--color-text);
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-chevron {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  transition:
    color var(--transition-fast),
    transform var(--transition-fast);
}

.card:hover .card-chevron {
  color: var(--color-text-secondary);
  transform: translateX(2px);
}

/* --- Email Dropdown --- */
.card-dropdown {
  cursor: default;
}

.card-dropdown:hover {
  transform: none;
}

.card-dropdown .card-surface {
  overflow: hidden;
}

.card-dropdown-toggle {
  cursor: pointer;
}

.card-chevron-rotate {
  transition:
    color var(--transition-fast),
    transform var(--transition-smooth) !important;
}

.card-dropdown.open .card-chevron-rotate {
  transform: rotate(90deg);
  color: var(--color-text-secondary);
}

.email-list {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card-dropdown.open .email-list {
  grid-template-rows: 1fr;
}

.email-list-inner {
  overflow: hidden;
}

.email-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 18px;
  text-decoration: none;
  color: var(--color-text);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  transition:
    background var(--transition-fast),
    opacity 300ms ease;
  opacity: 0;
}

.card-dropdown.open .email-item {
  opacity: 1;
}

.card-dropdown.open .email-item:nth-child(1) { transition-delay: 60ms; }
.card-dropdown.open .email-item:nth-child(2) { transition-delay: 120ms; }
.card-dropdown.open .email-item:nth-child(3) { transition-delay: 180ms; }
.card-dropdown.open .email-item:nth-child(4) { transition-delay: 240ms; }

.email-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.email-item:active {
  background: rgba(255, 255, 255, 0.03);
}

.email-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.email-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.email-item-company {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.email-item-address {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 400;
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* --- Section Label --- */
.card-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--space-4) 0 var(--space-1) var(--space-1);
}

/* --- Company Cards --- */
.card-company-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.06);
}

/* Save Contact Hero — prominent CTA at top */
.card-save-hero .card-surface {
  background: rgba(48, 209, 88, 0.08);
  box-shadow:
    inset 0 0.5px 0 rgba(48, 209, 88, 0.2),
    inset 0 0 0 0.5px rgba(48, 209, 88, 0.15),
    0 2px 12px rgba(48, 209, 88, 0.06);
}

.card-save-hero:hover .card-surface {
  background: rgba(48, 209, 88, 0.14);
  box-shadow:
    inset 0 0.5px 0 rgba(48, 209, 88, 0.3),
    inset 0 0 0 0.5px rgba(48, 209, 88, 0.25),
    0 4px 24px rgba(48, 209, 88, 0.12);
}

.card-save-hero .card-icon {
  background: rgba(48, 209, 88, 0.15);
  color: #30d158;
}

.card-save-hero:hover .card-icon {
  background: rgba(48, 209, 88, 0.22);
  color: #5bda7d;
}

.card-save-hero .card-value {
  color: rgba(48, 209, 88, 0.9);
}

.card-save-hero .card-chevron {
  color: rgba(48, 209, 88, 0.4);
}

.card-save-hero:hover .card-chevron {
  color: rgba(48, 209, 88, 0.6);
  transform: translateX(2px);
}

/* Subtle breathing glow to draw attention */
@keyframes save-glow {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

.card-save-hero .card-refraction {
  opacity: 0.3;
  animation: refract 4s linear infinite, save-glow 3s ease-in-out infinite;
  background: conic-gradient(
    from var(--gradient-angle),
    rgba(48, 209, 88, 0.6),
    rgba(48, 220, 130, 0.5),
    rgba(100, 230, 180, 0.4),
    rgba(48, 209, 88, 0.6)
  );
}

.card-save-hero:hover .card-refraction {
  opacity: 0.55;
  animation: refract 4s linear infinite;
}

/* CTA card — Apple blue accent */
.card-cta .card-icon {
  background: rgba(10, 132, 255, 0.12);
  color: var(--color-accent);
}

.card-cta:hover .card-icon {
  background: rgba(10, 132, 255, 0.18);
  color: #3b9dff;
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--space-8) var(--space-4) var(--space-10);
}

.footer a {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer a:hover {
  color: var(--color-text-secondary);
}

/* --- Entry Animations --- */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.header {
  animation: fade-in 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.cards > *:nth-child(1)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both; }
.cards > *:nth-child(2)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.16s both; }
.cards > *:nth-child(3)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.22s both; }
.cards > *:nth-child(4)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.28s both; }
.cards > *:nth-child(5)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.34s both; }
.cards > *:nth-child(6)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.38s both; }
.cards > *:nth-child(7)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.42s both; }
.cards > *:nth-child(8)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.46s both; }
.cards > *:nth-child(9)  { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.50s both; }
.cards > *:nth-child(10) { animation: fade-in 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.54s both; }

.footer {
  animation: fade-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s both;
}

/* --- Mobile --- */
@media (max-width: 480px) {
  .main {
    padding: var(--space-6) var(--space-4);
    align-items: flex-start;
    padding-top: var(--space-16);
  }

  .container {
    max-width: 100%;
  }

  .card-content {
    padding: 12px 14px;
  }

  .name {
    font-size: 2rem;
  }

  .avatar {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 460px;
  }
}
