/* ============================================================
   FINN EGGERS — PORTFOLIO
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --bg-card: #131313;
  --text: #e8e8e8;
  --text-muted: #777777;
  --accent: #f2c14e;
  --accent-rgb: 242, 193, 78;
  --accent-dim: rgba(var(--accent-rgb), 0.14);
  --accent-soft: rgba(var(--accent-rgb), 0.38);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.2);
  --font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

a { color: inherit; text-decoration: none; cursor: none; }
button { cursor: none; }
img { display: block; max-width: 100%; }

::selection {
  background: rgba(var(--accent-rgb), 0.28);
  color: #fff;
}

/* --- Noise --- */
.noise {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --- Cursor --- */
#cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border: 1.5px solid rgba(255,255,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease), height 0.3s var(--ease), border-color 0.3s;
  mix-blend-mode: difference;
}
#cursor-trail {
  position: fixed;
  width: 6px;
  height: 6px;
  background: rgba(255,255,255,0.8);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
}
#cursor.hover {
  width: 50px;
  height: 50px;
  border-color: rgba(255,255,255,0.8);
}

/* --- Container --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 80px);
}

/* --- Nav --- */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px clamp(24px, 5vw, 80px);
  transition: background 0.4s, backdrop-filter 0.4s;
}
#nav.scrolled {
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-brand {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(var(--accent-rgb), 0.35);
}
.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}
.nav-links a {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.3s;
  position: relative;
}
.nav-links a::before {
  content: attr(data-index);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: rgba(var(--accent-rgb), 0.75);
  position: absolute;
  top: -12px;
  left: 0;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s var(--ease);
  transform: translateY(4px);
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::before { opacity: 1; transform: translateY(0); }

#nav-toggle {
  display: none;
  flex-direction: column;
  gap: 6px;
  background: none;
  border: none;
  padding: 8px;
  z-index: 110;
}
#nav-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.3s;
}
#nav-toggle.active span:first-child { transform: rotate(45deg) translate(3px, 3px); }
#nav-toggle.active span:last-child { transform: rotate(-45deg) translate(3px, -3px); }

/* Mobile menu */
#mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
#mobile-menu.active { opacity: 1; pointer-events: all; }
.mobile-menu-inner { display: flex; flex-direction: column; gap: 32px; text-align: center; }
.mobile-menu-inner a {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  transition: color 0.3s;
  position: relative;
}
.mobile-menu-inner a::before {
  content: attr(data-index);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: rgba(var(--accent-rgb), 0.75);
  position: absolute;
  top: 0;
  left: -28px;
}
.mobile-menu-inner a:hover { color: var(--accent); }

/* --- Hero --- */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 0 clamp(24px, 5vw, 80px);
  max-width: 900px;
}
.hero-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.2s forwards;
}
.hero-title {
  font-size: clamp(4rem, 12vw, 10rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 32px;
}
.hero-title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
.hero-title .word {
  display: inline-block;
  transform: translateY(110%);
  animation: wordReveal 1s var(--ease) forwards;
}
.hero-title .word[data-delay="1"] {
  animation-delay: 0.15s;
  color: var(--accent);
  text-shadow: 0 0 28px rgba(var(--accent-rgb), 0.28);
}
.hero-sub {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 520px;
  line-height: 1.7;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.5s forwards;
}
.hero-cta {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  opacity: 0;
  animation: fadeUp 0.8s var(--ease) 0.7s forwards;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.35);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 34px rgba(var(--accent-rgb), 0.42);
}
.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 14px 32px;
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  transition: border-color 0.3s, background 0.3s;
}
.btn-ghost:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 40px;
  right: clamp(24px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 2;
}
.scroll-indicator span {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  writing-mode: vertical-rl;
}
.scroll-line {
  width: 1px;
  height: 60px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

/* --- Sections --- */
.section { padding: clamp(80px, 12vh, 160px) 0; }
.section-header {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 64px;
}
.section-index {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.section-header h2 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.subsection-title {
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 80px 0 32px;
}

/* --- About --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}
.about-text .large-text {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  line-height: 1.6;
  margin-bottom: 24px;
  font-weight: 300;
}
.about-text p { color: var(--text-muted); line-height: 1.8; }
.about-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.about-card {
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.4s, transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.about-card:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.1);
  transform: translateY(-4px);
}
.about-card-icon { width: 32px; height: 32px; margin-bottom: 16px; color: var(--text-muted); }
.about-card-icon svg { width: 100%; height: 100%; }
.about-card h3 { font-size: 0.95rem; font-weight: 500; margin-bottom: 8px; color: var(--accent); }
.about-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; }

/* --- Featured projects duo (compact) --- */
.featured-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.featured-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.4s, transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.featured-card:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 12px 34px rgba(var(--accent-rgb), 0.12);
  transform: translateY(-4px);
}
.featured-card-visual {
  width: 100%;
  height: 180px;
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
}
.featured-card-visual canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.featured-card-body { padding: 28px; }
.project-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
  display: block;
}
.featured-card-body h3 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.featured-card-body p {
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 16px;
  font-size: 0.88rem;
}
.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.project-tech span {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: rgba(var(--accent-rgb), 0.9);
}
.project-links { display: flex; gap: 20px; }
.project-links a {
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
}
.project-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.3s var(--ease);
}
.project-links a:hover::after { width: 100%; }

/* --- Project cards grid --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.4s, transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
  display: flex;
  flex-direction: column;
}
.project-card:hover {
  border-color: var(--accent-soft);
  box-shadow: 0 12px 34px rgba(var(--accent-rgb), 0.12);
  transform: translateY(-4px);
}
.project-card-visual {
  width: 100%;
  height: 160px;
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
}
.project-card-visual canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.project-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.project-card-body h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.project-card-body p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.7;
  flex: 1;
  margin-bottom: 14px;
}
.project-card-body .project-tech { margin-bottom: 14px; }
.project-card-body .project-links { margin-top: auto; }

/* --- Achievements (sequential list) --- */
.achievements-list {
  display: flex;
  flex-direction: column;
}
.achievement {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 40px;
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.achievement:first-child { border-top: 1px solid var(--border); }
.achievement-year {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 4px;
}
.achievement-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.achievement-highlight {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 3px 10px;
  background: var(--accent-dim);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: var(--accent);
  vertical-align: middle;
  margin-left: 8px;
  font-weight: 400;
}
.achievement-content p {
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 40px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, rgba(var(--accent-rgb), 0.45), rgba(var(--accent-rgb), 0.08));
}
.timeline-item {
  position: relative;
  padding: 0 0 48px 32px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-marker {
  position: absolute;
  left: -44px;
  top: 6px;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  background: var(--bg);
  transition: background 0.3s, border-color 0.3s;
}
.timeline-item:hover .timeline-marker {
  background: var(--accent);
  border-color: var(--accent);
}
.timeline-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: rgba(var(--accent-rgb), 0.85);
  margin-bottom: 8px;
}
.timeline-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.timeline-org {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.timeline-item > p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* --- Separators --- */

/* Ticker */
.section-ticker {
  padding: 32px 0;
  overflow: hidden;
  border-top: 1px solid rgba(var(--accent-rgb), 0.35);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.35);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker 40s linear infinite;
}
.ticker-content {
  display: flex;
  flex-shrink: 0;
}
.ticker-content span {
  font-family: var(--mono);
  font-size: clamp(0.75rem, 1.2vw, 0.9rem);
  color: var(--text-muted);
  padding: 0 28px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Stats divider */
.divider-stats {
  padding: 48px clamp(24px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.divider-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(var(--accent-rgb), 0.45), transparent);
}
.divider-stats-row {
  display: flex;
  justify-content: center;
  gap: clamp(40px, 8vw, 100px);
}
.divider-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.divider-stat-num {
  font-family: var(--mono);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 600;
  color: var(--accent);
}
.divider-stat-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Wave divider */
.divider-wave {
  border-top: 1px solid rgba(var(--accent-rgb), 0.35);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.35);
  height: 80px;
  overflow: hidden;
}
.divider-wave canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* --- Contact --- */
.contact-content { max-width: 700px; }
.contact-content .large-text {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 300;
  line-height: 1.6;
  margin-bottom: 48px;
}
.contact-links { display: flex; flex-direction: column; }
.contact-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  transition: padding-left 0.4s var(--ease), border-color 0.3s, color 0.3s;
}
.contact-link:first-child { border-top: 1px solid var(--border); }
.contact-link:hover {
  padding-left: 16px;
  border-color: rgba(var(--accent-rgb), 0.45);
}
.contact-link:hover .contact-link-label,
.contact-link:hover .contact-link-value {
  color: var(--accent);
}
.contact-link-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.contact-link-value { font-size: 1rem; font-weight: 400; }

/* --- Footer --- */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Reveal --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}

/* --- Keyframes --- */
@keyframes wordReveal { to { transform: translateY(0); } }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scrollPulse {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0.4; transform: scaleY(0.6); }
}
@keyframes ticker { to { transform: translateX(-50%); } }

/* --- Responsive --- */
@media (max-width: 1024px) {
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .featured-duo { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  #cursor, #cursor-trail { display: none; }
  body { cursor: auto; }
  a, button { cursor: pointer; }
  .nav-links { display: none; }
  #nav-toggle { display: flex; }
  .projects-grid { grid-template-columns: 1fr; }
  .about-cards { grid-template-columns: 1fr; }
  .achievement { grid-template-columns: 1fr; gap: 8px; }
  .hero-title { font-size: clamp(3rem, 14vw, 5rem); }
  .section-header { flex-direction: column; gap: 8px; }
  .scroll-indicator { display: none; }
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; }
  .btn-primary, .btn-ghost { justify-content: center; }
  .contact-link { flex-direction: column; align-items: flex-start; gap: 4px; }
  .divider-stats-row { flex-wrap: wrap; gap: 24px; }
}
