:root {
  --bg: #040404;
  --bg-gradient-start: #050505;
  --bg-gradient-end: #0d0d19;
  --text: #f5f5f2;
  --muted: #b3b3b3;
  --card: rgba(15, 15, 25, 0.85);
  --card-highlight: rgba(16, 21, 45, 0.88);
  --border: rgba(255, 255, 255, 0.08);
  --red: #ec2d31;
  --blue: #1b6ef3;
  --gold: #f8b62d;
  --shadow: 0 20px 35px rgba(0, 0, 0, 0.45);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  background-color: #040408;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  padding: 0;
  background: transparent;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.3;
  z-index: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 2vw, 1.5rem) clamp(1.5rem, 4vw, 3rem);
  background: #040408;
  z-index: 100;
  pointer-events: auto;
  transition: background 0.3s ease;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.nav.scrolled {
  background: #040408;
}

.logo-mark {
  --dot-target-1-x: 52px;
  --dot-target-2-x: 108px;
  --dot-target-3-x: 168px;
  --dot-target-1-y: -4px;
  --dot-target-2-y: -6px;
  --dot-target-3-y: -8px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  position: relative;
  text-decoration: none;
  color: var(--text);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease;
  min-height: 26px;
}

.nav.scrolled .logo-mark {
  opacity: 1;
  pointer-events: auto;
}

.logo-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: opacity 0.4s ease 0.1s;
}

.logo-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: block;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.logo-dots .dot:nth-child(1) {
  transform-origin: center;
}

.logo-dots .dot:nth-child(2) {
  transform-origin: center;
}

.logo-dots .dot:nth-child(3) {
  transform-origin: center;
}

.logo-dots .dot-red {
  background: var(--red);
}

.logo-dots .dot-blue {
  background: var(--blue);
}

.logo-dots .dot-gold {
  background: var(--gold);
}

.logo-words {
  position: absolute;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(0 100% 0 0);
  transform: translateX(-5px);
  transition:
    opacity 0.3s ease,
    clip-path 0.4s cubic-bezier(0.2, 0, 0, 1),
    transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.logo-words .word {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transform: translateX(-10px);
  transition: transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.logo-mark:hover .logo-words .word,
.logo-mark:focus-visible .logo-words .word {
  transform: translateX(0);
}

.logo-words .word .label {
  color: var(--text);
}

.logo-words .period {
  font-size: 1.1rem;
  line-height: 1;
  margin-left: 0.05rem;
  transform-origin: left center;
  transform: scale(0.35) translateX(-3px);
  transition:
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  opacity: 0;
}

.logo-words .period.dot-red {
  color: var(--red);
}

.logo-words .period.dot-blue {
  color: var(--blue);
}

.logo-words .period.dot-gold {
  color: var(--gold);
}

.word {
  display: inline-flex;
  align-items: baseline;
  gap: 0.05rem;
}

.word .label {
  font-weight: 600;
}

.logo-mark:hover .logo-words,
.logo-mark:focus-visible .logo-words {
  opacity: 1;
  pointer-events: auto;
  clip-path: inset(0 0 0 0);
  transform: translateX(0);
}

.logo-mark:hover .logo-words .period,
.logo-mark:focus-visible .logo-words .period {
  transform: scale(1) translateX(0);
  opacity: 1;
}

.logo-mark:hover .logo-dots,
.logo-mark:focus-visible .logo-dots {
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.logo-mark:hover .logo-dots .dot:nth-child(1),
.logo-mark:focus-visible .logo-dots .dot:nth-child(1) {
  transform: translateX(var(--dot-target-1-x)) translateY(var(--dot-target-1-y));
}

.logo-mark:hover .logo-dots .dot:nth-child(2),
.logo-mark:focus-visible .logo-dots .dot:nth-child(2) {
  transform: translateX(var(--dot-target-2-x)) translateY(var(--dot-target-2-y));
}

.logo-mark:hover .logo-dots .dot:nth-child(3),
.logo-mark:focus-visible .logo-dots .dot:nth-child(3) {
  transform: translateX(var(--dot-target-3-x)) translateY(var(--dot-target-3-y));
}

@media (max-width: 900px), (hover: none) {
  .logo-mark:hover .logo-words,
  .logo-mark:focus-visible .logo-words {
    opacity: 0 !important;
    pointer-events: none !important;
    clip-path: inset(0 40% 0 0) !important;
    transform: translateX(-12px) !important;
  }

  .logo-mark:hover .logo-words .period,
  .logo-mark:focus-visible .logo-words .period {
    transform: scale(0.35) translateX(-3px) !important;
    opacity: 0 !important;
  }

  .logo-mark:hover .logo-dots,
  .logo-mark:focus-visible .logo-dots {
    opacity: 1 !important;
    transform: none !important;
    transition-delay: 0s !important;
  }

  .logo-mark:hover .logo-dots .dot,
  .logo-mark:focus-visible .logo-dots .dot {
    transform: none !important;
  }

  .logo-mark:active .logo-words {
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .logo-mark:active .logo-dots {
    opacity: 1 !important;
    transform: none !important;
  }

  .logo-mark:active .logo-dots .dot {
    transform: none !important;
    transition: background 0.1s ease;
  }

  .logo-mark.is-active .logo-dots .dot {
    background: white !important;
  }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  font-size: 0.95rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--text);
}

/* ===== HERO ===== */
.hero-section {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  background: #040408;
  overflow: hidden;
}

.hero-visual {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.6;
  pointer-events: auto;
  overflow: hidden;
}

.hero-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 28%, rgba(255, 255, 255, 0.035), transparent 45%),
    linear-gradient(90deg, rgba(4, 4, 8, 0.82) 0%, rgba(4, 4, 8, 0.65) 22%, rgba(4, 4, 8, 0.3) 40%, rgba(4, 4, 8, 0) 60%);
  pointer-events: none;
  z-index: 0;
}

.hero-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(4, 4, 6, 0.9) 0%, rgba(4, 4, 6, 0.45) 32%, rgba(4, 4, 6, 0.15) 58%, rgba(4, 4, 6, 0.05) 74%),
    linear-gradient(180deg, rgba(4, 4, 8, 0) 62%, rgba(4, 4, 8, 0.85) 88%, rgba(4, 4, 8, 1) 100%);
  pointer-events: none;
  z-index: 2;
}

#dot-canvas {
  position: absolute;
  top: -12%;
  bottom: -10%;
  left: -22vw;
  right: -16vw;
  width: auto;
  min-width: 180vw;
  height: 135%;
  pointer-events: auto;
  touch-action: none;
  opacity: 0.88;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 4rem) clamp(1.5rem, 4vw, 3rem);
}

.hero-text {
  max-width: 1100px;
}

.hero-title {
  font-size: clamp(4rem, 9vw, 11rem);
  line-height: 1.05;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem) 0;
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  gap: 0;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  align-items: flex-start;
}

.hero-title > span {
  display: block;
  white-space: nowrap;
}

.hero-title > span + span {
  margin-top: -0.08em;
}

.hero-title .dot {
  font-size: inherit;
  width: 0.18em;
  height: 0.18em;
  border-radius: 50%;
  display: inline-block;
  margin-left: 0.05em;
  vertical-align: bottom;
  position: relative;
  top: -0.18em;
  background-color: currentColor;
}

.hero-title .dot-red {
  background: var(--red);
}

.hero-title .dot-blue {
  background: var(--blue);
}

.hero-title .dot-gold {
  background: var(--gold);
}

.hero-tagline {
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.6;
  color: rgba(245, 245, 242, 0.7);
  max-width: 40ch;
  font-weight: 400;
  margin: 0;
}

/* ===== SECTIONS ===== */
.section {
  position: relative;
  padding: clamp(5rem, 10vh, 8rem) 0;
  background: #040408;
}

.section-inner {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.section-header {
  margin-bottom: clamp(3rem, 6vh, 5rem);
}

/* ===== TYPOGRAPHY ===== */
.section-title {
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0 0 2rem 0;
  color: var(--text);
}

.section-intro {
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  max-width: 60ch;
  margin: 0;
  font-weight: 400;
}

.section-blurb {
  font-size: clamp(1.1rem, 1.5vw, 1.3rem);
  line-height: 1.6;
  color: #ffffff;
  max-width: 40ch;
  margin: 0;
  font-weight: 400;
}

/* ===== ABOUT ===== */
.section-about {
  background: #040408;
  border-top: none;
}

.section-about .section-header {
  margin-bottom: 0;
}

.section-about .section-title {
  color: #ffffff;
}

.section-about .section-title::after {
  content: ".";
  color: var(--red);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 4vw, 3rem);
  align-items: start;
}

@media (min-width: 900px) {
  .about-grid {
    grid-template-columns: 1fr 1.5fr;
    gap: clamp(3rem, 6vw, 5rem);
  }
}

.about-lead {
  font-size: clamp(1.2rem, 1.6vw, 1.4rem);
  line-height: 1.5;
  font-weight: 500;
  color: #ffffff;
  margin: 0;
  max-width: 60ch;
}

.about-details {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.about-details p {
  font-size: clamp(1rem, 1.1vw, 1.1rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* ===== PROJECTS ===== */
.section-projects {
  background: #040408;
  border-top: none;
  padding-bottom: clamp(6rem, 12vh, 10rem);
}

.section-projects .section-title {
  color: #ffffff;
}

.section-projects .section-title::after {
  content: ".";
  color: var(--blue);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin-top: 3rem;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: clamp(2.5rem, 4vw, 3.5rem) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  transition: opacity 0.3s ease;
  position: relative;
  text-decoration: none;
  align-items: start;
  color: #ffffff;
}

.project-row:hover {
  background: transparent;
}

@media (min-width: 900px) {
  .project-row {
    grid-template-columns: 2fr 2.5fr 1.2fr;
    align-items: start;
    gap: 3rem;
  }
}

.project-title {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  line-height: 1;
}

.project-meta {
  font-family: "Space Mono", monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.5rem;
  white-space: nowrap;
}

.project-row-partner {
  margin-top: 6rem;
  background: transparent;
  border: none;
  /* Use pseudo-element for background to avoid layout shifts */
  position: relative;
  z-index: 1;
  padding: clamp(2.5rem, 4vw, 3.5rem) 0;
  color: #000000;
}

.project-row-partner::before {
  content: '';
  position: absolute;
  inset: -1.5rem -2rem;
  background: #ffffff;
  border-radius: 4px;
  z-index: -1;
}

/* Ensure no border on specific rows */
.project-row.no-border {
  border-bottom: none;
}

.project-row-partner:hover {
  opacity: 1;
}

.project-row-partner .project-title {
  color: #000000;
}

.project-row-partner .project-meta {
  color: rgba(0, 0, 0, 0.6);
}

.project-row-partner .project-desc {
  color: rgba(0, 0, 0, 0.8);
}

.partner-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 1rem;
}

@media (min-width: 900px) {
  .partner-actions {
    justify-content: flex-end;
    margin-top: 0;
  }
}

.email-link.partner-cta {
  font-family: "Space Mono", monospace;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0.02em;
  margin-top: 0;
  border: none;
  padding: 1em 1.8em;
  background: #000000;
  color: #ffffff;
  border-radius: 4px;
  font-weight: 500;
  line-height: 1;
}

.email-link.partner-cta:hover,
.email-link.partner-cta:focus-visible {
  background: var(--gold);
  border: none;
  color: #000000;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
  margin-top: 0.5rem;
}

@media (min-width: 900px) {
  .project-tags {
    justify-content: flex-end;
    margin-top: 0;
  }
}

.project-arrow {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.5);
  transition: transform 0.3s ease, color 0.3s ease;
  width: 32px;
  align-self: center;
}

.project-row:hover .project-arrow {
  color: #ffffff;
}

.tag {
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  padding: 0.35em 0.7em;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== CONTACT ===== */

.section-contact {
  background: #040408;
  border-top: none;
}

.section-contact .section-header {
  margin-bottom: 0;
}

.section-contact .section-title {
  color: #ffffff;
}

.section-contact .section-title::after {
  content: ".";
  color: var(--gold);
}

.contact-content {
  max-width: 60ch;
}

.contact-intro {
  font-size: clamp(1.15rem, 1.5vw, 1.3rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 1rem 0;
}

.contact-intro-secondary {
  font-size: clamp(1.05rem, 1.2vw, 1.15rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 2rem 0;
}

.email-link {
  display: inline-block;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  color: #ffffff;
  text-decoration: none;
  border-bottom: 2px solid rgba(248, 182, 45, 0.4);
  transition: border-color 0.3s ease;
  margin-top: 1rem;
}

.email-link:hover,
.email-link:focus-visible {
  border-bottom-color: var(--gold);
  border-bottom-width: 2px;
}

/* ===== FOOTER ===== */
footer {
  padding: clamp(2rem, 4vh, 3rem) clamp(1.5rem, 4vw, 3rem);
  background: #040408;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  text-align: center;
}

.footer-note {
  font-size: 0.9rem;
  color: rgba(245, 245, 242, 0.4);
  margin: 0;
}

/* ===== MOBILE ===== */
@media (max-width: 900px) {
  .hero-title {
    font-size: clamp(3.5rem, 15vw, 6rem);
  }

  .nav-links {
    gap: 1.25rem;
  }

  .logo-words {
    display: none;
  }

  .about-grid {
    gap: 2rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 4px;
}
