:root {
  --bg: #0c0c0c;
  --bg-elevated: #141414;
  --bg-card: #1a1a1a;
  --text: #e8e8e8;
  --text-secondary: #888;
  --text-muted: #555;
  --accent: #ff5c35;
  --accent-light: rgba(255, 92, 53, 0.1);
  --border: #2a2a2a;
  --border-light: #333;
  
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

html.modal-open,
html.modal-open body {
  overflow: hidden;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  cursor: none;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Custom Cursor */
.cursor {
  width: 20px;
  height: 20px;
  border: 1px solid var(--text);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s var(--ease), opacity 0.15s;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}

.cursor.hover {
  transform: translate(-50%, -50%) scale(2);
  background: var(--text);
}

/* Marquee */
.marquee-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  overflow: hidden;
  padding: 0.5rem 0;
}

.marquee {
  display: flex;
  gap: 3rem;
  animation: marquee 20s linear infinite;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.marquee span {
  flex-shrink: 0;
}

.marquee-dot {
  width: 4px;
  height: 4px;
  background: var(--bg);
  border-radius: 50%;
  align-self: center;
}

@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Navigation */
.nav {
  position: fixed;
  top: 2.5rem;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 3rem;
  mix-blend-mode: difference;
}

.nav-time {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.nav-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
}

.nav-right {
  display: flex;
  gap: 2rem;
}

.nav-link {
  font-size: 0.875rem;
  position: relative;
  transition: color 0.3s;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s var(--ease);
}

.nav-link:hover::after {
  width: 100%;
}

/* Hero */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  padding: 8rem 6rem 4rem;
  position: relative;
}

.hero-content {
  max-width: 600px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.tag-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.title-line {
  display: block;
  overflow: hidden;
}

.word {
  display: inline-block;
  animation: slideUp 0.8s var(--ease) backwards;
  animation-delay: calc(var(--i) * 0.1s);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
}

.word.italic {
  font-style: italic;
}

.word.name-highlight {
  color: var(--accent);
}

.word.underline-anim {
  position: relative;
}

.word.underline-anim::after {
  content: '';
  position: absolute;
  bottom: 0.1em;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  animation: underline 0.6s var(--ease) 0.8s forwards;
}

@keyframes underline {
  to { transform: scaleX(1); transform-origin: left; }
}

.hero-desc {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 400px;
}

.hero-desc em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text);
}

.hero-cta {
  display: flex;
  gap: 1rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 100px;
  font-weight: 500;
  transition: all 0.3s var(--ease);
}

.btn-primary svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s var(--ease);
}

.btn-primary:hover {
  background: var(--accent);
}

.btn-primary:hover svg {
  transform: translate(4px, -4px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-weight: 500;
  transition: all 0.3s var(--ease);
}

.btn-secondary:hover {
  border-color: var(--text);
}

/* Code Window */
.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.code-window {
  width: 100%;
  max-width: 480px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  animation: fadeInUp 0.8s var(--ease) 0.4s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
}

.code-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
}

.code-dots span:first-child { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #ffbd2e; }
.code-dots span:last-child { background: #28c840; }

.code-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.code-content {
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.8;
  overflow-x: auto;
}

.code-keyword { color: #c678dd; }
.code-var { color: #e06c75; }
.code-prop { color: #e5c07b; }
.code-string { color: #98c379; }
.code-bool { color: #56b6c2; }
.code-comment { color: var(--text-muted); font-style: italic; }

/* Scroll Hint */
.scroll-hint {
  position: absolute;
  bottom: 3rem;
  left: 6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

.scroll-line {
  width: 60px;
  height: 1px;
  background: var(--border);
  position: relative;
  overflow: hidden;
}

.scroll-line::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--text);
  animation: scrollLine 2s infinite;
}

@keyframes scrollLine {
  to { left: 100%; }
}

/* Sections */
.section {
  padding: 8rem 6rem;
  border-top: 1px solid var(--border);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 4rem;
}

.label-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
}

.label-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.section-heading {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.2;
  max-width: 700px;
}

.heading-em {
  font-style: italic;
  color: var(--accent);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 4rem;
}

.about-text {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  color: var(--text-secondary);
  max-width: 500px;
}

.about-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.info-card-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-list li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding-left: 1rem;
  position: relative;
}

.info-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

/* Stack Section */
.stack-section {
  margin-top: 4rem;
  padding-top: 4rem;
  border-top: 1px solid var(--border);
  overflow: hidden;
}

.stack-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.stack-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(
    to right,
    transparent,
    black 8%,
    black 92%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    black 8%,
    black 92%,
    transparent
  );
}

.stack-track {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1.5rem;
  animation: stackScroll 25s linear infinite;
}

.stack-track:hover {
  animation-play-state: paused;
}

@keyframes stackScroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.stack-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  transition: all 0.3s var(--ease);
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
}

.stack-item img,
.stack-item svg {
  width: 40px;
  height: 40px;
  object-fit: contain;
  transition: all 0.3s var(--ease);
}

.stack-item img.invert {
  filter: invert(1);
}

.stack-item .openai-icon {
  width: 40px;
  height: 40px;
  color: var(--text);
}

.stack-item span {
  position: absolute;
  opacity: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  transition: all 0.3s var(--ease);
  pointer-events: none;
}

.stack-item:hover {
  border-color: var(--accent);
  background: var(--bg-card);
  width: auto;
  padding: 1.25rem 1.5rem;
}

.stack-item:hover img,
.stack-item:hover svg {
  width: 28px;
  height: 28px;
  margin-right: 0.5rem;
}

.stack-item:hover span {
  position: relative;
  opacity: 1;
}

/* Projects */
.projects {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.project {
  display: grid;
  grid-template-columns: auto 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border);
}

.project:last-child {
  border-bottom: none;
}

.project-num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

.project-content {
  max-width: 400px;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.project-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 400;
}

.project-links {
  display: flex;
  gap: 1rem;
}

.project-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.3s var(--ease);
}

.project-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 1.5rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-tech span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
}

.project-image {
  aspect-ratio: 16/10;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Experience */
.exp-list {
  display: flex;
  flex-direction: column;
}

.exp-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 4rem;
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: all 0.3s var(--ease);
}

.exp-item:hover {
  padding-left: 1rem;
}

.exp-item:last-child {
  border-bottom: none;
}

.exp-date {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.exp-role {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 0.25rem;
}

.exp-company {
  color: var(--accent);
  font-size: 0.9375rem;
  margin-bottom: 1rem;
}

.exp-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  max-width: 500px;
}

/* Contact */
.contact {
  padding: 10rem 6rem;
  text-align: center;
}

.contact-content {
  max-width: 600px;
  margin: 0 auto;
}

.contact-heading {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 1.5rem;
}

.contact-heading span {
  display: block;
}

.contact-desc {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.contact-email {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 3rem;
  position: relative;
  transition: all 0.3s var(--ease);
}

.contact-email::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease);
}

.contact-email:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.contact-socials {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.social {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: color 0.3s;
}

.social:hover {
  color: var(--text);
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s var(--ease);
  padding: 2rem;
}

.modal:target {
  opacity: 1;
  visibility: visible;
}

.modal:target ~ main,
.modal:target ~ .marquee-container,
.modal:target ~ .nav {
  filter: blur(4px);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 4rem);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.4s var(--ease);
  overflow: hidden;
}

.modal:target .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  z-index: 10;
}

.modal-close:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.modal-header {
  padding: 3rem 3rem 2rem;
  background: linear-gradient(to bottom, var(--bg-elevated), var(--bg));
}

.modal-num {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--accent);
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.25rem 0.75rem;
  background: var(--accent-light);
  border-radius: 4px;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 400;
  line-height: 1.2;
}

.modal-body {
  padding: 2rem 3rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.modal-section {
  margin-bottom: 2.5rem;
}

.modal-section:last-child {
  margin-bottom: 0;
}

.modal-section h3 {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-section h3::before {
  content: '';
  width: 3px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
}

.modal-section p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.9375rem;
}

.modal-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.modal-tech span {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.5rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  transition: all 0.3s var(--ease);
}

.modal-tech span:hover {
  border-color: var(--accent);
  color: var(--text);
}

.modal-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-list li {
  color: var(--text-secondary);
  padding-left: 1.5rem;
  position: relative;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.modal-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  padding: 2rem 3rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
  .modal {
    padding: 1rem;
  }
  
  .modal-header {
    padding: 2rem 1.5rem 1.5rem;
  }
  
  .modal-body {
    padding: 0 1.5rem 1.5rem;
  }
  
  .modal-actions {
    padding: 1.5rem;
    flex-direction: column;
  }
  
  .modal-grid {
    grid-template-columns: 1fr;
  }
}

/* Footer */
.footer {
  padding: 2rem 6rem;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .nav {
    padding: 1rem 2rem;
  }
  
  .hero {
    grid-template-columns: 1fr;
    padding: 8rem 2rem 4rem;
    text-align: center;
  }
  
  .hero-content {
    max-width: none;
  }
  
  .hero-desc {
    max-width: none;
    margin-left: auto;
    margin-right: auto;
  }
  
  .hero-cta {
    justify-content: center;
  }
  
  .hero-visual {
    display: none;
  }
  
  .scroll-hint {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .section {
    padding: 4rem 2rem;
  }
  
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .project {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .project-num {
    display: none;
  }
  
  .exp-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .contact {
    padding: 6rem 2rem;
  }
  
  .footer {
    padding: 2rem;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }
  
  .modal-header,
  .modal-body {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (max-width: 640px) {
  .nav-time,
  .nav-right {
    display: none;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .modal-actions {
    flex-direction: column;
  }
}

/* Cursor styles for different elements */
@media (hover: hover) {
  a, button, .stack-item, .project, .info-card {
    cursor: none;
  }
}
