:root {
  --bg: #030406;
  --card: #08090d;
  --border: #14161f;
  --accent: #3b82f6;
}

html {
  scroll-padding-top: 5rem;
}

* {
  -webkit-tap-highlight-color: transparent;
}

body { 
  background-color: var(--bg); 
  color: #eee; 
  font-family: 'Inter', sans-serif; 
  overflow-x: hidden; 
  position: relative;
} 

@media (pointer: fine) {
  body {
    cursor: none;
  }
}

.mono { 
  font-family: 'JetBrains Mono', monospace; 
}

::-webkit-scrollbar { 
  display: none; 
}

#loading-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading-screen.hidden-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-text {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: 0.1em;
  color: #9ca3af;
  transition: all 0.25s ease;
}

.loader-brand-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.loader-brand-wrapper.active {
  opacity: 1;
  transform: scale(1);
}

.orbit-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 1.0s cubic-bezier(0.2, 1, 0.3, 1);
}

@media (max-width: 640px) {
  .orbit-wrapper {
    width: 100px;
    height: 100px;
  }
}

.loader-brand-wrapper.shifted .orbit-wrapper {
  transform: translateX(-12px);
}

.loader-orbit {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(59, 130, 246, 0.45);
  border-radius: 50%;
  animation: loaderSpin 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-orbit::after {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 25px var(--accent);
}

@keyframes loaderSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-brand-text {
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.8s ease, max-width 1.0s cubic-bezier(0.2, 1, 0.3, 1), transform 1.0s cubic-bezier(0.2, 1, 0.3, 1);
  transform: translateX(-10px);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 900;
  font-size: 3.5rem;
  letter-spacing: 0.1em;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
  padding-left: 0.15em;
}

@media (max-width: 640px) {
  .loader-brand-text {
    font-size: 2rem;
  }
}

.loader-brand-text.show {
  opacity: 1;
  max-width: 400px;
  transform: translateX(0);
}

#cursor-dot { 
  width: 5px; 
  height: 5px; 
  background: var(--accent); 
  position: fixed; 
  pointer-events: none; 
  z-index: 9999; 
  border-radius: 50%; 
  transform: translate(-50%, -50%); 
}

#cursor-outline { 
  width: 35px; 
  height: 35px; 
  border: 1px solid rgba(59, 130, 246, 0.4); 
  position: fixed; 
  pointer-events: none; 
  z-index: 9998; 
  border-radius: 50%; 
  transform: translate(-50%, -50%); 
  transition: width 0.3s, height 0.3s; 
  will-change: transform, left, top; 
}

#cursor-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(147, 51, 234, 0.04) 40%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease-out;
  filter: blur(40px);
  will-change: left, top;
}

@media (pointer: coarse) {
  #cursor-dot, #cursor-outline, #cursor-glow {
    display: none !important;
  }
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -150px;
  left: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}

.bento-card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  padding: 1.25rem; 
  border-radius: 16px; 
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.project-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.project-1-bg {
  background-image: linear-gradient(to top, rgba(8, 9, 13, 0.95), rgba(8, 9, 13, 0.4)), url('images/formosa-bg.jpg');
}

.project-2-bg {
  background-image: linear-gradient(to top, rgba(8, 9, 13, 0.95), rgba(8, 9, 13, 0.4)), url('images/nemesis-bg.jpg');
}

.project-3-bg {
  background-image: linear-gradient(to top, rgba(8, 9, 13, 0.95), rgba(8, 9, 13, 0.4)), url('images/converter-bg.jpg');
}

@media (hover: hover) and (pointer: fine) {
  .bento-card:hover { 
    border-color: #262938; 
    transform: translateY(-4px); 
    background-color: #0b0c12; 
  }
}

.bento-card:active {
  transform: scale(0.98);
  background-color: #0d0f17;
}

.reveal { 
  opacity: 0; 
  transform: translateY(30px); 
  transition: all 0.8s cubic-bezier(0.2, 0, 0.2, 1); 
}

.reveal.active { 
  opacity: 1; 
  transform: translateY(0); 
}

.typing-cursor::after {
  content: '|';
  display: inline-block;
  margin-left: 2px;
  color: #3b82f6;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.logo-container { 
  position: relative; 
  width: 38px; 
  height: 38px; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
}

.atomic-orbit { 
  position: absolute; 
  width: 38px; 
  height: 38px; 
  border: 1.5px solid rgba(59, 130, 246, 0.4); 
  border-radius: 50%; 
  animation: spin 4s linear infinite; 
}

.atomic-orbit::after { 
  content: ''; 
  position: absolute; 
  top: -4px; 
  left: 50%; 
  width: 7px; 
  height: 7px; 
  background: var(--accent); 
  border-radius: 50%; 
  box-shadow: 0 0 12px var(--accent); 
}

@keyframes spin { 
  100% { transform: rotate(360deg); } 
}

nav {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
}

nav.scrolled {
  border-color: rgba(255, 255, 255, 0.1);
  background-color: rgba(3, 4, 6, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 9999px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.menu-toggle,
.mobile-menu {
  display: none;
}

@media (max-width: 768px) and (orientation: portrait) {
  .desktop-menu {
    display: none !important;
  }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 60;
  }

  .menu-toggle span {
    width: 100%;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
  }

  .mobile-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background-color: rgba(8, 9, 13, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1rem;
    gap: 0.5rem;
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-menu.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mobile-menu a {
    padding: 0.75rem 1rem;
    color: #d1d5db;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
  }

  .mobile-menu a:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
  }
}
